138889Sjdp/* Symbol concatenation utilities. 238889Sjdp 360484Sobrien Copyright (C) 1998, 2000 Free Software Foundation, Inc. 438889Sjdp 538889Sjdp This program is free software; you can redistribute it and/or modify 638889Sjdp it under the terms of the GNU General Public License as published by 738889Sjdp the Free Software Foundation; either version 2 of the License, or 838889Sjdp (at your option) any later version. 938889Sjdp 1038889Sjdp This program is distributed in the hope that it will be useful, 1138889Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1238889Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1338889Sjdp GNU General Public License for more details. 1438889Sjdp 1538889Sjdp You should have received a copy of the GNU General Public License along 1638889Sjdp with this program; if not, write to the Free Software Foundation, Inc., 17218822Sdim 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 1838889Sjdp 1938889Sjdp#ifndef SYM_CAT_H 2038889Sjdp#define SYM_CAT_H 2138889Sjdp 2277298Sobrien#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 2338889Sjdp#define CONCAT2(a,b) a##b 2438889Sjdp#define CONCAT3(a,b,c) a##b##c 2538889Sjdp#define CONCAT4(a,b,c,d) a##b##c##d 2638889Sjdp#define STRINGX(s) #s 2738889Sjdp#else 2877298Sobrien/* Note one should never pass extra whitespace to the CONCATn macros, 2977298Sobrien e.g. CONCAT2(foo, bar) because traditonal C will keep the space between 3077298Sobrien the two labels instead of concatenating them. Instead, make sure to 3177298Sobrien write CONCAT2(foo,bar). */ 3238889Sjdp#define CONCAT2(a,b) a/**/b 3338889Sjdp#define CONCAT3(a,b,c) a/**/b/**/c 3438889Sjdp#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d 3560484Sobrien#define STRINGX(s) "s" 3638889Sjdp#endif 3738889Sjdp 3838889Sjdp#define XCONCAT2(a,b) CONCAT2(a,b) 3938889Sjdp#define XCONCAT3(a,b,c) CONCAT3(a,b,c) 4038889Sjdp#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) 4138889Sjdp 4277298Sobrien/* Note the layer of indirection here is typically used to allow 4377298Sobrien stringification of the expansion of macros. I.e. "#define foo 4477298Sobrien bar", "XSTRING(foo)", to yield "bar". Be aware that this only 4577298Sobrien works for __STDC__, not for traditional C which will still resolve 4677298Sobrien to "foo". */ 4738889Sjdp#define XSTRING(s) STRINGX(s) 4838889Sjdp 4977298Sobrien#endif /* SYM_CAT_H */ 50