~ubuntu-branches/ubuntu/oneiric/nux/oneiric

« back to all changes in this revision

Viewing changes to NuxCore/NSystem.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-12-17 13:59:57 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101217135957-5gvg6fkjxaa252i0
Tags: upstream-0.9.12
ImportĀ upstreamĀ versionĀ 0.9.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2010 Inalogic Inc.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License version 3, as
6
 
 * published by the  Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
10
 
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
 
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
12
 
 * License for more details.
13
 
 *
14
 
 * You should have received a copy of both the GNU Lesser General Public
15
 
 * License version 3 along with this program.  If not, see
16
 
 * <http://www.gnu.org/licenses/>
17
 
 *
18
 
 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
19
 
 *
20
 
 */
21
 
 
22
 
 
23
 
#ifndef NSYSTEM_H
24
 
#define NSYSTEM_H
25
 
 
26
 
#ifdef _DEBUG
27
 
#define NUX_DEBUG
28
 
#endif
29
 
 
30
 
#ifdef _WIN32
31
 
    #define NUX_OS_WINDOWS
32
 
#elif __linux
33
 
    #define NUX_OS_LINUX
34
 
#elif __APPLE__
35
 
    #define NUX_OS_MACOSX
36
 
#endif
37
 
 
38
 
#if __GNUC__
39
 
    #define NUX_GNUC_COMPILER
40
 
#if __GNUG__
41
 
    #define NUX_GNUCPP_COMPILER
42
 
#else
43
 
    #error Support only g++.
44
 
#endif
45
 
 
46
 
// Compiler string.
47
 
#define NUX_COMPILER_STRING "GNU CPP Compiler"
48
 
 
49
 
// Build string
50
 
#ifdef NUX_DEBUG
51
 
    #define NUX_BUILD_STRING "Debug build compiled with " NUX_COMPILER_STRING
52
 
#else
53
 
    #define NUX_BUILD_STRING "Compiled with " NUX_COMPILER_STRING
54
 
#endif
55
 
#endif
56
 
 
57
 
#if __APPLE_CC__
58
 
#define NUX_APPLE_COMPILER
59
 
#endif
60
 
 
61
 
#if defined(_M_X64) || defined(__amd64__) || defined(__ia64__)
62
 
#define NUX_ARCH_x64
63
 
#elif defined(_M_IX86) || defined(__i386__)
64
 
#define NUX_ARCH_i386
65
 
#elif defined(__arm__)
66
 
#define NUX_ARCH_arm
67
 
#elif defined(__cell)
68
 
#define NUX_ARCH_cell
69
 
#endif
70
 
 
71
 
#if _MSC_VER
72
 
#define NUX_MICROSOFT_COMPILER
73
 
#endif
74
 
 
75
 
// Compiler Macros:
76
 
// NUX_GNUCPP_COMPILER
77
 
// NUX_MICROSOFT_COMPILER
78
 
 
79
 
// OS Macros:
80
 
// NUX_OS_WINDOWS
81
 
// NUX_OS_LINUX
82
 
// NUX_OS_CELL
83
 
// NUX_OS_MACOSX
84
 
 
85
 
#ifdef _WIN32
86
 
 
87
 
//    Add lib  DbgHelp.lib for the following function
88
 
//    StackWalk64
89
 
//    SymFunctionTableAccess64
90
 
//    SymGetModuleBase64
91
 
//    SymGetModuleInfo64
92
 
//    SymGetLineFromAddr64
93
 
//    SymGetSymFromAddr64
94
 
//    SymInitialize
95
 
//    SymSetOptions
96
 
//    SymGetOptions
97
 
//    SymLoadModule64
98
 
#pragma comment(lib, "DbgHelp")
99
 
 
100
 
// _MSC_VER: Defines the major and minor versions of the compiler. For example, 1300 for Microsoft Visual C++ .NET. 1300 represents version 13
101
 
// and no point release. This represents the fact that there have been a total of 13 releases of the compiler.
102
 
// If you type cl /? at the command line, you will see the full version for the compiler you are using.
103
 
 
104
 
#ifndef _MSC_VER
105
 
#error Support only Visual Studio Compiler.
106
 
#endif
107
 
 
108
 
#define VISUAL_STUDIO_2008_COMPILER     1500
109
 
