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