xref: /xnu-11417.140.69/bsd/arm/_types.h (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
1*43a90889SApple OSS Distributions /*
2*43a90889SApple OSS Distributions  * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3*43a90889SApple OSS Distributions  */
4*43a90889SApple OSS Distributions #ifndef _BSD_ARM__TYPES_H_
5*43a90889SApple OSS Distributions #define _BSD_ARM__TYPES_H_
6*43a90889SApple OSS Distributions 
7*43a90889SApple OSS Distributions #if defined (__arm__) || defined (__arm64__)
8*43a90889SApple OSS Distributions 
9*43a90889SApple OSS Distributions #if defined(KERNEL)
10*43a90889SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
11*43a90889SApple OSS Distributions /*
12*43a90889SApple OSS Distributions  * Xcode doesn't currently set up search paths correctly for Kernel extensions,
13*43a90889SApple OSS Distributions  * so the clang headers are not seen in the correct order to use their types.
14*43a90889SApple OSS Distributions  */
15*43a90889SApple OSS Distributions #endif
16*43a90889SApple OSS Distributions #define USE_CLANG_TYPES 0
17*43a90889SApple OSS Distributions #else
18*43a90889SApple OSS Distributions #if defined(__has_feature) && __has_feature(modules)
19*43a90889SApple OSS Distributions #define USE_CLANG_TYPES 1
20*43a90889SApple OSS Distributions #else
21*43a90889SApple OSS Distributions #define USE_CLANG_TYPES 0
22*43a90889SApple OSS Distributions #endif
23*43a90889SApple OSS Distributions #endif
24*43a90889SApple OSS Distributions 
25*43a90889SApple OSS Distributions #if USE_CLANG_TYPES
26*43a90889SApple OSS Distributions #include <sys/_types/_ptrdiff_t.h>
27*43a90889SApple OSS Distributions #include <sys/_types/_size_t.h>
28*43a90889SApple OSS Distributions #include <sys/_types/_va_list.h>
29*43a90889SApple OSS Distributions #include <sys/_types/_wchar_t.h>
30*43a90889SApple OSS Distributions #endif
31*43a90889SApple OSS Distributions 
32*43a90889SApple OSS Distributions /*
33*43a90889SApple OSS Distributions  * This header file contains integer types.  It's intended to also contain
34*43a90889SApple OSS Distributions  * flotaing point and other arithmetic types, as needed, later.
35*43a90889SApple OSS Distributions  */
36*43a90889SApple OSS Distributions 
37*43a90889SApple OSS Distributions #ifdef __GNUC__
38*43a90889SApple OSS Distributions typedef __signed char           __int8_t;
39*43a90889SApple OSS Distributions #else   /* !__GNUC__ */
40*43a90889SApple OSS Distributions typedef char                    __int8_t;
41*43a90889SApple OSS Distributions #endif  /* !__GNUC__ */
42*43a90889SApple OSS Distributions typedef unsigned char           __uint8_t;
43*43a90889SApple OSS Distributions typedef short                   __int16_t;
44*43a90889SApple OSS Distributions typedef unsigned short          __uint16_t;
45*43a90889SApple OSS Distributions typedef int                     __int32_t;
46*43a90889SApple OSS Distributions typedef unsigned int            __uint32_t;
47*43a90889SApple OSS Distributions typedef long long               __int64_t;
48*43a90889SApple OSS Distributions typedef unsigned long long      __uint64_t;
49*43a90889SApple OSS Distributions 
50*43a90889SApple OSS Distributions typedef long                    __darwin_intptr_t;
51*43a90889SApple OSS Distributions typedef unsigned int            __darwin_natural_t;
52*43a90889SApple OSS Distributions 
53*43a90889SApple OSS Distributions /*
54*43a90889SApple OSS Distributions  * The rune type below is declared to be an ``int'' instead of the more natural
55*43a90889SApple OSS Distributions  * ``unsigned long'' or ``long''.  Two things are happening here.  It is not
56*43a90889SApple OSS Distributions  * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,
57*43a90889SApple OSS Distributions  * it looks like 10646 will be a 31 bit standard.  This means that if your
58*43a90889SApple OSS Distributions  * ints cannot hold 32 bits, you will be in trouble.  The reason an int was
59*43a90889SApple OSS Distributions  * chosen over a long is that the is*() and to*() routines take ints (says
60*43a90889SApple OSS Distributions  * ANSI C), but they use __darwin_ct_rune_t instead of int.  By changing it
61*43a90889SApple OSS Distributions  * here, you lose a bit of ANSI conformance, but your programs will still
62*43a90889SApple OSS Distributions  * work.
63*43a90889SApple OSS Distributions  *
64*43a90889SApple OSS Distributions  * NOTE: rune_t is not covered by ANSI nor other standards, and should not
65*43a90889SApple OSS Distributions  * be instantiated outside of lib/libc/locale.  Use wchar_t.  wchar_t and
66*43a90889SApple OSS Distributions  * rune_t must be the same type.  Also wint_t must be no narrower than
67*43a90889SApple OSS Distributions  * wchar_t, and should also be able to hold all members of the largest
68*43a90889SApple OSS Distributions  * character set plus one extra value (WEOF). wint_t must be at least 16 bits.
69*43a90889SApple OSS Distributions  */
70*43a90889SApple OSS Distributions 
71*43a90889SApple OSS Distributions typedef int                     __darwin_ct_rune_t;     /* ct_rune_t */
72*43a90889SApple OSS Distributions 
73*43a90889SApple OSS Distributions /*
74*43a90889SApple OSS Distributions  * mbstate_t is an opaque object to keep conversion state, during multibyte
75*43a90889SApple OSS Distributions  * stream conversions.  The content must not be referenced by user programs.
76*43a90889SApple OSS Distributions  */
77*43a90889SApple OSS Distributions typedef union {
78*43a90889SApple OSS Distributions 	char            __mbstate8[128];
79*43a90889SApple OSS Distributions 	long long       _mbstateL;                      /* for alignment */
80*43a90889SApple OSS Distributions } __mbstate_t;
81*43a90889SApple OSS Distributions 
82*43a90889SApple OSS Distributions typedef __mbstate_t             __darwin_mbstate_t;     /* mbstate_t */
83*43a90889SApple OSS Distributions 
84*43a90889SApple OSS Distributions #if USE_CLANG_TYPES
85*43a90889SApple OSS Distributions typedef ptrdiff_t               __darwin_ptrdiff_t;     /* ptr1 - ptr2 */
86*43a90889SApple OSS Distributions #elif defined(__PTRDIFF_TYPE__)
87*43a90889SApple OSS Distributions typedef __PTRDIFF_TYPE__        __darwin_ptrdiff_t;     /* ptr1 - ptr2 */
88*43a90889SApple OSS Distributions #elif defined(__LP64__)
89*43a90889SApple OSS Distributions typedef long                    __darwin_ptrdiff_t;     /* ptr1 - ptr2 */
90*43a90889SApple OSS Distributions #else
91*43a90889SApple OSS Distributions typedef int                     __darwin_ptrdiff_t;     /* ptr1 - ptr2 */
92*43a90889SApple OSS Distributions #endif /* __GNUC__ */
93*43a90889SApple OSS Distributions 
94*43a90889SApple OSS Distributions #if USE_CLANG_TYPES
95*43a90889SApple OSS Distributions typedef size_t                  __darwin_size_t;        /* sizeof() */
96*43a90889SApple OSS Distributions #elif defined(__SIZE_TYPE__)
97*43a90889SApple OSS Distributions typedef __SIZE_TYPE__           __darwin_size_t;        /* sizeof() */
98*43a90889SApple OSS Distributions #else
99*43a90889SApple OSS Distributions typedef unsigned long           __darwin_size_t;        /* sizeof() */
100*43a90889SApple OSS Distributions #endif
101*43a90889SApple OSS Distributions 
102*43a90889SApple OSS Distributions #if USE_CLANG_TYPES
103*43a90889SApple OSS Distributions typedef va_list                 __darwin_va_list;       /* va_list */
104*43a90889SApple OSS Distributions #elif (__GNUC__ > 2)
105*43a90889SApple OSS Distributions typedef __builtin_va_list       __darwin_va_list;       /* va_list */
106*43a90889SApple OSS Distributions #else
107*43a90889SApple OSS Distributions typedef void *                  __darwin_va_list;       /* va_list */
108*43a90889SApple OSS Distributions #endif
109*43a90889SApple OSS Distributions 
110*43a90889SApple OSS Distributions #if USE_CLANG_TYPES
111*43a90889SApple OSS Distributions typedef wchar_t                 __darwin_wchar_t;       /* wchar_t */
112*43a90889SApple OSS Distributions #elif defined(__WCHAR_TYPE__)
113*43a90889SApple OSS Distributions typedef __WCHAR_TYPE__          __darwin_wchar_t;       /* wchar_t */
114*43a90889SApple OSS Distributions #else
115*43a90889SApple OSS Distributions typedef __darwin_ct_rune_t      __darwin_wchar_t;       /* wchar_t */
116*43a90889SApple OSS Distributions #endif
117*43a90889SApple OSS Distributions 
118*43a90889SApple OSS Distributions typedef __darwin_wchar_t        __darwin_rune_t;        /* rune_t */
119*43a90889SApple OSS Distributions 
120*43a90889SApple OSS Distributions #if defined(__WINT_TYPE__)
121*43a90889SApple OSS Distributions typedef __WINT_TYPE__           __darwin_wint_t;        /* wint_t */
122*43a90889SApple OSS Distributions #else
123*43a90889SApple OSS Distributions typedef __darwin_ct_rune_t      __darwin_wint_t;        /* wint_t */
124*43a90889SApple OSS Distributions #endif
125*43a90889SApple OSS Distributions 
126*43a90889SApple OSS Distributions typedef unsigned long           __darwin_clock_t;       /* clock() */
127*43a90889SApple OSS Distributions typedef __uint32_t              __darwin_socklen_t;     /* socklen_t (duh) */
128*43a90889SApple OSS Distributions typedef long                    __darwin_ssize_t;       /* byte count or error */
129*43a90889SApple OSS Distributions typedef long                    __darwin_time_t;        /* time() */
130*43a90889SApple OSS Distributions 
131*43a90889SApple OSS Distributions #undef USE_CLANG_TYPES
132*43a90889SApple OSS Distributions 
133*43a90889SApple OSS Distributions #endif /* defined (__arm__) || defined (__arm64__) */
134*43a90889SApple OSS Distributions 
135*43a90889SApple OSS Distributions #endif  /* _BSD_ARM__TYPES_H_ */
136