flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > preprocessor , get the first equ definition? |
Author |
|
edfed 24 Feb 2023, 18:48
how is it possible to make it work?
Code: VALUE equ "value is pre overriden" if ~defined VALUE VALUE equ "value is now defined" end if db VALUE,0 |
|||
24 Feb 2023, 18:48 |
|
ProMiNick 24 Feb 2023, 19:53
Code: value equ "value is pre overriden" irpv v, value { common temp equ } match =temp,temp { value equ "value is now defined" } restore temp db value,0 |
|||
24 Feb 2023, 19:53 |
|
edfed 25 Feb 2023, 14:07
Thanks!!!
yess! then if i undestand well, =operator before the A argument of match is a not. and then, match will preproc when value is not value. it is not clearly documented in the fasm doc. Quote:
maybe an example for this part would be interresting as there are a lot of usecases where we need to do this kind of stuff. |
|||
25 Feb 2023, 14:07 |
|
revolution 25 Feb 2023, 14:35
If 'value' has no existing definition then the part after the comma is simply itself and the match succeeds.
If 'value' has been defined then the part after the comma is replaced. Code: value equ foo match =foo, value { display "I am a match because 'foo' == 'foo'",13,10 } match =foo, foo { display "I am a match because 'foo' == 'foo'",13,10 } match =value, value { display "you never see me because 'value' != 'foo'",13,10 } match =value, foo { display "you never see me because 'value' != 'foo'",13,10 } |
|||
25 Feb 2023, 14:35 |
|
ProMiNick 25 Feb 2023, 17:42
Code: value = 4 value equ value value equ value irpv v, value { \common display "value is at least once overrided",13,10 } irpv v, value { display "count of this message is displayed is equal count of value overridings,13,10 } irpv v, foo { \common display "you never see me because foo is never overrided",13,10 } value is overrided but still Code: match =value, value { display "you will see me too'",13,10 } so this is not property of absence of override or absence of value that could be assembled Code: dd value; assembled with no error,no matter than match =value,value |
|||
25 Feb 2023, 17:42 |
|
edfed 26 Feb 2023, 12:14
right
i tested with an undefined constant, it don't works as i expected. match is a hard to understand directive. in this code, i want to define A, B, C and D only when value is defined. the equ after value should match the pattern of the macro. in this example, there is not check of pattern, but it works when value is defined. Code: macro _value a,b,c,d { A=a B=b C=c D=d } match value,value { _value value } |
|||
26 Feb 2023, 12:14 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.