flat assembler
Message board for the users of flat assembler.

Index > Windows > 'proc' macro: question for FASM pros

Author
Thread Post new topic Reply to topic
ejamesr



Joined: 04 Feb 2011
Posts: 52
Location: Provo, Utah, USA
ejamesr
The 'proc' macro in the FASM v1.71.13 file ..\INCLUDE\MACRO\PROC32.INC includes a '>' after 'args' and a '<' in front of 'params' as shown here:
Code:
macro proc [args]                       ; define procedure
 { common
    match name params, args>
    \{ define@proc name,<params \} }    

What is the purpose of those characters? I appear to have missed the documentation on that.

Is this a way to convert the entire 'args' list into one symbol? And/or is there a simple way to convert the entire list into one symbol that can be manipulated later (other than concatenating each element one at a time via a forward or reverse section in the macro)?

Thanks,

Eric
Post 24 Oct 2013, 22:51
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
It is a way of putting all "args" into one parameter without having the outer macro strip the surrounding angle brackets (<>).
Post 24 Oct 2013, 23:20
View user's profile Send private message Visit poster's website Reply with quote
ejamesr



Joined: 04 Feb 2011
Posts: 52
Location: Provo, Utah, USA
ejamesr
Thanks, revolution. I have another question.

If a 'proc' procedure has no arguments other than the procedure name, the match statement in the 'proc' macro will not match, and so the block will not get processed and 'define@proc' should not be called. But it is still always processed, even though it seems it should not.

Why is that?
Post 25 Oct 2013, 02:50
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
Because the '>' character will match
Post 25 Oct 2013, 07:37
View user's profile Send private message Visit poster's website Reply with quote
ejamesr



Joined: 04 Feb 2011
Posts: 52
Location: Provo, Utah, USA
ejamesr
That makes sense; I forgot that the angle brackets (or any other symbol character) would end the current symbol. So after, for example, 'proc MyProc', the 'match' statement above assigns 'MyProc' to 'name', and '>' to 'params', which means the block can then be processed because it matches the match pattern (which requires two components).

I'm learning that the 'match' command is very flexible, but can also be quite complex!

Thanks again,

Eric
Post 25 Oct 2013, 17:44
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.