Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:16

0001 /* Symbol concatenation utilities.
0002 
0003    Copyright (C) 1998-2022 Free Software Foundation, Inc.
0004 
0005    This program is free software; you can redistribute it and/or modify
0006    it under the terms of the GNU General Public License as published by
0007    the Free Software Foundation; either version 2 of the License, or
0008    (at your option) any later version.
0009 
0010    This program is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013    GNU General Public License for more details.
0014  
0015    You should have received a copy of the GNU General Public License along
0016    with this program; if not, write to the Free Software Foundation, Inc.,
0017    51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
0018 
0019 #ifndef SYM_CAT_H
0020 #define SYM_CAT_H
0021 
0022 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
0023 #define CONCAT2(a,b)     a##b
0024 #define CONCAT3(a,b,c)   a##b##c
0025 #define CONCAT4(a,b,c,d) a##b##c##d
0026 #define CONCAT5(a,b,c,d,e) a##b##c##d##e
0027 #define CONCAT6(a,b,c,d,e,f) a##b##c##d##e##f
0028 #define STRINGX(s) #s
0029 #else
0030 /* Note one should never pass extra whitespace to the CONCATn macros,
0031    e.g. CONCAT2(foo, bar) because traditonal C will keep the space between
0032    the two labels instead of concatenating them.  Instead, make sure to
0033    write CONCAT2(foo,bar).  */
0034 #define CONCAT2(a,b)     a/**/b
0035 #define CONCAT3(a,b,c)   a/**/b/**/c
0036 #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
0037 #define CONCAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e
0038 #define CONCAT6(a,b,c,d,e,f) a/**/b/**/c/**/d/**/e/**/f
0039 #define STRINGX(s) "s"
0040 #endif
0041 
0042 #define XCONCAT2(a,b)     CONCAT2(a,b)
0043 #define XCONCAT3(a,b,c)   CONCAT3(a,b,c)
0044 #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)
0045 #define XCONCAT5(a,b,c,d,e) CONCAT5(a,b,c,d,e)
0046 #define XCONCAT6(a,b,c,d,e,f) CONCAT6(a,b,c,d,e,f)
0047 
0048 /* Note the layer of indirection here is typically used to allow
0049    stringification of the expansion of macros.  I.e. "#define foo
0050    bar", "XSTRING(foo)", to yield "bar".  Be aware that this only
0051    works for __STDC__, not for traditional C which will still resolve
0052    to "foo".  */
0053 #define XSTRING(s) STRINGX(s) 
0054 
0055 #endif /* SYM_CAT_H */