source: Sophya/trunk/SophyaLib/BaseTools/machdefs_ac.h@ 1405

Last change on this file since 1405 was 1396, checked in by ansari, 25 years ago

Numero de version - Reza 12/2/2001

File size: 7.2 KB
Line 
1#ifndef MACHDEFS_SEEN
2#define MACHDEFS_SEEN
3
4#include <config.h>
5
6/***********************************************************************/
7/* Find hardware, OS and compiler combination */
8/***********************************************************************/
9
10#if defined(OSF1)
11#define MACH_ALPHA
12#define OS_OSF1
13#endif
14
15#if defined(_AIX) || defined(AIX)
16#define MACH_IBMRS
17#define OS_AIX
18#endif
19
20#if defined(__hpux__) || defined(HPUX)
21#define MACH_HP
22#define OS_HPUX
23#endif
24
25#ifdef __MWERKS__
26#define MACH_POWERMAC
27#define OS_MACOS
28#endif
29
30#if defined(SunOS) || defined ( sun )
31#define MACH_SUN
32#define OS_SOLARIS
33#endif
34
35#ifdef IRIX64
36#define MACH_SGI
37#define OS_IRIX64
38#endif
39
40#if defined(Linux) || defined(linux)
41#if defined(__alpha__)
42#define MACH_ALPHA
43#elif defined(powerpc)
44#define MACH_POWERPC
45#elif defined(__i386__)
46#define MACH_INTEL
47#else
48#error Undefined Platform (machine) type with linux in machdefs.h
49#endif
50#define OS_LINUX
51#endif
52
53
54/***********************************************************************/
55/* Hardware/OS dependent stuff */
56/***********************************************************************/
57
58typedef signed char int_1;
59typedef unsigned char uint_1;
60
61#if (SIZEOF_SHORT == 2)
62typedef short int_2;
63typedef unsigned short uint_2;
64#elif (SIZEOF_INT == 2)
65typedef int int_2;
66typedef unsigned int uint_2;
67#else
68#error "no size 2 integer"
69#endif
70
71#if (SIZEOF_INT == 4)
72typedef int int_4;
73typedef unsigned int uint_4;
74#elif (SIZEOF_LONG == 4)
75typedef long int_4;
76typedef unsigned long uint_4;
77#else
78#error "no size 4 integer"
79#endif
80
81#if (SIZEOF_LONG_LONG == 8)
82typedef long long int_8;
83typedef unsigned long long uint_8;
84#elif (SIZEOF_LONG == 9)
85typedef long int_8;
86typedef unsigned long uint_8;
87#else
88#error "no size 8 integer"
89#endif
90
91
92#if (SIZEOF_FLOAT == 4)
93typedef float r_4;
94#else
95#error "no size 4 float"
96#endif
97
98#if (SIZEOF_DOUBLE == 8)
99typedef double r_8;
100#else
101#error "no size 8 float"
102#endif
103
104#ifdef WORDS_BIGENDIAN
105#define SWAP 0
106#define SWAPDEFAUT 0
107#define IS_BIG_ENDIAN 1
108#else
109#define SWAP 1
110#define SWAPDEFAUT 1
111#define IS_BIG_ENDIAN 0
112#endif
113
114
115
116
117/***********************************************************************/
118/* Find Compiler */
119/***********************************************************************/
120
121/* __MWERKS__ : Metrowerks Codewarrior (>= PRO 4) */
122/* __DECCXX : DEC CXX, version >= 6 is required */
123/* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
124/* __aCC__ : aCC on HP */
125/* __KCC__ : KCC, version >= 3.3 is required */
126/* __SGICC__ : SGI (IRIX64) CC compiler */
127
128/***********************************************************************/
129/* Compiler-specific stuff */
130/***********************************************************************/
131
132/* Some features will be *required* for Planck. Which ones ? */
133
134/* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
135/* GNUG_TEMPLATES : use GNU syntax for explicit templates */
136/* PRAGMA_TEMPLATES : use pragma template, a la cxx */
137/* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
138/* STREAMPOS_IS_CLASS : streampos is a real class */
139/* ITER_TAG : use iter_tag for iterator qualifiers in STL */
140/* NO_STRSTREAM : does not have strstream */
141/* HAS_EXPLICIT : knows about explicit keyword - constructors */
142/* HAS_IOS_BIN */
143/* HAS_IOS_NOCREATE */
144/* HAS_VEC_NEW : operator new[] */
145/* CC_HAS_RTTI_SUPPORT has Run Time Type Identification support */
146/* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
147/* HAS_STR_NPOS : has string::npos and not a global NPOS */
148/* NO_IOS_COMPLEX : does not have operator << defined for complex */
149
150
151/* The following is true for most compilers */
152
153#ifndef HAS_VEC_NEW
154#define HAS_VEC_NEW
155#endif
156
157#ifndef COMPILER_EXCEPTIONS
158#define COMPILER_EXCEPTIONS
159#endif
160
161#ifndef CC_HAS_RTTI_SUPPORT
162#define CC_HAS_RTTI_SUPPORT
163#endif
164
165/* now the specific things */
166
167#ifdef __MWERKS__
168#define ANSI_TEMPLATES
169#undef HAS_VEC_NEW
170#define NO_STRSTREAM
171//#define STREAMPOS_IS_CLASS
172#define ITER_TAG
173#define HAS_IOS_BIN
174#define HAS_IOS_NOCREATE
175#define HAS_STR_NPOS
176#endif
177
178#ifdef __GNUG__
179#define ANSI_TEMPLATES
180// #define GNU_TEMPLATES
181#define HAS_STR_NPOS
182#define HAS_EXPLICIT
183#define HAS_IOS_BIN
184#define HAS_IOS_NOCREATE
185#endif
186
187#ifdef __DECCXX
188#define HAS_STR_NPOS
189#define ITER_TAG
190#define __CXX_PRAGMA_TEMPLATES__
191#define PRAGMA_TEMPLATES
192#endif
193
194#if defined (__aCC__)
195#ifndef ANSI_TEMPLATES
196#define ANSI_TEMPLATES
197#endif
198#endif
199
200#if defined(__KCC__)
201/* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
202#define HAS_STR_NPOS
203#ifndef ANSI_TEMPLATES
204#define ANSI_TEMPLATES
205#endif
206/* Standard C++ library classes are in the namespace std */
207#ifdef __cplusplus
208namespace std { }
209using namespace std;
210#endif
211#endif
212
213#if defined(__SGICC__)
214/* Standard C++ library classes are in the namespace std */
215#define HAS_STR_NPOS
216#ifndef ANSI_TEMPLATES
217#define ANSI_TEMPLATES
218#endif
219#ifdef __cplusplus
220namespace std { }
221using namespace std;
222#endif
223#endif
224
225/* Get things has homogeneous as possible between compilers */
226
227#ifdef HAS_STR_NPOS
228#define NPOS string::npos
229#else
230#define NPOS (size_t)-1
231#endif
232
233#ifndef __GNUG__
234#define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
235#ifndef __FUNCTION__
236#define __FUNCTION__ __FILE__ " __LINE__ "
237#endif
238#ifndef __KCC__
239#define __attribute__(_x_)
240#endif
241#endif
242
243#ifndef HAS_EXPLICIT
244#define explicit
245#endif
246
247#ifdef HAS_IOS_BIN
248#define IOS_BIN ios::binary
249#else
250#define IOS_BIN 0
251#endif
252
253#ifdef ANSI_IO
254#define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
255#define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
256#endif
257
258#ifdef __MWERKS__
259//#define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
260#define random() (rand()*65538.0 + rand()*2. + rand())
261#define srandom srand
262#define initstate(seed, tab, n) srand(seed)
263#define nice(_x)
264
265#ifdef __cplusplus
266#include <string.h>
267#include <string>
268inline bool operator< (string const& s1, string const& s2)
269{ return (strcmp(s1.c_str(), s2.c_str()) < 0); }
270#endif
271#endif
272
273
274/********************************************************/
275/* Outil d'impressions pour debug */
276#define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
277#define CR {cout<<"\n"<<flush;}
278/* ********************************************************/
279
280/* ---- Activation des flags de debug/bound checking ----- */
281#ifdef SOPHYA_DEBUG
282#define SO_BOUNDCHECKING
283#endif
284
285/* ---- La taille et les index des tableaux ---- */
286#ifdef SGI_ARCH64
287typedef int_8 sa_size_t ;
288#else
289typedef int_4 sa_size_t ;
290#endif
291
292
293/* Compatibilite, avant de migrer tout le code en "PLANCK" */
294
295#ifdef __cplusplus
296namespace SOPHYA {}
297using namespace SOPHYA;
298#define EXPLICIT explicit
299#endif
300
301#endif
Note: See TracBrowser for help on using the repository browser.