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