~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/NSystem.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-02 03:28:11 UTC
  • Revision ID: neil.patel@canonical.com-20100902032811-i2m18tfb6pkasnvt
Remove Win EOL chars

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
 
23
 
#ifndef NSYSTEM_H
24
 
#define NSYSTEM_H
25
 
 
26
 
#ifdef _WIN32
27
 
    #define INL_OS_WINDOWS
28
 
#elif __linux
29
 
    #define INL_OS_LINUX
30
 
#elif INL_PS3
31
 
    #define INL_OS_CELL
32
 
#elif __APPLE__ 
33
 
    #define INL_OS_MACOSX
34
 
#endif
35
 
 
36
 
#if __GNUC__
37
 
    #define INL_GNUC_COMPILER
38
 
    #if __GNUG__
39
 
        #define INL_GNUCPP_COMPILER
40
 
    #else  
41
 
        #error Support only g++.
42
 
    #endif
43
 
 
44
 
    // Compiler string.
45
 
    #define INL_COMPILER_STRING "GNU CPP Compiler"
46
 
 
47
 
    // Build string
48
 
    #ifdef _DEBUG
49
 
        #define INL_BUILD_STRING "Debug build compiled with " INL_COMPILER_STRING
50
 
    #else
51
 
        #define INL_BUILD_STRING "Compiled with " INL_COMPILER_STRING
52
 
    #endif
53
 
#endif
54
 
 
55
 
#if __APPLE_CC__
56
 
    #define INL_APPLE_COMPILER
57
 
#endif
58
 
 
59
 
#if defined(_M_X64) || defined(__amd64__) || defined(__ia64__)
60
 
    #define INL_ARCH_x64
61
 
#elif defined(_M_IX86) || defined(__i386__)
62
 
    #define INL_ARCH_i386
63
 
#elif defined(__arm__)
64
 
    #define INL_ARCH_arm
65
 
#elif defined(__cell)
66
 
    #define INL_ARCH_cell
67
 
#endif
68
 
 
69
 
#if _MSC_VER
70
 
    #define INL_MICROSOFT_COMPILER
71
 
#endif
72
 
 
73
 
// Compiler Macros:
74
 
// INL_GNUCPP_COMPILER
75
 
// INL_MICROSOFT_COMPILER
76
 
 
77
 
// OS Macros:
78
 
// INL_OS_WINDOWS
79
 
// INL_OS_LINUX
80
 
// INL_OS_CELL
81
 
// INL_OS_MACOSX
82
 
 
83
 
#ifdef _WIN32
84
 
 
85
 
//    Add lib  DbgHelp.lib for the following function
86
 
//    StackWalk64
87
 
//    SymFunctionTableAccess64
88
 
//    SymGetModuleBase64
89
 
//    SymGetModuleInfo64
90
 
//    SymGetLineFromAddr64
91
 
//    SymGetSymFromAddr64
92
 
//    SymInitialize
93
 
//    SymSetOptions
94
 
//    SymGetOptions
95
 
//    SymLoadModule64
96
 
    #pragma comment(lib, "DbgHelp")
97
 
 
98
 
    // _MSC_VER: Defines the major and minor versions of the compiler. For example, 1300 for Microsoft Visual C++ .NET. 1300 represents version 13
99
 
    // and no point release. This represents the fact that there have been a total of 13 releases of the compiler. 
100
 
    // If you type cl /? at the command line, you will see the full version for the compiler you are using.
101
 
    
102
 
    #ifndef _MSC_VER
103
 
        #error Support only Visual Studio Compiler.
104
 
    #endif
105
 
 
106
 
    #define VISUAL_STUDIO_2008_COMPILER     1500
107
 
    #define VISUAL_STUDIO_2005_COMPILER     1400
108
 
    #define VISUAL_STUDIO_2003_COMPILER     1310
109
 
 
110
 
    #if _MSC_VER >= 1500
111
 
        #define INL_VISUAL_STUDIO_2008
112
 
    #elif _MSC_VER >= 1400
