| 1 | //$$ include.h include files required by various versions of C++ |
|---|
| 2 | |
|---|
| 3 | #ifndef INCLUDE_LIB |
|---|
| 4 | #define INCLUDE_LIB |
|---|
| 5 | |
|---|
| 6 | //#define use_namespace // define name spaces |
|---|
| 7 | |
|---|
| 8 | //#define SETUP_C_SUBSCRIPTS // allow element access via A[i][j] |
|---|
| 9 | |
|---|
| 10 | //#define OPT_COMPATIBLE // for use with opt++ |
|---|
| 11 | |
|---|
| 12 | // Activate just one of the following 3 statements |
|---|
| 13 | |
|---|
| 14 | //#define SimulateExceptions // use simulated exceptions |
|---|
| 15 | #define UseExceptions // use C++ exceptions |
|---|
| 16 | //#define DisableExceptions // do not use exceptions |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | //#define TEMPS_DESTROYED_QUICKLY // for compilers that delete |
|---|
| 20 | // temporaries too quickly |
|---|
| 21 | |
|---|
| 22 | //#define TEMPS_DESTROYED_QUICKLY_R // the same thing but applied |
|---|
| 23 | // to return from functions only |
|---|
| 24 | |
|---|
| 25 | //#define DO_FREE_CHECK // check news and deletes balance |
|---|
| 26 | |
|---|
| 27 | #define USING_DOUBLE // elements of type double |
|---|
| 28 | //#define USING_FLOAT // elements of type float |
|---|
| 29 | |
|---|
| 30 | #define bool_LIB 0 // for compatibility with my older libraries |
|---|
| 31 | |
|---|
| 32 | //#define ios_format_flags ios::fmtflags // for Gnu 3 and Intel for Linux |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | //#define _STANDARD_ // using standard library |
|---|
| 36 | |
|---|
| 37 | //#define use_float_h // use float.h for precision data |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | //#define HAS_INT64 // if unsigned _int64 is recognised |
|---|
| 41 | // used by newran03 |
|---|
| 42 | |
|---|
| 43 | // comment out next line if Exception causes a problem |
|---|
| 44 | #define TypeDefException |
|---|
| 45 | |
|---|
| 46 | //*********************** end of options set by user ******************** |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | // for Gnu C++ version 3 |
|---|
| 50 | #if defined __GNUG__ && __GNUG__ >= 3 |
|---|
| 51 | #define _STANDARD_ // use standard library |
|---|
| 52 | #define ios_format_flags ios::fmtflags |
|---|
| 53 | #endif |
|---|
| 54 | |
|---|
| 55 | // for Intel C++ for Linux |
|---|
| 56 | #if defined __ICC |
|---|
| 57 | #define _STANDARD_ // use standard library |
|---|
| 58 | #define ios_format_flags ios::fmtflags |
|---|
| 59 | #endif |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | #ifdef _STANDARD_ // using standard library |
|---|
| 63 | #include <cstdlib> |
|---|
| 64 | #ifdef _MSC_VER |
|---|
| 65 | #include <limits> // for VC++6 |
|---|
| 66 | #endif |
|---|
| 67 | #ifdef WANT_STREAM |
|---|
| 68 | #include <iostream> |
|---|
| 69 | #include <iomanip> |
|---|
| 70 | #endif |
|---|
| 71 | #ifdef WANT_MATH |
|---|
| 72 | #include <cmath> |
|---|
| 73 | #endif |
|---|
| 74 | #ifdef WANT_STRING |
|---|
| 75 | #include <cstring> |
|---|
| 76 | #endif |
|---|
| 77 | #ifdef WANT_TIME |
|---|
| 78 | #include <ctime> |
|---|
| 79 | #endif |
|---|
| 80 | #ifdef WANT_FSTREAM |
|---|
| 81 | #include <fstream> |
|---|
| 82 | #endif |
|---|
| 83 | using namespace std; |
|---|
| 84 | #else |
|---|
| 85 | |
|---|
| 86 | #define DEFAULT_HEADER // use AT&T style header |
|---|
| 87 | // if no other compiler is recognised |
|---|
| 88 | |
|---|
| 89 | #ifdef _MSC_VER // Microsoft |
|---|
| 90 | #include <stdlib.h> |
|---|
| 91 | |
|---|
| 92 | // reactivate these statements to run under MSC version 7.0 |
|---|
| 93 | // typedef int jmp_buf[9]; |
|---|
| 94 | // extern "C" |
|---|
| 95 | // { |
|---|
| 96 | // int __cdecl setjmp(jmp_buf); |
|---|
| 97 | // void __cdecl longjmp(jmp_buf, int); |
|---|
| 98 | // } |
|---|
| 99 | |
|---|
| 100 | #ifdef WANT_STREAM |
|---|
| 101 | #include <iostream.h> |
|---|
| 102 | #include <iomanip.h> |
|---|
| 103 | #endif |
|---|
| 104 | #ifdef WANT_MATH |
|---|
| 105 | #include <math.h> |
|---|
| 106 | #include <float.h> |
|---|
| 107 | #endif |
|---|
| 108 | #ifdef WANT_STRING |
|---|
| 109 | #include <string.h> |
|---|
| 110 | #endif |
|---|
| 111 | #ifdef WANT_TIME |
|---|
| 112 | #include <time.h> |
|---|
| 113 | #endif |
|---|
| 114 | #ifdef WANT_FSTREAM |
|---|
| 115 | #include <fstream.h> |
|---|
| 116 | #endif |
|---|
| 117 | #undef DEFAULT_HEADER |
|---|
| 118 | #endif |
|---|
| 119 | |
|---|
| 120 | #ifdef __ZTC__ // Zortech |
|---|
| 121 | #include <stdlib.h> |
|---|
| 122 | #ifdef WANT_STREAM |
|---|
| 123 | #include <iostream.hpp> |
|---|
| 124 | #include <iomanip.hpp> |
|---|
| 125 | #define flush "" // not defined in iomanip? |
|---|
| 126 | #endif |
|---|
| 127 | #ifdef WANT_MATH |
|---|
| 128 | #include <math.h> |
|---|
| 129 | #include <float.h> |
|---|
| 130 | #endif |
|---|
| 131 | #ifdef WANT_STRING |
|---|
| 132 | #include <string.h> |
|---|
| 133 | #endif |
|---|
| 134 | #ifdef WANT_TIME |
|---|
| 135 | #include <time.h> |
|---|
| 136 | #endif |
|---|
| 137 | #ifdef WANT_FSTREAM |
|---|
| 138 | #include <fstream.h> |
|---|
| 139 | #endif |
|---|
| 140 | #undef DEFAULT_HEADER |
|---|
| 141 | #endif |
|---|
| 142 | |
|---|
| 143 | #if defined __BCPLUSPLUS__ || defined __TURBOC__ // Borland or Turbo |
|---|
| 144 | #include <stdlib.h> |
|---|
| 145 | #ifdef WANT_STREAM |
|---|
| 146 | #include <iostream.h> |
|---|
| 147 | #include <iomanip.h> |
|---|
| 148 | #endif |
|---|
| 149 | #ifdef WANT_MATH |
|---|
| 150 | #include <math.h> |
|---|
| 151 | #include <float.h> // Borland has both float and values |
|---|
| 152 | // but values.h returns +INF for |
|---|
| 153 | // MAXDOUBLE in BC5 |
|---|
| 154 | #endif |
|---|
| 155 | #ifdef WANT_STRING |
|---|
| 156 | #include <string.h> |
|---|
| 157 | #endif |
|---|
| 158 | #ifdef WANT_TIME |
|---|
| 159 | #include <time.h> |
|---|
| 160 | #endif |
|---|
| 161 | #ifdef WANT_FSTREAM |
|---|
| 162 | #include <fstream.h> |
|---|
| 163 | #endif |
|---|
| 164 | #undef DEFAULT_HEADER |
|---|
| 165 | #endif |
|---|
| 166 | |
|---|
| 167 | #ifdef __GNUG__ // Gnu C++ |
|---|
| 168 | #include <stdlib.h> |
|---|
| 169 | #ifdef WANT_STREAM |
|---|
| 170 | #include <iostream.h> |
|---|
| 171 | #include <iomanip.h> |
|---|
| 172 | #endif |
|---|
| 173 | #ifdef WANT_MATH |
|---|
| 174 | #include <math.h> |
|---|
| 175 | #include <float.h> |
|---|
| 176 | #endif |
|---|
| 177 | #ifdef WANT_STRING |
|---|
| 178 | #include <string.h> |
|---|
| 179 | #endif |
|---|
| 180 | #ifdef WANT_TIME |
|---|
| 181 | #include <time.h> |
|---|
| 182 | #endif |
|---|
| 183 | #ifdef WANT_FSTREAM |
|---|
| 184 | #include <fstream.h> |
|---|
| 185 | #endif |
|---|
| 186 | #undef DEFAULT_HEADER |
|---|
| 187 | #endif |
|---|
| 188 | |
|---|
| 189 | #ifdef __WATCOMC__ // Watcom C/C++ |
|---|
| 190 | #include <stdlib.h> |
|---|
| 191 | #ifdef WANT_STREAM |
|---|
| 192 | #include <iostream.h> |
|---|
| 193 | #include <iomanip.h> |
|---|
| 194 | #endif |
|---|
| 195 | #ifdef WANT_MATH |
|---|
| 196 | #include <math.h> |
|---|
| 197 | #include <float.h> |
|---|
| 198 | #endif |
|---|
| 199 | #ifdef WANT_STRING |
|---|
| 200 | #include <string.h> |
|---|
| 201 | #endif |
|---|
| 202 | #ifdef WANT_TIME |
|---|
| 203 | #include <time.h> |
|---|
| 204 | #endif |
|---|
| 205 | #ifdef WANT_FSTREAM |
|---|
| 206 | #include <fstream.h> |
|---|
| 207 | #endif |
|---|
| 208 | #undef DEFAULT_HEADER |
|---|
| 209 | #endif |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | #ifdef macintosh // MPW C++ on the Mac |
|---|
| 213 | #include <stdlib.h> |
|---|
| 214 | #ifdef WANT_STREAM |
|---|
| 215 | #include <iostream.h> |
|---|
| 216 | #include <iomanip.h> |
|---|
| 217 | #endif |
|---|
| 218 | #ifdef WANT_MATH |
|---|
| 219 | #include <float.h> |
|---|
| 220 | #include <math.h> |
|---|
| 221 | #endif |
|---|
| 222 | #ifdef WANT_STRING |
|---|
| 223 | #include <string.h> |
|---|
| 224 | #endif |
|---|
| 225 | #ifdef WANT_TIME |
|---|
| 226 | #include <time.h> |
|---|
| 227 | #endif |
|---|
| 228 | #ifdef WANT_FSTREAM |
|---|
| 229 | #include <fstream.h> |
|---|
| 230 | #endif |
|---|
| 231 | #undef DEFAULT_HEADER |
|---|
| 232 | #endif |
|---|
| 233 | |
|---|
| 234 | #ifdef use_float_h // use float.h for precision values |
|---|
| 235 | #include <stdlib.h> |
|---|
| 236 | #ifdef WANT_STREAM |
|---|
| 237 | #include <iostream.h> |
|---|
| 238 | #include <iomanip.h> |
|---|
| 239 | #endif |
|---|
| 240 | #ifdef WANT_MATH |
|---|
| 241 | #include <float.h> |
|---|
| 242 | #include <math.h> |
|---|
| 243 | #endif |
|---|
| 244 | #ifdef WANT_STRING |
|---|
| 245 | #include <string.h> |
|---|
| 246 | #endif |
|---|
| 247 | #ifdef WANT_TIME |
|---|
| 248 | #include <time.h> |
|---|
| 249 | #endif |
|---|
| 250 | #ifdef WANT_FSTREAM |
|---|
| 251 | #include <fstream.h> |
|---|
| 252 | #endif |
|---|
| 253 | #undef DEFAULT_HEADER |
|---|
| 254 | #endif |
|---|
| 255 | |
|---|
| 256 | |
|---|
| 257 | #ifdef DEFAULT_HEADER // for example AT&T |
|---|
| 258 | #define ATandT |
|---|
| 259 | #include <stdlib.h> |
|---|
| 260 | #ifdef WANT_STREAM |
|---|
| 261 | #include <iostream.h> |
|---|
| 262 | #include <iomanip.h> |
|---|
| 263 | #endif |
|---|
| 264 | #ifdef WANT_MATH |
|---|
| 265 | #include <math.h> |
|---|
| 266 | #define SystemV // use System V |
|---|
| 267 | #include <values.h> |
|---|
| 268 | #endif |
|---|
| 269 | #ifdef WANT_STRING |
|---|
| 270 | #include <string.h> |
|---|
| 271 | #endif |
|---|
| 272 | #ifdef WANT_TIME |
|---|
| 273 | #include <time.h> |
|---|
| 274 | #endif |
|---|
| 275 | #ifdef WANT_FSTREAM |
|---|
| 276 | #include <fstream.h> |
|---|
| 277 | #endif |
|---|
| 278 | #endif // DEFAULT_HEADER |
|---|
| 279 | |
|---|
| 280 | #endif // _STANDARD_ |
|---|
| 281 | |
|---|
| 282 | #ifdef use_namespace |
|---|
| 283 | namespace RBD_COMMON { |
|---|
| 284 | #endif |
|---|
| 285 | |
|---|
| 286 | |
|---|
| 287 | #ifdef USING_FLOAT // set precision type to float |
|---|
| 288 | typedef float Real; |
|---|
| 289 | typedef double long_Real; |
|---|
| 290 | #endif |
|---|
| 291 | |
|---|
| 292 | #ifdef USING_DOUBLE // set precision type to double |
|---|
| 293 | typedef double Real; |
|---|
| 294 | typedef long double long_Real; |
|---|
| 295 | #endif |
|---|
| 296 | |
|---|
| 297 | |
|---|
| 298 | // This is for (very old) compilers that do not have bool automatically defined |
|---|
| 299 | |
|---|
| 300 | #ifndef bool_LIB |
|---|
| 301 | #define bool_LIB 0 |
|---|
| 302 | |
|---|
| 303 | class bool |
|---|
| 304 | { |
|---|
| 305 | int value; |
|---|
| 306 | public: |
|---|
| 307 | bool(const int b) { value = b ? 1 : 0; } |
|---|
| 308 | bool(const void* b) { value = b ? 1 : 0; } |
|---|
| 309 | bool() {} |
|---|
| 310 | operator int() const { return value; } |
|---|
| 311 | int operator!() const { return !value; } |
|---|
| 312 | }; |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | const bool true = 1; |
|---|
| 316 | const bool false = 0; |
|---|
| 317 | |
|---|
| 318 | #endif |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | #ifdef use_namespace |
|---|
| 323 | } |
|---|
| 324 | #endif |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | #ifdef use_namespace |
|---|
| 328 | namespace RBD_COMMON {} |
|---|
| 329 | namespace RBD_LIBRARIES // access all my libraries |
|---|
| 330 | { |
|---|
| 331 | using namespace RBD_COMMON; |
|---|
| 332 | } |
|---|
| 333 | #endif |
|---|
| 334 | |
|---|
| 335 | |
|---|
| 336 | #endif |
|---|