FreeWRL / FreeX3D 4.3.0
system.h
1/*******************************************************************
2 *
3 * FreeWRL main program
4 *
5 * internal header - system.h
6 *
7 * Program system dependencies.
8 *
9 *
10 *******************************************************************/
11
12/****************************************************************************
13 This file is part of the FreeWRL/FreeX3D Distribution.
14
15 Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
16
17 FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
18 it under the terms of the GNU Lesser Public License as published by
19 the Free Software Foundation, either version 3 of the License, or
20 (at your option) any later version.
21
22 FreeWRL/FreeX3D is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
26
27 You should have received a copy of the GNU General Public License
28 along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
29****************************************************************************/
30
31
32
33#ifndef __FREEWRL_SYSTEM_H__
34#define __FREEWRL_SYSTEM_H__
35
36#if HAVE_STDINT_H
37# include <stdint.h>
38#endif
39
40#if STDC_HEADERS
41# include <stdio.h>
42# include <stdlib.h>
43# include <string.h>
44#else
45# if !HAVE_STRCHR
46# define strchr index
47# define strrchr rindex
48# endif
49char *strchr (), *strrchr ();
50# if !HAVE_MEMCPY
51# define memcpy(d, s, n) bcopy ((s), (d), (n))
52# define memmove(d, s, n) bcopy ((s), (d), (n))
53# endif
54#endif
55
56#if HAVE_STDBOOL_H
57# include <stdbool.h>
58#else
59# if ! HAVE__BOOL
60# ifdef __cplusplus
61typedef bool _Bool;
62# else
63typedef unsigned char _Bool;
64# endif
65# endif
66# define bool _Bool
67# define false 0
68# define true 1
69# define __bool_true_false_are_defined 1
70#endif
71
72#define TRUE 1
73#define FALSE 0
74
75#if HAVE_UNISTD_H
76# if HAVE_SYS_TYPES_H
77# include <sys/types.h>
78# endif
79# include <unistd.h>
80#endif
81
82#if defined(_MSC_VER)
83
84#if HAVE_SYS_WAIT_H
85# include <sys/wait.h>
86#endif
87#ifndef WEXITSTATUS
88# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
89#endif
90#ifndef WIFEXITED
91# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
92#endif
93
94#if HAVE_PTHREAD
95# include <pthread.h>
96#endif
97
98#if HAVE_SYS_IPC_H
99# include <sys/ipc.h>
100#endif
101
102#if HAVE_SYS_MSG_H
103# include <sys/msg.h>
104#endif
105
106#if !defined(assert)
107# include <assert.h>
108#endif
109
110#if HAVE_DIRECT_H
111#include <direct.h>
112#endif
113
114#if HAVE_SIGNAL_H
115#include <signal.h>
116 /* install the signal handler for SIGQUIT */
117#define SIGQUIT SIGINT
118/*#define SIGTERM SIGTERM *//*not generated under win32 but can raise */
119/*#define SIGSEGV SIGSEGV */ /* memory overrun */
120#define SIGALRM SIGABRT /* I don't know so I guessed the lookup */
121#define SIGHUP SIGFPE /* fpe means floating poinot error */
122#endif
123
124
125#else
126
127#if HAVE_SIGNAL_H
128#include <signal.h>
129#endif
130
131#endif
132
133
134
135#endif /* __FREEWRL_SYSTEM_H__ */