flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > fasm1: macroset to extend array size of any type struct

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 804
Location: Russian Federation, Sochi
ProMiNick 30 Jan 2023, 12:03
helper macros
Code:
macro array size,type,[value] {
 common local index
        index = 0
        if size
 forward
                type value
                index = index + 1
 common
                repeat size-index
                        type
                end repeat
        end if }    
array overload itself
Code:
macro arrayoverload [type] {
 macro type definition& \{
  match [size] values, definition: \\{
   match vals:,values \\\{ array size,type,vals \\\}
   match :,values \\\{ array size,type \\\}
   overloaded equ \\}
  match =overloaded,overloaded \\{type definition \\}
  restore overloaded\}
 struc type definition& \{
        virtual
                . type
        end virtual
        type definition \}}    


test sequence:
Code:
include 'win32a.inc'
arrayoverload WNDCLASS,RECT ; overload only ones we need
  WindowProc dd ?
  _class dd ?
; now allowed both extended syntax and built in syntax
  a RECT 1,2,4,6 ; built in syntax still work
  b RECT[0] ; no occupy space just def struct
  wc WNDCLASS[3] <0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class>
  c RECT[3] <1,2,3,0>,<>,<1,2,3,0>
  assert b.top=wc.lpfnWndProc    

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 30 Jan 2023, 12:03
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.