113
 
        #define INL_VISUAL_STUDIO_2005
114
 
    #elif _MSC_VER >= 1310
115
 
        #define INL_VISUAL_STUDIO_2003
116
 
    #endif
117
 
 
118
 
    // Compiler string.
119
 
    #if (_MSC_VER >= VISUAL_STUDIO_2008_COMPILER)
120
 
        #define INL_COMPILER_STRING "Visual Studio 2008"
121
 
    #elif (_MSC_VER >= VISUAL_STUDIO_2005_COMPILER)
122
 
        #define INL_COMPILER_STRING "Visual Studio 2005"
123
 
    #elif (_MSC_VER >= VISUAL_STUDIO_2003_COMPILER)
124
 
        #define INL_COMPILER_STRING "Visual Studio 2003"
125
 
    #endif
126
 
 
127
 
    // Build String
128
 
    #ifdef _DEBUG
129
 
        #define INL_BUILD_STRING "Debug build compiled with " INL_COMPILER_STRING
130
 
    #else
131
 
        #define INL_BUILD_STRING "Compiled with " INL_COMPILER_STRING
132
 
    #endif
133
 
 
134
 
 
135
 
// Define the proper values for _WIN32_WINNT and WINVER in the compiler response file "compiler_options.h"
136
 
//    Windows Vista         _WIN32_WINNT>=0x0600
137
 
//                          WINVER>=0x0600
138
 
//    Windows Server 2003   _WIN32_WINNT>=0x0502
139
 
//                          WINVER>=0x0502
140
 
//    Windows XP                _WIN32_WINNT>=0x0501
141
 
//                          WINVER>=0x0501
142
 
//    Windows 2000              _WIN32_WINNT>=0x0500
143
 
//                          WINVER>=0x0500
144
 
//    Windows NT 4.0        _WIN32_WINNT>=0x0400
145
 
//                          WINVER>=0x0400
146
 
//    Windows Me                _WIN32_WINDOWS=0x0500
147
 
//                          WINVER>=0x0500
148
 
//    Windows 98                _WIN32_WINDOWS>=0x0410
149
 
//                          WINVER>=0x0410
150
 
//    Windows 95                _WIN32_WINDOWS>=0x0400
151
 
//                          WINVER>=0x0400
152
 
 
153
 
 
154
 
//    Minimum system required   Macros to define
155
 
//    Windows Vista     NTDDI_VERSION >=NTDDI_LONGHORN
156
 
//    Windows Server 2003 SP1   NTDDI_VERSION >=NTDDI_WS03SP1
157
 
//    Windows Server 2003       NTDDI_VERSION >=NTDDI_WS03
158
 
//    Windows XP SP2    NTDDI_VERSION >=NTDDI_WINXPSP2
159
 
//    Windows XP SP1    NTDDI_VERSION >=NTDDI_WINXPSP1
160
 
//    Windows XP        NTDDI_VERSION >=NTDDI_WINXP
161
 
//    Windows 2000 SP4  NTDDI_VERSION >=NTDDI_WIN2KSP4
162
 
//    Windows 2000 SP3  NTDDI_VERSION >=NTDDI_WIN2KSP3
163
 
//    Windows 2000 SP2  NTDDI_VERSION >=NTDDI_WIN2KSP2
164
 
//    Windows 2000 SP1  NTDDI_VERSION >=NTDDI_WIN2KSP1
165
 
//    Windows 2000      NTDDI_VERSION >=NTDDI_WIN2K
166
 
 
167
 
    #define WIN32_LEAN_AND_MEAN 1
168
 
#endif  // _WIN32
169
 
 
170
 
 
171
 
 
172
 
 
173
 
// Logging
174
 
#if defined(INL_OS_WINDOWS) && defined(_DEBUG)
175
 
    #define INL_ENABLE_ASSERT_MACROS
176
 
    #define INL_ENABLE_LOGGING
177
 
#elif defined(INL_OS_LINUX) && defined(_DEBUG)
178
 
    #define INL_ENABLE_ASSERT_MACROS
