c96f24cb53b05768f55c127d1f1010f6246d05c5
[svn/Cll1h/.git] / demos / for_range.c
1 #include "cll1.h"
2
3 program
4 {
5 int i,j=1;
6
7 echo("Just plain vanilla auto-increment:\tfor_range(i,1,5)");
8 for_range(i,1,5)
9 {
10 printf(" [%d]",i);
11 }
12 print("");
13
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 }
19 print("");
20
21 echo("Just plain vanilla auto-decrement:\tfor_range(i,1,0)");
22 for_range(i,1,0)
23 {
24 printf(" [%d]",i);
25 }
26 print("");
27
28 echo("Single iteration is possible too:\tfor_range(i,1,1)");
29 for_range(i,1,1)
30 {
31 printf(" [%d]",i);
32 }
33 print("");
34
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 }
50 print("");
51 }
This page took 0.267667 seconds and 3 git commands to generate.