msvc_include.h

Go to the documentation of this file.
00001 //
00002 // MSVC Inlcude... Kludges and precompiled header for Pentagram
00003 //
00004 
00005 #if defined(_MSC_VER) && !defined(UNDER_CE)
00006 
00007 #pragma once
00008 
00009 // This is 64bit safe
00010 #define EX_TYPE_INT8    __int8
00011 #define EX_TYPE_INT16   __int16
00012 #define EX_TYPE_INT32   __int32
00013 #ifdef _WIN64
00014 #define EX_TYPE_INTPTR  __int64
00015 #else
00016 #define EX_TYPE_INTPTR  __w64 int
00017 #endif
00018 
00019 #ifndef VERSION
00020 #define VERSION "0.1cvs"
00021 #endif
00022 
00023 // Fisrtly some things that need to be defined
00024 #define PENTAGRAM 
00025 #define BUILTIN_DATA
00026 //#define SIZEOF_SHORT 2
00027 //#define SIZEOF_INT 4
00028 //#undef USE_PRECOMPILED_HEADER
00029 //#define COLOURLESS_WANTS_A_DATA_FREE_PENATGRAM
00030 //#define WIN32_USE_MY_DOCUMENTS
00031 //#define I_AM_COLOURLESS_EXPERIMENTING_WITH_D3D
00032 //#define I_AM_COLOURLESS_EXPERIMENTING_WITH_HW_CURSORS
00033 
00034 #define USE_FMOPL_MIDI
00035 #define USE_TIMIDITY_MIDI
00036 //#define USE_FLUIDSYNTH_MIDI
00037 
00038 //#define SOFTRENDSURF_FORCE_HW_DOUBLEBUF
00039 
00040 //#define COMPILE_GAMMA_CORRECT_SCALERS
00041 //#define COMPILE_ALL_BILINEAR_SCALERS
00042 
00043 #define _USE_MATH_DEFINES
00044 
00045 #ifdef _DEBUG
00046 #define DEBUG
00047 #endif
00048 
00049 // Don't need everything in the windows headers
00050 #define WIN32_LEAN_AND_MEAN
00051 
00052 // Don't let windows define min and max as macros
00053 #define NOMINMAX
00054 template<class T> T &max(T &a, T &b) { return (((a) > (b)) ? (a) : (b)); }
00055 template<class T> T &min(T &a, T &b) { return (((a) < (b)) ? (a) : (b)); }
00056 
00057 
00058 // Disable some warnings
00059 #pragma warning (disable: 4786) // Debug Len > 255
00060 #pragma warning (disable: 4355) // 'this' : used in base member initializer list
00061 
00062 #ifndef ENABLE_EXTRA_WARNINGS
00063 #pragma warning (disable: 4101) // unreferenced local variable
00064 #pragma warning (disable: 4309) // truncation of constant value
00065 #pragma warning (disable: 4305) // truncation from 'const int' to 'char'
00066 #endif
00067 
00068 // We need this defined
00069 #define __STRING(x) #x
00070 #define yyFlexLexer llcFlexLexer
00071 
00072 //
00073 // Hacks for MSVC 6
00074 //
00075 #if (_MSC_VER == 1200)
00076 
00077 // We don't have it, but MSVC7 does
00078 #define DONT_HAVE_HASH_SET
00079 #define DONT_HAVE_HASH_MAP
00080 
00081 // Define size_t, but don't define tm, we'll define that later
00082 #define _TM_DEFINED
00083 #include <wctype.h>
00084 #undef _TM_DEFINED
00085 
00086 #define _SIZE_T_DEFINED
00087 
00088 // we can't put cstdio into std because MSVC MUST have it in the global namespace
00089 #include <cstdio>
00090 
00091 // Now put the headers that should be in std into the std namespace
00092 namespace std {
00093 
00094         #include <wchar.h>
00095         #include <sys/types.h>
00096         #include <errno.h>
00097         #include <ctype.h>
00098         #include <signal.h>
00099         #include <cstdlib>
00100         #include <cstring>
00101         #include <ctime>
00102         #include <cmath>
00103         #include <cstdarg>
00104 
00105         // Kludge to make Exult think that size_t has been put into the
00106         // std namespace
00107         typedef ::size_t size_t2;
00108         #define size_t size_t2
00109 
00110         // These are declared/defined in <cstdio> and the need to be in 
00111         // the std namespace
00112         using ::FILE;
00113         using ::fread;
00114         using ::va_list;
00115         using ::fopen;
00116         using ::fprintf;
00117         using ::fclose;
00118         using ::fwrite;
00119         using ::remove;
00120         using ::printf;
00121         
00122 #ifndef PENTAGRAM_NEW
00123         using ::_snprintf;
00124 #endif
00125 
00126 }
00127 
00128 // These get put in std when they otherwise should be, or are required by other headers
00129 using std::memcmp;
00130 using std::memcpy;
00131 using std::mbstate_t;
00132 using std::size_t;
00133 using std::time_t;
00134 using std::_fsize_t;
00135 using std::tm;
00136 using std::_dev_t;
00137 using std::_ino_t;
00138 using std::_off_t;
00139 using std::isspace;
00140 using std::strlen;
00141 using std::strtol;
00142 using std::memset;
00143 using std::atoi;
00144 
00145 // Nope, stat isn't defined
00146 #ifdef _STAT_DEFINED
00147 #undef _STAT_DEFINED
00148 #endif
00149 #include <sys/stat.h>
00150 
00151 //
00152 // Hacks for MSVC.Net
00153 //
00154 #elif (_MSC_VER >= 1300) 
00155 
00156 #if (_MSC_VER != 1300) && (_MSC_VER != 1310) && (_MSC_VER != 1400)
00157 // with line number
00158 #define MYSTRING2(x) #x
00159 #define MYSTRING(x) MYSTRING2(x)
00160 
00161 #pragma message( __FILE__ "(" MYSTRING(__LINE__)") : warning : Compiling with untested version of MSVC" )
00162 #undef MYSTRING2
00163 #undef MYSTRING
00164 #endif
00165 
00166 #include <cctype>
00167 #define HAVE_SYS_STAT_H
00168 #define inline __forceinline
00169 //#pragma inline_depth(255)
00170 
00171 //
00172 // Uh oh, unknown MSVC version
00173 //
00174 
00175 #else
00176 
00177 #error Unknown Version of MSVC being used. Edit "msvc_include.h" and add your version
00178 
00179 #endif
00180 
00181 #if !defined(WIN32) && defined(_WIN32)
00182 #define WIN32
00183 #endif
00184 
00185 #define snprintf _snprintf
00186 #define vsnprintf _vsnprintf
00187 
00188 // We've got snprintf
00189 #define HAVE_SNPRINTF
00190 
00191 // Some often used headers that could be included in out precompiled header
00192 #include <fstream>
00193 #include <exception>
00194 #include <vector>
00195 #include <iomanip>
00196 #include <set>
00197 #include <map>
00198 #include <cassert>
00199 #include <fcntl.h>
00200 #include <direct.h>
00201 #include <cmath>
00202 #include <ctime>
00203 #include <malloc.h>
00204 
00205 #include <windows.h>
00206 #include <windef.h>
00207 
00208 #ifdef DEBUG
00209 #define STRICTUNZIP
00210 #define STRICTZIP
00211 #endif
00212 
00213 #ifndef _WIN64
00214 using std::exit;
00215 #else
00216 namespace std 
00217 { 
00218         using ::exit; 
00219         using ::memcpy; 
00220         using ::memset; 
00221         using ::strcmp; 
00222         using ::size_t; 
00223         using ::atoi; 
00224         using ::atof; 
00225         using ::strstr; 
00226         using ::fclose; 
00227         using ::free; 
00228         using ::fopen; 
00229         using ::fprintf; 
00230         using ::fwrite; 
00231         using ::log10; 
00232         using ::malloc; 
00233         using ::memcmp; 
00234         using ::pow; 
00235         using ::rand; 
00236         using ::tolower; 
00237         using ::toupper; 
00238         using ::time; 
00239         using ::strtoul; 
00240         using ::strtol; 
00241         using ::strtod; 
00242         using ::strncmp; 
00243         using ::strncpy; 
00244         using ::strlen; 
00245         using ::strcpy; 
00246         using ::strcat; 
00247         using ::sqrt; 
00248         using ::sin; 
00249         using ::printf; 
00250         using ::calloc; 
00251         using ::abs;
00252         using ::isprint;
00253 }
00254 #endif
00255 
00256 // Don't want SDL Parachute
00257 #define NO_SDL_PARACHUTE
00258 
00259 // This is for stat
00260 #ifndef S_ISDIR
00261 #define S_ISDIR(mode)    __S_ISTYPE((mode), _S_IFDIR)
00262 #endif //S_ISDIR
00263 
00264 #ifndef __S_ISTYPE
00265 #define __S_ISTYPE(mode, mask)  (((mode) & _S_IFMT) == (mask))
00266 #endif //__S_ISTYPE
00267 
00268 #define va_copy(a,b) do { (a)=(b); } while(0)
00269 
00270 #endif

Generated on Fri Jul 27 22:27:26 2007 for pentagram by  doxygen 1.4.7