1 /* 2 * stdafx.h 3 * 4 * Copyright (C) 1999 Stephen F. White 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (see the file "COPYING" for details); if 18 * not, write to the Free Software Foundation, Inc., 675 Mass Ave, 19 * Cambridge, MA 02139, USA. 20 */ 21 22 // stdafx.h : include file for standard system include files, 23 // or project specific include files that are used frequently, but 24 // are changed infrequently 25 // 26 27 #ifndef _STDAFX_H 28 #define _STDAFX_H 29 30 // yet another stringcompare... 31 #define stringncmp(x,y) strncmp(x,y,strlen(y)) 32 33 #ifdef _WIN32 34 35 #if _MSC_VER < 1800 36 #pragma string_gs_check(on) 37 #endif 38 #ifndef M_PI 39 # define M_PI 3.14159265358979323846 40 #endif 41 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 42 43 #include <windows.h> 44 #include <sys/timeb.h> 45 #include <io.h> 46 #include <fcntl.h> 47 #include <direct.h> 48 49 #define strcasecmp _stricmp 50 #define strncasecmp _strnicmp 51 52 #include <stdio.h> 53 54 #define fileno _fileno 55 56 #include <float.h> 57 #include <limits.h> 58 59 #include <assert.h> 60 61 // redefine assert for a save before crash 62 63 #ifndef HAVE_WANT_CORE 64 #include "xerrorhandler.h" 65 # undef _ASSERT_H 66 # define _ASSERT_H 67 # undef assert 68 # define assert(x) { if (!(x)) emergency_rescue(); } 69 #endif 70 71 # define S_ISREG(x) (x & _S_IFREG) 72 73 // "__cdecl" is a special M$Windows visual studio compiler keyword 74 // rather useless but needed here, otherwise there are problems with the linker 75 #define compareFaceFunction __cdecl compareFace 76 77 #else // not WIN32 78 79 #include "config.h" 80 81 #include <unistd.h> 82 83 #include <limits.h> 84 /* 85 #include <values.h> 86 */ 87 88 #ifndef HAVE_GLDELETETEXTURES 89 #define glDeleteTextures glDeleteTexturesEXT 90 #endif 91 92 /* Define if you have glGenTextures. */ 93 #ifndef HAVE_GLGENTEXTURES 94 #define glGenTextures glGenTexturesEXT 95 #endif 96 97 #ifndef HAVE_GLBINDTEXTURE 98 #define glBindTexture glBindTextureEXT 99 #endif 100 101 #define compareFaceFunction compareFace 102 103 #endif // WIN32 104 105 #include <GL/gl.h> 106 #include "GL/glu.h" 107 108 // the include of gl.h should do this 109 #ifdef HAVE_GLFOGCOORDF 110 extern "C" void glFogCoordf(GLfloat coord); 111 #endif 112 113 #define MY_CPLUSPLUS 1 114 #include "mysnprintf.h" 115 116 #ifndef MAX 117 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 118 #endif 119 120 #ifndef MIN 121 #define MIN(a, b) ((a) <= (b) ? (a) : (b)) 122 #endif 123 124 #ifndef TRUE 125 #define TRUE 1 126 #endif 127 128 #ifndef FALSE 129 #define FALSE 0 130 #endif 131 132 #ifndef CLAMP 133 #define CLAMP(v, min, max) MIN(MAX(v, min), max) 134 #endif 135 136 //#ifndef PI 137 //#define PI 3.141592653589f 138 //#endif 139 140 #define FEPSILON 1E-6 141 #define EQUALF(a, b) (fabs((a) - (b)) < FEPSILON) 142 143 #ifndef RAD2DEG 144 #define RAD2DEG(a) ((a) * (180.0f / M_PI)) 145 #define DEG2RAD(a) ((a) * (M_PI / 180.0f)) 146 #endif 147 148 /* strlen("+2147483647") */ 149 #define LEN_DEZIMAL_INT_MAX 11 150 151 #include <assert.h> 152 153 #ifdef HAVE_WANT_CORE 154 extern void coredump(void); 155 # ifndef NDEBUG 156 # undef _ASSERT_H 157 # define _ASSERT_H 158 # undef assert 159 # define assert(x) { if (!(x)) coredump(); } 160 # endif 161 #endif 162 163 #endif // _STDAFX_H 164 165