| Line | |
|---|
| 1 | divert(`-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
|
|---|
| 6 | define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1',
|
|---|
| 7 | `pushdef(`$1', eval(`$2'))_forloop(`$1',
|
|---|
| 8 | eval(`$3'), `$4')popdef(`$1')')')
|
|---|
| 9 | define(`_forloop',
|
|---|
| 10 | `$3`'ifelse(indir(`$1'), `$2', `',
|
|---|
| 11 | `define(`$1', incr(indir(`$1')))$0($@)')')
|
|---|
| 12 | divert`'dnl
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.