• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

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 #include <new>
00182 #include <cstring> //size_t
00183 namespace ZenLib
00184 {
00185     const std::size_t Error=((std::size_t)(-1));
00186     const std::size_t All=((std::size_t)(-1));
00187     const std::size_t Unlimited=((std::size_t)(-1));
00188 }
00189 
00190 //***************************************************************************
00191 // (With namespace)
00192 //***************************************************************************
00193 
00194 namespace ZenLib
00195 {
00196 
00197 //***************************************************************************
00198 // International
00199 //***************************************************************************
00200 
00201 //---------------------------------------------------------------------------
00202 //Char types
00203 #if defined(__UNICODE__)
00204     #if defined (_MSC_VER) && !defined (_NATIVE_WCHAR_T_DEFINED)
00205         #pragma message Native wchar_t is not defined, not tested, you should put /Zc:wchar_t in compiler options
00206     #endif
00207     typedef wchar_t Char;
00208     #undef  __T
00209     #define __T(__x) L ## __x
00210 #else // defined(__UNICODE__)
00211     typedef char Char;
00212     #undef  __T
00213     #define __T(__x) __x
00214 #endif // defined(__UNICODE__)
00215 #ifdef wchar_t
00216     typedef wchar_t wchar;
00217 #endif // wchar_t
00218 
00219 //***************************************************************************
00220 // Platform differences
00221 //***************************************************************************
00222 
00223 //End of line
00224 extern const Char* EOL;
00225 extern const Char  PathSeparator;
00226 
00227 //***************************************************************************
00228 // Types
00229 //***************************************************************************
00230 
00231 //---------------------------------------------------------------------------
00232 //int
00233 typedef signed   int            ints;
00234 typedef unsigned int            intu;
00235 
00236 //---------------------------------------------------------------------------
00237 //8-bit int
00238 #if UCHAR_MAX==0xff
00239     #undef  MAXTYPE_INT
00240     #define MAXTYPE_INT 8
00241     typedef signed   char       int8s;
00242     typedef unsigned char       int8u;
00243 #else
00244     #pragma message This machine has no 8-bit integertype?
00245 #endif
00246 
00247 //---------------------------------------------------------------------------
00248 //16-bit int
00249 #if UINT_MAX == 0xffff
00250     #undef  MAXTYPE_INT
00251     #define MAXTYPE_INT 16
00252     typedef signed   int        int16s;
00253     typedef unsigned int        int16u;
00254 #elif USHRT_MAX == 0xffff
00255     #undef  MAXTYPE_INT
00256     #define MAXTYPE_INT 16
00257     typedef signed   short      int16s;
00258     typedef unsigned short      int16u;
00259 #else
00260     #pragma message This machine has no 16-bit integertype?
00261 #endif
00262 
00263 //---------------------------------------------------------------------------
00264 //32-bit int
00265 #if UINT_MAX == 0xfffffffful
00266     #undef  MAXTYPE_INT
00267     #define MAXTYPE_INT 32
00268     typedef signed   int        int32s;
00269     typedef unsigned int        int32u;
00270 #elif ULONG_MAX == 0xfffffffful
00271     #undef  MAXTYPE_INT
00272     #define MAXTYPE_INT 32
00273     typedef signed   long       int32s;
00274     typedef unsigned long       int32u;
00275 #elif USHRT_MAX == 0xfffffffful
00276     #undef  MAXTYPE_INT
00277     #define MAXTYPE_INT 32
00278     typedef signed   short      int32s;
00279     typedef unsigned short      int32u;
00280 #else
00281     #pragma message This machine has no 32-bit integer type?
00282 #endif
00283 
00284 //---------------------------------------------------------------------------
00285 //64-bit int
00286 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
00287     #undef  MAXTYPE_INT
00288     #define MAXTYPE_INT 64
00289     typedef signed   long long  int64s;
00290     typedef unsigned long long  int64u;
00291 #elif defined(__WIN32__)
00292     #undef  MAXTYPE_INT
00293     #define MAXTYPE_INT 64
00294     typedef signed   __int64    int64s;
00295     typedef unsigned __int64    int64u;
00296 #else
00297     #pragma message This machine has no 64-bit integer type?
00298 #endif
00299 
00300 //---------------------------------------------------------------------------
00301 //32-bit float
00302 #if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
00303     #undef  MAXTYPE_FLOAT
00304     #define MAXTYPE_FLOAT 32
00305     typedef float                float32;
00306 #else
00307     #pragma message This machine has no 32-bit float type?
00308 #endif
00309 
00310 //---------------------------------------------------------------------------
00311 //64-bit float
00312 #if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
00313     #undef  MAXTYPE_FLOAT
00314     #define MAXTYPE_FLOAT 64
00315     typedef double                float64;
00316 #else
00317     #pragma message This machine has no 64-bit float type?
00318 #endif
00319 
00320 //---------------------------------------------------------------------------
00321 //80-bit float
00322 #if defined(WINDOWS) || defined(UNIX) || defined(MACOSX)
00323     #undef  MAXTYPE_FLOAT
00324     #define MAXTYPE_FLOAT 80
00325     typedef long double           float80;
00326 #else
00327     #pragma message This machine has no 80-bit float type?
00328 #endif
00329 
00330 //***************************************************************************
00331 // Nested functions
00332 //***************************************************************************
00333 
00334 //Unices
00335 #if defined (UNIX)
00336     #define snwprintf swprintf
00337 #endif
00338 
00339 //Windows - MSVC
00340 #if defined (_MSC_VER)
00341     #define snprintf _snprintf
00342     #define snwprintf _snwprintf
00343 #endif
00344 
00345 } //namespace
00346 #endif

Generated on Sun Nov 9 2014 17:08:44 for ZenLib by  doxygen 1.7.1