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 _MSC_VER <= 1200
00078     #define for if(true)for
00079 #endif
00080 
00081 //***************************************************************************
00082 // International
00083 //***************************************************************************
00084 
00085 //---------------------------------------------------------------------------
00086 //Unicode
00087 #if (defined(_UNICODE) || defined(UNICODE) || defined(__UNICODE__))
00088     #ifndef _UNICODE
00089         #define _UNICODE
00090     #endif
00091     #ifndef UNICODE
00092         #define UNICODE
00093     #endif
00094     #ifndef __UNICODE__
00095         #define __UNICODE__
00096     #endif
00097 #endif
00098 
00099 //---------------------------------------------------------------------------
00100 //Char types
00101 typedef _TCHAR Char;
00102 
00103 //***************************************************************************
00104 // Platforms
00105 //***************************************************************************
00106 
00107 //---------------------------------------------------------------------------
00108 //Win32 (Win95, Win98, WinMe, WinNT, WinXP)
00109 #if (defined(__NT__) || defined(_WIN32) || defined(WIN32)) && !defined(__WIN32__)
00110     #define __WIN32__
00111 #endif
00112 
00113 //Unix (Linux, HP, Sun, BeOS...)
00114 #if (defined(__unix) || defined(__unix__) || \
00115       defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
00116       defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
00117       defined(__EMX__) || defined(__VMS) || defined(__BEOS__)) && !defined(__UNIX__)
00118 #define __UNIX__
00119 #endif
00120 
00121 //Test of targets
00122 #if defined(__WIN32__) && defined(__UNIX__)
00123     #error Two platforms???
00124 #endif
00125 
00126 #if !defined(__WIN32__) && !defined(__UNIX__)
00127     #pragma message No known platforms, assume default
00128 #endif
00129 
00130 //***************************************************************************
00131 // Types
00132 //***************************************************************************
00133 
00134 //---------------------------------------------------------------------------
00135 //int
00136 typedef signed   int        ints;
00137 typedef unsigned int        intu;
00138 
00139 //---------------------------------------------------------------------------
00140 //8-bit int
00141 #if UCHAR_MAX==0xff
00142     #undef  MAXTYPE_INT
00143     #define MAXTYPE_INT 8
00144     typedef signed   char       int8s;
00145     typedef unsigned char       int8u;
00146 #else
00147     #pragma message This machine has no 8-bit integertype?
00148 #endif
00149 
00150 //---------------------------------------------------------------------------
00151 //16-bit int
00152 #if UINT_MAX == 0xffff
00153     #undef  MAXTYPE_INT
00154     #define MAXTYPE_INT 16
00155     typedef signed   int        int16s;
00156     typedef unsigned int        int16u;
00157 #elif USHRT_MAX == 0xffff
00158     #undef  MAXTYPE_INT
00159     #define MAXTYPE_INT 16
00160     typedef signed   short      int16s;
00161     typedef unsigned short      int16u;
00162 #else
00163     #pragma message This machine has no 16-bit integertype?
00164 #endif
00165 
00166 //---------------------------------------------------------------------------
00167 //32-bit int
00168 #if UINT_MAX == 0xfffffffful
00169     #undef  MAXTYPE_INT
00170     #define MAXTYPE_INT 32
00171     typedef signed   int        int32s;
00172     typedef unsigned int        int32u;
00173 #elif ULONG_MAX == 0xfffffffful
00174     #undef  MAXTYPE_INT
00175     #define MAXTYPE_INT 32
00176     typedef signed   long       int32s;
00177     typedef unsigned long       int32u;
00178 #elif USHRT_MAX == 0xfffffffful
00179     #undef  MAXTYPE_INT
00180     #define MAXTYPE_INT 32
00181     typedef signed   short      int32s;
00182     typedef unsigned short      int32u;
00183 #else
00184     #pragma message This machine has no 32-bit integer type?
00185 #endif
00186 
00187 //---------------------------------------------------------------------------
00188 //64-bit int
00189 #if defined(__MINGW32__) || defined(__CYGWIN32__)
00190     #undef  MAXTYPE_INT
00191     #define MAXTYPE_INT 64
00192     typedef signed   long long  int64s; //not tested!!!
00193     typedef unsigned long long  int64u; //not tested!!!
00194 #elif defined(__WIN32__)
00195     #undef  MAXTYPE_INT
00196     #define MAXTYPE_INT 64
00197     typedef signed   __int64    int64s;
00198     typedef unsigned __int64    int64u;
00199 #else
00200     #pragma message This machine has no 64-bit integer type?
00201 #endif
00202 
00203 //---------------------------------------------------------------------------
00204 //32-bit float
00205 //#if FLT_DIG >= 5 || _MSC_VER //Microsoft doesn't know FLT_DIG???
00206     #undef  MAXTYPE_FLOAT
00207     #define MAXTYPE_FLOAT 32
00208     typedef float                float32;
00209 //#else
00210 //    #pragma message This machine has no 32-bit float type?
00211 //#endif
00212 
00213 //---------------------------------------------------------------------------
00214 //64-bit float
00215 //#if DBL_DIG >= 15 || _MSC_VER //Microsoft doesn't know DBL_DIG???
00216     #undef  MAXTYPE_FLOAT
00217     #define MAXTYPE_FLOAT 64
00218     typedef double                float64;
00219 //#else
00220 //    #pragma message This machine has no 64-bit float type?
00221 //#endif
00222 
00223 } //namespace
00224 #endif

Generated on Mon Aug 2 20:47:10 2004 for ZenLib by doxygen1.3-rc3