CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 06/07/12 13:27:26
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.37
retrieving revision 1.1.1.1.2.38
diff -u -b -r1.1.1.1.2.37 -r1.1.1.1.2.38
--- doc/m4.texinfo 12 Jul 2006 13:14:51 -0000 1.1.1.1.2.37
+++ doc/m4.texinfo 12 Jul 2006 13:27:26 -0000 1.1.1.1.2.38
@@ -3996,6 +3996,31 @@
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:
+
[EMAIL PROTECTED]
+define(`a1', `A1')
[EMAIL PROTECTED]
+dnl First argument, concatenated with 1
+define(`_1', `$1')define(`first1', `_1($@@)1')
[EMAIL PROTECTED]
+dnl Eleventh argument, portable
+define(`_9', `$9')define(`eleventh', `_9(shift(shift($@@)))')
[EMAIL PROTECTED]
+dnl Eleventh argument, GNU style
+define(`Eleventh', `$11')
[EMAIL PROTECTED]
+first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')
[EMAIL PROTECTED]
+eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')
[EMAIL PROTECTED]
+Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')
[EMAIL PROTECTED]
[EMAIL PROTECTED] example
+
@item
The @code{divert} (@pxref{Divert}) macro can manage more than 9
diversions. GNU @code{m4} treats all positive numbers as valid