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

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

EA

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