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