Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Conf.h

Go to the documentation of this file.
00001 // ZenLib::ZenTypes - To be independant of platform & compiler
00002 // Copyright (C) 2002-2003 Jérôme Martinez, Zen@MediaArea.net
00003 //
00004 // This software is provided 'as-is', without any express or implied
00005 // warranty.  In no event will the authors be held liable for any damages
00006 // arising from the use of this software.
00007 //
00008 // Permission is granted to anyone to use this software for any purpose,
00009 // including commercial applications, and to alter it and redistribute it
00010 // freely, subject to the following restrictions:
00011 //
00012 // 1. The origin of this software must not be misrepresented; you must not
00013 //    claim that you wrote the original software. If you use this software
00014 //    in a product, an acknowledgment in the product documentation would be
00015 //    appreciated but is not required.
00016 // 2. Altered source versions must be plainly marked as such, and must not be
00017 //    misrepresented as being the original software.
00018 // 3. This notice may not be removed or altered from any source distribution.
00019 //
00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00021 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00022 // ZenTypes
00023 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024 //
00025 // Version 0.3.2
00026 // -------------
00027 // Independancies of types
00028 //               (u)int  (u)int  (u)int  (u)int  Float   Float
00029 //                8bit   16bit   32bit   64bit   32bit   64bit
00030 // Win32        :   X      X       X       X       X       X   
00031 // Linux        :   X      X       X
00032 //
00033 // Platform detection
00034 // __WIN32__, __UNIX__
00035 //
00036 // Easy Unicode Support
00037 // 
00038 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00039 //
00040 // 0.3.2 (Zen@MediaArea.net, 2003-09-13)
00041 // Unicode
00042 //
00043 // 0.3.1 (Zen@MediaArea.net, 2003-06-22)
00044 // Add Float
00045 //
00046 // 0.3.0 (Zen@MediaArea.net, 2003-06-22)
00047 // Platform definition
00048 //
00049 // 0.2.0 (Zen@MediaArea.net)
00050 // Win32 64 bits
00051 // Linux 8-32 bits
00052 //
00053 // 0.1.0 (Zen@MediaArea.net)
00054 // Win32 8-32 bits
00055 //
00056 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00057 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00058 
00059 //---------------------------------------------------------------------------
00060 #ifndef ZenTypesH
00061 #define ZenTypesH
00062 //---------------------------------------------------------------------------
00063 
00064 //---------------------------------------------------------------------------
00065 #include <limits.h>
00066 #include <tchar.h>
00067 //---------------------------------------------------------------------------
00068 
00069 namespace ZenLib
00070 {
00071 
00072 //***************************************************************************
00073 // Compiler bugs
00074 //***************************************************************************
00075 
00076 //MSVC6 : for(int t=0; t<10; ++t) { do something }; for(int t=0; t<10; ++t) { do something } 
00077 #if !defined(_MSC_VER) && _MSC_VER <= 1200
00078     #define for if(true)for
00079     #pragma warning(disable:4786) // MSVC6 doesn't like typenames longer than 255 chars (which generates an enormous amount of warnings).
00080 #endif
00081 
00082 //***************************************************************************
00083 // International
00084 //***************************************************************************
00085 
00086 //---------------------------------------------------------------------------
00087 //Unicode
00088 #if (defined(_UNICODE) || defined(UNICODE) || defined(__UNICODE__))
00089     #ifndef _UNICODE
00090         #define _UNICODE
00091     #endif
00092     #ifndef UNICODE
00093         #define UNICODE
00094     #endif
00095     #ifndef __UNICODE__
00096         #define __UNICODE__
00097     #endif
00098 #endif
00099 
00100 //---------------------------------------------------------------------------
00101 //Char types
00102 typedef _TCHAR Char;
00103 
00104 //***************************************************************************
00105 // Platforms
00106 //***************************************************************************
00107 
00108 //---------------------------------------------------------------------------
00109 //Win32 (Win95, Win98, WinMe, WinNT, WinXP)
00110 #if (defined(__NT__) || defined(_WIN32) || defined(WIN32)) && !defined(__WIN32__)
00111     #define __WIN32__
00112 #endif
00113 
00114 //Unix (Linux, HP, Sun, BeOS...)
00115 #if (defined(__unix) || defined(__unix__) || \
00116       defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
00117       defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
00118       defined(__EMX__) || defined(__VMS) || defined(__BEOS__)) && !defined(__UNIX__)
00119 #define __UNIX__
00120 #endif
00121 
00122 //Test of targets
00123 #if defined(__WIN32__) && defined(__UNIX__)
00124     #error Two platforms???
00125 #endif
00126 
00127 #if !defined(__WIN32__) && !defined(__UNIX__)
00128     #pragma message No known platforms, assume default
00129 #endif
00130 
00131 //***************************************************************************
00132 // Types
00133 //***************************************************************************
00134 
00135 //---------------------------------------------------------------------------
00136 //int
00137 typedef signed   int        ints;
00138 typedef unsigned int        intu;
00139 
00140 //---------------------------------------------------------------------------
00141 //8-bit int
00142 #if UCHAR_MAX==0xff
00143     #undef  MAXTYPE_INT
00144     #define MAXTYPE_INT 8
00145     typedef signed   char       int8s;
00146     typedef unsigned char       int8u;
00147 #else
00148     #pragma message This machine has no 8-bit integertype?
00149 #endif
00150 
00151 //---------------------------------------------------------------------------
00152 //16-bit int
00153 #if UINT_MAX == 0xffff
00154     #undef  MAXTYPE_INT
00155     #define MAXTYPE_INT 16
00156     typedef signed   int        int16s;
00157     typedef unsigned int        int16u;
00158 #elif USHRT_MAX == 0xffff
00159     #undef  MAXTYPE_INT
00160     #define MAXTYPE_INT 16
00161     typedef signed   short      int16s;
00162     typedef unsigned short      int16u;
00163 #else
00164     #pragma message This machine has no 16-bit integertype?
00165 #endif
00166 
00167 //---------------------------------------------------------------------------
00168 //32-bit int
00169 #if UINT_MAX == 0xfffffffful
00170     #undef  MAXTYPE_INT
00171     #define MAXTYPE_INT 32
00172     typedef signed   int        int32s;
00173     typedef unsigned int        int32u;
00174 #elif ULONG_MAX == 0xfffffffful
00175     #undef  MAXTYPE_INT
00176     #define MAXTYPE_INT 32
00177     typedef signed   long       int32s;
00178     typedef unsigned long       int32u;
00179 #elif USHRT_MAX == 0xfffffffful
00180     #undef  MAXTYPE_INT
00181     #define MAXTYPE_INT 32
00182     typedef signed   short      int32s;
00183     typedef unsigned short      int32u;
00184 #else
00185     #pragma message This machine has no 32-bit integer type?
00186 #endif
00187 
00188 //---------------------------------------------------------------------------
00189 //64-bit int
00190 #if defined(__MINGW32__) || defined(__CYGWIN32__)
00191     #undef  MAXTYPE_INT
00192     #define MAXTYPE_INT 64
00193     typedef signed   long long  int64s; //not tested!!!
00194     typedef unsigned long long  int64u; //not tested!!!
00195 #elif defined(__WIN32__)
00196     #undef  MAXTYPE_INT
00197     #define MAXTYPE_INT 64
00198     typedef signed   __int64    int64s;
00199     typedef unsigned __int64    int64u;
00200 #else
00201     #pragma message This machine has no 64-bit integer type?
00202 #endif
00203 
00204 //---------------------------------------------------------------------------
00205 //32-bit float
00206 //#if FLT_DIG >= 5 || _MSC_VER //Microsoft doesn't know FLT_DIG???
00207     #undef  MAXTYPE_FLOAT
00208     #define MAXTYPE_FLOAT 32
00209     typedef float                float32;
00210 //#else
00211 //    #pragma message This machine has no 32-bit float type?
00212 //#endif
00213 
00214 //---------------------------------------------------------------------------
00215 //64-bit float
00216 //#if DBL_DIG >= 15 || _MSC_VER //Microsoft doesn't know DBL_DIG???
00217     #undef  MAXTYPE_FLOAT
00218     #define MAXTYPE_FLOAT 64
00219     typedef double                float64;
00220 //#else
00221 //    #pragma message This machine has no 64-bit float type?
00222 //#endif
00223 
00224 } //namespace
00225 #endif

Generated on Mon Jan 10 01:41:04 2005 for ZenLib by doxygen1.3-rc3