179
 
    #define INL_ENABLE_LOGGING
180
 
#endif
181
 
 
182
 
// NOP: no operation
183
 
// Specifies that a function should be ignored and the argument list 
184
 
// be parsed but no code be generated for the arguments. It is intended for use in global
185
 
// debug functions that take a variable number of arguments.
186
 
 
187
 
#if defined(INL_MICROSOFT_COMPILER)
188
 
    #define INL_COMPILER_SUPPORTS_NOOP
189
 
    #define INL_NOOP __noop
190
 
#elif defined(INL_GNUCPP_COMPILER)
191
 
    #define INL_COMPILER_SUPPORTS_NOOP
192
 
    #define INL_NOOP __asm__("nop")
193
 
#elif defined(INL_PS3)
194
 
    #define INL_COMPILER_SUPPORTS_NOOP
195
 
    #define INL_NOOP __asm__("nop")
196
 
#endif
197
 
 
198
 
// Pragma pack support
199
 
#if defined(INL_MICROSOFT_COMPILER) || defined(INL_GNUCPP_COMPILER) || defined(INL_PS3)
200
 
    #define INL_SUPPORTS_PRAGMA_PACK
201
 
#endif
202
 
 
203
 
 
204
 
// Define variadic macro support
205
 
#if defined(INL_MICROSOFT_COMPILER) && (defined(INL_VISUAL_STUDIO_2005) || defined(INL_VISUAL_STUDIO_2008))
206
 
    #define INL_VARIADIC_MACROS_SUPPORT
207
 
#elif defined(INL_GNUCPP_COMPILER)
208
 
    #define INL_VARIADIC_MACROS_SUPPORT
209
 
#elif defined(INL_PS3)
210
 
    #define INL_VARIADIC_MACROS_SUPPORT
211
 
#endif
212
 
 
213
 
 
214
 
/// DLL declaration macros
215
 
#if defined(INL_OS_WINDOWS)
216
 
    #ifdef INL_DLL
217
 
        #if (!defined(_WIN32)) && (!defined(_WIN64))
218
 
            #error("ERROR: Use INL_DLL is permitted only on win32 & win64 platforms")
219
 
        #endif
220
 
 
221
 
        #define INL_DECLSPEC_DLLIMPORT        __declspec(dllimport)
222
 
        #define INL_DECLSPEC_DLLEXPORT        __declspec(dllexport)
223
 
    #else
224
 
        #define INL_DECLSPEC_DLLIMPORT
225
 
        #define INL_DECLSPEC_DLLEXPORT
226
 
    #endif
227
 
 
228
 
    #ifdef INL_EXPORT_DLL
229
 
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLEXPORT
230
 
    #else
231
 
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLIMPORT
232
 
    #endif
233
 
#elif defined(INL_OS_LINUX)
234
 
    #if __GNUC__ >= 4
235
 
        #define INL_DECLSPEC_DLLIMPORT __attribute__ ((visibility("default")))
236
 
        #define INL_DECLSPEC_DLLEXPORT __attribute__ ((visibility("default")))
237
 
    #else
238
 
        #define INL_DECLSPEC_DLLIMPORT
239
 
        #define INL_DECLSPEC_DLLEXPORT
240
 
    #endif
241
 
 
242
 
    #ifdef INL_EXPORT_DLL
243
 
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLEXPORT
244
 
    #else
245
 
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLIMPORT
246
 
    #endif
247
 
#endif
248
 
 
249
 
#define INL_CHECK_PUREVIRTUALS 1
250
 
 
251
 
// Throwing exceptions:
252
 
 
253
 
// #ifdef _DEBUG
254
 
//     // if we are in Debug disable exceptions. What we want is to break were and error happens: ie INL_BREAK_ASM_INT3
255
 
//     #define INL_EXCEPTIONS_DISABLED 1
256
 
// #endif
257
 
 
258
 
#define INL_EXCEPTIONS_DISABLED 1
259
 
 
260
 
#define STL std
261
 
 
262
 
