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