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