#endif // NSYSTEM_H
263
 
 
 
23
#ifndef NSYSTEM_H
 
24
#define NSYSTEM_H
 
25
 
 
26
#ifdef _WIN32
 
27
    #define INL_OS_WINDOWS
 
28
#elif __linux
 
29
    #define INL_OS_LINUX
 
30
#elif INL_PS3
 
31
    #define INL_OS_CELL
 
32
#elif __APPLE__ 
 
33
    #define INL_OS_MACOSX
 
34
#endif
 
35
 
 
36
#if __GNUC__
 
37
    #define INL_GNUC_COMPILER
 
38
    #if __GNUG__
 
39
        #define INL_GNUCPP_COMPILER
 
40
    #else  
 
41
        #error Support only g++.
 
42
    #endif
 
43
 
 
44
    // Compiler string.
 
45
    #define INL_COMPILER_STRING "GNU CPP Compiler"
 
46
 
 
47
    // Build string
 
48
    #ifdef _DEBUG
 
49
        #define INL_BUILD_STRING "Debug build compiled with " INL_COMPILER_STRING
 
50
    #else
 
51
        #define INL_BUILD_STRING "Compiled with " INL_COMPILER_STRING
 
52
    #endif
 
53
#endif
 
54
 
 
55
#if __APPLE_CC__
 
56
    #define INL_APPLE_COMPILER
 
57
#endif
 
58
 
 
59
#if defined(_M_X64) || defined(__amd64__) || defined(__ia64__)
 
60
    #define INL_ARCH_x64
 
61
#elif defined(_M_IX86) || defined(__i386__)
 
62
    #define INL_ARCH_i386
 
63
#elif defined(__arm__)
 
64
    #define INL_ARCH_arm
 
65
#elif defined(__cell)
 
66
    #define INL_ARCH_cell
 
67
#endif
 
68
 
 
69
#if _MSC_VER
 
70
    #define INL_MICROSOFT_COMPILER
 
71
#endif
 
72
 
 
73
// Compiler Macros:
 
74
// INL_GNUCPP_COMPILER
 
75
// INL_MICROSOFT_COMPILER
 
76
 
 
77
// OS Macros:
 
78
// INL_OS_WINDOWS
 
79
// INL_OS_LINUX
 
80
// INL_OS_CELL
 
81
// INL_OS_MACOSX
 
82
 
 
83
#ifdef _WIN32
 
84
 
 
85
//    Add lib  DbgHelp.lib for the following function
 
86
//    StackWalk64
 
87
//    SymFunctionTableAccess64
 
88
//    SymGetModuleBase64
 
89
//    SymGetModuleInfo64
 
90
//    SymGetLineFromAddr64
 
91
//    SymGetSymFromAddr64
 
92
//    SymInitialize
 
93
//    SymSetOptions
 
94
//    SymGetOptions
 
95
//    SymLoadModule64
 
96
    #pragma comment(lib, "DbgHelp")
 
97
 
 
98
    // _MSC_VER: Defines the major and minor versions of the compiler. For example, 1300 for Microsoft Visual C++ .NET. 1300 represents version 13
 
99
    // and no point release. This represents the fact that there have been a total of 13 releases of the compiler. 
 
100
    // If you type cl /? at the command line, you will see the full version for the compiler you are using.
 
101
    
 
102
    #ifndef _MSC_VER
 
103
        #error Support only Visual Studio Compiler.
 
104
    #endif
 
105
 
 
106
    #define VISUAL_STUDIO_2008_COMPILER     1500
 
107
    #define VISUAL_STUDIO_2005_COMPILER     1400
 
108
    #define VISUAL_STUDIO_2003_COMPILER     1310
 
109
 
 
110
    #if _MSC_VER >= 1500
 
111
        #define INL_VISUAL_STUDIO_2008
 
112
    #elif _MSC_VER >= 1400
 
113
        #define INL_VISUAL_STUDIO_2005
 
114
    #elif _MSC_VER >= 1310
 
