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