flat assembler
Message board for the users of flat assembler.
Index
> Windows > fasm C-compatible syntax typedef macro |
Author |
|
goldenspider 05 Apr 2013, 14:40
According to the post using types defined with EQU in structures
i update the typedef macro and work OK. Code: macro macro@typedef base,[type] { forward struc type [v] \{ \common match any, v \\{ . base v \\} match , v \\{ . base ? \\} \} macro type [v] \{ \common match any, v \\{ base v \\} match , v \\{ base ? \\} \} virtual at 0 base ? sizeof.#type=$ end virtual } macro typedef [statement] { common match gs@base gs@type,statement \{ macro@typedef gs@base,gs@type \} } for example: Code: typedef dd SDWORD typedef SDWORD DWORD,INT32,LONG typedef db CHAR,BYTE _WIN64 equ FALSE match =TRUE ,_WIN64{typedef dq PVOID} match =FALSE,_WIN64{typedef dd PVOID} typedef PVOID HANDLE,PSTR,PWSTR ;.................... ;struct define struc point x,y { .: .x SDWORD x .y INT32 y .size = $ - . } struct SIZE cx LONG cy LONG ends typedef SIZE newSIZE ;.................... ;Data define m1 SDWORD 12,13,14,sizeof.DWORD m2 INT32 12,13,14,sizeof.INT32 my point 7,my.size INT32 m3 INT32 ;.................... ;local define proc WindowProc uses ebx esi edi,hwnd,wmsg,wparam,lparam local hDC:HANDLE local mySize:newSIZE ... Typical windows data types: Code: _WIN64 equ FALSE ;(or TRUE) typedef db UINT8 ,INT8 ,BYTE ,CHAR,UCHAR typedef dw UINT16,INT16,WORD ,WCHAR typedef dd UINT32,INT32,DWORD,LONG,ULONG typedef dq UINT64,INT64,QWORD,LONGLONG,ULONGLONG typedef DWORD BOOL,long,int,HRESULT match =TRUE ,_WIN64{typedef dq PVOID} match =FALSE,_WIN64{typedef dd PVOID} typedef PVOID HANDLE,PSTR,PWSTR,LPVOID
|
|||||||||||
05 Apr 2013, 14:40 |
|
l_inc 05 Apr 2013, 23:43
goldenspider
That's a simple and concise feature, so don't make it more complicated, than it should be. Code: macro macro@typedef base,[type] { forward struc type [v=?] \{ \common . base v \} macro type [v=?] \{ \common base v \} virtual at 0 base ? sizeof.#type=$ end virtual } Btw. I'd rather prefer a single macro, i.e. no multiplication of entities beyond necessity: Code: macro typedef [statement*] { common match gs@base gs@type,statement \{ irp type,gs@type \\{ struc type [v=?] \\\{ \\\common . gs@base v \\\} macro type [v=?] \\\{ \\\common gs@base v \\\} virtual at 0 gs@base ? sizeof.\\#type=$ end virtual \\} \} } _________________ Faith is a superposition of knowledge and fallacy |
|||
05 Apr 2013, 23:43 |
|
l_inc 06 Apr 2013, 13:52
goldenspider
Sure, you are right. But considering, that fasm is small, free, portable and retains backward compatibility, I see no reason to support older versions by introducing more complexity. IMHO older versions support is only eligible if no trade off is needed to achieve that. _________________ Faith is a superposition of knowledge and fallacy |
|||
06 Apr 2013, 13:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.