Get the ol' Dreamcast target building and sort of booting again.
[newos.git] / include / newos / types.h
blob93c45ce4da2bc603a4f97e6c43fd5914507af3a5
1 /*
2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #ifndef _TYPES_H
6 #define _TYPES_H
8 #if defined(__i386__) || defined(__I386__)
9 #undef i386
10 #define INC_ARCH(path, x) <path/i386/x>
11 #endif
12 #if defined(__ppc__) || defined(__PPC__)
13 #undef ppc
14 #define INC_ARCH(path, x) <path/ppc/x>
15 #endif
16 #if defined(__x86_64__) || defined(__X86_64__)
17 #undef x86_64
18 #define INC_ARCH(path, x) <path/x86_64/x>
19 #endif
20 #if defined(__arm__) || defined(__ARM__)
21 #undef arm
22 #define INC_ARCH(path, x) <path/arm/x>
23 #endif
24 #if defined(__sh4__) || defined(__SH4__)
25 #undef sh4
26 #define INC_ARCH(path, x) <path/sh4/x>
27 #endif
30 #include INC_ARCH(arch,types.h)
32 #ifndef __cplusplus
34 #define false 0
35 #define true 1
36 typedef int bool;
38 #endif
41 XXX serious hack that doesn't really solve the problem.
42 As of right now, some versions of the toolchain expect size_t to
43 be unsigned long (newer ones than 2.95.2 and beos), and the older
44 ones need it to be unsigned int. It's an actual failure when
45 operator new is declared. This will have to be resolved in the
46 future.
49 #ifdef ARCH_m68k
50 #define __SIZE_T_LONG 1
51 #endif
53 #ifdef ARCH_ppc
54 #define __SIZE_T_INT 1
55 #endif
57 #ifdef ARCH_sh4
58 #define __SIZE_T_INT 1
59 #endif
61 #if !__SIZE_T_LONG && !__SIZE_T_INT
62 /* when in doubt, set it to LONG */
63 #define __SIZE_T_LONG 1
64 #endif
66 /* uncomment the following if you want to override LONG vs INT */
67 #if 0
68 #ifdef __SIZE_T_LONG
69 #undef __SIZE_T_LONG
70 #endif
71 #ifdef __SIZE_T_INT
72 #undef __SIZE_T_INT
73 #endif
75 /* to override the LONG vs INT setting, set *one* of the below to 1 */
76 #define __SIZE_T_LONG 0
77 #define __SIZE_T_INT 1
78 #endif
80 // note that we only declare a proxy typedef here for size_t, called _newos_size_t
81 // which stddef.h then retypedefs as the actual size_t. ssize_t is not C++ standard,
82 // so it belongs here as well as anywhere.
84 #if __SIZE_T_LONG
85 typedef unsigned long _newos_size_t;
86 typedef signed long ssize_t;
87 #elif __SIZE_T_INT
88 typedef unsigned int _newos_size_t;
89 typedef signed int ssize_t;
90 #else
91 #error "Don't know what size_t should be (int or long)!"
92 #endif
94 typedef int64 off_t;
96 typedef unsigned char u_char;
97 typedef unsigned short u_short;
98 typedef unsigned int u_int;
99 typedef unsigned long u_long;
101 typedef unsigned char uchar;
102 typedef unsigned short ushort;
103 typedef unsigned int uint;
104 typedef unsigned long ulong;
106 typedef volatile unsigned char vuchar;
107 typedef volatile unsigned short vushort;
108 typedef volatile unsigned int vuint;
109 typedef volatile unsigned long vulong;
111 /* system types */
112 typedef int64 bigtime_t;
113 typedef uint64 vnode_id;
114 typedef int region_id; // vm region id
115 typedef int aspace_id; // address space id
116 typedef int thread_id; // thread id
117 typedef int proc_id; // process id
118 typedef int pgrp_id; // process group id
119 typedef int sess_id; // session id
120 typedef int sem_id; // semaphore id
121 typedef int port_id; // ipc port id
122 typedef int image_id; // binary image id
124 # include <stddef.h>
126 #endif