115
        #define INL_VISUAL_STUDIO_2003
 
116
    #endif
 
117
 
 
118
    // Compiler string.
 
119
    #if (_MSC_VER >= VISUAL_STUDIO_2008_COMPILER)
 
120
        #define INL_COMPILER_STRING "Visual Studio 2008"
 
121
    #elif (_MSC_VER >= VISUAL_STUDIO_2005_COMPILER)
 
122
        #define INL_COMPILER_STRING "Visual Studio 2005"
 
123
    #elif (_MSC_VER >= VISUAL_STUDIO_2003_COMPILER)
 
124
        #define INL_COMPILER_STRING "Visual Studio 2003"
 
125
    #endif
 
126
 
 
127
    // Build String
 
128
    #ifdef _DEBUG
 
129
        #define INL_BUILD_STRING "Debug build compiled with " INL_COMPILER_STRING
 
130
    #else
 
131
        #define INL_BUILD_STRING "Compiled with " INL_COMPILER_STRING
 
132
    #endif
 
133
 
 
134
 
 
135
// Define the proper values for _WIN32_WINNT and WINVER in the compiler response file "compiler_options.h"
 
136
//    Windows Vista         _WIN32_WINNT>=0x0600
 
137
//                          WINVER>=0x0600
 
138
//    Windows Server 2003   _WIN32_WINNT>=0x0502
 
139
//                          WINVER>=0x0502
 
140
//    Windows XP                _WIN32_WINNT>=0x0501
 
141
//                          WINVER>=0x0501
 
142
//    Windows 2000              _WIN32_WINNT>=0x0500
 
143
//                          WINVER>=0x0500
 
144
//    Windows NT 4.0        _WIN32_WINNT>=0x0400
 
145
//                          WINVER>=0x0400
 
146
//    Windows Me                _WIN32_WINDOWS=0x0500
 
147
//                          WINVER>=0x0500
 
148
//    Windows 98                _WIN32_WINDOWS>=0x0410
 
149
//                          WINVER>=0x0410
 
150
//    Windows 95                _WIN32_WINDOWS>=0x0400
 
151
//                          WINVER>=0x0400
 
152
 
 
153
 
 
154
//    Minimum system required   Macros to define
 
155
//    Windows Vista     NTDDI_VERSION >=NTDDI_LONGHORN
 
156
//    Windows Server 2003 SP1   NTDDI_VERSION >=NTDDI_WS03SP1
 
157
//    Windows Server 2003       NTDDI_VERSION >=NTDDI_WS03
 
158
//    Windows XP SP2    NTDDI_VERSION >=NTDDI_WINXPSP2
 
159
//    Windows XP SP1    NTDDI_VERSION >=NTDDI_WINXPSP1
 
160
//    Windows XP        NTDDI_VERSION >=NTDDI_WINXP
 
161
//    Windows 2000 SP4  NTDDI_VERSION >=NTDDI_WIN2KSP4
 
162
//    Windows 2000 SP3  NTDDI_VERSION >=NTDDI_WIN2KSP3
 
163
//    Windows 2000 SP2  NTDDI_VERSION >=NTDDI_WIN2KSP2
 
164
//    Windows 2000 SP1  NTDDI_VERSION >=NTDDI_WIN2KSP1
 
165
//    Windows 2000      NTDDI_VERSION >=NTDDI_WIN2K
 
166
 
 
167
    #define WIN32_LEAN_AND_MEAN 1
 
168
#endif  // _WIN32
 
169
 
 
170
 
 
171
 
 
172
 
 
173
// Logging
 
174
#if defined(INL_OS_WINDOWS) && defined(_DEBUG)
 
175
    #define INL_ENABLE_ASSERT_MACROS
 
176
    #define INL_ENABLE_LOGGING
 
177
#elif defined(INL_OS_LINUX) && defined(_DEBUG)
 
178
    #define INL_ENABLE_ASSERT_MACROS
 
179
    #define INL_ENABLE_LOGGING
 
180
#endif
 
