1 |
/* |
2 |
* sysdeps.h - System dependent definitions |
3 |
* |
4 |
* cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#ifndef SYSDEPS_H |
22 |
#define SYSDEPS_H |
23 |
|
24 |
#ifndef __STDC__ |
25 |
#error "Your compiler is not ANSI. Get a real one." |
26 |
#endif |
27 |
|
28 |
#include "config.h" |
29 |
|
30 |
#ifndef STDC_HEADERS |
31 |
#error "You don't have ANSI C header files." |
32 |
#endif |
33 |
|
34 |
#ifdef HAVE_UNISTD_H |
35 |
# include <sys/types.h> |
36 |
# include <unistd.h> |
37 |
#endif |
38 |
|
39 |
#include <netinet/in.h> |
40 |
#include <string.h> |
41 |
#include <errno.h> |
42 |
|
43 |
/* Data types */ |
44 |
|
45 |
#ifdef __BEOS__ |
46 |
|
47 |
#include <support/ByteOrder.h> |
48 |
|
49 |
#else |
50 |
|
51 |
typedef unsigned char uint8; |
52 |
typedef signed char int8; |
53 |
#if SIZEOF_SHORT == 2 |
54 |
typedef unsigned short uint16; |
55 |
typedef short int16; |
56 |
#elif SIZEOF_INT == 2 |
57 |
typedef unsigned int uint16; |
58 |
typedef int int16; |
59 |
#else |
60 |
#error "No 2 byte type, you lose." |
61 |
#endif |
62 |
#if SIZEOF_INT == 4 |
63 |
typedef unsigned int uint32; |
64 |
typedef int int32; |
65 |
#elif SIZEOF_LONG == 4 |
66 |
typedef unsigned long uint32; |
67 |
typedef long int32; |
68 |
#else |
69 |
#error "No 4 byte type, you lose." |
70 |
#endif |
71 |
#if SIZEOF_LONG == 8 |
72 |
typedef unsigned long uint64; |
73 |
typedef long int64; |
74 |
#define VAL64(a) (a ## l) |
75 |
#define UVAL64(a) (a ## ul) |
76 |
#elif SIZEOF_LONG_LONG == 8 |
77 |
typedef unsigned long long uint64; |
78 |
typedef long long int64; |
79 |
#define VAL64(a) (a ## LL) |
80 |
#define UVAL64(a) (a ## uLL) |
81 |
#else |
82 |
#error "No 8 byte type, you lose." |
83 |
#endif |
84 |
#if SIZEOF_VOID_P == 4 |
85 |
typedef uint32 uintptr; |
86 |
typedef int32 intptr; |
87 |
#elif SIZEOF_VOID_P == 8 |
88 |
typedef uint64 uintptr; |
89 |
typedef int64 intptr; |
90 |
#else |
91 |
#error "Unsupported size of pointer" |
92 |
#endif |
93 |
|
94 |
#endif // def __BEOS__ |
95 |
|
96 |
#endif |