flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Need an if before equ |
Author |
|
revolution 15 Apr 2016, 15:07
IF and EQU are not compatible when used like that. IF is processed by the assembler, EQU by the preprocessor. In your code 'var' is always EQUated to '1'.
Instead, try using '='. Code: var = 0 |
|||
15 Apr 2016, 15:07 |
|
l4m2 15 Apr 2016, 15:09
revolution wrote: IF and EQU are not compatible when used like that. IF is processed by the assembler, EQU by the preprocessor. In your code 'var' is always EQUated to '1'. |
|||
15 Apr 2016, 15:09 |
|
l4m2 15 Apr 2016, 15:12
Mainly I wonder how to do with this
Code: if x in <(, [, \{> t equ x else if ~defined t goto _false |
|||
15 Apr 2016, 15:12 |
|
revolution 15 Apr 2016, 15:16
Use MATCH instead of IF.
|
|||
15 Apr 2016, 15:16 |
|
l4m2 15 Apr 2016, 15:21
Code: macro matche s{ local t irps x, s \{ if x in <(, [, \{> t equ x else if x eqtype 0 t equ num else if ~defined t goto _false else if x eq ) & t eq ( restore t else if x eq ] & t eq [ restore t else if x eq \} & t eq \{ restore t else if x eqtype eax & t eq num restore t else goto _false end if \} if defined t _false: var equ 0 else var equ 1 end if } with eqtype still use MATCH how? |
|||
15 Apr 2016, 15:21 |
|
revolution 15 Apr 2016, 15:26
You can't use IF any other assembler operator like EQ or EQTYPE with RESTORE/MATCH/EQU like that. You'll need to use only preprocessor operators, or only assembler operators. You have to understand that the two stages are completely separate.
|
|||
15 Apr 2016, 15:26 |
|
revolution 15 Apr 2016, 15:29
If you want an example to show one way to use MATCH look at the macro 'allow_nesting' in WIN32AX.inc.
|
|||
15 Apr 2016, 15:29 |
|
l4m2 15 Apr 2016, 15:53
I didn't ask why not correct but how to make it correct, right?
|
|||
15 Apr 2016, 15:53 |
|
revolution 15 Apr 2016, 16:14
l4m2 wrote: I didn't ask why not correct but how to make it correct, right? But I also think that writing a full parser in fasm preprocessor syntax will be very challenging. Perhaps Tomasz's suggestion about using fasmg (in your other thread) is worth considering. |
|||
15 Apr 2016, 16:14 |
|
l4m2 15 Apr 2016, 23:48
Code: macro matche s{ local t irps x, s \{ if x in <(, [, \{> t = x else if ~defined t goto _false else if x eq ) & t eq ( =restore t else if x eq ] & t eq [ =restore t else if x eq \} & t eq \{ =restore t else goto _false end if \} if defined t _false: var = 0 else var = 1 end if } If using Control directives how to make the stack ? |
|||
15 Apr 2016, 23:48 |
|
revolution 16 Apr 2016, 11:42
EQU pushes on the stack, RESTORE pops off the stack. IRPV enumerates the stack.
|
|||
16 Apr 2016, 11:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.