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