diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-05-25 22:09:17 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-05-25 22:09:17 -0700 |
commit | ca4f36cc2cda9fcf241f2e4befa6441b7652132a (patch) | |
tree | aecc5176c29d4680238c2c731112db45e5ca5471 /doc | |
parent | ce2233bb9f166848bc8c99bf3d19d9693fbb27a4 (diff) | |
download | nasm-ca4f36cc2cda9fcf241f2e4befa6441b7652132a.tar.gz |
Document %? and %??
Diffstat (limited to 'doc')
-rw-r--r-- | doc/nasmdoc.src | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 367f92e6..ad266244 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -3,7 +3,7 @@ \# \M{category}{Programming} \M{title}{NASM - The Netwide Assembler} -\M{year}{2007} +\M{year}{2008} \M{author}{The NASM Development Team} \M{license}{All rights reserved. This document is redistributable under the license given in the file "COPYING" distributed in the NASM archive.} \M{summary}{This file documents NASM, the Netwide Assembler: an assembler targetting the Intel x86 series of processors, with portable source.} @@ -2003,6 +2003,36 @@ Using this feature, we can simplify references to a lot of macros (and, in turn, reduce typing errors). +\S{selfref%?} The Macro Name Itself: \i\c{%?} and \i\c{%??} + +The special symbols \c{%?} and \c{%??} can be used to reference the +macro name itself inside a macro expansion, this is supported for both +single-and multi-line macros. \c{%?} refers to the macro name as +\e{invoked}, whereas \c{%??} refers to the macro name as +\e{declared}. The two are always the same for case-sensitive +macros, but for case-insensitive macros, they can differ. + +For example: + +\c %idefine Foo mov %?,%?? +\c +\c foo +\c FOO + +will expand to: + +\c mov foo,Foo +\c mov FOO,Foo + +The sequence: + +\c %idefine keyword $%? + +can be used to make a keyword "disappear", for example in case a new +instruction has been used as a label in older code. For example: + +\c %idefine pause $%? ; Hide the PAUSE instruction + \S{undef} Undefining macros: \i\c{%undef} Single-line macros can be removed with the \c{%undef} command. For |