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