arsa  2.7
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 #if defined(__GNUC__)
11  #include <limits.h> // for __WORDSIZE
12 #endif
13 
14 namespace irr
15 {
16 
18 
19 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
20 typedef unsigned __int8 u8;
21 #else
22 typedef unsigned char u8;
23 #endif
24 
26 
27 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
28 typedef __int8 s8;
29 #else
30 typedef signed char s8;
31 #endif
32 
34 
35 typedef char c8;
36 
37 
38 
40 
41 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
42 typedef unsigned __int16 u16;
43 #else
44 typedef unsigned short u16;
45 #endif
46 
48 
49 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
50 typedef __int16 s16;
51 #else
52 typedef signed short s16;
53 #endif
54 
55 
56 
58 
59 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
60 typedef unsigned __int32 u32;
61 #else
62 typedef unsigned int u32;
63 #endif
64 
66 
67 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
68 typedef __int32 s32;
69 #else
70 typedef signed int s32;
71 #endif
72 
73 
74 #ifdef __IRR_HAS_S64
75 
77 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
78 typedef unsigned __int64 u64;
79 #elif defined(__GNUC__)
80 #if defined(__WORDSIZE) && __WORDSIZE == 64
81 typedef unsigned long int u64;
82 #else
83 __extension__ typedef unsigned long long u64;
84 #endif
85 #else
86 typedef unsigned long long u64;
87 #endif
88 
90 
91 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
92 typedef __int64 s64;
93 #elif defined(__GNUC__)
94 #if defined(__WORDSIZE) && __WORDSIZE == 64
95 typedef long int s64;
96 #else
97 __extension__ typedef long long s64;
98 #endif
99 #else
100 typedef long long s64;
101 #endif
102 #endif // __IRR_HAS_S64
103 
104 
105 
107 
108 typedef float f32;
109 
111 
112 typedef double f64;
113 
114 
115 } // end namespace irr
116 
117 
118 #include <wchar.h>
119 #ifdef _IRR_WINDOWS_API_
120 #if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
125 #define swprintf_irr swprintf_s
126 #define snprintf_irr sprintf_s
127 #elif !defined(__CYGWIN__)
128 #define swprintf_irr _snwprintf
129 #define snprintf_irr _snprintf
130 #endif
131 
132 // define the wchar_t type if not already built in.
133 #ifdef _MSC_VER
134 #ifndef _WCHAR_T_DEFINED
135 
143 typedef unsigned short wchar_t;
144 #define _WCHAR_T_DEFINED
145 #endif // wchar is not defined
146 #endif // microsoft compiler
147 #else
148 #define swprintf_irr swprintf
149 #define snprintf_irr snprintf
150 #endif // _IRR_WINDOWS_API_
151 
152 namespace irr
153 {
154 
156 
161 #if defined(_IRR_WCHAR_FILESYSTEM)
162  typedef wchar_t fschar_t;
163  #define _IRR_TEXT(X) L##X
164 #else
165  typedef char fschar_t;
166  #define _IRR_TEXT(X) X
167 #endif
168 
169 } // end namespace irr
170 
172 #if defined(_DEBUG)
173 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
174 #if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
175  #include <crtdbg.h>
176  #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
177 #else
178  #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
179 #endif
180 #else
181  #include "assert.h"
182  #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
183 #endif
184 #else
185  #define _IRR_DEBUG_BREAK_IF( _CONDITION_ )
186 #endif
187 
189 
195 #if defined(IGNORE_DEPRECATED_WARNING)
196 #define _IRR_DEPRECATED_
197 #elif _MSC_VER >= 1310 //vs 2003 or higher
198 #define _IRR_DEPRECATED_ __declspec(deprecated)
199 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // all versions above 3.0 should support this feature
200 #define _IRR_DEPRECATED_ __attribute__ ((deprecated))
201 #else
202 #define _IRR_DEPRECATED_
203 #endif
204 
206 
209 #if ( ((__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7))) && (defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L) )
210 #define _IRR_OVERRIDE_ override
211 #elif (_MSC_VER >= 1600 ) /* supported since MSVC 2010 */
212 #define _IRR_OVERRIDE_ override
213 #elif (__clang_major__ >= 3 && __has_feature(cxx_override_control))
214 #define _IRR_OVERRIDE_ override
215 #else
216 #define _IRR_OVERRIDE_
217 #endif
218 
219 // memory debugging
220 #if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \
221  (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
222 
223  #define CRTDBG_MAP_ALLOC
224  #define _CRTDBG_MAP_ALLOC
225  #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
226  #include <stdlib.h>
227  #include <crtdbg.h>
228  #define new DEBUG_CLIENTBLOCK
229 #endif
230 
232 
233 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400)
234  //#pragma warning( disable: 4996)
235  //#define _CRT_SECURE_NO_DEPRECATE 1
236  //#define _CRT_NONSTDC_NO_DEPRECATE 1
237 #endif
238 
239 
241 
243 #define MAKE_IRR_ID(c0, c1, c2, c3) \
244  ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
245  ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
246 
247 #endif // __IRR_TYPES_H_INCLUDED__
signed short s16
16 bit signed variable.
Definition: irrTypes.h:52
unsigned long long u64
64 bit unsigned variable.
Definition: irrTypes.h:86
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
char c8
8 bit character variable.
Definition: irrTypes.h:35
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
double f64
64 bit floating point variable.
Definition: irrTypes.h:112
long long s64
64 bit signed variable.
Definition: irrTypes.h:100
unsigned char u8
8 bit unsigned variable.
Definition: irrTypes.h:22
unsigned short u16
16 bit unsigned variable.
Definition: irrTypes.h:44
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
signed char s8
8 bit signed variable.
Definition: irrTypes.h:30
char fschar_t
Type name for character type used by the file system.
Definition: irrTypes.h:165