00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef ZenTypesH
00055 #define ZenTypesH
00056
00057
00058
00059
00060
00061
00062
00063 #if defined(_MSC_VER) && _MSC_VER <= 1200
00064 #define for if(true)for
00065 #pragma warning(disable:4786) // MSVC6 doesn't like typenames longer than 255 chars (which generates an enormous amount of warnings).
00066 #endif
00067
00068
00069 #if defined(_MSC_VER) && _MSC_VER <= 1400
00070 #pragma warning(disable : 4996)
00071 #endif
00072
00073
00074 namespace ZenLib
00075 {
00076 const unsigned int Error=((unsigned int)(-1));
00077 }
00078
00079
00080
00081
00082
00083 #include <limits.h>
00084 #if defined(DEBUG) || defined(_DEBUG)
00085 #include <ZenLib/MemoryDebug.h>
00086 #endif // defined(DEBUG) || defined(_DEBUG)
00087
00088
00089 namespace ZenLib
00090 {
00091
00092
00093
00094
00095
00096
00097
00098 #if defined(_UNICODE) || defined(UNICODE) || defined(__UNICODE__)
00099 #ifndef _UNICODE
00100 #define _UNICODE
00101 #endif
00102 #ifndef UNICODE
00103 #define UNICODE
00104 #endif
00105 #ifndef __UNICODE__
00106 #define __UNICODE__
00107 #endif
00108 #endif
00109
00110
00111
00112 #undef _T
00113 #define _T(__x) __T(__x)
00114 #undef _TEXT
00115 #define _TEXT(__x) __T(__x)
00116 #undef __TEXT
00117 #define __TEXT(__x) __T(__x)
00118 #if defined(__UNICODE__)
00119 #if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
00120 #pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
00121 #endif
00122 typedef wchar_t Char;
00123 #undef __T
00124 #define __T(__x) L##__x
00125 #else
00126 typedef char Char;
00127 #undef __T
00128 #define __T(__x) __x
00129 #endif
00130 #ifdef wchar_t
00131 typedef wchar_t wchar;
00132 #endif
00133
00134
00135
00136
00137
00138
00139
00140 #if defined(__NT__) || defined(_WIN32) || defined(WIN32)
00141 #ifndef WIN32
00142 #define WIN32
00143 #endif
00144 #ifndef _WIN32
00145 #define _WIN32
00146 #endif
00147 #ifndef __WIN32__
00148 #define __WIN32__ 1
00149 #endif
00150 #endif
00151
00152
00153
00154 #if defined(_WIN64) || defined(WIN64)
00155 #ifndef WIN64
00156 #define WIN64
00157 #endif
00158 #ifndef _WIN64
00159 #define _WIN64
00160 #endif
00161 #ifndef __WIN64__
00162 #define __WIN64__ 1
00163 #endif
00164 #endif
00165
00166
00167
00168 #if defined(WIN32) || defined(WIN64)
00169 #ifndef WINDOWS
00170 #define WINDOWS
00171 #endif
00172 #ifndef _WINDOWS
00173 #define _WINDOWS
00174 #endif
00175 #ifndef __WINDOWS__
00176 #define __WINDOWS__ 1
00177 #endif
00178 #endif
00179
00180
00181
00182 #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \
00183 || defined(__unix) || defined(__unix__) \
00184 || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \
00185 || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \
00186 || defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
00187 #ifndef UNIX
00188 #define UNIX
00189 #endif
00190 #ifndef _UNIX
00191 #define _UNIX
00192 #endif
00193 #ifndef __UNIX__
00194 #define __UNIX__ 1
00195 #endif
00196 #endif
00197
00198
00199 #if defined(WIN32) && defined(UNIX)
00200 #pragma message Two platforms??? (WIN32 and UNIX is defined)
00201 #endif
00202
00203 #if !defined(WIN32) && !defined(UNIX)
00204 #pragma message No known platforms, assume default
00205 #endif
00206
00207
00208
00209
00210
00211
00212
00213 typedef signed int ints;
00214 typedef unsigned int intu;
00215
00216
00217
00218 #if UCHAR_MAX==0xff
00219 #undef MAXTYPE_INT
00220 #define MAXTYPE_INT 8
00221 typedef signed char int8s;
00222 typedef unsigned char int8u;
00223 #else
00224 #pragma message This machine has no 8-bit integertype?
00225 #endif
00226
00227
00228
00229 #if UINT_MAX == 0xffff
00230 #undef MAXTYPE_INT
00231 #define MAXTYPE_INT 16
00232 typedef signed int int16s;
00233 typedef unsigned int int16u;
00234 #elif USHRT_MAX == 0xffff
00235 #undef MAXTYPE_INT
00236 #define MAXTYPE_INT 16
00237 typedef signed short int16s;
00238 typedef unsigned short int16u;
00239 #else
00240 #pragma message This machine has no 16-bit integertype?
00241 #endif
00242
00243
00244
00245 #if UINT_MAX == 0xfffffffful
00246 #undef MAXTYPE_INT
00247 #define MAXTYPE_INT 32
00248 typedef signed int int32s;
00249 typedef unsigned int int32u;
00250 #elif ULONG_MAX == 0xfffffffful
00251 #undef MAXTYPE_INT
00252 #define MAXTYPE_INT 32
00253 typedef signed long int32s;
00254 typedef unsigned long int32u;
00255 #elif USHRT_MAX == 0xfffffffful
00256 #undef MAXTYPE_INT
00257 #define MAXTYPE_INT 32
00258 typedef signed short int32s;
00259 typedef unsigned short int32u;
00260 #else
00261 #pragma message This machine has no 32-bit integer type?
00262 #endif
00263
00264
00265
00266 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__)
00267 #undef MAXTYPE_INT
00268 #define MAXTYPE_INT 64
00269 typedef signed long long int64s;
00270 typedef unsigned long long int64u;
00271 #elif defined(__WIN32__)
00272 #undef MAXTYPE_INT
00273 #define MAXTYPE_INT 64
00274 typedef signed __int64 int64s;
00275 typedef unsigned __int64 int64u;
00276 #else
00277 #pragma message This machine has no 64-bit integer type?
00278 #endif
00279
00280
00281
00282 #if defined(__WIN32__) || defined(__BORLANDC__) || defined(__UNIX__)
00283 #undef MAXTYPE_FLOAT
00284 #define MAXTYPE_FLOAT 32
00285 typedef float float32;
00286 #else
00287 #pragma message This machine has no 32-bit float type?
00288 #endif
00289
00290
00291
00292 #if defined(__WIN32__) || defined(__BORLANDC__) || defined(__UNIX__)
00293 #undef MAXTYPE_FLOAT
00294 #define MAXTYPE_FLOAT 64
00295 typedef double float64;
00296 #else
00297 #pragma message This machine has no 64-bit float type?
00298 #endif
00299
00300
00301
00302 #if defined(__WIN32__) || defined(__BORLANDC__) || defined(__UNIX__)
00303 #undef MAXTYPE_FLOAT
00304 #define MAXTYPE_FLOAT 80
00305 typedef long double float128;
00306 #else
00307 #pragma message This machine has no 128-bit float type?
00308 #endif
00309
00310
00311
00312
00313
00314
00315 #if defined (UNIX)
00316 #define snwprintf swprintf
00317 #endif
00318
00319
00320 #if defined (_MSC_VER)
00321 #define snprintf _snprintf
00322 #define snwprintf _snwprintf
00323 #endif
00324
00325 }
00326 #endif
00327