Irrlicht 3D Engine
irrTypes.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __IRR_TYPES_H_INCLUDED__
6 #define __IRR_TYPES_H_INCLUDED__
7 
8 #include "IrrCompileConfig.h"
9 
10 namespace irr
11 {
12 
14 
15 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
16 typedef unsigned __int8 u8;
17 #else
18 typedef unsigned char u8;
19 #endif
20 
22 
23 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
24 typedef __int8 s8;
25 #else
26 typedef signed char s8;
27 #endif
28 
30 
31 typedef char c8;
32 
33 
34 
36 
37 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
38 typedef unsigned __int16 u16;
39 #else
40 typedef unsigned short u16;
41 #endif
42 
44 
45 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
46 typedef __int16 s16;
47 #else
48 typedef signed short s16;
49 #endif
50 
51 
52 
54 
55 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
56 typedef unsigned __int32 u32;
57 #else
58 typedef unsigned int u32;
59 #endif
60 
62 
63 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
64 typedef __int32 s32;
65 #else
66 typedef signed int s32;
67 #endif
68 
69 
70 #ifdef __IRR_HAS_S64
71 
73 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
74 typedef unsigned __int64 u64;
75 #elif __GNUC__
76 #if __WORDSIZE == 64
77 typedef unsigned long int u64;
78 #else
79 __extension__ typedef unsigned long long u64;
80 #endif
81 #else
82 typedef unsigned long long u64;
83 #endif
84 
86 
87 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
88 typedef __int64 s64;
89 #elif __GNUC__
90 #if __WORDSIZE == 64
91 typedef long int s64;
92 #else
93 __extension__ typedef long long s64;
94 #endif
95 #else
96 typedef long long s64;
97 #endif
98 #endif // __IRR_HAS_S64
99 
100 
101 
103 
104 typedef float f32;
105 
107 
108 typedef double f64;
109 
110 
111 } // end namespace irr
112 
113 
114 #include <wchar.h>
115 #ifdef _IRR_WINDOWS_API_
116 #if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
121 #define swprintf swprintf_s
122 #define snprintf sprintf_s
123 #elif !defined(__CYGWIN__)
124 #define swprintf _snwprintf
125 #define snprintf _snprintf
126 #endif
127 
128 // define the wchar_t type if not already built in.
129 #ifdef _MSC_VER
130 #ifndef _WCHAR_T_DEFINED
131 
139 typedef unsigned short wchar_t;
140 #define _WCHAR_T_DEFINED
141 #endif // wchar is not defined
142 #endif // microsoft compiler
143 #endif // _IRR_WINDOWS_API_
144 
145 namespace irr
146 {
147 
149 
154 #if defined(_IRR_WCHAR_FILESYSTEM)
155  typedef wchar_t fschar_t;
156  #define _IRR_TEXT(X) L##X
157 #else
158  typedef char fschar_t;
159  #define _IRR_TEXT(X) X
160 #endif
161 
162 } // end namespace irr
163 
165 #if defined(_DEBUG)
166 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
167  #if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
168  #include <crtdbg.h>
169  #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
170  #else
171  #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
172  #endif
173 #else
174 #include "assert.h"
175 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
176 #endif
177 #else
178 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ )
179 #endif
180 
182 
188 #if defined(IGNORE_DEPRECATED_WARNING)
189 #define _IRR_DEPRECATED_
190 #elif _MSC_VER >= 1310 //vs 2003 or higher
191 #define _IRR_DEPRECATED_ __declspec(deprecated)
192 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // all versions above 3.0 should support this feature
193 #define _IRR_DEPRECATED_ __attribute__ ((deprecated))
194 #else
195 #define _IRR_DEPRECATED_
196 #endif
197 
199 
204 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400)
205 #define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100
206 #else
207 #define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
208 #endif // _IRR_MANAGED_MARSHALLING_BUGFIX
209 
210 
211 // memory debugging
212 #if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \
213  (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
214 
215  #define CRTDBG_MAP_ALLOC
216  #define _CRTDBG_MAP_ALLOC
217  #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
218  #include <stdlib.h>
219  #include <crtdbg.h>
220  #define new DEBUG_CLIENTBLOCK
221 #endif
222 
223 // disable truncated debug information warning in visual studio 6 by default
224 #if defined(_MSC_VER) && (_MSC_VER < 1300 )
225 #pragma warning( disable: 4786)
226 #endif // _MSC
227 
228 
230 
231 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400)
232  //#pragma warning( disable: 4996)
233  //#define _CRT_SECURE_NO_DEPRECATE 1
234  //#define _CRT_NONSTDC_NO_DEPRECATE 1
235 #endif
236 
237 
239 
241 #define MAKE_IRR_ID(c0, c1, c2, c3) \
242  ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
243  ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
244 
245 #if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
246 #define _strcmpi(a,b) strcmpi(a,b)
247 #endif
248 
249 #endif // __IRR_TYPES_H_INCLUDED__
250 
signed short s16
16 bit signed variable.
Definition: irrTypes.h:48
unsigned long long u64
64 bit unsigned variable.
Definition: irrTypes.h:82
float f32
32 bit floating point variable.
Definition: irrTypes.h:104
char c8
8 bit character variable.
Definition: irrTypes.h:31
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:12
double f64
64 bit floating point variable.
Definition: irrTypes.h:108
long long s64
64 bit signed variable.
Definition: irrTypes.h:96
unsigned char u8
8 bit unsigned variable.
Definition: irrTypes.h:18
unsigned short u16
16 bit unsigned variable.
Definition: irrTypes.h:40
signed int s32
32 bit signed variable.
Definition: irrTypes.h:66
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:58
signed char s8
8 bit signed variable.
Definition: irrTypes.h:26
char fschar_t
Type name for character type used by the file system.
Definition: irrTypes.h:158