Search
lxdream.org :: lxdream/src/x86dasm/symcat.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/x86dasm/symcat.h
changeset 362:dc40e2064dc4
author nkeynes
date Tue Aug 28 08:46:54 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add the i386 disassembler from binutils (why write your own if you don't
have to) to use for translator validation
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/x86dasm/symcat.h Tue Aug 28 08:46:54 2007 +0000
1.3 @@ -0,0 +1,49 @@
1.4 +/* Symbol concatenation utilities.
1.5 +
1.6 + Copyright (C) 1998, 2000 Free Software Foundation, Inc.
1.7 +
1.8 + This program is free software; you can redistribute it and/or modify
1.9 + it under the terms of the GNU General Public License as published by
1.10 + the Free Software Foundation; either version 2 of the License, or
1.11 + (at your option) any later version.
1.12 +
1.13 + This program is distributed in the hope that it will be useful,
1.14 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1.15 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.16 + GNU General Public License for more details.
1.17 +
1.18 + You should have received a copy of the GNU General Public License along
1.19 + with this program; if not, write to the Free Software Foundation, Inc.,
1.20 + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1.21 +
1.22 +#ifndef SYM_CAT_H
1.23 +#define SYM_CAT_H
1.24 +
1.25 +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1.26 +#define CONCAT2(a,b) a##b
1.27 +#define CONCAT3(a,b,c) a##b##c
1.28 +#define CONCAT4(a,b,c,d) a##b##c##d
1.29 +#define STRINGX(s) #s
1.30 +#else
1.31 +/* Note one should never pass extra whitespace to the CONCATn macros,
1.32 + e.g. CONCAT2(foo, bar) because traditonal C will keep the space between
1.33 + the two labels instead of concatenating them. Instead, make sure to
1.34 + write CONCAT2(foo,bar). */
1.35 +#define CONCAT2(a,b) a/**/b
1.36 +#define CONCAT3(a,b,c) a/**/b/**/c
1.37 +#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
1.38 +#define STRINGX(s) "s"
1.39 +#endif
1.40 +
1.41 +#define XCONCAT2(a,b) CONCAT2(a,b)
1.42 +#define XCONCAT3(a,b,c) CONCAT3(a,b,c)
1.43 +#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)
1.44 +
1.45 +/* Note the layer of indirection here is typically used to allow
1.46 + stringification of the expansion of macros. I.e. "#define foo
1.47 + bar", "XSTRING(foo)", to yield "bar". Be aware that this only
1.48 + works for __STDC__, not for traditional C which will still resolve
1.49 + to "foo". */
1.50 +#define XSTRING(s) STRINGX(s)
1.51 +
1.52 +#endif /* SYM_CAT_H */
.