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

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

fin ndataBlock + AnyDataObj cree rz+cmv 26/4/99

File size: 8.0 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/* NO_IOS_COMPLEX : does not have operator << defined for complex */
206
207
208/* The following is true for most compilers */
209
210#ifndef HAS_VEC_NEW
211#define HAS_VEC_NEW
212#endif
213
214#ifndef COMPILER_EXCEPTIONS
215#define COMPILER_EXCEPTIONS
216#endif
217
218/* now the specific things */
219
220#ifdef __MWERKS__
221#define ANSI_TEMPLATES
222#undef HAS_VEC_NEW
223#define NO_STRSTREAM
224#define STREAMPOS_IS_CLASS
225#define ITER_TAG
226#define HAS_IOS_BIN
227#define HAS_IOS_NOCREATE
228#define HAS_STR_NPOS
229#endif
230
231#ifdef __GNUG__
232#define GNU_TEMPLATES
233#define HAS_STR_NPOS
234#define HAS_EXPLICIT
235#define HAS_IOS_BIN
236#define HAS_IOS_NOCREATE
237#endif
238
239#ifdef __DECCXX
240#define HAS_STR_NPOS
241#define ITER_TAG
242#define __CXX_PRAGMA_TEMPLATES__
243#define PRAGMA_TEMPLATES
244#endif
245
246#if defined (__aCC__)
247#ifndef COMPILER_EXCEPTIONS
248#define COMPILER_EXCEPTIONS
249#endif
250#ifndef ANSI_TEMPLATES
251#define ANSI_TEMPLATES
252#endif
253#endif
254
255#if defined(__KCC__)
256/* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
257#define STREAMPOS_IS_CLASS
258#define HAS_STR_NPOS
259#ifndef COMPILER_EXCEPTIONS
260#define COMPILER_EXCEPTIONS
261#endif
262#ifndef ANSI_TEMPLATES
263#define ANSI_TEMPLATES
264#endif
265#endif
266
267
268/* Get things has homogeneous as possible between compilers */
269
270#ifdef HAS_STR_NPOS
271#define NPOS string::npos
272#else
273#define NPOS (size_t)-1
274#endif
275
276#ifndef __GNUG__
277#define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
278#ifndef __FUNCTION__
279#define __FUNCTION__ __FILE__ " __LINE__ "
280#endif
281#ifndef __KCC__
282#define __attribute__(_x_)
283#endif
284#endif
285
286#ifndef HAS_EXPLICIT
287#define explicit
288#endif
289
290#ifdef HAS_IOS_BIN
291#define IOS_BIN ios::binary
292#else
293#define IOS_BIN 0
294#endif
295
296#ifdef ANSI_IO
297#define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
298#define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
299#endif
300
301#ifdef __MWERKS__
302//#define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
303#define random() (rand()*65538.0 + rand()*2. + rand())
304#define srandom srand
305#define initstate(seed, tab, n) srand(seed)
306#define nice(_x)
307
308#ifdef __cplusplus
309#include <string.h>
310#include <string>
311inline bool operator< (string const& s1, string const& s2)
312{ return (strcmp(s1.c_str(), s2.c_str()) < 0); }
313#endif
314#endif
315
316
317/********************************************************/
318/* Outil d'impressions pour debug */
319#define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
320#define CR {cout<<"\n"<<flush;}
321/* ********************************************************/
322
323/* Compatibilite, avant de migrer tout le code en "PLANCK" */
324
325#ifdef __cplusplus
326namespace PlanckDPC {}
327using namespace PlanckDPC;
328#define EXPLICIT explicit
329#include "pclassids.h"
330#endif
331
332#endif
Note: See TracBrowser for help on using the repository browser.