source: trunk/MagicSoft/Simulation/Corsika/Mmcs614/initial.h@ 3827

Last change on this file since 3827 was 1444, checked in by blanch, 22 years ago
*** empty log message ***
File size: 8.8 KB
Line 
1/* ------------------------------------------------------------------ */
2/** @file initial.h
3 @short Indentification of the system and including some basic include file.
4
5 @author Konrad Bernloehr
6 @date 1991 to 2000
7 @date $Date: 2002-07-25 17:53:46 $
8 @version $Revision: 1.1 $
9
10 This file identifies a range of supported operating systems
11 and processor types. As a result, some preprocessor definitions
12 are made. A basic set of system include files (which may vary
13 from one system to another) are included.
14 In addition, compatibility between different systems is improved,
15 for example between K&R compiler systems and ANSI C compilers
16 of various flavours.
17
18@verbatim
19 Identification of the host operating system (not CPU):
20
21 Supported identifiers are
22 OS_MSDOS
23 OS_VAXVMS
24 OS_UNIX
25 + variant identifiers like
26 OS_ULTRIX, OS_LYNX, OS_LINUX, OS_DECUNIX, OS_AIX, OS_HPUX
27 Note: ULTRIX may be on VAX or MIPS, LINUX on Intel or Alpha,
28 OS_LYNX on 68K or PowerPC.
29 OS_OS9
30
31 You might first reset all identifiers here.
32
33 Then set one or more identifiers according to the system.
34
35 Identification of the CPU architecture:
36
37 Supported CPU identifiers are
38 CPU_I86
39 CPU_VAX
40 CPU_MIPS
41 CPU_ALPHA
42 CPU_68K
43 CPU_RS6000
44 CPU_PowerPC
45 CPU_HPPA
46@endverbatim
47*/
48
49/* ------------------------------------------------------------------ */
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55#ifndef INITIAL_H__LOADED
56
57#define INITIAL_H__LOADED 1
58
59#ifndef NO_IEEE_FLOAT_FORMAT
60#define IEEE_FLOAT_FORMAT 1
61#endif
62
63#if ( defined(MSDOS) || defined(__MSDOS__) ) /* MS C or Turbo C */
64# define OS_MSDOS 1
65# define CPU_I86 1
66#elif ( defined(vax) && defined(vms) ) /* VAX/VMS (what about OpenVMS?) */
67# define OS_VAXVMS 1
68# define VAX_FLOAT_FORMAT 1
69# undef IEEE_FLOAT_FORMAT
70# define CPU_VAX 1
71#elif ( defined(linux) || defined(__linux__) ) /* Linux OS */
72# define OS_UNIX 1
73# define OS_LINUX 1
74# if ( defined(i386) || defined(__i386) ) /* Linux on Intel-like CPU */
75# define CPU_I86 1
76# elif ( defined(__alpha) ) /* Linux on Alpha */
77# define CPU_ALPHA 1
78# endif
79#elif ( defined(ultrix) ) /* Ultrix (MIPS or VAX) */
80# define OS_UNIX 1
81# define OS_ULTRIX 1
82# ifndef ULTRIX
83# define ULTRIX 1
84# endif
85# ifndef vax
86# define CPU_MIPS 1
87# else
88# define VAX_FLOAT_FORMAT 1
89# undef IEEE_FLOAT_FORMAT
90# define CPU_VAX 1
91# endif
92#elif ( defined(lynx) || defined(__lynx__) ) /* Lynx-OS */
93# define OS_UNIX 1
94# define OS_LYNX 1
95# if ( defined(_ARCH_PPC) || defined(__powerpc__) ) /* Lynx-OS on PowerPC */
96# define CPU_PowerPC 1
97# elif ( defined(M68K) ) /* Lynx-OS on Motorola 68K */
98# define CPU_68K 1
99# endif
100#elif ( defined(AIX) ) /* IBM RS/6000 or PowerPC under AIX */
101# define OS_UNIX 1
102# define OS_AIX 1
103# define CPU_RS6000 1
104# define CPU_PowerPC 1
105#elif ( defined(__osf__) && defined(__alpha) ) /* DEC Unix */
106# define OS_UNIX 1
107# define OS_DECUNIX 1
108# define CPU_ALPHA 1
109# define SIXTY_FOUR_BITS 1
110#elif ( defined(OSK) ) /* OS-9 68k */
111# define OS_OS9 1
112# define CPU_68K 1
113# define FSTAT_NOT_AVAILABLE 1
114#elif ( defined(M68K) ) /* seems to be LynxOS on a 68k */
115# define OS_UNIX 1
116# define OS_LYNX 1
117# define CPU_68K 1
118#elif ( defined(__hpux) ) /* HP-UX */
119# define OS_HPUX 1
120# define OS_UNIX 1
121# ifdef __hppa
122# define CPU_HPPA 1
123# endif
124#else
125# if defined(unix) || defined(__unix)
126# define OS_UNIX 1 /* UNIX variant and CPU type are unknown */
127# endif
128#endif
129
130/* On UNIX the version of files extracted from SCCS are available for 'what' */
131#ifdef OS_UNIX
132# ifndef lint
133# define USING_SCCS 1
134# define USING_SCCS_ID 1
135# endif
136#endif
137
138/* The identifier 'ANSI_C' tells that a compiler supporting ANSI C is used */
139#if defined(__STDC__) /* Usually means 'ANSI C and nothing more than ANSI C' */
140# ifndef ANSI_C
141# define ANSI_C 1
142# endif
143#endif
144
145/* On the following systems all known C compilers (should) support ANSI C: */
146#if ( defined(OS_MSDOS) || defined(OS_VAXVMS) || defined(OS_UNIX) )
147# ifndef ANSI_C
148# define ANSI_C 1
149# endif
150#endif
151
152/* To test the code the 'ANSI_C' identifier may be reset */
153#ifdef SIMPLE_C
154# ifdef ANSI_C
155# undef ANSI_C
156# endif
157#endif
158
159/* Which types of systems have a VME bus? */
160#if ( defined(OS_OS9) || defined(OS_LYNX) )
161# define VME_BUS 1
162#endif
163
164/* -------------------------------------------------- */
165
166#ifndef NO_INITIAL_INCLUDES
167
168/* Include standard OS-dependent include files */
169#if ( defined(OS_OS9) || defined(BSD) )
170# include <strings.h>
171#else
172# include <string.h>
173#endif
174
175#include <stdio.h>
176#include <math.h>
177#ifndef M_PI
178# define M_PI 3.14159265358979323846
179#endif
180#include <time.h>
181#if defined(ANSI_C) || defined(__STDC__)
182# include <stdlib.h>
183#endif
184#ifdef OS_UNIX
185# include <unistd.h>
186#endif
187#ifdef OS_MSDOS
188# include <io.h>
189#endif
190#endif
191/* ^-- end of '#ifndef NO_INITIAL_INCLUDES' */
192
193/* -------------------------------------------------- */
194
195#if ANSI_C
196# define ARGLIST(a) a
197#else
198# define ARGLIST(a) ()
199#endif
200
201/* -------------------------------------------------- */
202
203#ifndef NO_INITIAL_MACROS
204
205#ifndef ANSI_C
206# ifndef NULL
207# define NULL (void *) 0
208# endif
209# ifdef OS_OS9
210 typedef unsigned size_t;
211# endif
212# define ARGLIST(a) ()
213#endif
214
215/* Definitions normally found in include files: */
216/* OS-9 include files don't define SEEK_CUR */
217#ifndef SEEK_CUR
218# define SEEK_CUR 1
219#endif
220/* OS-9 does not provide a isatty() function */
221#ifdef OS_OS9
222# define ISATTY_NOT_AVAILABLE 1
223# define strchr(arg1,arg2) index(arg1,arg2)
224char *getenv ARGLIST((char *));
225#endif
226#ifdef OS_LYNX
227# define memmove(a,b,n) bcopy(b,a,n)
228 void bcopy ARGLIST((char *b, char *a, int n));
229# define tsleep(t) usleep(10000*t)
230#endif
231
232/* fopen() options needed for portability to MS-DOS */
233#ifdef OS_MSDOS
234# define WRITE_TEXT "wt"
235# define WRITE_BINARY "wb"
236# define READ_TEXT "rt"
237# define READ_BINARY "rb"
238# define APPEND_TEXT "at"
239# define APPEND_BINARY "ab"
240#else
241# define WRITE_TEXT "w"
242# define WRITE_BINARY "w"
243# define READ_TEXT "r"
244# define READ_BINARY "r"
245# define APPEND_TEXT "a"
246# define APPEND_BINARY "a"
247#endif
248
249#ifndef __cplusplus
250
251/* Nearest integer macro */
252#define Nint(a) (((a)>=0.)?((long)(a+0.5)):((long)(a-0.5)))
253/* Absolute value independent of data type */
254#define Abs(a) (((a)>=0)?(a):(-1*(a)))
255#define Min(a,b) ((a)<(b)?(a):(b))
256#define Max(a,b) ((a)>(b)?(a):(b))
257#ifdef CRT
258/* Old names for the above macros as used in CRT code */
259# define NINT(a) Nint(a)
260# define ABS(a) Abs(a)
261#endif
262/* Minimum and maximum macros (same definition as in X11) */
263#ifndef min
264# define min(a,b) ((a)<(b)?(a):(b))
265#endif
266#ifndef max
267# define max(a,b) ((a)>(b)?(a):(b))
268#endif
269
270#define REGISTER register
271#endif
272/* ^-- end of '#ifndef __cplusplus' */
273#endif
274/* ^-- end of '#ifndef NO_INITIAL_MACROS' */
275
276/* -------------------------------------------------- */
277
278#define CONST_QUAL
279
280/* =========== Integer data types ============ */
281
282#ifdef __STDC__
283#ifdef __STDC_VERSION__
284#if ( __STDC_VERSION__ >= 199901L )
285#define ANSI_C_99 1
286#undef CONST_QUAL
287#define CONST_QUAL const /* Qualifier for constant data */
288#endif
289#endif
290#endif
291
292#if defined(ANSI_C) || defined(__STDC__)
293# include <sys/types.h>
294#endif
295
296#if defined(ANSI_C_99) || defined(__int8_t_defined)
297/* ANSI C99 (C9x) has the following types specified in stdint.h */
298/* Fairly recent gcc implementations have them as well (in sys/types.h) */
299/* but stdint.h is provided as well and duplication does no harm. */
300# include <stdint.h>
301/* Older (2.7.x) gcc versions have some of them defined in */
302/* <sys/bitypes.h> (which is included from <sys/types.h>) and the rest */
303/* is slightly different but we have no stdint.h. */
304#elif defined(__BIT_TYPES_DEFINED__)
305 typedef u_int8_t uint8_t;
306 typedef u_int16_t uint16_t;
307 typedef u_int32_t uint32_t;
308# else
309/* Only for the older compilers we have to declare all the types here. */
310# if !defined(__GNUC__) && !defined(OS_UNIX)
311 typedef /*signed*/ char int8_t;
312#else
313 typedef signed char int8_t;
314#endif
315 typedef unsigned char uint8_t;
316
317 typedef short int16_t;
318 typedef unsigned short uint16_t;
319
320# ifdef OS_MSDOS
321 typedef long int32_t;
322 typedef unsigned long uint32_t;
323# else
324 typedef int int32_t;
325 typedef unsigned int uint32_t;
326# endif
327# if defined(SIXTY_FOUR_BITS)
328 typedef long int64_t;
329 typedef unsigned long uint64_t;
330# endif
331#endif
332
333/* This should do it for most other 64 bit systems than DEC Unix */
334#ifndef SIXTY_FOUR_BITS
335# ifdef __WORDSIZE
336# if __WORDSIZE == 64
337# define SIXTY_FOUR_BITS 1
338# endif
339# endif
340#endif
341
342/* Many 32 bit systems have long long int as 64 bit integer */
343#if defined(SIXTY_FOUR_BITS) || ( defined(INT64_MAX) && defined(__GNUC__) )
344# define HAVE_64BIT_INT 1
345#endif
346
347#ifdef __cplusplus
348}
349#endif
350
351#endif
Note: See TracBrowser for help on using the repository browser.