[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__
|
---|
[3070] | 40 | #ifdef __POWERPC__
|
---|
[1783] | 41 | #define MACH_POWERPC
|
---|
[3070] | 42 | #else
|
---|
| 43 | #define MACH_INTEL
|
---|
| 44 | #endif
|
---|
[1783] | 45 | #define OS_MACOSX
|
---|
| 46 | #endif
|
---|
| 47 | #endif
|
---|
| 48 |
|
---|
[1261] | 49 | #if defined(Linux) || defined(linux)
|
---|
| 50 | #if defined(__alpha__)
|
---|
| 51 | #define MACH_ALPHA
|
---|
| 52 | #elif defined(powerpc)
|
---|
| 53 | #define MACH_POWERPC
|
---|
[3131] | 54 | /* ----------------------
|
---|
| 55 | $CHECK$ (Reza Jan07) : __i386__ pas defini sur AMD
|
---|
| 56 | Il faut affiner ce test, si on veut etre sur
|
---|
| 57 | qu'on ait sur un processeur compatible Intel ( / AMD )
|
---|
| 58 | #elif defined(__i386__)
|
---|
| 59 | #define MACH_INTEL
|
---|
| 60 | #else
|
---|
| 61 | #error Undefined Platform (machine) type with linux in machdefs.h
|
---|
| 62 | -------------------------- */
|
---|
[1261] | 63 | #endif
|
---|
| 64 | #define OS_LINUX
|
---|
| 65 | #endif
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | /***********************************************************************/
|
---|
| 69 | /* Hardware/OS dependent stuff */
|
---|
| 70 | /***********************************************************************/
|
---|
| 71 |
|
---|
| 72 | #if defined(OS_OSF1)
|
---|
| 73 |
|
---|
| 74 | typedef signed char int_1;
|
---|
| 75 | typedef unsigned char uint_1;
|
---|
| 76 | typedef int int_4;
|
---|
| 77 | typedef unsigned int uint_4;
|
---|
| 78 | typedef short int_2;
|
---|
| 79 | typedef unsigned short uint_2;
|
---|
| 80 | typedef float r_4;
|
---|
| 81 | typedef double r_8;
|
---|
| 82 | typedef long long int_8;
|
---|
| 83 | typedef unsigned long long uint_8;
|
---|
| 84 |
|
---|
| 85 | #define SWAP 1
|
---|
| 86 | #define SWAPDEFAUT 1
|
---|
| 87 |
|
---|
| 88 | #elif defined(OS_HPUX)
|
---|
| 89 |
|
---|
| 90 | typedef signed char int_1;
|
---|
| 91 | typedef unsigned char uint_1;
|
---|
| 92 | typedef int int_4 ;
|
---|
| 93 | typedef unsigned int uint_4;
|
---|
| 94 | typedef short int_2;
|
---|
| 95 | typedef unsigned short uint_2;
|
---|
| 96 | typedef float r_4;
|
---|
| 97 | typedef double r_8;
|
---|
| 98 | typedef long long int_8;
|
---|
| 99 | typedef unsigned long long uint_8;
|
---|
| 100 |
|
---|
| 101 | #define SWAP 0
|
---|
| 102 | #define SWAPDEFAUT 0
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | #elif defined( OS_AIX )
|
---|
| 106 |
|
---|
| 107 | typedef signed char int_1;
|
---|
| 108 | typedef unsigned char uint_1;
|
---|
| 109 | typedef int int_4;
|
---|
| 110 | typedef unsigned int uint_4;
|
---|
| 111 | typedef short int_2;
|
---|
| 112 | typedef unsigned short uint_2;
|
---|
| 113 | typedef float r_4;
|
---|
| 114 | typedef double r_8;
|
---|
| 115 | typedef long long int_8;
|
---|
| 116 | typedef unsigned long long uint_8;
|
---|
| 117 |
|
---|
| 118 | #define SWAP 0
|
---|
| 119 | #define SWAPDEFAUT 0
|
---|
| 120 |
|
---|
| 121 | /* Check for solaris on intel... */
|
---|
| 122 | #elif defined( OS_SOLARIS ) && defined( MACH_SUN )
|
---|
| 123 |
|
---|
| 124 | typedef signed char int_1;
|
---|
| 125 | typedef unsigned char uint_1;
|
---|
| 126 | typedef int int_4;
|
---|
| 127 | typedef unsigned int uint_4;
|
---|
| 128 | typedef short int_2;
|
---|
| 129 | typedef unsigned short uint_2;
|
---|
| 130 | typedef float r_4;
|
---|
| 131 | typedef double r_8;
|
---|
| 132 | typedef long long int_8;
|
---|
| 133 | typedef unsigned long long uint_8;
|
---|
| 134 |
|
---|
| 135 | #define SWAP 0
|
---|
| 136 | #define SWAPDEFAUT 0
|
---|
| 137 |
|
---|
| 138 | #elif defined( OS_IRIX64 )
|
---|
| 139 |
|
---|
| 140 | typedef signed char int_1;
|
---|
| 141 | typedef unsigned char uint_1;
|
---|
| 142 | typedef int int_4;
|
---|
| 143 | typedef unsigned int uint_4;
|
---|
| 144 | typedef short int_2;
|
---|
| 145 | typedef unsigned short uint_2;
|
---|
| 146 | typedef float r_4;
|
---|
| 147 | typedef double r_8;
|
---|
| 148 | typedef long long int_8;
|
---|
| 149 | typedef unsigned long long uint_8;
|
---|
| 150 |
|
---|
| 151 | #define SWAP 0
|
---|
| 152 | #define SWAPDEFAUT 0
|
---|
| 153 |
|
---|
| 154 | /* Check linux on other machines than Intel */
|
---|
| 155 | #elif defined(OS_LINUX)
|
---|
| 156 | /* Sizes OK for PowerPC, Alpha, Intel */
|
---|
| 157 | /* On Alpha, long is 8 bytes */
|
---|
| 158 | typedef signed char int_1;
|
---|
| 159 | typedef unsigned char uint_1;
|
---|
| 160 | typedef int int_4;
|
---|
| 161 | typedef unsigned int uint_4;
|
---|
| 162 | typedef short int_2;
|
---|
| 163 | typedef unsigned short uint_2;
|
---|
| 164 | typedef float r_4;
|
---|
| 165 | typedef double r_8;
|
---|
| 166 | typedef long long int_8;
|
---|
| 167 | typedef unsigned long long uint_8;
|
---|
| 168 |
|
---|
| 169 | #if defined(powerpc) || (__alpha__)
|
---|
| 170 | #define SWAP 0
|
---|
| 171 | #define SWAPDEFAUT 0
|
---|
| 172 | #else
|
---|
| 173 | #define SWAP 1
|
---|
| 174 | #define SWAPDEFAUT 1
|
---|
| 175 | #endif
|
---|
| 176 |
|
---|
| 177 | #elif defined(OS_MACOS)
|
---|
| 178 |
|
---|
| 179 | typedef signed char int_1;
|
---|
| 180 | typedef unsigned char uint_1;
|
---|
| 181 | typedef long int_4;
|
---|
| 182 | typedef unsigned long uint_4;
|
---|
| 183 | typedef short int_2;
|
---|
| 184 | typedef unsigned short uint_2;
|
---|
| 185 | typedef float r_4;
|
---|
| 186 | typedef double r_8;
|
---|
| 187 | typedef long long int_8;
|
---|
| 188 | typedef unsigned long long uint_8;
|
---|
| 189 |
|
---|
| 190 | #define SWAP 0
|
---|
| 191 | #define SWAPDEFAUT 0
|
---|
| 192 |
|
---|
[1783] | 193 | #elif defined(OS_MACOSX)
|
---|
| 194 |
|
---|
| 195 | typedef signed char int_1;
|
---|
| 196 | typedef unsigned char uint_1;
|
---|
| 197 | typedef int int_4;
|
---|
| 198 | typedef unsigned int uint_4;
|
---|
| 199 | typedef short int_2;
|
---|
| 200 | typedef unsigned short uint_2;
|
---|
| 201 | typedef float r_4;
|
---|
| 202 | typedef double r_8;
|
---|
| 203 | typedef long long int_8;
|
---|
| 204 | typedef unsigned long long uint_8;
|
---|
| 205 |
|
---|
[3070] | 206 | #ifdef MACH_POWERPC
|
---|
[1783] | 207 | #define SWAP 0
|
---|
| 208 | #define SWAPDEFAUT 0
|
---|
[3070] | 209 | #else
|
---|
| 210 | #define SWAP 1
|
---|
| 211 | #define SWAPDEFAUT 1
|
---|
| 212 | #endif
|
---|
[1783] | 213 |
|
---|
[1261] | 214 | #else
|
---|
| 215 | #error Undefined Machine/OS type in machdefs.h
|
---|
| 216 | #endif
|
---|
| 217 |
|
---|
| 218 |
|
---|
| 219 |
|
---|
| 220 | #if SWAP==1
|
---|
| 221 | #define IS_BIG_ENDIAN 0
|
---|
| 222 | #else
|
---|
| 223 | #define IS_BIG_ENDIAN 1
|
---|
| 224 | #endif
|
---|
| 225 |
|
---|
| 226 |
|
---|
| 227 | /***********************************************************************/
|
---|
| 228 | /* Find Compiler */
|
---|
| 229 | /***********************************************************************/
|
---|
| 230 |
|
---|
| 231 | /* __MWERKS__ : Metrowerks Codewarrior (>= PRO 4) */
|
---|
| 232 | /* __DECCXX : DEC CXX, version >= 6 is required */
|
---|
| 233 | /* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
|
---|
| 234 | /* __aCC__ : aCC on HP */
|
---|
| 235 | /* __KCC__ : KCC, version >= 3.3 is required */
|
---|
| 236 | /* __SGICC__ : SGI (IRIX64) CC compiler */
|
---|
[2884] | 237 | /* __INTEL_COMPILER : : INTEL compiler */
|
---|
| 238 | /* __IBMCPP__ : AIX (IBM) xlC c++ compiler */
|
---|
[1261] | 239 |
|
---|
| 240 | /***********************************************************************/
|
---|
| 241 | /* Compiler-specific stuff */
|
---|
| 242 | /***********************************************************************/
|
---|
| 243 |
|
---|
| 244 | /* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
|
---|
| 245 | /* GNUG_TEMPLATES : use GNU syntax for explicit templates */
|
---|
| 246 | /* PRAGMA_TEMPLATES : use pragma template, a la cxx */
|
---|
| 247 | /* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
|
---|
| 248 | /* STREAMPOS_IS_CLASS : streampos is a real class */
|
---|
| 249 | /* ITER_TAG : use iter_tag for iterator qualifiers in STL */
|
---|
| 250 | /* NO_STRSTREAM : does not have strstream */
|
---|
[1889] | 251 | /* NO_EXPLICIT : does not know about explicit keyword */
|
---|
[1261] | 252 | /* HAS_IOS_BIN */
|
---|
| 253 | /* HAS_IOS_NOCREATE */
|
---|
| 254 | /* HAS_VEC_NEW : operator new[] */
|
---|
| 255 | /* CC_HAS_RTTI_SUPPORT has Run Time Type Identification support */
|
---|
| 256 | /* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
|
---|
| 257 | /* HAS_STR_NPOS : has string::npos and not a global NPOS */
|
---|
| 258 | /* NO_IOS_COMPLEX : does not have operator << defined for complex */
|
---|
[2339] | 259 | /* DECL_TEMP_SPEC : Template specialization declaration */
|
---|
[2884] | 260 | /* TSNMLUPG4 : Two stage name look-up scheme (g++>3.4) */
|
---|
[1261] | 261 |
|
---|
| 262 |
|
---|
[2322] | 263 | /* (STREAMPOS_IS_CLASS non-active: ca compile sans sur gcc3.2 et cxx)
|
---|
| 264 | rz+cmv 11/02/03 */
|
---|
| 265 |
|
---|
[1261] | 266 | /* The following is true for most compilers */
|
---|
| 267 |
|
---|
| 268 | #ifndef HAS_VEC_NEW
|
---|
| 269 | #define HAS_VEC_NEW
|
---|
| 270 | #endif
|
---|
| 271 |
|
---|
| 272 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 273 | #define COMPILER_EXCEPTIONS
|
---|
| 274 | #endif
|
---|
| 275 |
|
---|
| 276 | #ifndef CC_HAS_RTTI_SUPPORT
|
---|
| 277 | #define CC_HAS_RTTI_SUPPORT
|
---|
| 278 | #endif
|
---|
| 279 |
|
---|
[2339] | 280 |
|
---|
| 281 | #ifndef DECL_TEMP_SPEC
|
---|
| 282 | #define DECL_TEMP_SPEC
|
---|
| 283 | #endif
|
---|
| 284 |
|
---|
[2884] | 285 | /* Most compilers dot not implement two level name lookup for templates
|
---|
| 286 | introduced by gcc >= 3.4
|
---|
| 287 | */
|
---|
| 288 | #ifdef TSNMLUPG4
|
---|
| 289 | #undef TSNMLUPG4
|
---|
| 290 | #endif
|
---|
[2339] | 291 |
|
---|
[1261] | 292 | /* now the specific things */
|
---|
| 293 |
|
---|
| 294 | #ifdef __MWERKS__
|
---|
| 295 | #define ANSI_TEMPLATES
|
---|
| 296 | #undef HAS_VEC_NEW
|
---|
| 297 | #define NO_STRSTREAM
|
---|
| 298 | //#define STREAMPOS_IS_CLASS
|
---|
| 299 | #define ITER_TAG
|
---|
| 300 | #define HAS_IOS_BIN
|
---|
| 301 | #define HAS_IOS_NOCREATE
|
---|
| 302 | #define HAS_STR_NPOS
|
---|
| 303 | #endif
|
---|
| 304 |
|
---|
[3131] | 305 | #ifdef __GNUC__
|
---|
| 306 | #define GCC_VERSION (__GNUC__ * 1000 \
|
---|
[2884] | 307 | + __GNUC_MINOR__ * 100 \
|
---|
| 308 | + __GNUC_PATCHLEVEL__)
|
---|
[1261] | 309 | #define ANSI_TEMPLATES
|
---|
[2322] | 310 | /*
|
---|
| 311 | if (__GNUC__ >= 3)
|
---|
| 312 | define STREAMPOS_IS_CLASS
|
---|
| 313 | endif
|
---|
| 314 | */
|
---|
| 315 | #define GNU_TEMPLATES
|
---|
[1261] | 316 | #define HAS_STR_NPOS
|
---|
| 317 | #define HAS_IOS_BIN
|
---|
| 318 | #define HAS_IOS_NOCREATE
|
---|
[3131] | 319 | #if ( GCC_VERSION >= 3000 )
|
---|
[2884] | 320 | #undef DECL_TEMP_SPEC
|
---|
| 321 | #define DECL_TEMP_SPEC template <>
|
---|
[1261] | 322 | #endif
|
---|
[3131] | 323 | #if ( GCC_VERSION >= 3400 )
|
---|
[2884] | 324 | /* Two level name look-up scheme for templates introduced from gcc 3.4 */
|
---|
| 325 | #define TSNMLUPG4
|
---|
| 326 | #endif
|
---|
[1261] | 327 |
|
---|
[2884] | 328 | #endif
|
---|
| 329 |
|
---|
[1261] | 330 | #ifdef __DECCXX
|
---|
| 331 | #define HAS_STR_NPOS
|
---|
| 332 | #define ITER_TAG
|
---|
| 333 | #define __CXX_PRAGMA_TEMPLATES__
|
---|
| 334 | #define PRAGMA_TEMPLATES
|
---|
| 335 | #endif
|
---|
| 336 |
|
---|
| 337 | #if defined (__aCC__)
|
---|
| 338 | #ifndef ANSI_TEMPLATES
|
---|
| 339 | #define ANSI_TEMPLATES
|
---|
| 340 | #endif
|
---|
| 341 | #endif
|
---|
| 342 |
|
---|
| 343 | #if defined(__KCC__)
|
---|
| 344 | /* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
|
---|
| 345 | #define HAS_STR_NPOS
|
---|
| 346 | #ifndef ANSI_TEMPLATES
|
---|
| 347 | #define ANSI_TEMPLATES
|
---|
| 348 | #endif
|
---|
| 349 | #endif
|
---|
| 350 |
|
---|
| 351 | #if defined(__SGICC__)
|
---|
| 352 | #define HAS_STR_NPOS
|
---|
| 353 | #ifndef ANSI_TEMPLATES
|
---|
| 354 | #define ANSI_TEMPLATES
|
---|
[2867] | 355 | #endif
|
---|
[2339] | 356 | #undef DECL_TEMP_SPEC
|
---|
| 357 | #define DECL_TEMP_SPEC template <>
|
---|
[1261] | 358 | #endif
|
---|
[2867] | 359 |
|
---|
| 360 | #if defined(__IBMCPP__)
|
---|
| 361 | /* IBM xlC compiler support Added : dec 2005 */
|
---|
| 362 | #ifndef ANSI_TEMPLATES
|
---|
| 363 | #define ANSI_TEMPLATES
|
---|
[1261] | 364 | #endif
|
---|
[2867] | 365 | #undef DECL_TEMP_SPEC
|
---|
| 366 | #define DECL_TEMP_SPEC template <>
|
---|
| 367 | #endif
|
---|
[1261] | 368 |
|
---|
| 369 | /* Get things has homogeneous as possible between compilers */
|
---|
| 370 |
|
---|
| 371 | #ifdef HAS_STR_NPOS
|
---|
| 372 | #define NPOS string::npos
|
---|
| 373 | #else
|
---|
| 374 | #define NPOS (size_t)-1
|
---|
| 375 | #endif
|
---|
| 376 |
|
---|
| 377 | #ifndef __GNUG__
|
---|
| 378 | #define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 379 | #ifndef __FUNCTION__
|
---|
| 380 | #define __FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 381 | #endif
|
---|
| 382 | #ifndef __KCC__
|
---|
| 383 | #define __attribute__(_x_)
|
---|
| 384 | #endif
|
---|
| 385 | #endif
|
---|
| 386 |
|
---|
[1889] | 387 | #ifdef NO_EXPLICIT
|
---|
[1261] | 388 | #define explicit
|
---|
| 389 | #endif
|
---|
| 390 |
|
---|
| 391 | #ifdef HAS_IOS_BIN
|
---|
| 392 | #define IOS_BIN ios::binary
|
---|
| 393 | #else
|
---|
| 394 | #define IOS_BIN 0
|
---|
| 395 | #endif
|
---|
| 396 |
|
---|
[2322] | 397 | /* Commente par Reza+CMV - Fev 2003
|
---|
| 398 | ifdef ANSI_IO
|
---|
| 399 | define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
|
---|
| 400 | define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
|
---|
| 401 | endif
|
---|
| 402 | */
|
---|
[1261] | 403 |
|
---|
| 404 | #ifdef __MWERKS__
|
---|
| 405 | //#define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
|
---|
| 406 | #define random() (rand()*65538.0 + rand()*2. + rand())
|
---|
| 407 | #define srandom srand
|
---|
| 408 | #define initstate(seed, tab, n) srand(seed)
|
---|
| 409 | #define nice(_x)
|
---|
| 410 |
|
---|
| 411 | #ifdef __cplusplus
|
---|
| 412 | #include <string.h>
|
---|
| 413 | #include <string>
|
---|
| 414 | inline bool operator< (string const& s1, string const& s2)
|
---|
| 415 | { return (strcmp(s1.c_str(), s2.c_str()) < 0); }
|
---|
| 416 | #endif
|
---|
| 417 | #endif
|
---|
| 418 |
|
---|
[1783] | 419 | #ifdef OS_MACOSX
|
---|
| 420 | #define NO_VALUES_H
|
---|
| 421 | #include "osx_values.h"
|
---|
| 422 | #endif
|
---|
[1261] | 423 |
|
---|
[1783] | 424 |
|
---|
[1261] | 425 | /********************************************************/
|
---|
| 426 | /* Outil d'impressions pour debug */
|
---|
| 427 | #define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
|
---|
| 428 | #define CR {cout<<"\n"<<flush;}
|
---|
| 429 | /* ********************************************************/
|
---|
| 430 |
|
---|
| 431 | /* ---- Activation des flags de debug/bound checking ----- */
|
---|
| 432 | #ifdef SOPHYA_DEBUG
|
---|
| 433 | #define SO_BOUNDCHECKING
|
---|
| 434 | #endif
|
---|
| 435 |
|
---|
| 436 | /* ---- La taille et les index des tableaux ---- */
|
---|
| 437 | #ifdef SGI_ARCH64
|
---|
| 438 | typedef int_8 sa_size_t ;
|
---|
| 439 | #else
|
---|
| 440 | typedef int_4 sa_size_t ;
|
---|
| 441 | #endif
|
---|
| 442 |
|
---|
| 443 | /* Compatibilite, avant de migrer tout le code en "PLANCK" */
|
---|
| 444 |
|
---|
| 445 | #ifdef __cplusplus
|
---|
[1870] | 446 | /* Standard C++ library classes are in the namespace std */
|
---|
| 447 | namespace std { }
|
---|
| 448 | using namespace std;
|
---|
[2615] | 449 | /*******************************************/
|
---|
| 450 | /* SOPHYA classes are in namespace SOPHYA */
|
---|
| 451 | /* namespace SOPHYA {} */
|
---|
| 452 | /* using namespace SOPHYA; */
|
---|
| 453 | /* Please use instead: sopnamsp.h */
|
---|
| 454 | /*******************************************/
|
---|
[1261] | 455 | #define EXPLICIT explicit
|
---|
| 456 | #endif
|
---|
| 457 |
|
---|
| 458 | #endif
|
---|