1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23#define ABC \ 24 ggg 25 26ABC 27 28/* Standards --------------------------------------------------------------- */ 29 30#define NOTHING 31NOTHING 32 33#define SYMBOL symbol 34#undef SYMBOL 35#define SYMBOL _symbol_ 36 37< SYMBOL > // < _symbol_ > 38xSYMBOLx // xSYMBOLx 39+SYMBOL- // +_symbol_- 40>SYMBOL< // >_symbol_< 41<SYMBOL> // <_symbol_> 42 43#define FALSE 0 44#define TRUE !FALSE 45a = x > 0 ? TRUE : FALSE // a = x > 0 ? !0 : 0 46 47#define A x 48#define B y 49#define MAC(a, b) \ 50 T() { a(); return b; } // T() { x(); return y; } 51MAC(A,B); 52 53#ifdef MAC 54MAC(X,Y) 55#endif // MAC 56 57/* Recursions -------------------------------------------------------------- */ 58 59#define y x 60#define x y 61x // x 62 63#define Test(a) a 64#define b Test(b) 65a = b; // a = b; 66 67#define func abc(func) 68a = func // a = abc(func) 69 70#define func1 func(abc) 71a = func1 // a = abc(func)(abc) 72 73#define args(func, args) func args 74args(t1, (args(t2, (x, y)))) // t1 (t2 (x, y)) 75 76#define ARGS(a) a 77#define __ ARGS 78int foo __((int x)); // int foo (int x); 79 80/* Concatinations ---------------------------------------------------------- */ 81 82#define tail _Test 83// Txt_##tail // Txt_##_Test 84 85#define z(e,f) e##_##f 86z ( abc, xyz ) // abc_xyz 87 88 89#define CAT( var ) fix##.var 90CAT( a ) // fix.a 91 92#define CAT3( class, ref ) class##ref::class##ref 93CAT3( a, b ) // ab::ab 94 95#define CAT2( var ) fix##var::fix##var 96CAT2( a ) // fixa::fixa 97 98/* Extrems ----------------------------------------------------------------- */ 99 100#define MAKE_X( name ) name##_Test 101#define MAKE_Y( name ) MAKE_X( name##_Sym ) 102MAKE_Y( Txt ); // Txt_Sym_Test; 103 104 105/* Extensions -------------------------------------------------------------- */ 106 107/* 108#ident "(c)# Test.txt" 109 110#if #machine(i386) 111# error illegal machine 112#endif 113char machine[6]; 114*/ 115 116/* Last bug ----------------------------------------------------------------- */ 117#define Cfstrcpy Cstrcpy 118#define Cstrcpy( s1, s2 ) strcpy( s1, s2 ) 119 120Cfstrcpy(Par1,Par2 ) // blub( Par1, Par2 ) 121 122/* ---------------------------------------------------------------------- */ 123