[nasm:master] doc: replace %define with %xdefine in some preproc function examples

nasm-bot for H. Peter Anvin hpa at zytor.com
Sun Nov 13 21:15:05 PST 2022


Commit-ID:  8de66e9a5040a39272fbce75e186f191a94d6238
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=8de66e9a5040a39272fbce75e186f191a94d6238
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 13 Nov 2022 21:11:11 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 13 Nov 2022 21:11:11 -0800

doc: replace %define with %xdefine in some preproc function examples

In some of the preprocessor function examples, actually enforce
equivalence by using %xdefine in the function examples so the
expansion is at definition time.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 doc/nasmdoc.src | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index d850df9e..787b3eab 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -2904,9 +2904,9 @@ Being a function, the argument will need to have balanced parentheses
 or be escaped using \c{\{\}}.
 
 \c ; The following lines are all equivalent
-\c %define test 'TEST'
-\c %defstr test TEST
-\c %define test %str(TEST)
+\c %define  test 'TEST'
+\c %defstr  test TEST
+\c %xdefine test %str(TEST)
 
 
 \S{f_strcat} \i\c\{%strcat()} Function
@@ -2915,9 +2915,9 @@ The \c{%strcat()} function concatenates a list of quoted strings, in
 the same way the \i\c{%strcat} directive would, see \k{strcat}.
 
 \c ; The following lines are all equivalent
-\c %define alpha 'Alpha: 12" screen'
-\c %strcat alpha "Alpha: ", '12" screen'
-\c %define alpha %strcat("Alpha: ", '12" screen')
+\c %define  alpha 'Alpha: 12" screen'
+\c %strcat  alpha "Alpha: ", '12" screen'
+\c %xdefine alpha %strcat("Alpha: ", '12" screen')
 
 
 \S{f_strlen} \i\c{%strlen()} Function
@@ -2926,9 +2926,9 @@ The \c{%strlen()} function expands to the length of a quoted string,
 in the same way the \i\c{%strlen} directive would, see \k{strlen}.
 
 \c ; The following lines are all equivalent
-\c %define charcnt 9
-\c %strlen charcnt 'my string'
-\c %define charcnt %strlen('my string')
+\c %define  charcnt 9
+\c %strlen  charcnt 'my string'
+\c %xdefine charcnt %strlen('my string')
 
 
 \S{f_substr} \i\c\{%substr()} Function
@@ -2939,9 +2939,9 @@ that unlike the \c{%substr} directive, a comma is required after the
 string argument.
 
 \c ; The following lines are all equivalent
-\c %define mychar 'yzw'
-\c %substr mychar 'xyzw' 2,-1
-\c %define mychar %substr('xyzw',2,-1)
+\c %define  mychar 'yzw'
+\c %substr  mychar 'xyzw' 2,-1
+\c %xdefine mychar %substr('xyzw',2,-1)
 
 
 \S{f_tok} \i\c{%tok()} function


More information about the Nasm-commits mailing list