cfad47cfa3/t3compiler/tads3/test/data/main2.t

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
#define recurs(x) (recurs(x) + 1)
2
recurs(recurs(5));
3
4
#define foo1 a,b
5
#define bar1(x) lose1(x)
6
#define lose1(x) (1 + (x))
7
bar1(foo1);
8
9
#define foo2 (a,b)
10
#define bar2(x) lose((x))
11
bar2(foo2);
12
13
#define xstr3(s) str3(s)
14
#define str3(s) #s
15
#define foo3  987
16
xstr3(foo3)
17
18
#define str(s) #s
19
#define foo 4
20
str (foo)
21
22
#define x (4 + y)
23
#define y (2 * x)
24
25
x;
26
y;
27
28
#define PASTE(a, b) a ## b
29
30
#if PASTE(1, 2) > 10
31
#pragma message("yes")
32
#else
33
#pragma message("no")
34
#endif
35
36
37
#if PASTE(1,
38
2) > 10
39
#pragma message("yes")
40
#else
41
#pragma message("no")
42
#endif
43
44
This is a test.  /* This is a comment. */  End of the test.
45
This       is         another        test.
46
47
   PASTE(({a, b, c}), ([d, e, f]));
48
49
50
Another multiline macro test: PASTE(100
51
                                     ,
52
                                    200
53
                                      +
54
                                    300
55
                                       ); that is all!!!;
56
57
Test of a multiline macro: PASTE(100,
58
                                 200); end of multi-line macro!
59
60
61
PASTE(aaa xxx,
62
#ifdef FOO
63
      bbb
64
#else
65
      ccc
66
#endif
67
68
     );
69
70
100 ## 200
71
72
73
#define FOOBAR 100
74
   PASTE(FOO, BAR)
75
76
77
#define FOO 1
78
#define BAR 2
79
   PASTE(FOO, BAR);
80
81
82
#define A(x) x*2
83
#define B(y, z) y(z)
84
85
B(A, 5)
86
87
PASTE(FOO, 1);
88
PASTE
89
  (X,
90
   Y);
91
PASTE
92
93
94
  X, y;
95
96
#define RECURSIVE(x) RECURSIVE(x)
97
    RECURSIVE(100);
98
        
99
"Try a macro that ends without closing its argument list...":
100
  PASTE(100,
101