00001 /* Symbol concatenation utilities. 00002 00003 Copyright (C) 1998, 2000 Free Software Foundation, Inc. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 00018 00019 #ifndef SYM_CAT_H 00020 #define SYM_CAT_H 00021 00022 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 00023 #define CONCAT2(a,b) a##b 00024 #define CONCAT3(a,b,c) a##b##c 00025 #define CONCAT4(a,b,c,d) a##b##c##d 00026 #define STRINGX(s) #s 00027 #else 00028 /* Note one should never pass extra whitespace to the CONCATn macros, 00029 e.g. CONCAT2(foo, bar) because traditonal C will keep the space between 00030 the two labels instead of concatenating them. Instead, make sure to 00031 write CONCAT2(foo,bar). */ 00032 #define CONCAT2(a,b) ab 00033 #define CONCAT3(a,b,c) abc 00034 #define CONCAT4(a,b,c,d) abcd 00035 #define STRINGX(s) "s" 00036 #endif 00037 00038 #define XCONCAT2(a,b) CONCAT2(a,b) 00039 #define XCONCAT3(a,b,c) CONCAT3(a,b,c) 00040 #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) 00041 00042 /* Note the layer of indirection here is typically used to allow 00043 stringification of the expansion of macros. I.e. "#define foo 00044 bar", "XSTRING(foo)", to yield "bar". Be aware that this only 00045 works for __STDC__, not for traditional C which will still resolve 00046 to "foo". */ 00047 #define XSTRING(s) STRINGX(s) 00048 00049 #endif /* SYM_CAT_H */
1.5.6