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 #if defined(__BORLANDC__)
00075 #include <sstream>
00076 #endif
00077
00078
00079 namespace ZenLib
00080 {
00081 const unsigned int Error=((unsigned int)(-1));
00082 const unsigned int All=((unsigned int)(-1));
00083 }
00084
00085
00086
00087
00088
00089
00090 #include <limits.h>
00091 #if defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
00092 #include <ZenLib/MemoryDebug.h>
00093 #endif // defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
00094
00095
00096 namespace ZenLib
00097 {
00098
00099
00100
00101
00102
00103
00104
00105 #if defined(_UNICODE) || defined(UNICODE) || defined(__UNICODE__)
00106 #ifndef _UNICODE
00107 #define _UNICODE
00108 #endif
00109 #ifndef UNICODE
00110 #define UNICODE
00111 #endif
00112 #ifndef __UNICODE__
00113 #define __UNICODE__ 1
00114 #endif
00115 #endif
00116
00117
00118
00119 #undef _T
00120 #define _T(__x) __T(__x)
00121 #undef _TEXT
00122 #define _TEXT(__x) __T(__x)
00123 #undef __TEXT
00124 #define __TEXT(__x) __T(__x)
00125 #if defined(__UNICODE__)
00126 #if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
00127 #pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
00128 #endif
00129 typedef wchar_t Char;
00130 #undef __T
00131 #define __T(__x) L##__x
00132 #else // defined(__UNICODE__)
00133 typedef char Char;
00134 #undef __T
00135 #define __T(__x) __x
00136 #endif // defined(__UNICODE__)
00137 #ifdef wchar_t
00138 typedef wchar_t wchar;
00139 #endif // wchar_t
00140
00141
00142
00143
00144
00145
00146
00147 #if defined(__NT__) || defined(_WIN32) || defined(WIN32)
00148 #ifndef WIN32
00149 #define WIN32
00150 #endif
00151 #ifndef _WIN32
00152 #define _WIN32
00153 #endif
00154 #ifndef __WIN32__
00155 #define __WIN32__ 1
00156 #endif
00157 #endif
00158
00159
00160
00161 #if defined(_WIN64) || defined(WIN64)
00162 #ifndef WIN64
00163 #define WIN64
00164 #endif
00165 #ifndef _WIN64
00166 #define _WIN64
00167 #endif
00168 #ifndef __WIN64__
00169 #define __WIN64__ 1
00170 #endif
00171 #endif
00172
00173
00174
00175 #if defined(WIN32) || defined(WIN64)
00176 #ifndef WINDOWS
00177 #define WINDOWS
00178 #endif
00179 #ifndef _WINDOWS
00180 #define _WINDOWS
00181 #endif
00182 #ifndef __WINDOWS__
00183 #define __WINDOWS__ 1
00184 #endif
00185 #endif
00186
00187
00188
00189 #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \
00190 || defined(__unix) || defined(__unix__) \
00191 || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \
00192 || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \
00193 || defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
00194 #ifndef UNIX
00195 #define UNIX
00196 #endif
00197 #ifndef _UNIX
00198 #define _UNIX
00199 #endif
00200 #ifndef __UNIX__
00201 #define __UNIX__ 1
00202 #endif
00203 #endif
00204
00205
00206 #if defined(WIN32) && defined(UNIX)
00207 #pragma message Two platforms??? (WIN32 and UNIX is defined)
00208 #endif
00209
00210 #if !defined(WIN32) && !defined(UNIX)
00211 #pragma message No known platforms, assume default
00212 #endif
00213
00214
00215
00216
00217
00218
00219
00220 typedef signed int ints;
00221 typedef unsigned int intu;
00222
00223
00224
00225 #if UCHAR_MAX==0xff
00226 #undef MAXTYPE_INT
00227 #define MAXTYPE_INT 8
00228 typedef signed char int8s;
00229 typedef unsigned char int8u;
00230 #else
00231 #pragma message This machine has no 8-bit integertype?
00232 #endif
00233
00234
00235
00236 #if UINT_MAX == 0xffff
00237 #undef MAXTYPE_INT
00238 #define MAXTYPE_INT 16
00239 typedef signed int int16s;
00240 typedef unsigned int int16u;
00241 #elif USHRT_MAX == 0xffff
00242 #undef MAXTYPE_INT
00243 #define MAXTYPE_INT 16
00244 typedef signed short int16s;
00245 typedef unsigned short int16u;
00246 #else
00247 #pragma message This machine has no 16-bit integertype?
00248 #endif
00249
00250
00251
00252 #if UINT_MAX == 0xfffffffful
00253 #undef MAXTYPE_INT
00254 #define MAXTYPE_INT 32
00255 typedef signed int int32s;
00256 typedef unsigned int int32u;
00257 #elif ULONG_MAX == 0xfffffffful
00258 #undef MAXTYPE_INT
00259 #define MAXTYPE_INT 32
00260 typedef signed long int32s;
00261 typedef unsigned long int32u;
00262 #elif USHRT_MAX == 0xfffffffful
00263 #undef MAXTYPE_INT
00264 #define MAXTYPE_INT 32
00265 typedef signed short int32s;
00266 typedef unsigned short int32u;
00267 #else
00268 #pragma message This machine has no 32-bit integer type?
00269 #endif
00270
00271
00272
00273 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__)
00274 #undef MAXTYPE_INT
00275 #define MAXTYPE_INT 64
00276 typedef signed long long int64s;
00277 typedef unsigned long long int64u;
00278 #elif defined(__WIN32__)
00279 #undef MAXTYPE_INT
00280 #define MAXTYPE_INT 64
00281 typedef signed __int64 int64s;
00282 typedef unsigned __int64 int64u;
00283 #else
00284 #pragma message This machine has no 64-bit integer type?
00285 #endif
00286
00287
00288
00289 #if defined(__WIN32__) || defined(__BORLANDC__) || defined(__UNIX__)
00290 #undef MAXTYPE_FLOAT
00291 #define MAXTYPE_FLOAT 32
00292 typedef float float32;
00293 #else
00294 #pragma message This machine has no 32-bit float type?
00295 #endif
00296
00297
00298
00299 #if defined(__WIN32__) || defined(__BORLANDC__) || defined(__UNIX__)
00300 #undef MAXTYPE_FLOAT
00301 #define MAXTYPE_FLOAT 64
00302 typedef double float64;
00303 #else
00304 #pragma message This machine has no 64-bit float type?
00305 #endif
00306
00307
00308
00309 #if defined(__WIN32__) || defined(__BORLANDC__) || defined(__UNIX__)
00310 #undef MAXTYPE_FLOAT
00311 #define MAXTYPE_FLOAT 80
00312 typedef long double float128;
00313 #else
00314 #pragma message This machine has no 128-bit float type?
00315 #endif
00316
00317
00318
00319
00320
00321
00322 #if defined (UNIX)
00323 #define snwprintf swprintf
00324 #endif
00325
00326
00327 #if defined (_MSC_VER)
00328 #define snprintf _snprintf
00329 #define snwprintf _snwprintf
00330 #endif
00331
00332 }
00333 #endif
00334