| [1261] | 1 | #ifndef MACHDEFS_SEEN | 
|---|
|  | 2 | #define MACHDEFS_SEEN | 
|---|
|  | 3 |  | 
|---|
| [3203] | 4 | /* -------------- List of flags (and description) ------------------- | 
|---|
|  | 5 | - SO_ARCH64 : select 64 bits architecture (default 32 bits) | 
|---|
|  | 6 | - SO_NOFPIC  : disable fPIC flag (Position Independent Code) default fPIC enabled | 
|---|
|  | 7 | - SO_SASIZET64 : select 64 bits size for array indices (default 32 bits) | 
|---|
| [3750] | 8 | - SO_LDBLE128  : enable support for 128 bits floating point numbers (default NO 128 bits floats) | 
|---|
| [3203] | 9 | - SO_BOUNDCHECKING : activate bound checking (in accessing array elements) | 
|---|
|  | 10 | - SOPHYA_DEBUG : debug flag ( --> if set, SO_BOUNDCHECKING is also set) | 
|---|
|  | 11 | ------------------------------------------------------------------  */ | 
|---|
|  | 12 |  | 
|---|
|  | 13 | #ifdef SOPHYA_DEBUG | 
|---|
|  | 14 | #define SO_BOUNDCHECKING | 
|---|
|  | 15 | #endif | 
|---|
|  | 16 |  | 
|---|
| [1261] | 17 | /***********************************************************************/ | 
|---|
|  | 18 | /* Find hardware, OS and compiler combination                          */ | 
|---|
|  | 19 | /***********************************************************************/ | 
|---|
|  | 20 |  | 
|---|
|  | 21 | #if defined(OSF1) | 
|---|
|  | 22 | #define MACH_ALPHA | 
|---|
|  | 23 | #endif | 
|---|
|  | 24 |  | 
|---|
|  | 25 | #if defined(_AIX) || defined(AIX) | 
|---|
|  | 26 | #define MACH_IBMRS | 
|---|
|  | 27 | #endif | 
|---|
|  | 28 |  | 
|---|
|  | 29 | #if defined(__hpux__) || defined(HPUX) | 
|---|
|  | 30 | #define MACH_HP | 
|---|
|  | 31 | #endif | 
|---|
|  | 32 |  | 
|---|
|  | 33 | #if defined(SunOS)  || defined ( sun ) | 
|---|
|  | 34 | #define MACH_SUN | 
|---|
|  | 35 | #endif | 
|---|
|  | 36 |  | 
|---|
|  | 37 | #ifdef IRIX64 | 
|---|
|  | 38 | #define MACH_SGI | 
|---|
|  | 39 | #endif | 
|---|
|  | 40 |  | 
|---|
| [1783] | 41 | #ifdef __APPLE__ | 
|---|
|  | 42 | #ifdef __MACH__ | 
|---|
| [3070] | 43 | #ifdef __POWERPC__ | 
|---|
| [1783] | 44 | #define MACH_POWERPC | 
|---|
| [3070] | 45 | #else | 
|---|
|  | 46 | #define MACH_INTEL | 
|---|
|  | 47 | #endif | 
|---|
| [1783] | 48 | #endif | 
|---|
|  | 49 | #endif | 
|---|
|  | 50 |  | 
|---|
| [1261] | 51 | #if defined(Linux)  || defined(linux) | 
|---|
|  | 52 | #if defined(__alpha__) | 
|---|
|  | 53 | #define MACH_ALPHA | 
|---|
|  | 54 | #elif defined(powerpc) | 
|---|
|  | 55 | #define MACH_POWERPC | 
|---|
| [3240] | 56 | #elif defined(__i386__) | 
|---|
| [3203] | 57 | #define MACH_INTEL | 
|---|
|  | 58 | #else | 
|---|
|  | 59 | #define MACH_AMD | 
|---|
|  | 60 | /* $CHECK$ (Reza Avril 2007):  Il faut affiner ce test pour | 
|---|
|  | 61 | determiner correctement le type de  processeur        */ | 
|---|
| [1261] | 62 | #endif | 
|---|
|  | 63 | #endif | 
|---|
|  | 64 |  | 
|---|
|  | 65 | /***********************************************************************/ | 
|---|
|  | 66 | /* Hardware/OS dependent stuff                                         */ | 
|---|
|  | 67 | /***********************************************************************/ | 
|---|
|  | 68 |  | 
|---|
| [3203] | 69 | /* --------------------------------------------------------------- */ | 
|---|
|  | 70 | /* 1/     typedefs for different size integers and floats          */ | 
|---|
|  | 71 | /* --------------------------------------------------------------- */ | 
|---|
| [1261] | 72 |  | 
|---|
| [3203] | 73 | /* --- Avr2007: The following typdefs should be OK for most system */ | 
|---|
|  | 74 | /* and compilers:  OSF, Linux, AIX, SGI, MacOSX, Sun, HP           */ | 
|---|
| [1261] | 75 |  | 
|---|
| [3203] | 76 | typedef signed char int_1; | 
|---|
|  | 77 | typedef unsigned char uint_1; | 
|---|
|  | 78 | typedef short int_2; | 
|---|
|  | 79 | typedef unsigned short uint_2; | 
|---|
|  | 80 | typedef int int_4; | 
|---|
|  | 81 | typedef unsigned int uint_4; | 
|---|
|  | 82 | typedef long long int_8; | 
|---|
|  | 83 | typedef unsigned long long uint_8; | 
|---|
|  | 84 | typedef float r_4; | 
|---|
|  | 85 | typedef double r_8; | 
|---|
| [3750] | 86 | #ifdef SO_LDBLE128 | 
|---|
|  | 87 | /* 128 bits floating point numbers */ | 
|---|
|  | 88 | typedef long double r_16; | 
|---|
|  | 89 | #endif | 
|---|
| [1261] | 90 |  | 
|---|
| [3203] | 91 | /* --------------------------------------------------------------- */ | 
|---|
|  | 92 | /* 2/     Endiannes (/ byteswap for different processors)          */ | 
|---|
|  | 93 | /* --------------------------------------------------------------- */ | 
|---|
|  | 94 | /* | 
|---|
|  | 95 | ==> POWERPC, IBMRS, HP_UX, IRIX64, SunSPARC (?) : | 
|---|
|  | 96 | BigEndian    ( SWAP=SWAPDEFAUT=0) | 
|---|
|  | 97 | ==> ALPHA, INTEL, AMD : | 
|---|
|  | 98 | LittleEndian ( SWAP=SWAPDEFAUT=1) | 
|---|
|  | 99 | */ | 
|---|
| [1261] | 100 |  | 
|---|
| [3203] | 101 | #if defined(MACH_ALPHA) || defined(MACH_INTEL) || defined(MACH_AMD) | 
|---|
|  | 102 | #define IS_BIG_ENDIAN 0 | 
|---|
|  | 103 | #else | 
|---|
|  | 104 | #define IS_BIG_ENDIAN 1 | 
|---|
| [1261] | 105 | #endif | 
|---|
|  | 106 |  | 
|---|
| [3203] | 107 | /* ---- La taille des index des tableaux ---- */ | 
|---|
|  | 108 | #ifdef SO_SASIZET64 | 
|---|
|  | 109 | typedef int_8 sa_size_t ; | 
|---|
| [3070] | 110 | #else | 
|---|
| [3203] | 111 | typedef int_4 sa_size_t ; | 
|---|
| [3070] | 112 | #endif | 
|---|
| [1783] | 113 |  | 
|---|
| [1261] | 114 |  | 
|---|
|  | 115 | /***********************************************************************/ | 
|---|
|  | 116 | /* Find Compiler                                                       */ | 
|---|
|  | 117 | /***********************************************************************/ | 
|---|
|  | 118 |  | 
|---|
|  | 119 | /*    __DECCXX     : DEC CXX, version >= 6 is required                 */ | 
|---|
|  | 120 | /*    __GNUG__     : GNU C++ 2.8.1, egcs ??                            */ | 
|---|
|  | 121 | /*    __aCC__      : aCC on HP                                         */ | 
|---|
|  | 122 | /*    __KCC__      : KCC, version >= 3.3 is required                   */ | 
|---|
|  | 123 | /*    __SGICC__    : SGI (IRIX64) CC compiler                          */ | 
|---|
| [2884] | 124 | /*    __INTEL_COMPILER :   : INTEL compiler                            */ | 
|---|
|  | 125 | /*    __IBMCPP__   : AIX (IBM) xlC c++ compiler                        */ | 
|---|
| [1261] | 126 |  | 
|---|
|  | 127 | /***********************************************************************/ | 
|---|
|  | 128 | /* Compiler-specific stuff                                             */ | 
|---|
|  | 129 | /***********************************************************************/ | 
|---|
|  | 130 |  | 
|---|
|  | 131 | /*   ANSI_TEMPLATES        : use ANSI syntax for explicit templates        */ | 
|---|
|  | 132 | /*   GNUG_TEMPLATES        : use GNU syntax for explicit templates         */ | 
|---|
|  | 133 | /*   PRAGMA_TEMPLATES      : use pragma template, a la cxx                 */ | 
|---|
|  | 134 | /*   COMPILER_EXCEPTIONS   : knows about exceptions  --- required ?        */ | 
|---|
|  | 135 | /*   STREAMPOS_IS_CLASS    : streampos is a real class                     */ | 
|---|
|  | 136 | /*   ITER_TAG              : use iter_tag for iterator qualifiers in STL   */ | 
|---|
|  | 137 | /*   NO_STRSTREAM          : does not have strstream                       */ | 
|---|
|  | 138 | /*   HAS_IOS_BIN                                                           */ | 
|---|
|  | 139 | /*   HAS_IOS_NOCREATE                                                      */ | 
|---|
|  | 140 | /*   HAS_VEC_NEW           : operator new[]                                */ | 
|---|
|  | 141 | /*   CC_HAS_RTTI_SUPPORT     has Run Time Type Identification support      */ | 
|---|
|  | 142 | /*   ANSI_IO               : rdbuf()->pubseekoff rather than seekg         */ | 
|---|
|  | 143 | /*   HAS_STR_NPOS          : has string::npos and not a global NPOS        */ | 
|---|
|  | 144 | /*   NO_IOS_COMPLEX        : does not have operator << defined for complex */ | 
|---|
| [2339] | 145 | /*   DECL_TEMP_SPEC        : Template specialization declaration           */ | 
|---|
| [2884] | 146 | /*   TSNMLUPG4             : Two stage name look-up scheme (g++>3.4)       */ | 
|---|
| [3831] | 147 | /*   NEED_EXT_DECL_TEMP    : extern declaration for template classes       */ | 
|---|
| [1261] | 148 |  | 
|---|
|  | 149 |  | 
|---|
| [2322] | 150 | /* (STREAMPOS_IS_CLASS non-active: ca compile sans sur gcc3.2 et cxx) | 
|---|
|  | 151 | rz+cmv 11/02/03 */ | 
|---|
|  | 152 |  | 
|---|
| [1261] | 153 | /* The following is true for most compilers */ | 
|---|
|  | 154 |  | 
|---|
|  | 155 | #ifndef HAS_VEC_NEW | 
|---|
|  | 156 | #define HAS_VEC_NEW | 
|---|
|  | 157 | #endif | 
|---|
|  | 158 |  | 
|---|
|  | 159 | #ifndef COMPILER_EXCEPTIONS | 
|---|
|  | 160 | #define COMPILER_EXCEPTIONS | 
|---|
|  | 161 | #endif | 
|---|
|  | 162 |  | 
|---|
|  | 163 | #ifndef  CC_HAS_RTTI_SUPPORT | 
|---|
|  | 164 | #define  CC_HAS_RTTI_SUPPORT | 
|---|
|  | 165 | #endif | 
|---|
|  | 166 |  | 
|---|
| [2339] | 167 |  | 
|---|
|  | 168 | #ifndef DECL_TEMP_SPEC | 
|---|
|  | 169 | #define DECL_TEMP_SPEC | 
|---|
|  | 170 | #endif | 
|---|
|  | 171 |  | 
|---|
| [2884] | 172 | /* Most compilers dot not implement two level name lookup for templates | 
|---|
|  | 173 | introduced by gcc >= 3.4 | 
|---|
|  | 174 | */ | 
|---|
|  | 175 | #ifdef TSNMLUPG4 | 
|---|
|  | 176 | #undef TSNMLUPG4 | 
|---|
|  | 177 | #endif | 
|---|
| [2339] | 178 |  | 
|---|
| [3831] | 179 |  | 
|---|
|  | 180 | /*  Dynamic_cast problem encountered on Mac OS X 10.6 for explicitly instanciated classes across | 
|---|
|  | 181 | dynamic libraries. solved by extern declaration of  explicitly instanciated template classes */ | 
|---|
|  | 182 | #ifndef NEED_EXT_DECL_TEMP | 
|---|
|  | 183 | #define NEED_EXT_DECL_TEMP | 
|---|
|  | 184 | #endif | 
|---|
|  | 185 |  | 
|---|
|  | 186 |  | 
|---|
| [1261] | 187 | /* now the specific things */ | 
|---|
|  | 188 |  | 
|---|
| [3131] | 189 | #ifdef __GNUC__ | 
|---|
|  | 190 | #define GCC_VERSION (__GNUC__ * 1000 \ | 
|---|
| [2884] | 191 | + __GNUC_MINOR__ * 100 \ | 
|---|
|  | 192 | + __GNUC_PATCHLEVEL__) | 
|---|
| [1261] | 193 | #define ANSI_TEMPLATES | 
|---|
| [2322] | 194 | /* | 
|---|
|  | 195 | if (__GNUC__ >= 3) | 
|---|
|  | 196 | define STREAMPOS_IS_CLASS | 
|---|
|  | 197 | endif | 
|---|
|  | 198 | */ | 
|---|
|  | 199 | #define GNU_TEMPLATES | 
|---|
| [1261] | 200 | #define HAS_STR_NPOS | 
|---|
|  | 201 | #define HAS_IOS_BIN | 
|---|
|  | 202 | #define HAS_IOS_NOCREATE | 
|---|
| [3131] | 203 | #if ( GCC_VERSION >= 3000 ) | 
|---|
| [2884] | 204 | #undef  DECL_TEMP_SPEC | 
|---|
|  | 205 | #define DECL_TEMP_SPEC template <> | 
|---|
| [1261] | 206 | #endif | 
|---|
| [3131] | 207 | #if ( GCC_VERSION >= 3400 ) | 
|---|
| [2884] | 208 | /* Two level name look-up scheme for templates introduced from gcc 3.4 */ | 
|---|
|  | 209 | #define TSNMLUPG4 | 
|---|
|  | 210 | #endif | 
|---|
| [1261] | 211 |  | 
|---|
| [2884] | 212 | #endif | 
|---|
|  | 213 |  | 
|---|
| [1261] | 214 | #ifdef __DECCXX | 
|---|
|  | 215 | #define HAS_STR_NPOS | 
|---|
|  | 216 | #define ITER_TAG | 
|---|
|  | 217 | #define __CXX_PRAGMA_TEMPLATES__ | 
|---|
|  | 218 | #define PRAGMA_TEMPLATES | 
|---|
| [3831] | 219 | #undef NEED_EXT_DECL_TEMP   /* old compiler version cxx 6.5 - we don't activate extern declaration */ | 
|---|
| [1261] | 220 | #endif | 
|---|
|  | 221 |  | 
|---|
|  | 222 | #if defined (__aCC__) | 
|---|
|  | 223 | #ifndef ANSI_TEMPLATES | 
|---|
|  | 224 | #define ANSI_TEMPLATES | 
|---|
|  | 225 | #endif | 
|---|
|  | 226 | #endif | 
|---|
|  | 227 |  | 
|---|
|  | 228 | #if defined(__KCC__) | 
|---|
|  | 229 | /* KCC V 3.2 ne compile pas  i/ostream s ; long p = s.tellg();  OK en  V 3.3 */ | 
|---|
|  | 230 | #define HAS_STR_NPOS | 
|---|
|  | 231 | #ifndef ANSI_TEMPLATES | 
|---|
|  | 232 | #define ANSI_TEMPLATES | 
|---|
|  | 233 | #endif | 
|---|
|  | 234 | #endif | 
|---|
|  | 235 |  | 
|---|
|  | 236 | #if defined(__SGICC__) | 
|---|
|  | 237 | #define HAS_STR_NPOS | 
|---|
|  | 238 | #ifndef ANSI_TEMPLATES | 
|---|
|  | 239 | #define ANSI_TEMPLATES | 
|---|
| [2867] | 240 | #endif | 
|---|
| [2339] | 241 | #undef  DECL_TEMP_SPEC | 
|---|
|  | 242 | #define DECL_TEMP_SPEC template <> | 
|---|
| [1261] | 243 | #endif | 
|---|
| [2867] | 244 |  | 
|---|
|  | 245 | #if defined(__IBMCPP__) | 
|---|
|  | 246 | /* IBM xlC compiler support Added : dec 2005 */ | 
|---|
|  | 247 | #ifndef ANSI_TEMPLATES | 
|---|
|  | 248 | #define ANSI_TEMPLATES | 
|---|
| [1261] | 249 | #endif | 
|---|
| [2867] | 250 | #undef  DECL_TEMP_SPEC | 
|---|
|  | 251 | #define DECL_TEMP_SPEC template <> | 
|---|
|  | 252 | #endif | 
|---|
| [1261] | 253 |  | 
|---|
|  | 254 | /* Get things has homogeneous as possible between compilers */ | 
|---|
|  | 255 |  | 
|---|
|  | 256 | #ifdef HAS_STR_NPOS | 
|---|
|  | 257 | #define NPOS string::npos | 
|---|
|  | 258 | #else | 
|---|
|  | 259 | #define NPOS (size_t)-1 | 
|---|
|  | 260 | #endif | 
|---|
|  | 261 |  | 
|---|
|  | 262 | #ifndef __GNUG__ | 
|---|
|  | 263 | #define __PRETTY_FUNCTION__ __FILE__ " __LINE__ " | 
|---|
|  | 264 | #ifndef __FUNCTION__ | 
|---|
|  | 265 | #define __FUNCTION__ __FILE__ " __LINE__ " | 
|---|
|  | 266 | #endif | 
|---|
|  | 267 | #ifndef __KCC__ | 
|---|
|  | 268 | #define __attribute__(_x_) | 
|---|
|  | 269 | #endif | 
|---|
|  | 270 | #endif | 
|---|
|  | 271 |  | 
|---|
|  | 272 |  | 
|---|
|  | 273 | #ifdef HAS_IOS_BIN | 
|---|
|  | 274 | #define IOS_BIN ios::binary | 
|---|
|  | 275 | #else | 
|---|
|  | 276 | #define IOS_BIN 0 | 
|---|
|  | 277 | #endif | 
|---|
|  | 278 |  | 
|---|
|  | 279 |  | 
|---|
| [3525] | 280 | #ifdef Darwin | 
|---|
| [1783] | 281 | #define NO_VALUES_H | 
|---|
|  | 282 | #include "osx_values.h" | 
|---|
|  | 283 | #endif | 
|---|
| [1261] | 284 |  | 
|---|
| [1783] | 285 |  | 
|---|
| [1261] | 286 | #ifdef __cplusplus | 
|---|
| [1870] | 287 | /* Standard C++ library classes are in the namespace std  */ | 
|---|
|  | 288 | namespace std { } | 
|---|
|  | 289 | using namespace std; | 
|---|
| [2615] | 290 | /*******************************************/ | 
|---|
|  | 291 | /* SOPHYA classes are in namespace SOPHYA  */ | 
|---|
|  | 292 | /* namespace SOPHYA {}                     */ | 
|---|
|  | 293 | /* using namespace SOPHYA;                 */ | 
|---|
|  | 294 | /* Please use instead: sopnamsp.h          */ | 
|---|
|  | 295 | /*******************************************/ | 
|---|
| [1261] | 296 | #endif | 
|---|
|  | 297 |  | 
|---|
|  | 298 | #endif | 
|---|