flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Parentheses?

Author
Thread Post new topic Reply to topic
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 07 May 2010, 22:05
baldr used parentheses in a way I've never seen done in Fasm here. What do they do? I've read the macro section of Fasm's manual multiple times and don't remember ever seeing ()s used for anything other than arithmetic.
Post 07 May 2010, 22:05
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 07 May 2010, 23:12
My guess is they are just matched.

_________________
This is a block of text that can be added to posts you make.
Post 07 May 2010, 23:12
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 08 May 2010, 04:46
Tyler,

mindcooler is right; match is powerful. For preprocessor, most of the input is just a stream of tokens (until they get handled).

It's easy to enhance macro with arguments syntax (but hard to invent clever one). Wink
Post 08 May 2010, 04:46
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 08 May 2010, 12:28
Oh, I don't get match anyway, that's probably why I didn't notice it.

How does it work, is it like if or something?
Post 08 May 2010, 12:28
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 08 May 2010, 13:22
Tyler,

It performs attempt to match left and right sides of comma-separated pair. If they've matched, body is expanded, replacing tokens from left side with their matching counterparts from right side.
Code:
match 0, 1 { db 0 }    
This code performs as follows:
  1. «0» token is matched with «1» token;
  2. macro body is expanded, replacing «0» with «1»
  3. result is «db 1».
To protect tokens from replacement and match them literally, you must prepend them with «=»:
Code:
match =0, 1 { db 0 }    
This code fails to match literal «0» token with «1» token, thus macro body doesn't get expanded.

Back to the topic:
Code:
match .name(.count), MessageBoxTimeoutW(6) { db .count, `.name }    
Post 08 May 2010, 13:22
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.