From ca4f36cc2cda9fcf241f2e4befa6441b7652132a Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 25 May 2008 22:09:17 -0700 Subject: [PATCH] Document %? and %?? --- doc/nasmdoc.src | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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 -- 2.11.4.GIT