]> git.saurik.com Git - apple/xnu.git/blob - bsd/i386/_types.h
3734dcb2396e6c4cd63d1d5acf7a760ee8a9e7a6
[apple/xnu.git] / bsd / i386 / _types.h
1 /*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 #ifndef _BSD_I386__TYPES_H_
31 #define _BSD_I386__TYPES_H_
32
33 /*
34 * This header file contains integer types. It's intended to also contain
35 * flotaing point and other arithmetic types, as needed, later.
36 */
37
38 #ifdef __GNUC__
39 typedef __signed char __int8_t;
40 #else /* !__GNUC__ */
41 typedef char __int8_t;
42 #endif /* !__GNUC__ */
43 typedef unsigned char __uint8_t;
44 typedef unsigned short __int16_t;
45 typedef unsigned short __uint16_t;
46 typedef int __int32_t;
47 typedef unsigned int __uint32_t;
48 typedef long long __int64_t;
49 typedef unsigned long long __uint64_t;
50
51 typedef long __darwin_intptr_t;
52 typedef unsigned int __darwin_natural_t;
53
54 /*
55 * The rune type below is declared to be an ``int'' instead of the more natural
56 * ``unsigned long'' or ``long''. Two things are happening here. It is not
57 * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
58 * it looks like 10646 will be a 31 bit standard. This means that if your
59 * ints cannot hold 32 bits, you will be in trouble. The reason an int was
60 * chosen over a long is that the is*() and to*() routines take ints (says
61 * ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
62 * here, you lose a bit of ANSI conformance, but your programs will still
63 * work.
64 *
65 * NOTE: rune_t is not covered by ANSI nor other standards, and should not
66 * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
67 * rune_t must be the same type. Also wint_t must be no narrower than
68 * wchar_t, and should also be able to hold all members of the largest
69 * character set plus one extra value (WEOF). wint_t must be at least 16 bits.
70 */
71
72 typedef int __darwin_ct_rune_t; /* ct_rune_t */
73
74 /*
75 * mbstate_t is an opaque object to keep conversion state, during multibyte
76 * stream conversions. The content must not be referenced by user programs.
77 */
78 typedef union {
79 char __mbstate8[128];
80 long long _mbstateL; /* for alignment */
81 } __mbstate_t;
82
83 typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
84
85 #if defined(__GNUC__) && defined(__PTRDIFF_TYPE__)
86 typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
87 #else
88 typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
89 #endif /* __GNUC__ */
90
91 #if defined(__GNUC__) && defined(__SIZE_TYPE__)
92 typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
93 #else
94 typedef unsigned long __darwin_size_t; /* sizeof() */
95 #endif
96
97 #ifdef KERNEL
98 typedef void * __darwin_va_list; /* va_list */
99 #else /* !KERNEL */
100 #if (__GNUC__ > 2)
101 typedef __builtin_va_list __darwin_va_list; /* va_list */
102 #else
103 typedef void * __darwin_va_list; /* va_list */
104 #endif
105 #endif /* KERNEL */
106
107 #if defined(__GNUC__) && defined(__WCHAR_TYPE__)
108 typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
109 #else
110 typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
111 #endif
112
113 typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
114
115 #if defined(__GNUC__) && defined(__WINT_TYPE__)
116 typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
117 #else
118 typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
119 #endif
120
121 typedef unsigned long __darwin_clock_t; /* clock() */
122 typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
123 typedef long __darwin_ssize_t; /* byte count or error */
124 typedef long __darwin_time_t; /* time() */
125
126 #endif /* _BSD_I386__TYPES_H_ */