flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > fasmg counterpart of 'if Arg in <X,Y,Z>end if' construction

Author
Thread Post new topic Reply to topic
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 23 Sep 2021, 17:52
What is the fasmg counterpart of fasm 1 syntactic construction
Code:
if Arg in <X,Y,Z>
(...)
end if    

Question
Post 23 Sep 2021, 17:52
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 23 Sep 2021, 19:28
There's no direct counterpart. The closest might be the TRANSFORM command available in CALM, with a dedicated namespace containing all the items to recognize. The example might look a bit complex, though the underlying idea is simple:
Code:
macro ifin?! candidate, matches
        local list, result, tester

        iterate item, matches
                define list.item
        end iterate

        calminstruction (out) tester in
                local state
                transform in, list
                jyes true
                compute state, 0
                jump done
            true:
                compute state, 1
            done:
                publish out, state
        end calminstruction

        result tester candidate
        if result
end macro     
Code:
macro try Arg
        ifin Arg, <X,Y,Z>
                display 'Yes'
        else
                display 'No'
        end if
end macro

try Z    
Post 23 Sep 2021, 19:28
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 23 Sep 2021, 19:35
Thank you, I have tested these macros and they work exactly as expected. Very Happy
Post 23 Sep 2021, 19:35
View user's profile Send private message Visit poster's website 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.