[219] | 1 | #ifndef DEFS_SEEN
|
---|
| 2 | #define DEFS_SEEN
|
---|
| 3 |
|
---|
| 4 | /*#define DEBUG*/
|
---|
| 5 |
|
---|
| 6 | #ifdef DEBUG
|
---|
| 7 | #define IMGRGCHECK
|
---|
| 8 | #define IMGVOIDCHECK
|
---|
| 9 | #endif
|
---|
| 10 |
|
---|
| 11 | /* Sur mac, PP utilise fp.h plutot que math.h, et les deux sont incompatibles... */
|
---|
| 12 | #ifdef __MWERKS__
|
---|
| 13 | /*
|
---|
| 14 | #include <fp.h>
|
---|
| 15 | #define __MATH__
|
---|
| 16 | */
|
---|
| 17 | #endif
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | /********************************************************/
|
---|
| 21 | /* Outil d'impressions pour debug */
|
---|
| 22 | #define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
|
---|
| 23 | #define CR {cout<<"\n"<<flush;}
|
---|
| 24 | /* ********************************************************/
|
---|
| 25 |
|
---|
| 26 | /* Sur quelle machine sommes-nous ? */
|
---|
| 27 | /* Il faudrait uniformiser tous les sources avec les memes conventions... */
|
---|
| 28 |
|
---|
| 29 | #if defined(__alpha) || defined(__alpha__) || defined(OSF1) || defined(DECALPHA)
|
---|
| 30 | #undef OSF1
|
---|
| 31 | #define OSF1
|
---|
| 32 | #undef DECALPHA
|
---|
| 33 | #define DECALPHA
|
---|
| 34 | #undef __alpha__
|
---|
| 35 | #define __alpha__
|
---|
| 36 | #endif
|
---|
| 37 |
|
---|
| 38 |
|
---|
| 39 | #if defined(_AIX) && !defined(AIX)
|
---|
| 40 | #define AIX 1
|
---|
| 41 | #endif
|
---|
| 42 |
|
---|
| 43 | #if defined(__hpux__) && !defined(HPUX)
|
---|
| 44 | #define HPUX 1
|
---|
| 45 | #endif
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | #ifdef ultrix
|
---|
| 49 | #define DECULTRIX 1
|
---|
| 50 | #endif
|
---|
| 51 |
|
---|
| 52 | #ifdef __ultrix__
|
---|
| 53 | #define DECULTRIX 1
|
---|
| 54 | #endif
|
---|
| 55 |
|
---|
| 56 | #ifdef THINK_CPLUS
|
---|
| 57 | #define __mac__
|
---|
| 58 | #endif
|
---|
| 59 |
|
---|
| 60 | #ifdef __MWERKS__
|
---|
| 61 | #define __mac__
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | /* Quelques variantes du C++ selon le compilateur */
|
---|
| 65 |
|
---|
| 66 | #define USESTRING
|
---|
| 67 |
|
---|
| 68 | #define HAS_VEC_NEW
|
---|
| 69 |
|
---|
| 70 | #ifdef __MWERKS__
|
---|
| 71 | #define __ANSI_TEMPLATES__
|
---|
| 72 | #undef HAS_VEC_NEW
|
---|
| 73 | #define COMPILER_EXCEPTIONS
|
---|
| 74 | #define NO_STRSTREAM
|
---|
| 75 | #define STREAMPOS_IS_CLASS
|
---|
| 76 | #define ITER_TAG
|
---|
| 77 | #endif
|
---|
| 78 |
|
---|
| 79 | #ifdef __GNUG__
|
---|
| 80 | #define __GNU_TEMPLATES__
|
---|
| 81 | #endif
|
---|
| 82 |
|
---|
| 83 | #ifdef __DECCXX
|
---|
| 84 | #if __DECCXX_VER > 60000000
|
---|
| 85 | #define CXX6 1
|
---|
| 86 | #define ITER_TAG
|
---|
| 87 | /* #define __GNU_TEMPLATES__ */
|
---|
| 88 | #define __CXX_PRAGMA_TEMPLATES__
|
---|
| 89 | #else
|
---|
| 90 | #define CXX5 1
|
---|
| 91 | #define __CXX_PRAGMA_TEMPLATES__
|
---|
| 92 | /* Pour definir bool Reza 20/05/97 */
|
---|
| 93 | #include <stl_macros>
|
---|
| 94 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 95 | #define COMPILER_EXCEPTIONS
|
---|
| 96 | #endif
|
---|
| 97 | #endif
|
---|
| 98 |
|
---|
| 99 | #endif
|
---|
| 100 |
|
---|
| 101 | /* GCC 2.8.0 : exception, string::npos */
|
---|
| 102 | #ifdef __GNUC__
|
---|
| 103 | #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
|
---|
| 104 | #undef COMPILER_EXCEPTIONS
|
---|
| 105 | #define COMPILER_EXCEPTIONS
|
---|
| 106 | #define NPOS string::npos
|
---|
| 107 | #endif
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | #ifndef __GNUG__
|
---|
| 112 | /*typedef int bool;*/
|
---|
| 113 | #define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 114 | #ifndef __FUNCTION__
|
---|
| 115 | #define __FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 116 | #endif
|
---|
| 117 | #ifndef __KCC__
|
---|
| 118 | #define __attribute__(_x_)
|
---|
| 119 | #endif
|
---|
| 120 | #endif
|
---|
| 121 |
|
---|
| 122 | #ifdef __GNUG__
|
---|
| 123 | #define HAS_NAMED_RETURN 0
|
---|
| 124 | #else
|
---|
| 125 | #define HAS_NAMED_RETURN 0
|
---|
| 126 | #endif
|
---|
| 127 |
|
---|
| 128 | #ifdef THINK_CPLUS
|
---|
| 129 | #define ARG_FUNC_CPP_C 0
|
---|
| 130 | #else
|
---|
| 131 | #define ARG_FUNC_CPP_C 1
|
---|
| 132 | #endif
|
---|
| 133 |
|
---|
| 134 | #ifdef __GNUG__
|
---|
| 135 | #define HAS_EXPLICIT
|
---|
| 136 | #endif
|
---|
| 137 |
|
---|
| 138 | #ifdef HAS_EXPLICIT
|
---|
| 139 | #define EXPLICIT explicit
|
---|
| 140 | #else
|
---|
| 141 | #define EXPLICIT
|
---|
| 142 | #endif
|
---|
| 143 | /* Quelques variantes de la librairie C++. */
|
---|
| 144 | /* La librairie est AT&T par defaut, sauf si __ANSI_IO__ */
|
---|
| 145 |
|
---|
| 146 | /* $CHECK$ EA : a uniformiser */
|
---|
| 147 | /* remplacer HAS_IOS_BIN par un selecteur qui indique si c'est ios::binary ou */
|
---|
| 148 | /* ios::bin */
|
---|
| 149 |
|
---|
| 150 | #ifdef __MWERKS__
|
---|
| 151 | /* #define __ANSI_IO__ */
|
---|
| 152 | #endif
|
---|
| 153 |
|
---|
| 154 | #if defined(THINK_CPLUS)
|
---|
| 155 | #define HAS_IOS_BIN 0
|
---|
| 156 | #define HAS_IOS_NOCREATE 1
|
---|
| 157 | #define FITS_IOS_IN_OPT ios::in | ios::nocreate
|
---|
| 158 | #define FITS_IOS_OUT_OPT ios::out
|
---|
| 159 |
|
---|
| 160 | #elif defined(__MWERKS__)
|
---|
| 161 | #define HAS_IOS_BIN 1
|
---|
| 162 | #define HAS_IOS_NOCREATE 1
|
---|
| 163 | #define NPOS string::npos
|
---|
| 164 |
|
---|
| 165 | #elif defined(__GNUG__)
|
---|
| 166 | #define HAS_IOS_BIN 1
|
---|
| 167 | #define HAS_IOS_NOCREATE 1
|
---|
| 168 | #define FITS_IOS_IN_OPT ios::in | ios::bin | ios::nocreate
|
---|
| 169 | #define FITS_IOS_OUT_OPT ios::out | ios::bin
|
---|
| 170 |
|
---|
| 171 | #else
|
---|
| 172 | #define HAS_IOS_BIN 0
|
---|
| 173 | #define HAS_IOS_NOCREATE 0
|
---|
| 174 | #endif
|
---|
| 175 |
|
---|
| 176 | #ifdef __ANSI_IO__
|
---|
| 177 | #define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
|
---|
| 178 | #define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
|
---|
| 179 | #endif
|
---|
| 180 |
|
---|
| 181 |
|
---|
| 182 | #define STR2CH(x) ((string(x)).c_str())
|
---|
| 183 |
|
---|
| 184 | /* Des fonctions qui manquent sur certaines machines */
|
---|
| 185 |
|
---|
| 186 | #if defined(__DECCXX)
|
---|
| 187 | /* a cause des exceptions dans math.h */
|
---|
| 188 | #define exception math_exception
|
---|
| 189 | #include <math.h>
|
---|
| 190 | #undef exception
|
---|
| 191 | #else
|
---|
| 192 | #include <math.h>
|
---|
| 193 | #endif
|
---|
| 194 |
|
---|
| 195 | #if defined(__DECCXX)
|
---|
| 196 | /* Pour definir bool Reza 20/05/97 */
|
---|
| 197 | #include <stl_macros>
|
---|
| 198 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 199 | #define COMPILER_EXCEPTIONS
|
---|
| 200 | #endif
|
---|
| 201 | #endif
|
---|
| 202 |
|
---|
| 203 | #if defined(__xlC) && defined (__cplusplus)
|
---|
| 204 | #include <bool.h>
|
---|
| 205 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 206 | #define COMPILER_EXCEPTIONS
|
---|
| 207 | // NPOS - On utilise la STL de g++ 2.7.2
|
---|
| 208 | #endif
|
---|
| 209 | #endif
|
---|
| 210 |
|
---|
| 211 | #if defined( __DECCXX ) || defined (__aCC__)
|
---|
| 212 | /* en fait si c'est RogueWave */
|
---|
| 213 | /* Remis par Reza 20/05/97 */
|
---|
| 214 | #define NPOS (size_t)-1
|
---|
| 215 | #endif
|
---|
| 216 |
|
---|
| 217 | #if defined (__aCC__)
|
---|
| 218 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 219 | #define COMPILER_EXCEPTIONS
|
---|
| 220 | #endif
|
---|
| 221 | #ifndef __ANSI_TEMPLATES__
|
---|
| 222 | #define __ANSI_TEMPLATES__
|
---|
| 223 | #endif
|
---|
| 224 | #endif
|
---|
| 225 |
|
---|
| 226 | #if defined(__KCC__)
|
---|
| 227 | /* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
|
---|
| 228 | #define STREAMPOS_IS_CLASS
|
---|
| 229 | #define NPOS string::npos
|
---|
| 230 |
|
---|
| 231 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 232 | #define COMPILER_EXCEPTIONS
|
---|
| 233 | #endif
|
---|
| 234 | #ifndef __ANSI_TEMPLATES__
|
---|
| 235 | #define __ANSI_TEMPLATES__
|
---|
| 236 | #endif
|
---|
| 237 | #endif
|
---|
| 238 |
|
---|
| 239 | #ifndef M_PI
|
---|
| 240 | #define M_PI 3.1415926535
|
---|
| 241 | #endif
|
---|
| 242 |
|
---|
| 243 | #ifdef __mac__
|
---|
| 244 | #define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
|
---|
| 245 | /* #define nintf(x) ((int) (x)) */
|
---|
| 246 | #define random() (rand()*65538.0 + rand()*2. + rand())
|
---|
| 247 | #define srandom srand
|
---|
| 248 | #define initstate(seed, tab, n) srand(seed)
|
---|
| 249 | #define nice(_x)
|
---|
| 250 | /*#define getpid() 1 */
|
---|
| 251 |
|
---|
| 252 | #ifdef __cplusplus
|
---|
| 253 | #include <string.h>
|
---|
| 254 | #include <string>
|
---|
| 255 | inline bool operator< (string const& s1, string const& s2)
|
---|
| 256 | { return (strcmp(s1.c_str(), s2.c_str()) < 0); }
|
---|
| 257 | #endif
|
---|
| 258 | #endif
|
---|
| 259 |
|
---|
| 260 |
|
---|
| 261 |
|
---|
| 262 | #endif
|
---|
| 263 |
|
---|