1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     macros.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Revision: 13332 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_CONFIG_MACROS_H_
17 #define NW_CONFIG_MACROS_H_
18 
19 #include <nw/config/compiler.h>
20 
21 #define NW_MACRO_STRING_I_(text)    #text
22 
23 #if defined( NW_COMPILER_CWCC )
24 
25 #define NW_MACRO_STRING_(text)         NW_MACRO_STRING_O_((text))
26 #define NW_MACRO_STRING_O_(params)     NW_MACRO_STRING_I_ ## params
27 
28 #define NW_MACRO_CAT_(a, b)            NW_MACRO_CAT_O_((a, b))
29 #define NW_MACRO_CAT_O_(params)        NW_MACRO_CAT_I_ ## params
30 #define NW_MACRO_CAT_I_(a, b)          a ## b
31 
32 #elif defined( NW_COMPILER_MSVC )
33 
34 #define NW_MACRO_STRING_(text)         NW_MACRO_STRING_O_((text))
35 #define NW_MACRO_STRING_O_(params)     NW_MACRO_STRING_I_ params
36 
37 #define NW_MACRO_CAT_(a, b)            NW_MACRO_CAT_I_(a, b)
38 #define NW_MACRO_CAT_I_(a, b)          NW_MACRO_CAT_II_(a ## b)
39 #define NW_MACRO_CAT_II_(text)         text
40 
41 #else // RVCT もこれでOK
42 
43 #define NW_MACRO_STRING_(text)         NW_MACRO_STRING_I_(text)
44 
45 #define NW_MACRO_CAT_I_(a, b)          a ## b
46 #define NW_MACRO_CAT_(a, b)            NW_MACRO_CAT_I_(a, b)
47 
48 #endif
49 
50 #define NW_ADAPTIVE_HEADER(prefix, target)        <NW_MACRO_CAT_(prefix, target)>
51 #define NW_ADAPTIVE_HEADER_LOCAL(prefix, target)  NW_MACRO_STRING_(NW_MACRO_CAT_(prefix, target))
52 
53 #endif // NW_CONFIG_MACROS_H_
54