21.4.4 Looping

back: conditionals
forward: diversions
fastback: diversions
up: features of m4
fastforward: writing macros within the gnu autotools framework
top: autoconf, automake, and libtool
contents: table of contents
index: index
about: about this document

There is no support in M4 for doing traditional iterations (ie. `for-do' loops ), however macros may invoke themselves . Thus, it is possible to iterate using recursion. The recursive definition can use conditionals (21.4.3 Conditionals) to terminate the loop at its completion by providing a trivial case. The GNU M4 manual provides some clever recursive definitions, including a definition for a forloop macro that emulates a `for-do' loop.

It is conceivable that you might wish to use these M4 constructs when writing macros to generate large amounts of in-line shell code or arbitrarily nested if; then; fi statements.

This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html

GNU Autoconf, Automake and Libtool
GNU Autoconf, Automake, and Libtool
ISBN: 1578701902
EAN: 2147483647
Year: 2002
Pages: 290

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net