nkeynes@362: /* Symbol concatenation utilities. nkeynes@362: nkeynes@362: Copyright (C) 1998, 2000 Free Software Foundation, Inc. nkeynes@362: nkeynes@362: This program is free software; you can redistribute it and/or modify nkeynes@362: it under the terms of the GNU General Public License as published by nkeynes@362: the Free Software Foundation; either version 2 of the License, or nkeynes@362: (at your option) any later version. nkeynes@362: nkeynes@362: This program is distributed in the hope that it will be useful, nkeynes@362: but WITHOUT ANY WARRANTY; without even the implied warranty of nkeynes@362: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nkeynes@362: GNU General Public License for more details. nkeynes@362: nkeynes@362: You should have received a copy of the GNU General Public License along nkeynes@362: with this program; if not, write to the Free Software Foundation, Inc., nkeynes@362: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ nkeynes@362: nkeynes@362: #ifndef SYM_CAT_H nkeynes@362: #define SYM_CAT_H nkeynes@362: nkeynes@362: #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) nkeynes@362: #define CONCAT2(a,b) a##b nkeynes@362: #define CONCAT3(a,b,c) a##b##c nkeynes@362: #define CONCAT4(a,b,c,d) a##b##c##d nkeynes@362: #define STRINGX(s) #s nkeynes@362: #else nkeynes@362: /* Note one should never pass extra whitespace to the CONCATn macros, nkeynes@362: e.g. CONCAT2(foo, bar) because traditonal C will keep the space between nkeynes@362: the two labels instead of concatenating them. Instead, make sure to nkeynes@362: write CONCAT2(foo,bar). */ nkeynes@362: #define CONCAT2(a,b) a/**/b nkeynes@362: #define CONCAT3(a,b,c) a/**/b/**/c nkeynes@362: #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d nkeynes@362: #define STRINGX(s) "s" nkeynes@362: #endif nkeynes@362: nkeynes@362: #define XCONCAT2(a,b) CONCAT2(a,b) nkeynes@362: #define XCONCAT3(a,b,c) CONCAT3(a,b,c) nkeynes@362: #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) nkeynes@362: nkeynes@362: /* Note the layer of indirection here is typically used to allow nkeynes@362: stringification of the expansion of macros. I.e. "#define foo nkeynes@362: bar", "XSTRING(foo)", to yield "bar". Be aware that this only nkeynes@362: works for __STDC__, not for traditional C which will still resolve nkeynes@362: to "foo". */ nkeynes@362: #define XSTRING(s) STRINGX(s) nkeynes@362: nkeynes@362: #endif /* SYM_CAT_H */