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] do purge or restore restores struc definition?

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 473
Location: Belarus
[fasmg] do purge or restore restores struc definition?
I'm trying to redefine standard data types to use only inside macro, and then restore them back:

Code:

macro my? name
  struc db? arg
    label .
    match ?arg
      rb 1
    else match n =dup? ?arg
      rb n
    else match n =dup? (?), arg
      rb n
    else
      err "Invalid element data type definition"
    end match
    .__length = $ - .
    .__size = 1
  end struc
  
  macro end?.my?
    end struc
    . . .
    purge db?
    ;restore db
  end macro
    struc my
      . . .
end macro



however, purge or restore doesn't seem to undefine struc, because when I do

Code:

my OWN
  a db ?
end my

b db 1

some OWN a:3



I get custom error "Invalid element data type definition" for `b db 1`. Looks like `end my` doesn't restore the symbol.
Post 11 Feb 2017, 12:16
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
It is the same as in fasm 1, for STRUC macros use RESTRUC instead of PURGE.

PURGE is for instruction class symbols (macros), RESTORE for expression class ones, and RESTRUC is for labeled instruction class (STRUC macros). You can have symbols with the same name in all three classes and each of them is going to work in the appropriate context.
Post 11 Feb 2017, 12:38
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 473
Location: Belarus
Ah, I see. I thought struc belongs to instruction class, too
Post 11 Feb 2017, 12:50
View user's profile Send private message 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-2016, Tomasz Grysztar.