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