source: Sophya/trunk/SophyaLib/BaseTools/machdefs.h@ 252

Last change on this file since 252 was 245, checked in by ansari, 26 years ago

creation NDataBlock, + remove .h unused rz+cmv 22/4/99

File size: 7.9 KB
Line 
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#ifdef 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#define SWAP 1
145#define SWAPDEFAUT 1
146
147#elif defined(OS_MACOS)
148
149 typedef signed char int_1;
150 typedef unsigned char uint_1;
151 typedef long int_4;
152 typedef unsigned long 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#define SWAP 0
161#define SWAPDEFAUT 0
162
163#else
164#error Undefined Machine/OS type in machdefs.h
165#endif
166
167
168
169#if SWAP==1
170#define IS_BIG_ENDIAN 0
171#else
172#define IS_BIG_ENDIAN 1
173#endif
174
175
176/***********************************************************************/
177/* Find Compiler */
178/***********************************************************************/
179
180/* __MWERKS__ : Metrowerks Codewarrior (>= PRO 4) */
181/* __DECCXX : DEC CXX, version >= 6 is required */
182/* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
183/* __aCC__ : aCC on HP */
184/* __KCC__ : KCC, version >= 3.3 is required */
185
186/***********************************************************************/
187/* Compiler-specific stuff */
188/***********************************************************************/
189
190/* Some features will be *required* for Planck. Which ones ? */
191
192/* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
193/* GNUG_TEMPLATES : use GNU syntax for explicit templates */
194/* PRAGMA_TEMPLATES : use pragma template, a la cxx */
195/* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
196/* STREAMPOS_IS_CLASS : streampos is a real class */
197/* ITER_TAG : use iter_tag for iterator qualifiers in STL */
198/* NO_STRSTREAM : does not have strstream */
199/* HAS_EXPLICIT : knows about explicit keyword - constructors */
200/* HAS_IOS_BIN */
201/* HAS_IOS_NOCREATE */
202/* HAS_VEC_NEW : operator new[] */
203/* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
204/* HAS_STR_NPOS : has string::npos and not a global NPOS */
205
206
207/* The following is true for most compilers */
208
209#ifndef HAS_VEC_NEW
210#define HAS_VEC_NEW
211#endif
212
213#ifndef COMPILER_EXCEPTIONS
214#define COMPILER_EXCEPTIONS
215#endif
216
217/* now the specific things */
218
219#ifdef __MWERKS__
220#define ANSI_TEMPLATES
221#undef HAS_VEC_NEW
222#define NO_STRSTREAM
223#define STREAMPOS_IS_CLASS
224#define ITER_TAG
225#define HAS_IOS_BIN
226#define HAS_IOS_NOCREATE
227#define HAS_STR_NPOS
228#endif
229
230#ifdef __GNUG__
231#define GNU_TEMPLATES
232#define HAS_STR_NPOS
233#define HAS_EXPLICIT
234#define HAS_IOS_BIN
235#define HAS_IOS_NOCREATE
236#endif
237
238#ifdef __DECCXX
239#define HAS_STR_NPOS
240#define ITER_TAG
241#define __CXX_PRAGMA_TEMPLATES__
242#define PRAGMA_TEMPLATES
243#endif
244
245#if defined (__aCC__)
246#ifndef COMPILER_EXCEPTIONS
247#define COMPILER_EXCEPTIONS
248#endif
249#ifndef ANSI_TEMPLATES
250#define ANSI_TEMPLATES
251#endif
252#endif
253
254#if defined(__KCC__)
255/* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
256#define STREAMPOS_IS_CLASS
257#define HAS_STR_NPOS
258#ifndef COMPILER_EXCEPTIONS
259#define COMPILER_EXCEPTIONS
260#endif
261#ifndef ANSI_TEMPLATES
262#define ANSI_TEMPLATES
263#endif
264#endif
265
266
267/* Get things has homogeneous as possible between compilers */
268
269#ifdef HAS_STR_NPOS
270#define NPOS string::npos
271#else
272#define NPOS (size_t)-1
273#endif
274
275#ifndef __GNUG__
276#define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
277#ifndef __FUNCTION__
278#define __FUNCTION__ __FILE__ " __LINE__ "
279#endif
280#ifndef __KCC__
281#define __attribute__(_x_)
282#endif
283#endif
284
285#ifndef HAS_EXPLICIT
286#define explicit
287#endif
288
289#ifdef HAS_IOS_BIN
290#define IOS_BIN ios::binary
291#else
292#define IOS_BIN 0
293#endif
294
295#ifdef ANSI_IO
296#define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
297#define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
298#endif
299
300#ifdef __MWERKS__
301//#define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
302#define random() (rand()*65538.0 + rand()*2. + rand())
303#define srandom srand
304#define initstate(seed, tab, n) srand(seed)
305#define nice(_x)
306
307#ifdef __cplusplus
308#include <string.h>
309#include <string>
310inline bool operator< (string const& s1, string const& s2)
311{ return (strcmp(s1.c_str(), s2.c_str()) < 0); }
312#endif
313#endif
314
315
316/********************************************************/
317/* Outil d'impressions pour debug */
318#define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
319#define CR {cout<<"\n"<<flush;}
320/* ********************************************************/
321
322/* Compatibilite, avant de migrer tout le code en "PLANCK" */
323
324#ifdef __cplusplus
325namespace PlanckDPC {}
326using namespace PlanckDPC;
327#define EXPLICIT explicit
328#include "pclassids.h"
329#endif
330
331#endif
Note: See TracBrowser for help on using the repository browser.