181
 
 
182
// NOP: no operation
 
183
// Specifies that a function should be ignored and the argument list 
 
184
// be parsed but no code be generated for the arguments. It is intended for use in global
 
185
// debug functions that take a variable number of arguments.
 
186
 
 
187
#if defined(INL_MICROSOFT_COMPILER)
 
188
    #define INL_COMPILER_SUPPORTS_NOOP
 
189
    #define INL_NOOP __noop
 
190
#elif defined(INL_GNUCPP_COMPILER)
 
191
    #define INL_COMPILER_SUPPORTS_NOOP
 
192
    #define INL_NOOP __asm__("nop")
 
193
#elif defined(INL_PS3)
 
194
    #define INL_COMPILER_SUPPORTS_NOOP
 
195
    #define INL_NOOP __asm__("nop")
 
196
#endif
 
197
 
 
198
// Pragma pack support
 
199
#if defined(INL_MICROSOFT_COMPILER) || defined(INL_GNUCPP_COMPILER) || defined(INL_PS3)
 
200
    #define INL_SUPPORTS_PRAGMA_PACK
 
201
#endif
 
202
 
 
203
 
 
204
// Define variadic macro support
 
205
#if defined(INL_MICROSOFT_COMPILER) && (defined(INL_VISUAL_STUDIO_2005) || defined(INL_VISUAL_STUDIO_2008))
 
206
    #define INL_VARIADIC_MACROS_SUPPORT
 
207
#elif defined(INL_GNUCPP_COMPILER)
 
208
    #define INL_VARIADIC_MACROS_SUPPORT
 
209
#elif defined(INL_PS3)
 
210
    #define INL_VARIADIC_MACROS_SUPPORT
 
211
#endif
 
212
 
 
213
 
 
214
/// DLL declaration macros
 
215
#if defined(INL_OS_WINDOWS)
 
216
    #ifdef INL_DLL
 
217
        #if (!defined(_WIN32)) && (!defined(_WIN64))
 
218
            #error("ERROR: Use INL_DLL is permitted only on win32 & win64 platforms")
 
219
        #endif
 
220
 
 
221
        #define INL_DECLSPEC_DLLIMPORT        __declspec(dllimport)
 
222
        #define INL_DECLSPEC_DLLEXPORT        __declspec(dllexport)
 
223
    #else
 
224
        #define INL_DECLSPEC_DLLIMPORT
 
225
        #define INL_DECLSPEC_DLLEXPORT
 
226
    #endif
 
227
 
 
228
    #ifdef INL_EXPORT_DLL
 
229
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLEXPORT
 
230
    #else
 
231
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLIMPORT
 
232
    #endif
 
233
#elif defined(INL_OS_LINUX)
 
234
    #if __GNUC__ >= 4
 
235
        #define INL_DECLSPEC_DLLIMPORT __attribute__ ((visibility("default")))
 
236
        #define INL_DECLSPEC_DLLEXPORT __attribute__ ((visibility("default")))
 
237
    #else
 
238
        #define INL_DECLSPEC_DLLIMPORT
 
239
        #define INL_DECLSPEC_DLLEXPORT
 
240
    #endif
 
241
 
 
242
    #ifdef INL_EXPORT_DLL
 
243
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLEXPORT
 
244
    #else
 
245
        #define INL_DECLSPEC_DLL               INL_DECLSPEC_DLLIMPORT
 
246
    #endif
 
247
#endif
 
248
 
 
249
#define INL_CHECK_PUREVIRTUALS 1
 
250
 
 
251
// Throwing exceptions:
 
252
 
 
253
// #ifdef _DEBUG
 
254
//     // if we are in Debug disable exceptions. What we want is to break were and error happens: ie INL_BREAK_ASM_INT3
 
255
//     #define INL_EXCEPTIONS_DISABLED 1
 
256
// #endif
 
257
 
 
258
#define INL_EXCEPTIONS_DISABLED 1
 
259
 
 
260
#define STL std
 
261
 
 
262
#endif // NSYSTEM_H
 
263