1169695Skan/* Symbol concatenation utilities. 2169695Skan 3169695Skan Copyright (C) 1998, 2000 Free Software Foundation, Inc. 4169695Skan 5169695Skan This program is free software; you can redistribute it and/or modify 6169695Skan it under the terms of the GNU General Public License as published by 7169695Skan the Free Software Foundation; either version 2 of the License, or 8169695Skan (at your option) any later version. 9169695Skan 10169695Skan This program is distributed in the hope that it will be useful, 11169695Skan but WITHOUT ANY WARRANTY; without even the implied warranty of 12169695Skan MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13169695Skan GNU General Public License for more details. 14169695Skan 15169695Skan You should have received a copy of the GNU General Public License along 16169695Skan with this program; if not, write to the Free Software Foundation, Inc., 17169695Skan 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 18169695Skan 19169695Skan#ifndef SYM_CAT_H 20169695Skan#define SYM_CAT_H 21169695Skan 22169695Skan#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 23169695Skan#define CONCAT2(a,b) a##b 24169695Skan#define CONCAT3(a,b,c) a##b##c 25169695Skan#define CONCAT4(a,b,c,d) a##b##c##d 26169695Skan#define STRINGX(s) #s 27169695Skan#else 28169695Skan/* Note one should never pass extra whitespace to the CONCATn macros, 29169695Skan e.g. CONCAT2(foo, bar) because traditonal C will keep the space between 30169695Skan the two labels instead of concatenating them. Instead, make sure to 31169695Skan write CONCAT2(foo,bar). */ 32169695Skan#define CONCAT2(a,b) a/**/b 33169695Skan#define CONCAT3(a,b,c) a/**/b/**/c 34169695Skan#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d 35169695Skan#define STRINGX(s) "s" 36169695Skan#endif 37169695Skan 38169695Skan#define XCONCAT2(a,b) CONCAT2(a,b) 39169695Skan#define XCONCAT3(a,b,c) CONCAT3(a,b,c) 40169695Skan#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) 41169695Skan 42169695Skan/* Note the layer of indirection here is typically used to allow 43169695Skan stringification of the expansion of macros. I.e. "#define foo 44169695Skan bar", "XSTRING(foo)", to yield "bar". Be aware that this only 45169695Skan works for __STDC__, not for traditional C which will still resolve 46169695Skan to "foo". */ 47169695Skan#define XSTRING(s) STRINGX(s) 48169695Skan 49169695Skan#endif /* SYM_CAT_H */ 50