#define VISUAL_STUDIO_2005_COMPILER     1400
110
 
#define VISUAL_STUDIO_2003_COMPILER     1310
111
 
 
112
 
#if _MSC_VER >= 1500
113
 
#define NUX_VISUAL_STUDIO_2008
114
 
#elif _MSC_VER >= 1400
115
 
#define NUX_VISUAL_STUDIO_2005
116
 
#elif _MSC_VER >= 1310
117
 
#define NUX_VISUAL_STUDIO_2003
118
 
#endif
119
 
 
120
 
// Compiler string.
121
 
#if (_MSC_VER >= VISUAL_STUDIO_2008_COMPILER)
122
 
#define NUX_COMPILER_STRING "Visual Studio 2008"
123
 
#elif (_MSC_VER >= VISUAL_STUDIO_2005_COMPILER)
124
 
#define NUX_COMPILER_STRING "Visual Studio 2005"
125
 
#elif (_MSC_VER >= VISUAL_STUDIO_2003_COMPILER)
126
 
#define NUX_COMPILER_STRING "Visual Studio 2003"
127
 
#endif
128
 
 
129
 
// Build String
130
 
#ifdef NUX_DEBUG
131
 
#define NUX_BUILD_STRING "Debug build compiled with " NUX_COMPILER_STRING
132
 
#else
133
 
#define NUX_BUILD_STRING "Compiled with " NUX_COMPILER_STRING
134
 
#endif
135
 
 
136
 
 
137
 
// Define the proper values for _WIN32_WINNT and WINVER in the compiler response file "compiler_options.h"
138
 
//    Windows Vista         _WIN32_WINNT>=0x0600
139
 
//                          WINVER>=0x0600
140
 
//    Windows Server 2003   _WIN32_WINNT>=0x0502
141
 
//                          WINVER>=0x0502
142
 
//    Windows XP                _WIN32_WINNT>=0x0501
143
 
//                          WINVER>=0x0501
144
 
//    Windows 2000              _WIN32_WINNT>=0x0500
145
 
//                          WINVER>=0x0500
146
 
//    Windows NT 4.0        _WIN32_WINNT>=0x0400
147
 
//                          WINVER>=0x0400
148
 
//    Windows Me                _WIN32_WINDOWS=0x0500
149
 
//                          WINVER>=0x0500
150
 
//    Windows 98                _WIN32_WINDOWS>=0x0410
151
 
//                          WINVER>=0x0410
152
 
//    Windows 95                _WIN32_WINDOWS>=0x0400
153
 
//                          WINVER>=0x0400
154
 
 
155
 
 
156
 
//    Minimum system required   Macros to define
157
 
//    Windows Vista     NTDDI_VERSION >=NTDDI_LONGHORN
158
 
//    Windows Server 2003 SP1   NTDDI_VERSION >=NTDDI_WS03SP1
159
 
//    Windows Server 2003       NTDDI_VERSION >=NTDDI_WS03
160
 
//    Windows XP SP2    NTDDI_VERSION >=NTDDI_WINXPSP2
161
 
//    Windows XP SP1    NTDDI_VERSION >=NTDDI_WINXPSP1
162
 
//    Windows XP        NTDDI_VERSION >=NTDDI_WINXP
163
 
//    Windows 2000 SP4  NTDDI_VERSION >=NTDDI_WIN2KSP4
164
 
//    Windows 2000 SP3  NTDDI_VERSION >=NTDDI_WIN2KSP3
165
 
//    Windows 2000 SP2  NTDDI_VERSION >=NTDDI_WIN2KSP2
166
 
//    Windows 2000 SP1  NTDDI_VERSION >=NTDDI_WIN2KSP1
167
 
//    Windows 2000      NTDDI_VERSION >=NTDDI_WIN2K
168
 
 
169
 
#define WIN32_LEAN_AND_MEAN 1
170
 
#endif  // _WIN32
171
 
 
172
 
 
173
 
 
174
 
 
175
 
// Logging
176
 
#if defined(NUX_OS_WINDOWS) && defined(NUX_DEBUG)
177
 
#define NUX_ENABLE_ASSERT_MACROS
178
 
#define NUX_ENABLE_LOGGING
179
 
