From 02e49e048546ae5a4156585ed7de8f0ba89d9395 Mon Sep 17 00:00:00 2001 From: Keith Kanios Date: Sat, 18 Dec 2010 13:19:01 -0600 Subject: [PATCH] doc/nasmdoc.src: document additions from preprocessor-rewrite merge --- doc/nasmdoc.src | 77 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 4b2c2ac..515a8bb 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -2415,20 +2415,21 @@ things like \c silly {13,10}, crlf ; crlf: db 13,10 -\#\S{mlrmacro} \i{Recursive Multi-Line Macros}: \I\c{%irmacro}\i\c{%rmacro} -\# -\#A multi-line macro cannot be referenced within itself, in order to -\#prevent accidental infinite recursion. -\# -\#Recursive multi-line macros allow for self-referencing, with the -\#caveat that the user is aware of the existence, use and purpose of -\#recursive multi-line macros. There is also a generous, but sane, upper -\#limit to the number of recursions, in order to prevent run-away memory -\#consumption in case of accidental infinite recursion. -\# -\#As with non-recursive multi-line macros, recursive multi-line macros are -\#\i{case-sensitive}, unless you define them using the alternative -\#directive \c{%irmacro}. +\S{mlrmacro} \i{Recursive Multi-Line Macros}: \I\c{%irmacro}\i\c{%rmacro} + +A multi-line macro cannot be referenced within itself, in order to +prevent accidental infinite recursion and allow instruction overloading. + +Recursive multi-line macros allow for self-referencing, with the +caveat that the user is aware of the existence, use and purpose of +recursive multi-line macros. There is also a generous, but sane, upper +limit to the number of recursions, in order to prevent run-away memory +consumption in case of accidental infinite recursion. + +As with non-recursive multi-line macros, recursive multi-line macros are +\i{case-sensitive}, unless you define them using the alternative +directive \c{%irmacro}. + \S{mlmacover} Overloading Multi-Line Macros\I{overloading, multi-line macros} @@ -2887,20 +2888,21 @@ does \e{not} remove the macro \c{bar}, since the argument specification does not match exactly. -\#\S{exitmacro} Exiting Multi-Line Macros: \i\c{%exitmacro} -\# -\#Multi-line macro expansions can be arbitrarily terminated with -\#the \c{%exitmacro} directive. -\# -\#For example: -\# -\#\c %macro foo 1-3 -\#\c ; Do something -\#\c %if -\#\c %exitmacro -\#\c %endif -\#\c ; Do something -\#\c %endmacro +\S{exitmacro} Exiting Multi-Line Macros: \i\c{%exitmacro} + +Multi-line macro expansions can be arbitrarily terminated with +the \c{%exitmacro} directive. + +For example: + +\c %macro foo 1-3 +\c ; Do something +\c %if +\c %exitmacro +\c %endif +\c ; Do something +\c %endmacro + \H{condasm} \i{Conditional Assembly}\I\c{%if} @@ -3221,6 +3223,17 @@ Note a maximum repeat count is limited by 62 bit number, though it is hardly possible that you ever need anything bigger. +\H{while} \i{Conditional Loops}: \i\c{%while} + +The directives \c{%while} and \i\c{%endwhile} combine preprocessor +loops with conditional assembly, allowing the enclosed chunk of +code to be replicated as long as certain conditions are met: + +\c %while +\c ; some code which only repeats while is met +\c %endwhile + + \H{files} Source Files and Dependencies These commands allow you to split your sources into multiple files. @@ -3793,6 +3806,14 @@ variable, for example: \c %defstr C_colon %!'C:' +\S{final} \i\c{%final} Directive + +The \c{%final} directive is used to delay preprocessing of a line +until all other "normal" preprocessing is complete. Multiple +\c{%final} directives are processed in the opposite order of their +declaration, last one first and first one last. + + \H{stdmac} \i{Standard Macros} NASM defines a set of standard macros, which are already defined -- 2.7.4