Conf.h

Go to the documentation of this file.
00001 /*  Copyright (c) MediaArea.net SARL. All Rights Reserved.
00002  *
00003  *  Use of this source code is governed by a zlib-style license that can
00004  *  be found in the License.txt file in the root of the source tree.
00005  */
00006 
00007 //---------------------------------------------------------------------------
00008 #ifndef ZenConfH
00009 #define ZenConfH
00010 //---------------------------------------------------------------------------
00011 
00012 //***************************************************************************
00013 // Platforms
00014 //***************************************************************************
00015 
00016 //---------------------------------------------------------------------------
00017 //Win32
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 //Win64
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 //Windows
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 
00058 //---------------------------------------------------------------------------
00059 //Unix (Linux, HP, Sun, BeOS...)
00060 #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \
00061     || defined(__unix) || defined(__unix__) \
00062     || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \
00063     || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \
00064     || defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
00065     #ifndef UNIX
00066         #define UNIX
00067     #endif
00068     #ifndef _UNIX
00069         #define _UNIX
00070     #endif
00071     #ifndef __UNIX__
00072         #define __UNIX__ 1
00073     #endif
00074 #endif
00075 
00076 //---------------------------------------------------------------------------
00077 //MacOS Classic
00078 #if defined(macintosh)
00079     #ifndef MACOS
00080         #define MACOS
00081     #endif
00082     #ifndef _MACOS
00083         #define _MACOS
00084     #endif
00085     #ifndef __MACOS__
00086         #define __MACOS__ 1
00087     #endif
00088 #endif
00089 
00090 //---------------------------------------------------------------------------
00091 //MacOS X
00092 #if defined(__APPLE__) && defined(__MACH__)
00093     #ifndef MACOSX
00094         #define MACOSX
00095     #endif
00096     #ifndef _MACOSX
00097         #define _MACOSX
00098     #endif
00099     #ifndef __MACOSX__
00100         #define __MACOSX__ 1
00101     #endif
00102 #endif
00103 
00104 //Test of targets
00105 #if defined(WINDOWS) && defined(UNIX) && defined(MACOS) && defined(MACOSX)
00106     #pragma message Multiple platforms???
00107 #endif
00108 
00109 #if !defined(WIN32) && !defined(UNIX) && !defined(MACOS) && !defined(MACOSX)
00110     #pragma message No known platforms, assume default
00111 #endif
00112 
00113 //***************************************************************************
00114 // Internationnal
00115 //***************************************************************************
00116 
00117 //---------------------------------------------------------------------------
00118 //Unicode
00119 #if defined(_UNICODE) || defined(UNICODE) || defined(__UNICODE__)
00120     #ifndef _UNICODE
00121         #define _UNICODE
00122     #endif
00123     #ifndef UNICODE
00124         #define UNICODE
00125     #endif
00126     #ifndef __UNICODE__
00127         #define __UNICODE__ 1
00128     #endif
00129 #endif
00130 
00131 //---------------------------------------------------------------------------
00132 //wchar_t stuff
00133 #if defined(MACOS) || defined(MACOSX)
00134     #include <wchar.h>
00135 #endif
00136 
00137 //***************************************************************************
00138 // Compiler bugs/unuseful warning
00139 //***************************************************************************
00140 
00141 //MSVC6 : for(int t=0; t<10; ++t) { do something }; for(int t=0; t<10; ++t) { do something }
00142 #if defined(_MSC_VER) && _MSC_VER <= 1200
00143     #define for if(true)for
00144     #pragma warning(disable:4786) // MSVC6 doesn't like typenames longer than 255 chars (which generates an enormous amount of warnings).
00145 #endif
00146 
00147 //MSVC2005 : "deprecated" warning (replacement functions are not in MinGW32 or Borland!)
00148 #if defined(_MSC_VER) && _MSC_VER >= 1400
00149     #pragma warning(disable : 4996)
00150 #endif
00151 
00152 //***************************************************************************
00153 // (Without Namespace)
00154 //***************************************************************************
00155 
00156 //---------------------------------------------------------------------------
00157 #include <limits.h>
00158 
00159 //---------------------------------------------------------------------------
00160 #if defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
00161     #include "ZenLib/MemoryDebug.h"
00162 #endif // defined(ZENLIB_DEBUG) && (defined(DEBUG) || defined(_DEBUG))
00163 
00164 //***************************************************************************
00165 // Compiler helpers
00166 //***************************************************************************
00167 
00168 //---------------------------------------------------------------------------
00169 //Macro to cut down on compiler warnings
00170 #ifndef UNUSED
00171     #define UNUSED(Identifier)
00172 #endif
00173 //---------------------------------------------------------------------------
00174 //If we need size_t specific integer conversion
00175 #if !defined(SIZE_T_IS_LONG) && (defined(__LP64__) || defined(MACOSX))
00176     #define SIZE_T_IS_LONG
00177 #endif
00178 
00179 //---------------------------------------------------------------------------
00180 //(-1) is known to be the MAX of an unsigned int but GCC complains about it
00181 #ifdef __cplusplus
00182     #include <new> //for size_t
00183 #else /* __cplusplus */
00184     #include <stddef.h> //for size_t
00185 #endif /* __cplusplus */
00186 #include <cstring> //size_t
00187 namespace ZenLib
00188 {
00189     const std::size_t Error=((std::size_t)(-1));
00190     const std::size_t All=((std::size_t)(-1));
00191     const std::size_t Unlimited=((std::size_t)(-1));
00192 }
00193 
00194 //***************************************************************************
00195 // (With namespace)
00196 //***************************************************************************
00197 
00198 namespace ZenLib
00199 {
00200 
00201 //***************************************************************************
00202 // International
00203 //***************************************************************************
00204 
00205 //---------------------------------------------------------------------------
00206 //Char types
00207 #if defined(__UNICODE__)
00208     #if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
00209         #pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
00210     #endif
00211     typedef wchar_t Char;
00212     #undef  __T
00213     #define __T(__x) L ## __x
00214 #else // defined(__UNICODE__)
00215     typedef char Char;
00216     #undef  __T
00217     #define __T(__x) __x
00218 #endif // defined(__UNICODE__)
00219 #ifdef wchar_t
00220     typedef wchar_t wchar;
00221 #endif // wchar_t
00222 
00223 //***************************************************************************
00224 // Platform differences
00225 //***************************************************************************
00226 
00227 //End of line
00228 extern const Char* EOL;
00229 extern const Char  PathSeparator;
00230 
00231 //***************************************************************************
00232 // Types
00233 //***************************************************************************
00234 
00235 //---------------------------------------------------------------------------
00236 //int
00237 typedef signed   int            ints;
00238 typedef unsigned int            intu;
00239 
00240 //---------------------------------------------------------------------------
00241 //8-bit int
00242 #if UCHAR_MAX==0xff
00243     #undef  MAXTYPE_INT
00244     #define MAXTYPE_INT 8
00245     typedef signed   char       int8s;
00246     typedef unsigned char       int8u;
00247 #else
00248     #pragma message This machine has no 8-bit integertype?
00249 #endif
00250 
00251 //---------------------------------------------------------------------------
00252 //16-bit int
00253 #if UINT_MAX == 0xffff
00254     #undef  MAXTYPE_INT
00255     #define MAXTYPE_INT 16
00256     typedef signed   int        int16s;
00257     typedef unsigned int        int16u;
00258 #elif USHRT_MAX == 0xffff
00259     #undef  MAXTYPE_INT
00260     #define MAXTYPE_INT 16
00261     typedef signed   short      int16s;
00262     typedef unsigned short      int16u;
00263 #else
00264     #pragma message This machine has no 16-bit integertype?
00265 #endif
00266 
00267 //---------------------------------------------------------------------------
00268 //32-bit int
00269 #if UINT_MAX == 0xfffffffful
00270     #undef  MAXTYPE_INT
00271     #define MAXTYPE_INT 32
00272     typedef signed   int        int32s;
00273     typedef unsigned int        int32u;
00274 #elif ULONG_MAX == 0xfffffffful
00275     #undef  MAXTYPE_INT
00276     #define MAXTYPE_INT 32
00277     typedef signed   long       int32s;
00278     typedef unsigned long       int32u;
00279 #elif USHRT_MAX == 0xfffffffful
00280     #undef  MAXTYPE_INT
00281     #define MAXTYPE_INT 32
00282     typedef signed   short      int32s;
00283     typedef unsigned short      int32u;
00284 #else
00285     #pragma message This machine has no 32-bit integer type?
00286 #endif
00287 
00288 //---------------------------------------------------------------------------
00289 //64-bit int
00290 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
00291     #undef  MAXTYPE_INT
00292     #define MAXTYPE_INT 64
00293     typedef signed   long long  int64s;
00294     typedef unsigned long long  int64u;
00295 #elif defined(__WIN32__)
00296     #undef  MAXTYPE_INT
00297     #define MAXTYPE_INT 64
00298     typedef signed   __int64    int64s;
00299     typedef unsigned __int64    int64u;
00300 #else
00301     #pragma message This machine has no 64-bit integer type?
00302 #endif
00303 
00304 //---------------------------------------------------------------------------
00305 //32-bit float
00306 #if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
00307     #undef  MAXTYPE_FLOAT
00308     #define MAXTYPE_FLOAT 32
00309     typedef float                float32;
00310 #else
00311     #pragma message This machine has no 32-bit float type?
00312 #endif
00313 
00314 //---------------------------------------------------------------------------
00315 //64-bit float
00316 #if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
00317     #undef  MAXTYPE_FLOAT
00318     #define MAXTYPE_FLOAT 64
00319     typedef double                float64;
00320 #else
00321     #pragma message This machine has no 64-bit float type?
00322 #endif
00323 
00324 //---------------------------------------------------------------------------
00325 //80-bit float
00326 #if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
00327     #undef  MAXTYPE_FLOAT
00328     #define MAXTYPE_FLOAT 80
00329     typedef long double           float80;
00330 #else
00331     #pragma message This machine has no 80-bit float type?
00332 #endif
00333 
00334 //***************************************************************************
00335 // Nested functions
00336 //***************************************************************************
00337 
00338 //Unices
00339 #if defined (UNIX)
00340     #define snwprintf swprintf
00341 #endif
00342 
00343 //Windows - MSVC (before Visual Studio 2015)
00344 #if defined (_MSC_VER) && _MSC_VER < 1900
00345     #define snprintf _snprintf
00346     #define snwprintf _snwprintf
00347 #endif
00348 
00349 } //namespace
00350 #endif

Generated on 5 Mar 2017 for ZenLib by  doxygen 1.4.7