flat assembler
Message board for the users of flat assembler.

Index > Main > How can I use parameters with "define"?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode 26 Mar 2010, 20:01
baldr wrote:
...only if it is the first token ...macro name...the second token....should...
why ? Very Happy qoute me please where is the "rule"....
you say...

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 26 Mar 2010, 20:01
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 26 Mar 2010, 20:41
hopcode,

The only source of such information is the FASM source. Wink
"2.3.4 Structures" subchapter of manual wrote:
Macroinstruction de fined using the struc directive must be preceded by a label (like the data defi nition directive) when it's used.
Note that unlike data definition directives (e.g. db) first token is not a true label, more like a struc macro parameter.
Post 26 Mar 2010, 20:41
View user's profile Send private message Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode 26 Mar 2010, 21:19
baldr, i thank you very much for your quoting. i think the matter
is not much related to that quoting, but i will no take part to discussion
about it anymore.
I have few posts as you can see, and almost your
same joining date. After one person posts 3 or max 5 posts on a subject,
and finds no "exit-way" for a solution or satisfactory explanation, well ,
it becomes imho pure blogging on these techical forums.
I agree if it happens in the heap forum, but not here.
Also, please dont take it personally,
i stop here posting and i will read your posts.
Thank you all for your efforts.

Cheers, Very Happy
hopcode

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 26 Mar 2010, 21:19
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 26 Mar 2010, 21:26
baldr wrote:
hopcode,

The only source of such information is the FASM source. Wink

Have you missed this paragraph? Wink
Section 2.3.7 - Order of processing
Section 2.3.7 wrote:
(...)It begins with checking for the preprocessor directives, and when none of them is detected, preprocessor checks whether the first symbol is macroinstruction. If no macroinstruction is found, it moves to the second symbol of line, and again begins with checking for directives, which in this case is only the equ directive, as this is the only one that occurs as the second symbol in line. If there's no directive, the second symbol is checked for the case of structure macroinstruction and when none of those checks gives the positive result, the symbolic constants are replaced with their values and such line is passed to the assembler.
Post 26 Mar 2010, 21:26
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 26 Mar 2010, 22:04
Tomasz Grysztar,

No, I haven't. There is additional code that recognizes the case when first token is not a macro name and second token is ':'. Wink
Post 26 Mar 2010, 22:04
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 26 Mar 2010, 22:10
baldr wrote:
No, I haven't. There is additional code that recognizes the case when first token is not a macro name and second token is ':'. Wink
Well, you MAY have read that paragraph before, but you definitely haven't read the entire section. Wink Or at least, you were not reading carefully.
Section 2.3.7 wrote:
There is one more special case - when preprocessor goes to checking the second symbol in the line and it happens to be the colon character (what is then interpreted by assembler as definition of a label), it stops in this place and finishes the preprocessing of the first symbol (so if it's the symbolic constant it gets unrolled) and if it still appears to be the label, it performs the standard preprocessing starting from the place after the label. This allows to place preprocessor directives and macroinstructions after the labels, analogously to the instructions and directives processed by assembler, (...)
etc. etc.
Post 26 Mar 2010, 22:10
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 27 Mar 2010, 00:10
Tomasz Grysztar,

I don't question the quality of the manual, it is good. I meant only that if there is some ambiguity, the best way to make it clear is to read the source:
Code:
macro a arg {
  local done
  define done -
  match =:, arg \{
    a:
    define done +
  \}
  match =-=:v,done arg \{
    b: v
    define done +
  \}
  match =-, done \{
    db `arg
  \}
}
a: db 'A'
   a  B
a:    
Post 27 Mar 2010, 00:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.