#elif defined(NUX_OS_LINUX) && defined(NUX_DEBUG)
180
 
#define NUX_ENABLE_ASSERT_MACROS
181
 
#define NUX_ENABLE_LOGGING
182
 
#endif
183
 
 
184
 
// NOP: no operation
185
 
// Specifies that a function should be ignored and the argument list
186
 
// be parsed but no code be generated for the arguments. It is intended for use in global
187
 
// debug functions that take a variable number of arguments.
188
 
 
189
 
#if defined(NUX_MICROSOFT_COMPILER)
190
 
    #define NUX_COMPILER_SUPPORTS_NOOP
191
 
    #define NUX_NOOP __noop
192
 
#elif defined(NUX_GNUCPP_COMPILER)
193
 
    #define NUX_COMPILER_SUPPORTS_NOOP
194
 
    #define NUX_NOOP __asm__("nop")
195
 
#endif
196
 
 
197
 
// Pragma pack support
198
 
#if defined(NUX_MICROSOFT_COMPILER) || defined(NUX_GNUCPP_COMPILER)
199
 
    #define NUX_SUPPORTS_PRAGMA_PACK
200
 
#endif
201
 
 
202
 
 
203
 
// Define variadic macro support
204
 
#if defined(NUX_MICROSOFT_COMPILER) && (defined(NUX_VISUAL_STUDIO_2005) || defined(NUX_VISUAL_STUDIO_2008))
205
 
    #define NUX_VARIADIC_MACROS_SUPPORT
206
 
#elif defined(NUX_GNUCPP_COMPILER)
207
 
    #define NUX_VARIADIC_MACROS_SUPPORT
208
 
#endif
209
 
 
210
 
 
211
 
/// DLL declaration macros
212
 
#if defined(NUX_OS_WINDOWS)
213
 
    #ifdef NUX_DLL
214
 
        #if (!defined(_WIN32)) && (!defined(_WIN64))
215
 
            #error("ERROR: Use NUX_DLL is permitted only on win32 & win64 platforms")
216
 
        #endif
217
 
 
218
 
        #define NUX_DECLSPEC_DLLIMPORT        __declspec(dllimport)
219
 
        #define NUX_DECLSPEC_DLLEXPORT        __declspec(dllexport)
220
 
    #else
221
 
        #define NUX_DECLSPEC_DLLIMPORT
222
 
        #define NUX_DECLSPEC_DLLEXPORT
223
 
    #endif
224
 
 
225
 
    #ifdef NUX_EXPORT_DLL
226
 
        #define NUX_DECLSPEC_DLL               NUX_DECLSPEC_DLLEXPORT
227
 
    #else
228
 
        #define NUX_DECLSPEC_DLL               NUX_DECLSPEC_DLLIMPORT
229
 
    #endif
230
 
#elif defined(NUX_OS_LINUX)
231
 
    #if __GNUC__ >= 4
232
 
        #define NUX_DECLSPEC_DLLIMPORT __attribute__ ((visibility("default")))
233
 
        #define NUX_DECLSPEC_DLLEXPORT __attribute__ ((visibility("default")))
234
 
    #else
235
 
        #define NUX_DECLSPEC_DLLIMPORT
236
 
        #define NUX_DECLSPEC_DLLEXPORT
237
 
    #endif
238
 
 
239
 
    #ifdef NUX_EXPORT_DLL
240
 
        #define NUX_DECLSPEC_DLL               NUX_DECLSPEC_DLLEXPORT
241
 
    #else
242
 
        #define NUX_DECLSPEC_DLL               NUX_DECLSPEC_DLLIMPORT
243
 
    #endif
244
 
#endif
245
 
 
246
 
#define NUX_CHECK_PUREVIRTUALS 1
247
 
 
248
 
// Throwing exceptions:
249
 
 
250
 
// #ifdef NUX_DEBUG
251
 
//     // if we are in Debug disable exceptions. What we want is to break were and error happens: ie NUX_BREAK_ASM_INT3
252
 
//     #define NUX_EXCEPTIONS_DISABLED 1
253
 
// #endif
254
 
 
255
 
#define NUX_EXCEPTIONS_DISABLED 1
256
 
 
257
 
#define STL std
258
 
 
259
 
#endif // NSYSTEM_H
260