From 077fb93d2bfaf2d4acb356535026efe56c0e120e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 20 Jul 2010 14:56:30 -0700 Subject: preproc: allow non-identifier character in environment variables Allow non-identifier characters in the name of environment variables, by surrounding them with string quotes (subject to ordinary string-quoting rules.) Signed-off-by: H. Peter Anvin --- doc/changes.src | 21 +++++++++++++++------ doc/nasmdoc.src | 12 +++++++++++- 2 files changed, 26 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/changes.src b/doc/changes.src index 43a49978..e27faded 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,7 +9,8 @@ since 2007. \S{cl-2.09} Version 2.09 -\b \c{%ifenv}, \c{%elifenv}, \c{%ifnenv}, and \c{%elifnenv} directives introduced. +\b \c{%ifenv}, \c{%elifenv}, \c{%ifnenv}, and \c{%elifnenv} directives + introduced. See \k{ifenv}. \b Fixed NULL dereference if environment variable is missed. @@ -19,7 +20,8 @@ since 2007. \b Fix for encoding the LFS, LGS and LSS in 64-bit mode. -\b Fixes for compatibility with OpenWatcom compiler and DOS 8.3 file format limitation. +\b Fixes for compatibility with OpenWatcom compiler and DOS 8.3 file + format limitation. \b Macros parameters range expansion introduced. See \k{mlmacrange}. @@ -29,14 +31,17 @@ since 2007. \b Short intersegment jumps are permitted now. -\b An alignment more then 64 bytes are allowed for \c{win32}, \c{win64} output formats. +\b An alignment more then 64 bytes are allowed for \c{win32}, + \c{win64} output formats. \b \c{SECTALIGN} directive introduced. In most cases invisible to user. -\b \c{nojmp} option introduced in \c{smartalign} package. See \k{pkg_smartalign}. +\b \c{nojmp} option introduced in \c{smartalign} package. See + \k{pkg_smartalign}. -\b Short aliases \c{win}, \c{elf} and \c{macho} for output formats are introduced. - Each stands for \c{win32}, \c{elf32} and \c{macho32} accordingly. +\b Short aliases \c{win}, \c{elf} and \c{macho} for output formats are + introduced. Each stands for \c{win32}, \c{elf32} and \c{macho32} + accordingly. \b Faster handling of missing directives implemented. @@ -53,6 +58,10 @@ since 2007. \b Make \c{-Ox} the default optimization level. For the legacy behavior, specify \c{-O0} explicitly. See \k{opt-O}. +\b Environment variables read with \c{%!} or tested with \c{%ifenv} + can now contain non-identifier characters if surrounded by quotes. + See \k{getenv}. + \S{cl-2.08.02} Version 2.08.02 diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 05dc5b5f..eb1fe5e6 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -3158,6 +3158,10 @@ the \c{%!} directive exists. The usual \i\c{%elifenv}, \i\c\{%ifnenv}, and \i\c{%elifnenv} variants are also provided. +Just as for \c{%!} the argument should be written as a string if +it contains characters that would not be legal in an identifier. See +\k{getenv}. + \H{rep} \i{Preprocessor Loops}\I{repeating code}: \i\c{%rep} NASM's \c{TIMES} prefix, though useful, cannot be used to invoke a @@ -3714,10 +3718,16 @@ For example, suppose that you have an environment variable \c{FOO}, and you want the contents of \c{FOO} to be embedded in your program. You could do that as follows: -\c %defstr FOO %!FOO +\c %defstr FOO %!FOO See \k{defstr} for notes on the \c{%defstr} directive. +If the name of the environment variable contains non-identifier +characters, you can use string quotes to surround the name of the +variable, for example: + +\c %defstr C_colon %!'C:' + \H{stdmac} \i{Standard Macros} -- cgit v1.2.1