m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/doc/m4.texinfo,v [branch-1_4]


From: Eric Blake
Subject: Changes to m4/doc/m4.texinfo,v [branch-1_4]
Date: Mon, 03 Jul 2006 13:16:21 +0000

CVSROOT:        /sources/m4
Module name:    m4
Branch:         branch-1_4
Changes by:     Eric Blake <ericb>      06/07/03 13:16:19

Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.29
retrieving revision 1.1.1.1.2.30
diff -u -b -r1.1.1.1.2.29 -r1.1.1.1.2.30
--- doc/m4.texinfo      30 Jun 2006 18:58:11 -0000      1.1.1.1.2.29
+++ doc/m4.texinfo      3 Jul 2006 13:16:18 -0000       1.1.1.1.2.30
@@ -1629,10 +1629,11 @@
 Here is an example of a loop macro that implements a simple for loop.  It
 can, for example, be used for simple counting:
 
address@hidden ignore
 @example
+include(`forloop.m4')
address@hidden
 forloop(`i', `1', `8', `i ')
address@hidden 2 3 4 5 6 7 8
address@hidden 2 3 4 5 6 7 8 @comment
 @end example
 
 The arguments are a name for the iteration variable, the starting value,
@@ -1642,14 +1643,15 @@
 
 For-loops can be nested, like
 
address@hidden ignore
 @example
+include(`forloop.m4')
address@hidden
 forloop(`i', `1', `4', `forloop(`j', `1', `8', `(i, j) ')
 ')
address@hidden(1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8)
address@hidden(2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8)
address@hidden(3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8)
address@hidden(4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8)
address@hidden(1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) @comment
address@hidden(2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) @comment
address@hidden(3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) @comment
address@hidden(4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) @comment
 @result{}
 @end example
 
@@ -1664,16 +1666,19 @@
 the iteration variable (using the predefined macro @code{incr},
 @pxref{Incr}), and recurses.
 
-Here is the actual implementation of @code{forloop}:
+Here is the actual implementation of @code{forloop}, distributed as
address@hidden/forloop.m4} in this package:
 
address@hidden ignore
 @example
-define(`forloop',
-  `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
address@hidden
-define(`_forloop',
-  `$4`'ifelse($1, `$3', ,
-    `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
+undivert(`forloop.m4')
address@hidden(`-1')
address@hidden forloop(var, from, to, stmt)
address@hidden(`forloop',
address@hidden  `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', 
`$4')popdef(`$1')')
address@hidden(`_forloop',
address@hidden  `$4`'ifelse($1, `$3', ,
address@hidden    `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
address@hidden'dnl
 @result{}
 @end example
 
@@ -2365,7 +2370,10 @@
 @result{}
 @end example
 
-Assume in the following that the file @file{incl.m4} contains the lines:
+The rest of this section assumes that @code{m4} is invoked with the
address@hidden option pointing to the @file{examples} directory shipped as
+part of the GNU @code{m4} package.  The file @file{examples/incl.m4} in
+the distribution contains the lines:
 @comment ignore
 @example
 Include file start
@@ -2602,8 +2610,8 @@
 GNU @code{m4} allows named files to be undiverted.  Given a non-numeric
 argument, the contents of the file named will be copied, uninterpreted, to
 the current output.  This complements the builtin @code{include}
-(@pxref{Include}).  To illustrate the difference, assume the file
address@hidden contains the word @samp{bar}:
+(@pxref{Include}).  To illustrate the difference, the file
address@hidden/foo} contains the word @samp{bar}:
 
 @example
 define(`bar', `BAR')
@@ -2978,8 +2986,9 @@
 Using the @code{forloop} macro defined in @xref{Loops}, this
 example shows how @code{format} can be used to produce tabular output.
 
address@hidden ignore
 @example
+include(`forloop.m4')
address@hidden
 forloop(`i', `1', `10', `format(`%6d squared is %10d
 ', i, eval(i**2))')
 @result{}     1 squared is          1
@@ -2992,6 +3001,7 @@
 @result{}     8 squared is         64
 @result{}     9 squared is         81
 @result{}    10 squared is        100
address@hidden
 @end example
 
 The builtin @code{format} is modeled after the ANSI C @samp{printf}
@@ -3867,10 +3877,11 @@
 processes all arguments, with output separated by spaces.
 
 However, it is possible to emulate @acronym{POSIX} behavior by
-including the sample file @file{wrapfifo.m4}:
+including the file @file{examples/wrapfifo.m4} from the distribution:
 
 @example
 undivert(`wrapfifo.m4')dnl
address@hidden Redefine m4wrap to have FIFO semantics.
 @result{}define(`_m4wrap_level', `0')dnl
 @result{}define(`m4wrap',
 @result{}`ifdef(`m4wrap'_m4wrap_level,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]