1*3d8817e4Smiod /* Symbol concatenation utilities. 2*3d8817e4Smiod 3*3d8817e4Smiod Copyright (C) 1998, 2000 Free Software Foundation, Inc. 4*3d8817e4Smiod 5*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 6*3d8817e4Smiod it under the terms of the GNU General Public License as published by 7*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 8*3d8817e4Smiod (at your option) any later version. 9*3d8817e4Smiod 10*3d8817e4Smiod This program is distributed in the hope that it will be useful, 11*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 12*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*3d8817e4Smiod GNU General Public License for more details. 14*3d8817e4Smiod 15*3d8817e4Smiod You should have received a copy of the GNU General Public License along 16*3d8817e4Smiod with this program; if not, write to the Free Software Foundation, Inc., 17*3d8817e4Smiod 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 18*3d8817e4Smiod 19*3d8817e4Smiod #ifndef SYM_CAT_H 20*3d8817e4Smiod #define SYM_CAT_H 21*3d8817e4Smiod 22*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 23*3d8817e4Smiod #define CONCAT2(a,b) a##b 24*3d8817e4Smiod #define CONCAT3(a,b,c) a##b##c 25*3d8817e4Smiod #define CONCAT4(a,b,c,d) a##b##c##d 26*3d8817e4Smiod #define STRINGX(s) #s 27*3d8817e4Smiod #else 28*3d8817e4Smiod /* Note one should never pass extra whitespace to the CONCATn macros, 29*3d8817e4Smiod e.g. CONCAT2(foo, bar) because traditonal C will keep the space between 30*3d8817e4Smiod the two labels instead of concatenating them. Instead, make sure to 31*3d8817e4Smiod write CONCAT2(foo,bar). */ 32*3d8817e4Smiod #define CONCAT2(a,b) a/**/b 33*3d8817e4Smiod #define CONCAT3(a,b,c) a/**/b/**/c 34*3d8817e4Smiod #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d 35*3d8817e4Smiod #define STRINGX(s) "s" 36*3d8817e4Smiod #endif 37*3d8817e4Smiod 38*3d8817e4Smiod #define XCONCAT2(a,b) CONCAT2(a,b) 39*3d8817e4Smiod #define XCONCAT3(a,b,c) CONCAT3(a,b,c) 40*3d8817e4Smiod #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) 41*3d8817e4Smiod 42*3d8817e4Smiod /* Note the layer of indirection here is typically used to allow 43*3d8817e4Smiod stringification of the expansion of macros. I.e. "#define foo 44*3d8817e4Smiod bar", "XSTRING(foo)", to yield "bar". Be aware that this only 45*3d8817e4Smiod works for __STDC__, not for traditional C which will still resolve 46*3d8817e4Smiod to "foo". */ 47*3d8817e4Smiod #define XSTRING(s) STRINGX(s) 48*3d8817e4Smiod 49*3d8817e4Smiod #endif /* SYM_CAT_H */ 50