GNU Info

Info Node: (nasm.info)Section 4.7

(nasm.info)Section 4.7


Next: Section 4.7.1 Prev: Section 4.6 Up: Chapter 4
Enter node , (file) or (file)node

4.7. The Context Stack
======================

   Having labels that are local to a macro definition is sometimes not
quite powerful enough: sometimes you want to be able to share labels
between several macro calls. An example might be a `REPEAT' ... `UNTIL'
loop, in which the expansion of the `REPEAT' macro would need to be
able to refer to a label which the `UNTIL' macro had defined. However,
for such a macro you would also want to be able to nest these loops.

   NASM provides this level of power by means of a _context stack_. The
preprocessor maintains a stack of _contexts_, each of which is
characterised by a name. You add a new context to the stack using the
`%push' directive, and remove one using `%pop'. You can define labels
that are local to a particular context on the stack.

Section 4.7.1
`%push' and `%pop': Creating and Removing Contexts
Section 4.7.2
Context-Local Labels
Section 4.7.3
Context-Local Single-Line Macros
Section 4.7.4
`%repl': Renaming a Context
Section 4.7.5
Example Use of the Context Stack: Block IFs

automatically generated by info2www version 1.2.2.9