0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00

doc: document the %[...] construct.

Add documentation for the %[...] construct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin
2008-10-19 17:00:52 -07:00
parent 2d4722fe4c
commit 0ca00860df

View File

@@ -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