mingw-5.1.4/win32/include/symcat.h
author jjkang
Fri, 11 Jun 2010 15:22:19 +0800
changeset 3 d6b1fbb42aec
parent 0 76b1f169d9fe
permissions -rw-r--r--
Change SFL to EPL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/* Symbol concatenation utilities.
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
   This program is free software; you can redistribute it and/or modify
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
   it under the terms of the GNU General Public License as published by
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
   the Free Software Foundation; either version 2 of the License, or
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
   (at your option) any later version.
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
   This program is distributed in the hope that it will be useful,
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
   GNU General Public License for more details.
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
 
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    15
   You should have received a copy of the GNU General Public License along
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    16
   with this program; if not, write to the Free Software Foundation, Inc.,
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    17
   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    18
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    19
#ifndef SYM_CAT_H
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    20
#define SYM_CAT_H
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    22
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    23
#define CONCAT2(a,b)	 a##b
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
#define CONCAT3(a,b,c)	 a##b##c
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
#define CONCAT4(a,b,c,d) a##b##c##d
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
#define STRINGX(s) #s
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
#else
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
/* Note one should never pass extra whitespace to the CONCATn macros,
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
   e.g. CONCAT2(foo, bar) because traditonal C will keep the space between
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
   the two labels instead of concatenating them.  Instead, make sure to
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    31
   write CONCAT2(foo,bar).  */
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    32
#define CONCAT2(a,b)	 a/**/b
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    33
#define CONCAT3(a,b,c)	 a/**/b/**/c
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
#define STRINGX(s) "s"
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
#endif
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
#define XCONCAT2(a,b)     CONCAT2(a,b)
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
#define XCONCAT3(a,b,c)   CONCAT3(a,b,c)
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
/* Note the layer of indirection here is typically used to allow
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    43
   stringification of the expansion of macros.  I.e. "#define foo
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    44
   bar", "XSTRING(foo)", to yield "bar".  Be aware that this only
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    45
   works for __STDC__, not for traditional C which will still resolve
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    46
   to "foo".  */
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    47
#define XSTRING(s) STRINGX(s) 
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    48
76b1f169d9fe DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    49
#endif /* SYM_CAT_H */