flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 24 Dec 2009, 06:57
You have to do it yourself and also you'll need to make your macros cooperate with this (like using a "RESULT" variable since macros don't have return value.
Make sure it really worths the effort, specially considering you could just write this instead: Code: macroA blah,blahblah,pizza if RESULT = 1 macroB foo, bar if RESULT = 2 ... ; Or this if you need long-circuit macroA blah,blahblah,pizza A = RESULT macroB foo, bar if (A = 1) & (RESULT = 2) ... PS: Just a note, the preprocessing elements of the macros will be always long-circuited in the example above, if the "if" should affect the preprocessing stage then match has to be used instead. |
|||
![]() |
|
Azu 24 Dec 2009, 07:06
It would be so much easier to read and write it if I could do it in one line though.
Here's what I have so far (requires multiple lines!) and it doesn't even work ![]() Code: macro varif [varMacro,<varArgs>,varCompareType,varCompareValue]{ varIsTrue=1 forward varMacro varArgs if result varCompareType varCompareValue else varIsTrue=0 end if common } varIf macroA,<blah,blahblah,pizza>,=,1,macroB,<foo,bar>,=,2 if varIsTrue See it is two lines, it is really ugly, and it won't even compile. ![]() This also doesn't work Code: macro varif [varMacro,<varArgs>,varCompare]{ varIsTrue=1 forward varMacro varArgs if result varCompare else varIsTrue=0 end if common } varIf macroA,<blah,blahblah,pizza>,= 1,macroB,<foo,bar>,= 2 if varIsTrue Please tell me what I'm doing wrong.. ![]() p.s. and yes I do set result in the macros |
|||
![]() |
|
Borsuc 25 Dec 2009, 01:24
I've no idea how you could do that but you might be interested in using 'match' in the varIF macro to get rid of all the commas...
have one parameter and use match to get the individual parameters, but you can define the separation with any symbol. you can use irp or irps to loop through them (though I don't think you'll need to). |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.