flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > undefine label |
Author |
|
LocoDelAssembly 21 Feb 2012, 21:01
Not possible, but with the preprocessor's assistance you may come up with something near to that:
Code: macro label arg { local d, l, m ; Check if already defined match =arg, arg\{d equ\} match d,d\{err 'Already defined'\} match name opts, arg \{ label l opts name equ l m equ \} match m, m \{ label l arg equ l \} } macro undefine name { match =name, name\{err 'No such label'\} restore name } label foo byte if ~defined foo display "1. Not defined" end if undefine foo if ~defined foo display "2. Not defined" end if |
|||
21 Feb 2012, 21:01 |
|
l_inc 21 Feb 2012, 23:46
An option with forward referencing:
Code: macro label [args] { common local name match \name opts,args \{ name equ \name \} match =name,name \{ name equ args \} match \name,name \{ if ~defined \name\#.undefined label args end if \} } macro undefine name { local undef if defined name#.undefined & ~defined undef display 'The label "',`name,'" is already undefined',13,10 err end if name#.undefined = 1 undef = 1 } undefine foo label foo byte if defined foo display 'Defined',13,10 else display 'Not defined',13,10 end if |
|||
21 Feb 2012, 23:46 |
|
BAiC 22 Feb 2012, 12:07
Thanks Loco, l_inc.
I was looking to keep something like the file-based templates that I have but it looks like going back to 'struc' is the simplest option: Code: struc GlobalStruc { .code: };define actual code. .localName GlobalStruc;define Single-Use struc. struc has the property that .code will be automatically appended to .localName allowing most of the code to be re-used as-is. |
|||
22 Feb 2012, 12:07 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.