Irrlicht 3D Engine
irrTypes.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __IRR_TYPES_H_INCLUDED__
00006 #define __IRR_TYPES_H_INCLUDED__
00007 
00008 #include "IrrCompileConfig.h"
00009 
00010 namespace irr
00011 {
00012 
00014 
00015 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00016 typedef unsigned __int8     u8;
00017 #else
00018 typedef unsigned char       u8;
00019 #endif
00020 
00022 
00023 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00024 typedef __int8          s8;
00025 #else
00026 typedef signed char     s8;
00027 #endif
00028 
00030 
00031 typedef char            c8;
00032 
00033 
00034 
00036 
00037 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00038 typedef unsigned __int16    u16;
00039 #else
00040 typedef unsigned short      u16;
00041 #endif
00042 
00044 
00045 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00046 typedef __int16         s16;
00047 #else
00048 typedef signed short        s16;
00049 #endif
00050 
00051 
00052 
00054 
00055 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00056 typedef unsigned __int32    u32;
00057 #else
00058 typedef unsigned int        u32;
00059 #endif
00060 
00062 
00063 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00064 typedef __int32         s32;
00065 #else
00066 typedef signed int      s32;
00067 #endif
00068 
00069 
00070 #ifdef __IRR_HAS_S64
00071 
00072 
00073 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00074 typedef unsigned __int64            u64;
00075 #elif __GNUC__
00076 #if __WORDSIZE == 64
00077 typedef unsigned long int           u64;
00078 #else
00079 __extension__ typedef unsigned long long    u64;
00080 #endif
00081 #else
00082 typedef unsigned long long          u64;
00083 #endif
00084 
00086 
00087 #if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
00088 typedef __int64                 s64;
00089 #elif __GNUC__
00090 #if __WORDSIZE == 64
00091 typedef long int                s64;
00092 #else
00093 __extension__ typedef long long         s64;
00094 #endif
00095 #else
00096 typedef long long               s64;
00097 #endif
00098 #endif  // __IRR_HAS_S64
00099 
00100 
00101 
00103 
00104 typedef float               f32;
00105 
00107 
00108 typedef double              f64;
00109 
00110 
00111 } // end namespace irr
00112 
00113 
00114 #include <wchar.h>
00115 #ifdef _IRR_WINDOWS_API_
00116 
00117 
00118 
00119 
00120 #if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
00121 #define swprintf swprintf_s
00122 #define snprintf sprintf_s
00123 #elif !defined(__CYGWIN__)
00124 #define swprintf _snwprintf
00125 #define snprintf _snprintf
00126 #endif
00127 
00128 // define the wchar_t type if not already built in.
00129 #ifdef _MSC_VER
00130 #ifndef _WCHAR_T_DEFINED
00131 
00132 
00139 typedef unsigned short wchar_t;
00140 #define _WCHAR_T_DEFINED
00141 #endif // wchar is not defined
00142 #endif // microsoft compiler
00143 #endif // _IRR_WINDOWS_API_
00144 
00145 namespace irr
00146 {
00147 
00149 
00154 #if defined(_IRR_WCHAR_FILESYSTEM)
00155     typedef wchar_t fschar_t;
00156     #define _IRR_TEXT(X) L##X
00157 #else
00158     typedef char fschar_t;
00159     #define _IRR_TEXT(X) X
00160 #endif
00161 
00162 } // end namespace irr
00163 
00165 #if defined(_DEBUG)
00166 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
00167   #if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
00168   #include <crtdbg.h>
00169   #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
00170   #else
00171   #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
00172   #endif
00173 #else
00174 #include "assert.h"
00175 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
00176 #endif
00177 #else
00178 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ )
00179 #endif
00180 
00182 
00188 #if defined(IGNORE_DEPRECATED_WARNING)
00189 #define _IRR_DEPRECATED_
00190 #elif _MSC_VER >= 1310 //vs 2003 or higher
00191 #define _IRR_DEPRECATED_ __declspec(deprecated)
00192 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // all versions above 3.0 should support this feature
00193 #define _IRR_DEPRECATED_  __attribute__ ((deprecated))
00194 #else
00195 #define _IRR_DEPRECATED_
00196 #endif
00197 
00199 
00204 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400)
00205 #define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100
00206 #else
00207 #define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
00208 #endif // _IRR_MANAGED_MARSHALLING_BUGFIX
00209 
00210 
00211 // memory debugging
00212 #if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \
00213     (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
00214 
00215     #define CRTDBG_MAP_ALLOC
00216     #define _CRTDBG_MAP_ALLOC
00217     #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
00218     #include <stdlib.h>
00219     #include <crtdbg.h>
00220     #define new DEBUG_CLIENTBLOCK
00221 #endif
00222 
00223 // disable truncated debug information warning in visual studio 6 by default
00224 #if defined(_MSC_VER) && (_MSC_VER < 1300 )
00225 #pragma warning( disable: 4786)
00226 #endif // _MSC
00227 
00228 
00230 
00231 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400)
00232     //#pragma warning( disable: 4996)
00233     //#define _CRT_SECURE_NO_DEPRECATE 1
00234     //#define _CRT_NONSTDC_NO_DEPRECATE 1
00235 #endif
00236 
00237 
00239 
00241 #define MAKE_IRR_ID(c0, c1, c2, c3) \
00242         ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
00243         ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
00244 
00245 #if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
00246 #define _strcmpi(a,b) strcmpi(a,b)
00247 #endif
00248 
00249 #endif // __IRR_TYPES_H_INCLUDED__
00250