11debfc3dSmrg /* Symbol concatenation utilities. 21debfc3dSmrg 3*8feb0f0bSmrg Copyright (C) 1998-2020 Free Software Foundation, Inc. 41debfc3dSmrg 51debfc3dSmrg This program is free software; you can redistribute it and/or modify 61debfc3dSmrg it under the terms of the GNU General Public License as published by 71debfc3dSmrg the Free Software Foundation; either version 2 of the License, or 81debfc3dSmrg (at your option) any later version. 91debfc3dSmrg 101debfc3dSmrg This program is distributed in the hope that it will be useful, 111debfc3dSmrg but WITHOUT ANY WARRANTY; without even the implied warranty of 121debfc3dSmrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 131debfc3dSmrg GNU General Public License for more details. 141debfc3dSmrg 151debfc3dSmrg You should have received a copy of the GNU General Public License along 161debfc3dSmrg with this program; if not, write to the Free Software Foundation, Inc., 171debfc3dSmrg 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 181debfc3dSmrg 191debfc3dSmrg #ifndef SYM_CAT_H 201debfc3dSmrg #define SYM_CAT_H 211debfc3dSmrg 221debfc3dSmrg #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) 231debfc3dSmrg #define CONCAT2(a,b) a##b 241debfc3dSmrg #define CONCAT3(a,b,c) a##b##c 251debfc3dSmrg #define CONCAT4(a,b,c,d) a##b##c##d 261debfc3dSmrg #define CONCAT5(a,b,c,d,e) a##b##c##d##e 271debfc3dSmrg #define CONCAT6(a,b,c,d,e,f) a##b##c##d##e##f 281debfc3dSmrg #define STRINGX(s) #s 291debfc3dSmrg #else 301debfc3dSmrg /* Note one should never pass extra whitespace to the CONCATn macros, 311debfc3dSmrg e.g. CONCAT2(foo, bar) because traditonal C will keep the space between 321debfc3dSmrg the two labels instead of concatenating them. Instead, make sure to 331debfc3dSmrg write CONCAT2(foo,bar). */ 341debfc3dSmrg #define CONCAT2(a,b) a/**/b 351debfc3dSmrg #define CONCAT3(a,b,c) a/**/b/**/c 361debfc3dSmrg #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d 371debfc3dSmrg #define CONCAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e 381debfc3dSmrg #define CONCAT6(a,b,c,d,e,f) a/**/b/**/c/**/d/**/e/**/f 391debfc3dSmrg #define STRINGX(s) "s" 401debfc3dSmrg #endif 411debfc3dSmrg 421debfc3dSmrg #define XCONCAT2(a,b) CONCAT2(a,b) 431debfc3dSmrg #define XCONCAT3(a,b,c) CONCAT3(a,b,c) 441debfc3dSmrg #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) 451debfc3dSmrg #define XCONCAT5(a,b,c,d,e) CONCAT5(a,b,c,d,e) 461debfc3dSmrg #define XCONCAT6(a,b,c,d,e,f) CONCAT6(a,b,c,d,e,f) 471debfc3dSmrg 481debfc3dSmrg /* Note the layer of indirection here is typically used to allow 491debfc3dSmrg stringification of the expansion of macros. I.e. "#define foo 501debfc3dSmrg bar", "XSTRING(foo)", to yield "bar". Be aware that this only 511debfc3dSmrg works for __STDC__, not for traditional C which will still resolve 521debfc3dSmrg to "foo". */ 531debfc3dSmrg #define XSTRING(s) STRINGX(s) 541debfc3dSmrg 551debfc3dSmrg #endif /* SYM_CAT_H */ 56