|
IrrlichtEngine
|
00001 // Copyright (C) 2002-2011 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 #ifdef _MSC_VER 00016 typedef unsigned __int8 u8; 00017 #else 00018 typedef unsigned char u8; 00019 #endif 00020 00022 00023 #ifdef _MSC_VER 00024 typedef __int8 s8; 00025 #else 00026 typedef signed char s8; 00027 #endif 00028 00030 00031 typedef char c8; 00032 00033 00034 00036 00037 #ifdef _MSC_VER 00038 typedef unsigned __int16 u16; 00039 #else 00040 typedef unsigned short u16; 00041 #endif 00042 00044 00045 #ifdef _MSC_VER 00046 typedef __int16 s16; 00047 #else 00048 typedef signed short s16; 00049 #endif 00050 00051 00052 00054 00055 #ifdef _MSC_VER 00056 typedef unsigned __int32 u32; 00057 #else 00058 typedef unsigned int u32; 00059 #endif 00060 00062 00063 #ifdef _MSC_VER 00064 typedef __int32 s32; 00065 #else 00066 typedef signed int s32; 00067 #endif 00068 00069 00070 00071 // 64 bit signed variable. 00072 // This is a typedef for __int64, it ensures portability of the engine. 00073 // This type is currently not used by the engine and not supported by compilers 00074 // other than Microsoft Compilers, so it is outcommented. 00075 //typedef __int64 s64; 00076 00077 00078 00080 00081 typedef float f32; 00082 00084 00085 typedef double f64; 00086 00087 00088 } // end namespace irr 00089 00090 00091 #include <wchar.h> 00092 #ifdef _IRR_WINDOWS_API_ 00093 00094 00095 00096 00097 #if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE) 00098 #define swprintf swprintf_s 00099 #define snprintf sprintf_s 00100 #else 00101 #define swprintf _snwprintf 00102 #define snprintf _snprintf 00103 #endif 00104 00105 // define the wchar_t type if not already built in. 00106 #ifdef _MSC_VER 00107 #ifndef _WCHAR_T_DEFINED 00108 00109 00116 typedef unsigned short wchar_t; 00117 #define _WCHAR_T_DEFINED 00118 #endif // wchar is not defined 00119 #endif // microsoft compiler 00120 #endif // _IRR_WINDOWS_API_ 00121 00122 namespace irr 00123 { 00124 00126 00131 #if defined(_IRR_WCHAR_FILESYSTEM) 00132 typedef wchar_t fschar_t; 00133 #define _IRR_TEXT(X) L##X 00134 #else 00135 typedef char fschar_t; 00136 #define _IRR_TEXT(X) X 00137 #endif 00138 00139 } // end namespace irr 00140 00142 #if defined(_DEBUG) 00143 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE) 00144 #if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration 00145 #include <crtdbg.h> 00146 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();} 00147 #else 00148 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3} 00149 #endif 00150 #else 00151 #include "assert.h" 00152 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) ); 00153 #endif 00154 #else 00155 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) 00156 #endif 00157 00159 00165 #if defined(IGNORE_DEPRECATED_WARNING) 00166 #define _IRR_DEPRECATED_ 00167 #elif _MSC_VER >= 1310 //vs 2003 or higher 00168 #define _IRR_DEPRECATED_ __declspec(deprecated) 00169 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // all versions above 3.0 should support this feature 00170 #define _IRR_DEPRECATED_ __attribute__ ((deprecated)) 00171 #else 00172 #define _IRR_DEPRECATED_ 00173 #endif 00174 00176 00181 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400) 00182 #define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100 00183 #else 00184 #define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX 00185 #endif // _IRR_MANAGED_MARSHALLING_BUGFIX 00186 00187 00188 // memory debugging 00189 #if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \ 00190 (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE) 00191 00192 #define CRTDBG_MAP_ALLOC 00193 #define _CRTDBG_MAP_ALLOC 00194 #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__) 00195 #include <stdlib.h> 00196 #include <crtdbg.h> 00197 #define new DEBUG_CLIENTBLOCK 00198 #endif 00199 00200 // disable truncated debug information warning in visual studio 6 by default 00201 #if defined(_MSC_VER) && (_MSC_VER < 1300 ) 00202 #pragma warning( disable: 4786) 00203 #endif // _MSC 00204 00205 00207 00208 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400) 00209 //#pragma warning( disable: 4996) 00210 //#define _CRT_SECURE_NO_DEPRECATE 1 00211 //#define _CRT_NONSTDC_NO_DEPRECATE 1 00212 #endif 00213 00214 00216 00218 #define MAKE_IRR_ID(c0, c1, c2, c3) \ 00219 ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \ 00220 ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 )) 00221 00222 #if defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 00223 #define _strcmpi(a,b) strcmpi(a,b) 00224 #endif 00225 00226 #endif // __IRR_TYPES_H_INCLUDED__ 00227