956a4c05 |
1 | #include "cll1.h" |
2 | |
3 | program |
4 | { |
a3c2aecb |
5 | int i,j=1; |
956a4c05 |
6 | |
a3c2aecb |
7 | echo("Just plain vanilla auto-increment:\tfor_range(i,1,5)"); |
8 | for_range(i,1,5) |
9 | { |
10 | printf(" [%d]",i); |
11 | } |
420bb771 |
12 | print(""); |
956a4c05 |
13 | |
a3c2aecb |
14 | echo("Single-evaluation of macro argument:\tj=1; for_range(i,0,j++)"); |
15 | for_range(i,0,j++) |
16 | { |
17 | printf(" [%d]",i); |
18 | } |
420bb771 |
19 | print(""); |
956a4c05 |
20 | |
a3c2aecb |
21 | echo("Just plain vanilla auto-decrement:\tfor_range(i,1,0)"); |
22 | for_range(i,1,0) |
23 | { |
24 | printf(" [%d]",i); |
25 | } |
420bb771 |
26 | print(""); |
956a4c05 |
27 | |
a3c2aecb |
28 | echo("Single iteration is possible too:\tfor_range(i,1,1)"); |
29 | for_range(i,1,1) |
30 | { |
31 | printf(" [%d]",i); |
32 | } |
420bb771 |
33 | print(""); |
956a4c05 |
34 | |
a3c2aecb |
35 | echo("Yet another example of macro safety:\tj=2; for_range(i,5,--j)"); |
36 | for_range(i,5,--j) |
37 | { |
38 | printf(" [%d]",i); |
39 | } |
40 | print(""); |
41 | |
42 | echo("Nesting of this macro seems to be safe:\tfor_range(i,1,3) for_range(j,3,1)"); |
43 | for_range(i,1,3) |
44 | { |
45 | for_range(j,3,1) |
46 | { |
47 | printf(" [%d,%d]",i,j); |
48 | } |
49 | } |
420bb771 |
50 | print(""); |
956a4c05 |
51 | } |