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

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

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