flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > last version of "struct" |
Author |
|
Tomasz Grysztar 11 Nov 2010, 10:55
Oh, just remove "label ." from this line:
Code: match , fields@struct \\\{ label . |
|||
11 Nov 2010, 10:55 |
|
ouadji 11 Nov 2010, 11:03
Could you upload a fixed version. For this to be accessible to all. Thank you very much Tomasz. |
|||
11 Nov 2010, 11:03 |
|
ouadji 11 Nov 2010, 11:08
oh, this is already done, thank you very much Tomasz (I have just checked, all is ok) |
|||
11 Nov 2010, 11:08 |
|
ouadji 11 Nov 2010, 13:52
this, right below, does compile without problem. So far so good ! Code: include 'win32a.inc' struct AA d1 dd ? d2 dd ? ends .x: jmp AA.d2.x ;all is ok here, nothing to say. jmp dodo.y dodo AA .y: but here I noticed a weird little thing: I'm not sure there is a problem, I think not, but... in fact, i don't know, Tomasz? what do you think of this ? Code: include 'win32a.inc' struct .AA d1 dd ? d2 dd ? ends .x: jmp .AA.d2.x ;does not compile (undefined symbol) jmp dodo.y ;but here, it does compile ! dodo .AA .y: Thank you Tomasz ! (I'm solving struct_names with dot(s) for next Wink) |
|||
11 Nov 2010, 13:52 |
|
Tomasz Grysztar 11 Nov 2010, 14:33
".AA.d2" is local label too, so there is no reason why it should be prepended to ".x".
Also: please treat the globals context after the "struct" definition as undefined (as in "not defined in the specification"). There is not much reason to make such macro behave in any specific way in such case, even though possible. |
|||
11 Nov 2010, 14:33 |
|
Tomasz Grysztar 11 Nov 2010, 14:37
Oh, one more thing: note than when you define with "struct" a structure with name starting with dot, it will mean nothing to preprocessor, so it still will be a "global" structure; however the structure offsets that it defines will be labels with names starting with dots, so will be treated as locals. Another case of interaction between various layers that better should be avoided.
It could be treated with either "struct" defining the offsets as symbolic constants or disallowing the name of structure to begin with dot. But I doubt that it would really be worth the trouble. |
|||
11 Nov 2010, 14:37 |
|
ouadji 11 Nov 2010, 15:02
ok Tomasz. .AA == global but .AA.d2 == local I understood ... and above all i understood "why"! wonderfull ! So, no change here,ok ... I will implement this behavior in Wink. |
|||
11 Nov 2010, 15:02 |
|
ouadji 12 Nov 2010, 12:20
i'm sorry Tomasz, but i'm not agree with the behavior and use of your last macro "struct". This example is really amazing. Is it impossible (now) to use "struct" symbolically? Do i have to declare absolutely a "struct name" to use "symbolic offsets" ? thank you. Code: toto: rd 100h struct BB g1 dd ? struct g8 dd ? union g2 dd ? g3 dd ? ends ends ends mov eax ,[toto + BB.g2] ;undefined symbol BB.g2 |
|||
12 Nov 2010, 12:20 |
|
Tomasz Grysztar 12 Nov 2010, 12:57
This is just a bug, not an expected behavior. I'll look into that later.
|
|||
12 Nov 2010, 12:57 |
|
ouadji 12 Nov 2010, 13:35
it is not easy to receive criticisms. Thank you for your quick reply (as usual) and this good feedback. ok .. I will wait for the fixed version , I need it to continue to develop Wink. Once again, thank you Tomasz. |
|||
12 Nov 2010, 13:35 |
|
ouadji 12 Nov 2010, 15:00
last update: 12 Nov 2010 14:31:33 UTC thank you Tomasz for this quick fix. I checked it, all is ok now. |
|||
12 Nov 2010, 15:00 |
|
ouadji 13 Nov 2010, 00:34
I stopped in Wink development with this: is this normal ? (I don't know !) Tomasz ? sorry to bother you with this, thank you in advance Code: ;does compile ;------------ struct .ZZ z1 dd ? ends struct HH h1 dd ? .ZZ ;<--- ".ZZ" (alone) h3 dd ? ends Code: ;does not compile ;---------------- struct .ZZ z1 dd ? ends struct HH h1 dd ? h2 .ZZ ;<--- not ".ZZ alone" but "h2 .ZZ" h3 dd ? ends |
|||
13 Nov 2010, 00:34 |
|
baldr 13 Nov 2010, 10:53
ouadji,
Read this paragraph again, throughly: Macroinstruction defined using the struc directive must be preceded by a label (like the data definition directive) when it's used. This label will be also attached at the beginning of every name starting with dot in the contents of macroinstruction. Code: match any,fields@struct \{ fields@struct equ fields@struct,.,.ZZ,<values>\}; . is h2, and .ZZ becomes h2.ZZ |
|||
13 Nov 2010, 10:53 |
|
ouadji 13 Nov 2010, 16:47
These special cases are due to the macro language itself. I understand all this ... but if one don't take into account the macro language (or if one don't knows it) ... the "final result" gives to this struct macro, a appearance, a behavior, that sometimes seems to lack consistency. (only for these special cases) That said, once again, i understand "why". This is not a big problem at all! I will implement this behavior in Wink. besides, It's already be done ! |
|||
13 Nov 2010, 16:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.