source: trunk/essentials/sys-devel/m4/examples/forloop2.m4

Last change on this file was 3090, checked in by bird, 18 years ago

m4 1.4.8

File size: 472 bytes
Line 
1divert(`-1')
2# forloop(var, from, to, stmt) - improved version:
3# works even if VAR is not a strict macro name
4# performs sanity check that FROM is larger than TO
5# allows complex numerical expressions in TO and FROM
6define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1',
7 `pushdef(`$1', eval(`$2'))_forloop(`$1',
8 eval(`$3'), `$4')popdef(`$1')')')
9define(`_forloop',
10 `$3`'ifelse(indir(`$1'), `$2', `',
11 `define(`$1', incr(indir(`$1')))$0($@)')')
12divert`'dnl
Note: See TracBrowser for help on using the repository browser.