[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: branch-1_4 doc improvements
From: |
Eric Blake |
Subject: |
Re: branch-1_4 doc improvements |
Date: |
Wed, 12 Jul 2006 07:26:12 -0600 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 7/12/2006 7:14 AM:
>>>> Here's another round of doc improvements.
Next - document a workaround for getting traditional behavior for `$11':
2006-07-12 Eric Blake <address@hidden>
* doc/m4.texinfo (Extensions): Document how to overcome
implementation difference in > 9 positional parameters.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEtPh084KuGfSFAYARAtM9AKCCAul1rDFyCwVcnVz4zVE0vV+KmgCgk+vg
ruhN8waa0RcZJcB+ETJm8vM=
=Hkzc
-----END PGP SIGNATURE-----
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.37
diff -u -p -r1.1.1.1.2.37 m4.texinfo
--- doc/m4.texinfo 12 Jul 2006 13:14:51 -0000 1.1.1.1.2.37
+++ doc/m4.texinfo 12 Jul 2006 13:25:40 -0000
@@ -3996,6 +3996,31 @@ several digits, while the System V @code
This allows macros in GNU @code{m4} to take any number of arguments, and
not only nine (@pxref{Arguments}).
+This means that @code{define(`foo', `$11')} is ambiguous between
+implementations. To portably choose between grabbing the first
+parameter and appending 1 to the expansion, or grabbing the eleventh
+parameter, you can do the following:
+
address@hidden
+define(`a1', `A1')
address@hidden
+dnl First argument, concatenated with 1
+define(`_1', `$1')define(`first1', `_1($@@)1')
address@hidden
+dnl Eleventh argument, portable
+define(`_9', `$9')define(`eleventh', `_9(shift(shift($@@)))')
address@hidden
+dnl Eleventh argument, GNU style
+define(`Eleventh', `$11')
address@hidden
+first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')
address@hidden
+eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')
address@hidden
+Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')
address@hidden
address@hidden example
+
@item
The @code{divert} (@pxref{Divert}) macro can manage more than 9
diversions. GNU @code{m4} treats all positive numbers as valid