flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > fasm1 crossarchitecture untyped typization extension |
Author |
|
ProMiNick 27 Feb 2019, 05:39
if base type is structure this modification adds same behavior to it:
Code: macro datadefinition [name,ddef,size] { local ddf macro ddf limit:-1,[arg] \{ \common \local a a = $ \forward match any,arg \\{ ddef arg \\} match ,arg \\{ if limit ddef ? end if \\} \common if not limit if $>(a+limit*size) Error->syntax cancelled: name [limit],arg else rb a+limit*size-$ end if end if \} sizeof.name = size macro name ?p:?,[p] \{ \common if ~?p eqtype [] match ,p \\{ ddf 1,?p \\} match any,p \\{ ddf 1,?p,p \\} else match [] ,?p \\{ ddf ,p \\} match [dim],?p \\{ ddf dim,p \\} end if \} struc name ?p:?,[p] \{ .: name ?p:?,[p] \} } |
|||
27 Feb 2019, 05:39 |
|
ProMiNick 28 Feb 2019, 11:32
little changes: params after brackets follows without preciding comma
Code: macro make@datadef [name,ddef,size] { local ddf macro ddf limit:0,[arg:?] \{ \common \local a a = $ \forward ddef arg \common if limit if $>(a+limit*size) Error->syntax cancelled: name [limit],arg else rb a+limit*size-$ end if end if \} sizeof.#name = size name#.align = size macro name data& \{ \local a ;define a match ,data \\{ ddf \\} match [],data \\{ define a \\} match [=0],data \\{ define a \\} match [] values,data \\{ ddf ,values define a \\} match [dim] values,data \\{ match =0 any,dim values \\\{ Error->syntax cancelled: name data \\\} ddf dim,values define a \\} match =a first rest,a data: \\{ match any:,rest \\\{ Error->syntax cancelled: name data \\\} ddf 1,first \\} \} struc name data \{ .: name data \} common ; these 3 lines only if needed to use symblol datadef@directives match any,datadef@directives \{ datadef@directives equ datadef@directives, \} ; datadef@directives equ datadef@directives name ; } Code: datadef@directives equ ; this line only if needed to use symblol datadef@directives ;x86 ASCII ;x86 Unicode ;x64 ASCII ;x64 Unicode ;ARM 32 ;AARCH64 make@datadef ACHAR,db,1,\ ;ACHAR,db,1,\ ;ACHAR,db,1,\ ;ACHAR,db,1,\ ;ACHAR,db,1,\ ;ACHAR,db,1,\ WCHAR,du,2,\ ;WCHAR,du,2,\ ;WCHAR,du,2,\ ;WCHAR,du,2,\ ;WCHAR,du,2,\ ;WCHAR,du,2,\ VOID_8,db,1,\ ;VOID_8,db,1,\ ;VOID_8,db,1,\ ;VOID_8,db,1,\ ;VOID_8,db,1,\ ;VOID_8,db,1,\ VOID_16,dw,2,\ ;VOID_16,dw,2,\ ;VOID_16,dw,2,\ ;VOID_16,dw,2,\ ;VOID_16,dh,2,\ ;VOID_16,dh,2,\ VOID_32,dd,4,\ ;VOID_32,dd,4,\ ;VOID_32,dd,4,\ ;VOID_32,dd,4,\ ;VOID_32,dw,4,\ ;VOID_32,dw,4,\ VOID_64,dq,8,\ ;VOID_64,dq,8,\ ;VOID_64,dq,8,\ ;VOID_64,dq,8,\ ;VOID_64,dd,8,\ ;VOID_64,dd,8,\ TCHAR,db,1,\ ;TCHAR,db,2,\ ;TCHAR,db,1,\ ;TCHAR,db,2,\ ;TCHAR,db,2,\ ;TCHAR,db,2,\ VOID,dd,4,\ ;VOID,dd,4,\ ;VOID,dd,8,\ ;VOID,dd,8,\ ;VOID,dw,4,\ ;VOID,dd,8,\ HNDL,dd,4,\ ;HNDL,dd,4,\ ;HNDL,dd,8,\ ;HNDL,dd,8,\ ;HNDL,dw,4,\ ;HNDL,dd,8,\ PTR,dd,4,\ ;PTR,dd,4,\ ;PTR,dd,8,\ ;PTR,dd,8,\ ;PTR,dw,4,\ ;PTR,dd,8,\ ptr,dd,4 ;ptr,dd,4 ;ptr,dd,8 ;ptr,dd,8 ;ptr,dw,4 ;ptr,dd,8 Code: hellotext VOID_32 [3] "Hell","o wo","rld!" WCHAR[0] ACHAR[] ACHAR VOID_8[1] 27 VOID_32 [1] 100:100 ;VOID_32 100:100 - this cause an error, but it dosn`t matter because long variant in line above support colon separated syntax for now this is impossible(possible but not implemented yet) to override structure definitioins in similar manner |
|||
28 Feb 2019, 11:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.