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