xref: /aoo41x/main/soltools/cpp/Test.txt (revision cdf0e10c)
1
2#define ABC \
3		ggg
4
5ABC
6
7/* Standards --------------------------------------------------------------- */
8
9#define NOTHING
10NOTHING
11
12#define SYMBOL symbol
13#undef SYMBOL
14#define SYMBOL _symbol_
15
16< SYMBOL >                      // < _symbol_ >
17xSYMBOLx                        // xSYMBOLx
18+SYMBOL-                        // +_symbol_-
19>SYMBOL<                        // >_symbol_<
20<SYMBOL>                        // <_symbol_>
21
22#define FALSE 0
23#define TRUE  !FALSE
24a = x > 0 ? TRUE : FALSE        // a = x > 0 ? !0 : 0
25
26#define A x
27#define B y
28#define MAC(a, b) \
29	T() { a(); return b; }      // T() { x(); return y; }
30MAC(A,B);
31
32#ifdef MAC
33MAC(X,Y)
34#endif // MAC
35
36/* Recursions -------------------------------------------------------------- */
37
38#define y x
39#define x y
40x                               // x
41
42#define Test(a) a
43#define b Test(b)
44a = b;                          // a = b;
45
46#define func abc(func)
47a = func                        // a = abc(func)
48
49#define func1 func(abc)
50a = func1                       // a = abc(func)(abc)
51
52#define args(func, args) func args
53args(t1, (args(t2, (x, y))))    // t1 (t2 (x, y))
54
55#define ARGS(a) a
56#define __ ARGS
57int foo __((int x));            // int foo (int x);
58
59/* Concatinations ---------------------------------------------------------- */
60
61#define tail _Test
62// Txt_##tail                      // Txt_##_Test
63
64#define z(e,f) e##_##f
65z ( abc, xyz )                  // abc_xyz
66
67
68#define CAT( var ) fix##.var
69CAT( a )                        // fix.a
70
71#define CAT3( class, ref ) class##ref::class##ref
72CAT3( a, b )                    // ab::ab
73
74#define CAT2( var ) fix##var::fix##var
75CAT2( a )                       // fixa::fixa
76
77/* Extrems ----------------------------------------------------------------- */
78
79#define MAKE_X( name )  name##_Test
80#define MAKE_Y( name )  MAKE_X( name##_Sym )
81MAKE_Y( Txt );                  // Txt_Sym_Test;
82
83
84/* Extensions -------------------------------------------------------------- */
85
86/*
87#ident "(c)# Test.txt"
88
89#if #machine(i386)
90#   error illegal machine
91#endif
92char machine[6];
93*/
94
95/* Last bug ----------------------------------------------------------------- */
96#define Cfstrcpy		Cstrcpy
97#define Cstrcpy( s1, s2 )	strcpy( s1, s2 )
98
99Cfstrcpy(Par1,Par2 )   		// blub( Par1, Par2 )
100
101/* ---------------------------------------------------------------------- */
102