flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > virtual in macro & struc offsets |
Author |
|
revolution 13 Mar 2012, 21:53
Show your code please. At least give us an example of what you are trying to do.
|
|||
13 Mar 2012, 21:53 |
|
Blank 14 Mar 2012, 08:22
It's not complete code listing but, here collected all declarations needed by 'py_members'.
Code: struc PyMemberDef name, type, offset, flags, doc { .name dd name ; char* .type dd type ; int .offset dd offset ; Py_ssize_t .flags dd flags ; int .doc dd doc ; char* } macro py_members obj,[name,type,field,flags,doc] { common local i virtual at 0 i obj end virtual forward offset=i#\.#field local UNIQUE .member#UNIQUE PyMemberDef name,type,offset,flags,doc common local UNIQUE .member#UNIQUE PyMemberDef 0,0,0,0,0 } T_SHORT = 0 T_INT = 1 T_LONGLONG = 17 struc GUID { .data1 dd ? .data2 dw ? .data3 dw ? .data4 rb 8 } data1_label db 'data1',0 data2_label db 'data2',0 data3_label db 'data3',0 data4_label db 'data4',0 py_members GUID_PyObject,\ data1_label, T_INT, guid.data1, 0, 0,\ data2_label, T_SHORT, guid.data2, 0, 0,\ data3_label, T_SHORT, guid.data3, 0, 0,\ data4_label, T_LONGLONG, guid.data4, 0, 0 struc GUID_PyObject { .ob_refcnt dd 0 .ob_type dd 0 .guid GUID } ob GUID_PyObject |
|||
14 Mar 2012, 08:22 |
|
revolution 14 Mar 2012, 08:40
The preprocessor is not multi-pass and cannot reference definitions before they are defined. That means you can't forward reference any macros, equs or strucs.
Simple rule with preprocessor related stuff: Define first, then use. |
|||
14 Mar 2012, 08:40 |
|
Blank 14 Mar 2012, 08:51
Is there no tricky way to define in py_members another macro which would be expanded when preprocessor got to know what is GUID_PyObject?
|
|||
14 Mar 2012, 08:51 |
|
revolution 14 Mar 2012, 09:01
Blank wrote: Is there no tricky way to define in py_members another macro which would be expanded when preprocessor got to know what is GUID_PyObject? Just remember that the preprocessor is not multi-pass. That should guide your coding of such things. |
|||
14 Mar 2012, 09:01 |
|
Blank 14 Mar 2012, 09:05
If preprocessor is not multi-pass, so sub-...-macro's expanded by one pass?
|
|||
14 Mar 2012, 09:05 |
|
revolution 14 Mar 2012, 09:06
Blank wrote: If preprocessor is not multi-pass, so sub-...-macro's expanded by one pass? |
|||
14 Mar 2012, 09:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.