flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Macroinstructions > [fasmg] quoted text as macro param -- match

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 479
Location: Belarus

[fasmg] quoted text as macro param -- match

Is it possible to match quoted text case insensitively?

Code:

macro bag_contains items
    match 'pair of socks' moreitems:
        socks = 1
    else match =book? moreitems:
        book = 1
    end match
end macro

bag_contains "pair of socks"




Can't figure out how to match quoted string in case-insensitive manner.
Tried ="text?=" and a bunch of other variants, but quoted text seems to always be matched literally. Please advise
Post 01 Apr 2017, 10:44
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6686
Location: Kraków, Poland

There is no such option in fasmg's MATCH, the case modifiers can only apply to name symbols.
Post 01 Apr 2017, 11:04
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 479
Location: Belarus

I came up with this solution:

Code:

macro bag_contains item
  local it
  len = lengthof `item
  if `item and 0xff = "'" & `item shr ((len - 1) * 8) = "'"
    eval 'define it 'item
  else
    define it item
  end if
  match =pair? =of? =socks?it
      display 'socks',13,10
  end match
end macro

bag_contains pair OF socks
bag_contains 'pair OF socks'


Post 01 Apr 2017, 11:47
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6686
Location: Kraków, Poland

Look OK, if that works for you. EVAL can often help when there is no other option.
Post 01 Apr 2017, 12:17
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.