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