~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to m4/forloop.m4

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
b'\\ No newline at end of file'