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