summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-19 17:00:52 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-19 17:00:52 -0700
commit0ca00860dfde882f384658409a0d14a3b46fc108 (patch)
tree2ff730b81c3bd19de2973396a40516556e3ef3d3
parent2d4722fe4ca6d6509fb4b6078e6ce07e3634b3a4 (diff)
downloadnasm-0ca00860dfde882f384658409a0d14a3b46fc108.tar.gz
doc: document the %[...] construct.
Add documentation for the %[...] construct. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--doc/nasmdoc.src19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index 326ab412..79a036f0 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -2026,6 +2026,24 @@ as that is what the embedded macro \c{isTrue} expanded to at
the time that \c{isFalse} was defined.
+\S{indmacro} \i{Macro Indirection}: \I\c{%[}\c{%[...]}
+
+The \c{%[...]} construct can be used to expand macros in contexts
+where macro expansion would otherwise not occur, including in the
+names other macros. For example, if you have a set of macros named
+\c{Foo16}, \c{Foo32} and \c{Foo64}, you could write:
+
+\c mov ax,Foo%[__BITS__] ; The Foo value
+
+to use the builtin macro \c{__BITS__} (see \k{bitsm}) to automatically
+select between them. Similarly, the two statements:
+
+\c %xdefine Bar Quux ; Expands due to %xdefine
+\c %define Bar %[Quux] ; Expands due to %[...]
+
+have, in fact, the exactly same effect.
+
+
\S{concat%+} Concatenating Single Line Macro Tokens: \i\c{%+}
Individual tokens in single line macros can be concatenated, to produce
@@ -2097,6 +2115,7 @@ instruction has been used as a label in older code. For example:
\c %idefine pause $%? ; Hide the PAUSE instruction
+
\S{undef} Undefining Single-Line Macros: \i\c{%undef}
Single-line macros can be removed with the \c{%undef} directive. For