flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > struc { .macro } -- bug? |
Author |
|
vid 20 Mar 2004, 09:40
of course, it is preprocessed to
bar2.foo which is not instruction or directive maybe you meant. struct bar2 {.foo:} (note ":") which will declare label. |
|||
20 Mar 2004, 09:40 |
|
S.T.A.S. 20 Mar 2004, 11:14
Quote: maybe you meant. No, I'm trying to use a macro, which name is started with the dot. This macro is to generate some local labels predefined earlier. Of cource, it's not hard to change the name of the macro (for example, just remove the dot), but I expect it should be preprocessed (like in the first variant) to: Code: bar2 {body of the macro .foo} I suppose the dot has special meaning inside the "struc" clause in this case, but it seems a bit illogical for me: We can declare a macro and use it everywhere in the source. But when its name is started with dot, the "struc" clause is the only exclusion from common rule. FASM.TXT wrote: All the rules concerning standard macroinstructions apply to structure macroinstructions. |
|||
20 Mar 2004, 11:14 |
|
Tomasz Grysztar 20 Mar 2004, 11:42
It's just a matter of priority. In the same way when you define macro of some name, and use another macro with parameter of the same name:
Code: macro alpha { } macro beta alpha { alpha } then when you do: Code: beta nop you'll of course get NOP instruction processed, because all macro processing is done before anything else (like recognizing directives or other macros). This is substantial for the macro mechanism to become really usable. And processing symbols starting with dot before doing anything else with them is just one more aspect of this behaviour. |
|||
20 Mar 2004, 11:42 |
|
S.T.A.S. 20 Mar 2004, 16:06
Thanks for explanation, Privalov
now I understand it isn't a bug I was afraid before. In other words, if inside struc clause there is any name starting with dot, then it's interpreting like local label name unambiguously, but not a macro. This is, probably, because struc and macro are used in different ways: (and FASM needs to differ them, because they may have the same name) Code: macro .foo { } struc bar {.foo} macro bar {.foo} some: bar other bar ;; this won't work becouse of .foo So, it's better don't abuse dots (like me), instead of losing some other very nice capabilities Really, there are lots of symbols on my keyboard |
|||
20 Mar 2004, 16:06 |
|
Tomasz Grysztar 20 Mar 2004, 16:09
Also you can define and use some macro local to your structure this way, like:
Code: struc foo { macro .bar _% %_ .bar ; we use the above macro here } _% fix { %_ fix } If you do "some foo", it will define "some.bar" macro and use it, and it works because of the behavior pointed out by you. |
|||
20 Mar 2004, 16:09 |
|
pas 23 Mar 2004, 02:04
You want to change names macro dynamically on the certain pattern?
Such as to create macro: CLB Name, Name1 And to use: Name. Create Name1. Create And ò. ä.? If yes I can send macro of creation of an element of management such as CheckListBox. The announcement of elements of management: CheckListBox 206, List, 207, List2 Creation of elements of management List. Create List2. Create |
|||
23 Mar 2004, 02:04 |
|
S.T.A.S. 23 Mar 2004, 11:02
Privalov, thanks for excellent example of this very powerful feature
I think it could be REALLY useful, for example, to define some advanced kind of "comcall" macro pas, thanks, now I see how it works ^^ |
|||
23 Mar 2004, 11:02 |
|
vid 23 Mar 2004, 19:38
sorry for my mistake, i havent noticed "macro .foo {}"
Just to add, structure name will be appended not only to labels starting with dot, but to every symbol starting with dot, even .45 (which is elsewhere valid FP number) |
|||
23 Mar 2004, 19:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.