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