Imported Upstream version 1.4.16
[platform/upstream/m4.git] / examples / loop.m4
1 dnl Stress test for recursion algorithms.  Usage:
2 dnl m4 -Ipath/to/examples [-Doptions] loop.m4
3 dnl Options include:
4 dnl -Dalt[=<n>] - test with foreachq<n> instead of foreachq2, default 3
5 dnl -Dlimit=<num> - set upper limit of sequence to <num>, default 1000
6 dnl -Dverbose - print the sequence to the screen, rather than discarding
7 dnl -Ddebug[=<code>] - execute <code> after forloop but before foreach
8 dnl -Dsleep=<num> - sleep for <num> seconds before exit, to allow time
9 dnl   to examine peak process memory usage
10 include(`forloop2.m4')dnl
11 include(`quote.m4')dnl
12 ifelse(alt, `alt', `define(`alt', `2')', alt, `', `define(`alt', `3')')dnl
13 include(`foreachq'alt`.m4')dnl
14 ifdef(`limit', `', `define(`limit', `1000')')dnl
15 ifdef(`verbose', `', `divert(`-1')')dnl
16 ifdef(`debug', `', `define(`debug')')dnl
17 foreachq(`i', dquote(1forloop(`i', `2', limit, `,i'))debug, ` i')
18 ifdef(`sleep',`syscmd(`echo done>/dev/tty;sleep 'sleep)')dnl