[1261] | 1 | #ifndef MACHDEFS_SEEN
|
---|
| 2 | #define MACHDEFS_SEEN
|
---|
| 3 |
|
---|
| 4 | /***********************************************************************/
|
---|
| 5 | /* Find hardware, OS and compiler combination */
|
---|
| 6 | /***********************************************************************/
|
---|
| 7 |
|
---|
| 8 | #if defined(OSF1)
|
---|
| 9 | #define MACH_ALPHA
|
---|
| 10 | #define OS_OSF1
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 | #if defined(_AIX) || defined(AIX)
|
---|
| 14 | #define MACH_IBMRS
|
---|
| 15 | #define OS_AIX
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
| 18 | #if defined(__hpux__) || defined(HPUX)
|
---|
| 19 | #define MACH_HP
|
---|
| 20 | #define OS_HPUX
|
---|
| 21 | #endif
|
---|
| 22 |
|
---|
| 23 | #ifdef __MWERKS__
|
---|
| 24 | #define MACH_POWERMAC
|
---|
| 25 | #define OS_MACOS
|
---|
| 26 | #endif
|
---|
| 27 |
|
---|
| 28 | #if defined(SunOS) || defined ( sun )
|
---|
| 29 | #define MACH_SUN
|
---|
| 30 | #define OS_SOLARIS
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 | #ifdef IRIX64
|
---|
| 34 | #define MACH_SGI
|
---|
| 35 | #define OS_IRIX64
|
---|
| 36 | #endif
|
---|
| 37 |
|
---|
[1783] | 38 | #ifdef __APPLE__
|
---|
| 39 | #ifdef __MACH__
|
---|
| 40 | #define MACH_POWERPC
|
---|
| 41 | #define OS_MACOSX
|
---|
| 42 | #endif
|
---|
| 43 | #endif
|
---|
| 44 |
|
---|
[1261] | 45 | #if defined(Linux) || defined(linux)
|
---|
| 46 | #if defined(__alpha__)
|
---|
| 47 | #define MACH_ALPHA
|
---|
| 48 | #elif defined(powerpc)
|
---|
| 49 | #define MACH_POWERPC
|
---|
| 50 | #elif defined(__i386__)
|
---|
| 51 | #define MACH_INTEL
|
---|
| 52 | #else
|
---|
| 53 | #error Undefined Platform (machine) type with linux in machdefs.h
|
---|
| 54 | #endif
|
---|
| 55 | #define OS_LINUX
|
---|
| 56 | #endif
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | /***********************************************************************/
|
---|
| 60 | /* Hardware/OS dependent stuff */
|
---|
| 61 | /***********************************************************************/
|
---|
| 62 |
|
---|
| 63 | #if defined(OS_OSF1)
|
---|
| 64 |
|
---|
| 65 | typedef signed char int_1;
|
---|
| 66 | typedef unsigned char uint_1;
|
---|
| 67 | typedef int int_4;
|
---|
| 68 | typedef unsigned int uint_4;
|
---|
| 69 | typedef short int_2;
|
---|
| 70 | typedef unsigned short uint_2;
|
---|
| 71 | typedef float r_4;
|
---|
| 72 | typedef double r_8;
|
---|
| 73 | typedef long long int_8;
|
---|
| 74 | typedef unsigned long long uint_8;
|
---|
| 75 |
|
---|
| 76 | #define SWAP 1
|
---|
| 77 | #define SWAPDEFAUT 1
|
---|
| 78 |
|
---|
| 79 | #elif defined(OS_HPUX)
|
---|
| 80 |
|
---|
| 81 | typedef signed char int_1;
|
---|
| 82 | typedef unsigned char uint_1;
|
---|
| 83 | typedef int int_4 ;
|
---|
| 84 | typedef unsigned int uint_4;
|
---|
| 85 | typedef short int_2;
|
---|
| 86 | typedef unsigned short uint_2;
|
---|
| 87 | typedef float r_4;
|
---|
| 88 | typedef double r_8;
|
---|
| 89 | typedef long long int_8;
|
---|
| 90 | typedef unsigned long long uint_8;
|
---|
| 91 |
|
---|
| 92 | #define SWAP 0
|
---|
| 93 | #define SWAPDEFAUT 0
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | #elif defined( OS_AIX )
|
---|
| 97 |
|
---|
| 98 | typedef signed char int_1;
|
---|
| 99 | typedef unsigned char uint_1;
|
---|
| 100 | typedef int int_4;
|
---|
| 101 | typedef unsigned int uint_4;
|
---|
| 102 | typedef short int_2;
|
---|
| 103 | typedef unsigned short uint_2;
|
---|
| 104 | typedef float r_4;
|
---|
| 105 | typedef double r_8;
|
---|
| 106 | typedef long long int_8;
|
---|
| 107 | typedef unsigned long long uint_8;
|
---|
| 108 |
|
---|
| 109 | #define SWAP 0
|
---|
| 110 | #define SWAPDEFAUT 0
|
---|
| 111 |
|
---|
| 112 | /* Check for solaris on intel... */
|
---|
| 113 | #elif defined( OS_SOLARIS ) && defined( MACH_SUN )
|
---|
| 114 |
|
---|
| 115 | typedef signed char int_1;
|
---|
| 116 | typedef unsigned char uint_1;
|
---|
| 117 | typedef int int_4;
|
---|
| 118 | typedef unsigned int uint_4;
|
---|
| 119 | typedef short int_2;
|
---|
| 120 | typedef unsigned short uint_2;
|
---|
| 121 | typedef float r_4;
|
---|
| 122 | typedef double r_8;
|
---|
| 123 | typedef long long int_8;
|
---|
| 124 | typedef unsigned long long uint_8;
|
---|
| 125 |
|
---|
| 126 | #define SWAP 0
|
---|
| 127 | #define SWAPDEFAUT 0
|
---|
| 128 |
|
---|
| 129 | #elif defined( OS_IRIX64 )
|
---|
| 130 |
|
---|
| 131 | typedef signed char int_1;
|
---|
| 132 | typedef unsigned char uint_1;
|
---|
| 133 | typedef int int_4;
|
---|
| 134 | typedef unsigned int uint_4;
|
---|
| 135 | typedef short int_2;
|
---|
| 136 | typedef unsigned short uint_2;
|
---|
| 137 | typedef float r_4;
|
---|
| 138 | typedef double r_8;
|
---|
| 139 | typedef long long int_8;
|
---|
| 140 | typedef unsigned long long uint_8;
|
---|
| 141 |
|
---|
| 142 | #define SWAP 0
|
---|
| 143 | #define SWAPDEFAUT 0
|
---|
| 144 |
|
---|
| 145 | /* Check linux on other machines than Intel */
|
---|
| 146 | #elif defined(OS_LINUX)
|
---|
| 147 | /* Sizes OK for PowerPC, Alpha, Intel */
|
---|
| 148 | /* On Alpha, long is 8 bytes */
|
---|
| 149 | typedef signed char int_1;
|
---|
| 150 | typedef unsigned char uint_1;
|
---|
| 151 | typedef int int_4;
|
---|
| 152 | typedef unsigned int uint_4;
|
---|
| 153 | typedef short int_2;
|
---|
| 154 | typedef unsigned short uint_2;
|
---|
| 155 | typedef float r_4;
|
---|
| 156 | typedef double r_8;
|
---|
| 157 | typedef long long int_8;
|
---|
| 158 | typedef unsigned long long uint_8;
|
---|
| 159 |
|
---|
| 160 | #if defined(powerpc) || (__alpha__)
|
---|
| 161 | #define SWAP 0
|
---|
| 162 | #define SWAPDEFAUT 0
|
---|
| 163 | #else
|
---|
| 164 | #define SWAP 1
|
---|
| 165 | #define SWAPDEFAUT 1
|
---|
| 166 | #endif
|
---|
| 167 |
|
---|
| 168 | #elif defined(OS_MACOS)
|
---|
| 169 |
|
---|
| 170 | typedef signed char int_1;
|
---|
| 171 | typedef unsigned char uint_1;
|
---|
| 172 | typedef long int_4;
|
---|
| 173 | typedef unsigned long uint_4;
|
---|
| 174 | typedef short int_2;
|
---|
| 175 | typedef unsigned short uint_2;
|
---|
| 176 | typedef float r_4;
|
---|
| 177 | typedef double r_8;
|
---|
| 178 | typedef long long int_8;
|
---|
| 179 | typedef unsigned long long uint_8;
|
---|
| 180 |
|
---|
| 181 | #define SWAP 0
|
---|
| 182 | #define SWAPDEFAUT 0
|
---|
| 183 |
|
---|
[1783] | 184 | #elif defined(OS_MACOSX)
|
---|
| 185 |
|
---|
| 186 | typedef signed char int_1;
|
---|
| 187 | typedef unsigned char uint_1;
|
---|
| 188 | typedef int int_4;
|
---|
| 189 | typedef unsigned int uint_4;
|
---|
| 190 | typedef short int_2;
|
---|
| 191 | typedef unsigned short uint_2;
|
---|
| 192 | typedef float r_4;
|
---|
| 193 | typedef double r_8;
|
---|
| 194 | typedef long long int_8;
|
---|
| 195 | typedef unsigned long long uint_8;
|
---|
| 196 |
|
---|
| 197 | #define SWAP 0
|
---|
| 198 | #define SWAPDEFAUT 0
|
---|
| 199 |
|
---|
| 200 |
|
---|
[1261] | 201 | #else
|
---|
| 202 | #error Undefined Machine/OS type in machdefs.h
|
---|
| 203 | #endif
|
---|
| 204 |
|
---|
| 205 |
|
---|
| 206 |
|
---|
| 207 | #if SWAP==1
|
---|
| 208 | #define IS_BIG_ENDIAN 0
|
---|
| 209 | #else
|
---|
| 210 | #define IS_BIG_ENDIAN 1
|
---|
| 211 | #endif
|
---|
| 212 |
|
---|
| 213 |
|
---|
| 214 | /***********************************************************************/
|
---|
| 215 | /* Find Compiler */
|
---|
| 216 | /***********************************************************************/
|
---|
| 217 |
|
---|
| 218 | /* __MWERKS__ : Metrowerks Codewarrior (>= PRO 4) */
|
---|
| 219 | /* __DECCXX : DEC CXX, version >= 6 is required */
|
---|
| 220 | /* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
|
---|
| 221 | /* __aCC__ : aCC on HP */
|
---|
| 222 | /* __KCC__ : KCC, version >= 3.3 is required */
|
---|
| 223 | /* __SGICC__ : SGI (IRIX64) CC compiler */
|
---|
| 224 |
|
---|
| 225 | /***********************************************************************/
|
---|
| 226 | /* Compiler-specific stuff */
|
---|
| 227 | /***********************************************************************/
|
---|
| 228 |
|
---|
| 229 | /* Some features will be *required* for Planck. Which ones ? */
|
---|
| 230 |
|
---|
| 231 | /* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
|
---|
| 232 | /* GNUG_TEMPLATES : use GNU syntax for explicit templates */
|
---|
| 233 | /* PRAGMA_TEMPLATES : use pragma template, a la cxx */
|
---|
| 234 | /* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
|
---|
| 235 | /* STREAMPOS_IS_CLASS : streampos is a real class */
|
---|
| 236 | /* ITER_TAG : use iter_tag for iterator qualifiers in STL */
|
---|
| 237 | /* NO_STRSTREAM : does not have strstream */
|
---|
[1889] | 238 | /* NO_EXPLICIT : does not know about explicit keyword */
|
---|
[1261] | 239 | /* HAS_IOS_BIN */
|
---|
| 240 | /* HAS_IOS_NOCREATE */
|
---|
| 241 | /* HAS_VEC_NEW : operator new[] */
|
---|
| 242 | /* CC_HAS_RTTI_SUPPORT has Run Time Type Identification support */
|
---|
| 243 | /* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
|
---|
| 244 | /* HAS_STR_NPOS : has string::npos and not a global NPOS */
|
---|
| 245 | /* NO_IOS_COMPLEX : does not have operator << defined for complex */
|
---|
| 246 |
|
---|
| 247 |
|
---|
[2322] | 248 | /* (STREAMPOS_IS_CLASS non-active: ca compile sans sur gcc3.2 et cxx)
|
---|
| 249 | rz+cmv 11/02/03 */
|
---|
| 250 |
|
---|
[1261] | 251 | /* The following is true for most compilers */
|
---|
| 252 |
|
---|
| 253 | #ifndef HAS_VEC_NEW
|
---|
| 254 | #define HAS_VEC_NEW
|
---|
| 255 | #endif
|
---|
| 256 |
|
---|
| 257 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 258 | #define COMPILER_EXCEPTIONS
|
---|
| 259 | #endif
|
---|
| 260 |
|
---|
| 261 | #ifndef CC_HAS_RTTI_SUPPORT
|
---|
| 262 | #define CC_HAS_RTTI_SUPPORT
|
---|
| 263 | #endif
|
---|
| 264 |
|
---|
| 265 | /* now the specific things */
|
---|
| 266 |
|
---|
| 267 | #ifdef __MWERKS__
|
---|
| 268 | #define ANSI_TEMPLATES
|
---|
| 269 | #undef HAS_VEC_NEW
|
---|
| 270 | #define NO_STRSTREAM
|
---|
| 271 | //#define STREAMPOS_IS_CLASS
|
---|
| 272 | #define ITER_TAG
|
---|
| 273 | #define HAS_IOS_BIN
|
---|
| 274 | #define HAS_IOS_NOCREATE
|
---|
| 275 | #define HAS_STR_NPOS
|
---|
| 276 | #endif
|
---|
| 277 |
|
---|
| 278 | #ifdef __GNUG__
|
---|
| 279 | #define ANSI_TEMPLATES
|
---|
[2322] | 280 | /*
|
---|
| 281 | if (__GNUC__ >= 3)
|
---|
| 282 | define STREAMPOS_IS_CLASS
|
---|
| 283 | endif
|
---|
| 284 | */
|
---|
| 285 | #define GNU_TEMPLATES
|
---|
[1261] | 286 | #define HAS_STR_NPOS
|
---|
| 287 | #define HAS_IOS_BIN
|
---|
| 288 | #define HAS_IOS_NOCREATE
|
---|
| 289 | #endif
|
---|
| 290 |
|
---|
| 291 | #ifdef __DECCXX
|
---|
| 292 | #define HAS_STR_NPOS
|
---|
| 293 | #define ITER_TAG
|
---|
| 294 | #define __CXX_PRAGMA_TEMPLATES__
|
---|
| 295 | #define PRAGMA_TEMPLATES
|
---|
| 296 | #endif
|
---|
| 297 |
|
---|
| 298 | #if defined (__aCC__)
|
---|
| 299 | #ifndef ANSI_TEMPLATES
|
---|
| 300 | #define ANSI_TEMPLATES
|
---|
| 301 | #endif
|
---|
| 302 | #endif
|
---|
| 303 |
|
---|
| 304 | #if defined(__KCC__)
|
---|
| 305 | /* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
|
---|
| 306 | #define HAS_STR_NPOS
|
---|
| 307 | #ifndef ANSI_TEMPLATES
|
---|
| 308 | #define ANSI_TEMPLATES
|
---|
| 309 | #endif
|
---|
| 310 | #endif
|
---|
| 311 |
|
---|
| 312 | #if defined(__SGICC__)
|
---|
| 313 | #define HAS_STR_NPOS
|
---|
| 314 | #ifndef ANSI_TEMPLATES
|
---|
| 315 | #define ANSI_TEMPLATES
|
---|
| 316 | #endif
|
---|
| 317 | #endif
|
---|
| 318 |
|
---|
| 319 | /* Get things has homogeneous as possible between compilers */
|
---|
| 320 |
|
---|
| 321 | #ifdef HAS_STR_NPOS
|
---|
| 322 | #define NPOS string::npos
|
---|
| 323 | #else
|
---|
| 324 | #define NPOS (size_t)-1
|
---|
| 325 | #endif
|
---|
| 326 |
|
---|
| 327 | #ifndef __GNUG__
|
---|
| 328 | #define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 329 | #ifndef __FUNCTION__
|
---|
| 330 | #define __FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 331 | #endif
|
---|
| 332 | #ifndef __KCC__
|
---|
| 333 | #define __attribute__(_x_)
|
---|
| 334 | #endif
|
---|
| 335 | #endif
|
---|
| 336 |
|
---|
[1889] | 337 | #ifdef NO_EXPLICIT
|
---|
[1261] | 338 | #define explicit
|
---|
| 339 | #endif
|
---|
| 340 |
|
---|
| 341 | #ifdef HAS_IOS_BIN
|
---|
| 342 | #define IOS_BIN ios::binary
|
---|
| 343 | #else
|
---|
| 344 | #define IOS_BIN 0
|
---|
| 345 | #endif
|
---|
| 346 |
|
---|
[2322] | 347 | /* Commente par Reza+CMV - Fev 2003
|
---|
| 348 | ifdef ANSI_IO
|
---|
| 349 | define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
|
---|
| 350 | define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
|
---|
| 351 | endif
|
---|
| 352 | */
|
---|
[1261] | 353 |
|
---|
| 354 | #ifdef __MWERKS__
|
---|
| 355 | //#define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
|
---|
| 356 | #define random() (rand()*65538.0 + rand()*2. + rand())
|
---|
| 357 | #define srandom srand
|
---|
| 358 | #define initstate(seed, tab, n) srand(seed)
|
---|
| 359 | #define nice(_x)
|
---|
| 360 |
|
---|
| 361 | #ifdef __cplusplus
|
---|
| 362 | #include <string.h>
|
---|
| 363 | #include <string>
|
---|
| 364 | inline bool operator< (string const& s1, string const& s2)
|
---|
| 365 | { return (strcmp(s1.c_str(), s2.c_str()) < 0); }
|
---|
| 366 | #endif
|
---|
| 367 | #endif
|
---|
| 368 |
|
---|
[1783] | 369 | #ifdef OS_MACOSX
|
---|
| 370 | #define NO_VALUES_H
|
---|
| 371 | #include "osx_values.h"
|
---|
| 372 | #endif
|
---|
[1261] | 373 |
|
---|
[1783] | 374 |
|
---|
[1261] | 375 | /********************************************************/
|
---|
| 376 | /* Outil d'impressions pour debug */
|
---|
| 377 | #define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
|
---|
| 378 | #define CR {cout<<"\n"<<flush;}
|
---|
| 379 | /* ********************************************************/
|
---|
| 380 |
|
---|
| 381 | /* ---- Activation des flags de debug/bound checking ----- */
|
---|
| 382 | #ifdef SOPHYA_DEBUG
|
---|
| 383 | #define SO_BOUNDCHECKING
|
---|
| 384 | #endif
|
---|
| 385 |
|
---|
| 386 | /* ---- La taille et les index des tableaux ---- */
|
---|
| 387 | #ifdef SGI_ARCH64
|
---|
| 388 | typedef int_8 sa_size_t ;
|
---|
| 389 | #else
|
---|
| 390 | typedef int_4 sa_size_t ;
|
---|
| 391 | #endif
|
---|
| 392 |
|
---|
| 393 | /* Compatibilite, avant de migrer tout le code en "PLANCK" */
|
---|
| 394 |
|
---|
| 395 | #ifdef __cplusplus
|
---|
[1870] | 396 | /* Standard C++ library classes are in the namespace std */
|
---|
| 397 | namespace std { }
|
---|
| 398 | using namespace std;
|
---|
| 399 | /* SOPHYA classes are in namespace SOPHYA */
|
---|
[1261] | 400 | namespace SOPHYA {}
|
---|
| 401 | using namespace SOPHYA;
|
---|
| 402 | #define EXPLICIT explicit
|
---|
| 403 | #endif
|
---|
| 404 |
|
---|
| 405 | #endif
|
---|