├── APPLE_LICENSE ├── BuildCFLite ├── CFApplicationPreferences.c ├── CFArray.c ├── CFArray.h ├── CFBag.c ├── CFBag.h ├── CFBase.c ├── CFBase.h ├── CFBasicHash.h ├── CFBasicHash.m ├── CFBinaryHeap.c ├── CFBinaryHeap.h ├── CFBinaryPList.c ├── CFBitVector.c ├── CFBitVector.h ├── CFBuiltinConverters.c ├── CFBundle.c ├── CFBundle.h ├── CFBundlePriv.h ├── CFBundle_BinaryTypes.h ├── CFBundle_Internal.h ├── CFBundle_Resources.c ├── CFByteOrder.h ├── CFCalendar.c ├── CFCalendar.h ├── CFCharacterSet.c ├── CFCharacterSet.h ├── CFCharacterSetBitmaps.bitmap ├── CFCharacterSetPriv.h ├── CFConcreteStreams.c ├── CFData.c ├── CFData.h ├── CFDate.c ├── CFDate.h ├── CFDateFormatter.c ├── CFDateFormatter.h ├── CFDictionary.c ├── CFDictionary.h ├── CFError.c ├── CFError.h ├── CFError_Private.h ├── CFFileUtilities.c ├── CFICUConverters.c ├── CFICUConverters.h ├── CFInternal.h ├── CFLocale.c ├── CFLocale.h ├── CFLocaleIdentifier.c ├── CFLocaleInternal.h ├── CFLocaleKeys.m ├── CFLogUtilities.h ├── CFMachPort.c ├── CFMachPort.h ├── CFMessagePort.c ├── CFMessagePort.h ├── CFNumber.c ├── CFNumber.h ├── CFNumberFormatter.c ├── CFNumberFormatter.h ├── CFPlatform.c ├── CFPlatformConverters.c ├── CFPlugIn.c ├── CFPlugIn.h ├── CFPlugInCOM.h ├── CFPlugIn_Factory.c ├── CFPlugIn_Factory.h ├── CFPlugIn_Instance.c ├── CFPlugIn_PlugIn.c ├── CFPreferences.c ├── CFPreferences.h ├── CFPriv.h ├── CFPropertyList.c ├── CFPropertyList.h ├── CFRunLoop.c ├── CFRunLoop.h ├── CFRuntime.c ├── CFRuntime.h ├── CFSet.c ├── CFSet.h ├── CFSocket.c ├── CFSocket.h ├── CFSocketStream.c ├── CFSortFunctions.c ├── CFStorage.c ├── CFStorage.h ├── CFStream.c ├── CFStream.h ├── CFStreamAbstract.h ├── CFStreamInternal.h ├── CFStreamPriv.h ├── CFString.c ├── CFString.h ├── CFStringDefaultEncoding.h ├── CFStringEncodingConverter.c ├── CFStringEncodingConverter.h ├── CFStringEncodingConverterExt.h ├── CFStringEncodingConverterPriv.h ├── CFStringEncodingDatabase.c ├── CFStringEncodingDatabase.h ├── CFStringEncodingExt.h ├── CFStringEncodings.c ├── CFStringScanner.c ├── CFStringUtilities.c ├── CFSystemDirectories.c ├── CFTimeZone.c ├── CFTimeZone.h ├── CFTree.c ├── CFTree.h ├── CFURL.c ├── CFURL.h ├── CFURLAccess.c ├── CFURLAccess.h ├── CFUUID.c ├── CFUUID.h ├── CFUniChar.c ├── CFUniChar.h ├── CFUniCharPriv.h ├── CFUniCharPropertyDatabase.data ├── CFUnicodeData-B.mapping ├── CFUnicodeData-L.mapping ├── CFUnicodeDecomposition.c ├── CFUnicodeDecomposition.h ├── CFUnicodePrecomposition.c ├── CFUnicodePrecomposition.h ├── CFUserNotification.c ├── CFUserNotification.h ├── CFUtilities.c ├── CFVersion.c ├── CFWindowsMessageQueue.c ├── CFWindowsMessageQueue.h ├── CFXMLInputStream.c ├── CFXMLInputStream.h ├── CFXMLNode.c ├── CFXMLNode.h ├── CFXMLParser.c ├── CFXMLParser.h ├── CFXMLPreferencesDomain.c ├── CFXMLTree.c ├── CoreFoundation.h ├── CoreFoundation_Prefix.h ├── ForFoundationOnly.h ├── Info.plist ├── Makefile └── PropertyList.dtd /BuildCFLite: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | echo "Setup ..." 4 | 5 | ALL_CFILES=`ls *.c` 6 | ALL_HFILES=`ls *.h` 7 | ALL_MFILES=`ls *.m` 8 | 9 | MACHINE_TYPE=`uname -p` 10 | UNICODE_DATA_FILE="UNKNOWN" 11 | 12 | if [ "$MACHINE_TYPE" == "i386" ]; then 13 | UNICODE_DATA_FILE="CFUnicodeData-L.mapping" 14 | fi 15 | 16 | if [ "$MACHINE_TYPE" == "i686" ]; then 17 | UNICODE_DATA_FILE="CFUnicodeData-L.mapping" 18 | fi 19 | 20 | if [ "$MACHINE_TYPE" == "powerpc" ]; then 21 | UNICODE_DATA_FILE="CFUnicodeData-B.mapping" 22 | fi 23 | 24 | PUBLIC_HEADERS="CFArray.h CFBag.h CFBase.h CFBinaryHeap.h CFBitVector.h CFBundle.h CFByteOrder.h CFCalendar.h CFCharacterSet.h CFData.h CFDate.h CFDateFormatter.h CFDictionary.h CFError.h CFLocale.h CFMachPort.h CFMessagePort.h CFNumber.h CFNumberFormatter.h CFPlugIn.h CFPlugInCOM.h CFPreferences.h CFPropertyList.h CFRunLoop.h CFSet.h CFSocket.h CFStream.h CFString.h CFStringEncodingExt.h CFTimeZone.h CFTree.h CFURL.h CFURLAccess.h CFUUID.h CFUserNotification.h CFXMLNode.h CFXMLParser.h CoreFoundation.h" 25 | PRIVATE_HEADERS="CFBundlePriv.h CFCharacterSetPriv.h CFError_Private.h CFLogUtilities.h CFPriv.h CFRuntime.h CFStorage.h CFStreamAbstract.h CFStreamPriv.h CFStreamInternal.h CFStringDefaultEncoding.h CFStringEncodingConverter.h CFStringEncodingConverterExt.h CFUniChar.h CFUnicodeDecomposition.h CFUnicodePrecomposition.h ForFoundationOnly.h" 26 | 27 | OBJBASE=./CF-Objects 28 | ARCHFLAGS="-arch ppc -arch i386 -arch x86_64" 29 | CFLAGS="-c -x objective-c -pipe -std=gnu99 -g -Wmost -Wno-trigraphs -mmacosx-version-min=10.6 -fconstant-cfstrings -fexceptions -DCF_BUILDING_CF=1 -DDEPLOYMENT_TARGET_MACOSX=1 -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_6 -DU_SHOW_DRAFT_API=1 -I$OBJBASE -DVERSION=535 -include CoreFoundation_Prefix.h" 30 | LFLAGS="-dynamiclib -mmacosx-version-min=10.6 -twolevel_namespace -init ___CFInitialize -compatibility_version 150 -current_version 535 -sectcreate __UNICODE __csbitmaps CFCharacterSetBitmaps.bitmap -sectcreate __UNICODE __properties CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data $UNICODE_DATA_FILE -segprot __UNICODE r r" 31 | 32 | /bin/rm -rf $OBJBASE 33 | /bin/mkdir -p $OBJBASE 34 | /bin/mkdir $OBJBASE/normal 35 | /bin/mkdir $OBJBASE/CoreFoundation 36 | /bin/cp $ALL_HFILES $OBJBASE/CoreFoundation 37 | if [ $? -ne 0 ]; then 38 | echo "Setup failed" 39 | exit 1 40 | fi 41 | 42 | Build () { 43 | echo "Compiling $STYLE ..." 44 | for F in $ALL_CFILES ; do 45 | echo /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o 46 | /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o 47 | if [ $? -ne 0 ]; then 48 | echo "*** Compiling $STYLE failed ***" 49 | exit 1 50 | fi 51 | done 52 | for F in $ALL_MFILES ; do 53 | echo /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .m`.o 54 | /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .m`.o 55 | if [ $? -ne 0 ]; then 56 | echo "*** Compiling $STYLE failed ***" 57 | exit 1 58 | fi 59 | done 60 | echo "Linking $STYLE ..." 61 | echo /usr/bin/gcc $STYLE_LFLAGS -install_name /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation_$STYLE $ARCHFLAGS $LFLAGS $OBJBASE/$STYLE/*.o -licucore.A -lobjc -o $OBJBASE/CoreFoundation_$STYLE 62 | /usr/bin/gcc $STYLE_LFLAGS -install_name /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation_$STYLE $ARCHFLAGS $LFLAGS $OBJBASE/$STYLE/*.o -licucore.A -lobjc -o $OBJBASE/CoreFoundation_$STYLE 63 | if [ $? -ne 0 ]; then 64 | echo "*** Linking $STYLE failed ***" 65 | exit 1 66 | fi 67 | } 68 | 69 | STYLE=normal 70 | STYLE_CFLAGS="-O2" 71 | STYLE_LFLAGS= 72 | Build 73 | 74 | echo "Building done." 75 | 76 | echo "Installing ..." 77 | if [ -z "$DSTBASE" ]; then DSTBASE=../CF-Root ; fi 78 | 79 | /bin/rm -rf $DSTBASE/CoreFoundation.framework 80 | /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Resources 81 | /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Headers 82 | /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/PrivateHeaders 83 | /bin/ln -sf A $DSTBASE/CoreFoundation.framework/Versions/Current 84 | /bin/ln -sf Versions/Current/Resources $DSTBASE/CoreFoundation.framework/Resources 85 | /bin/ln -sf Versions/Current/Headers $DSTBASE/CoreFoundation.framework/Headers 86 | /bin/ln -sf Versions/Current/PrivateHeaders $DSTBASE/CoreFoundation.framework/PrivateHeaders 87 | /bin/ln -sf Versions/Current/CoreFoundation $DSTBASE/CoreFoundation.framework/CoreFoundation 88 | /bin/cp Info.plist $DSTBASE/CoreFoundation.framework/Versions/A/Resources 89 | /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Resources/en.lproj 90 | /bin/cp $PUBLIC_HEADERS $DSTBASE/CoreFoundation.framework/Versions/A/Headers 91 | /bin/cp $PRIVATE_HEADERS $DSTBASE/CoreFoundation.framework/Versions/A/PrivateHeaders 92 | /usr/bin/strip -S -o $DSTBASE/CoreFoundation.framework/Versions/A/CoreFoundation $OBJBASE/CoreFoundation_normal 93 | /usr/sbin/chown -RH -f root:wheel $DSTBASE/CoreFoundation.framework 94 | /bin/chmod -RH a-w,a+rX $DSTBASE/CoreFoundation.framework 95 | /bin/chmod -RH u+w $DSTBASE 96 | 97 | install_name_tool -id /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation $DSTBASE/CoreFoundation.framework/Versions/A/CoreFoundation 98 | 99 | echo "Installing done. The framework is in $DSTBASE" 100 | 101 | exit 0 102 | 103 | -------------------------------------------------------------------------------- /CFBag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFBag.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFBAG__) 29 | #define __COREFOUNDATION_CFBAG__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | typedef const void * (*CFBagRetainCallBack)(CFAllocatorRef allocator, const void *value); 36 | typedef void (*CFBagReleaseCallBack)(CFAllocatorRef allocator, const void *value); 37 | typedef CFStringRef (*CFBagCopyDescriptionCallBack)(const void *value); 38 | typedef Boolean (*CFBagEqualCallBack)(const void *value1, const void *value2); 39 | typedef CFHashCode (*CFBagHashCallBack)(const void *value); 40 | typedef struct { 41 | CFIndex version; 42 | CFBagRetainCallBack retain; 43 | CFBagReleaseCallBack release; 44 | CFBagCopyDescriptionCallBack copyDescription; 45 | CFBagEqualCallBack equal; 46 | CFBagHashCallBack hash; 47 | } CFBagCallBacks; 48 | 49 | CF_EXPORT 50 | const CFBagCallBacks kCFTypeBagCallBacks; 51 | CF_EXPORT 52 | const CFBagCallBacks kCFCopyStringBagCallBacks; 53 | 54 | typedef void (*CFBagApplierFunction)(const void *value, void *context); 55 | 56 | typedef const struct __CFBag * CFBagRef; 57 | typedef struct __CFBag * CFMutableBagRef; 58 | 59 | CF_EXPORT 60 | CFTypeID CFBagGetTypeID(void); 61 | 62 | CF_EXPORT 63 | CFBagRef CFBagCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFBagCallBacks *callBacks); 64 | 65 | CF_EXPORT 66 | CFBagRef CFBagCreateCopy(CFAllocatorRef allocator, CFBagRef theBag); 67 | 68 | CF_EXPORT 69 | CFMutableBagRef CFBagCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFBagCallBacks *callBacks); 70 | 71 | CF_EXPORT 72 | CFMutableBagRef CFBagCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFBagRef theBag); 73 | 74 | CF_EXPORT 75 | CFIndex CFBagGetCount(CFBagRef theBag); 76 | 77 | CF_EXPORT 78 | CFIndex CFBagGetCountOfValue(CFBagRef theBag, const void *value); 79 | 80 | CF_EXPORT 81 | Boolean CFBagContainsValue(CFBagRef theBag, const void *value); 82 | 83 | CF_EXPORT 84 | const void *CFBagGetValue(CFBagRef theBag, const void *value); 85 | 86 | CF_EXPORT 87 | Boolean CFBagGetValueIfPresent(CFBagRef theBag, const void *candidate, const void **value); 88 | 89 | CF_EXPORT 90 | void CFBagGetValues(CFBagRef theBag, const void **values); 91 | 92 | CF_EXPORT 93 | void CFBagApplyFunction(CFBagRef theBag, CFBagApplierFunction applier, void *context); 94 | 95 | CF_EXPORT 96 | void CFBagAddValue(CFMutableBagRef theBag, const void *value); 97 | 98 | CF_EXPORT 99 | void CFBagReplaceValue(CFMutableBagRef theBag, const void *value); 100 | 101 | CF_EXPORT 102 | void CFBagSetValue(CFMutableBagRef theBag, const void *value); 103 | 104 | CF_EXPORT 105 | void CFBagRemoveValue(CFMutableBagRef theBag, const void *value); 106 | 107 | CF_EXPORT 108 | void CFBagRemoveAllValues(CFMutableBagRef theBag); 109 | 110 | CF_EXTERN_C_END 111 | 112 | #endif /* ! __COREFOUNDATION_CFBAG__ */ 113 | 114 | -------------------------------------------------------------------------------- /CFBasicHash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFBasicHash.h 25 | Copyright (c) 2008-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #include 29 | #include 30 | #include "CFInternal.h" 31 | 32 | CF_EXTERN_C_BEGIN 33 | 34 | struct __objcFastEnumerationStateEquivalent2 { 35 | unsigned long state; 36 | unsigned long *itemsPtr; 37 | unsigned long *mutationsPtr; 38 | unsigned long extra[5]; 39 | }; 40 | 41 | enum { 42 | __kCFBasicHashLinearHashingValue = 1, 43 | __kCFBasicHashDoubleHashingValue = 2, 44 | __kCFBasicHashExponentialHashingValue = 3, 45 | }; 46 | 47 | enum { 48 | kCFBasicHashHasValues2 = (1UL << 2), 49 | kCFBasicHashHasKeys = (1UL << 3), 50 | kCFBasicHashHasKeys2 = (1UL << 4), 51 | kCFBasicHashHasCounts = (1UL << 5), 52 | kCFBasicHashHasOrder = (1UL << 6), 53 | kCFBasicHashHasHashCache = (1UL << 7), 54 | 55 | kCFBasicHashStrongValues = (1UL << 9), 56 | kCFBasicHashStrongValues2 = (1UL << 10), 57 | kCFBasicHashStrongKeys = (1UL << 11), 58 | kCFBasicHashStrongKeys2 = (1UL << 12), 59 | 60 | kCFBasicHashLinearHashing = (__kCFBasicHashLinearHashingValue << 13), // bits 13-14 61 | kCFBasicHashDoubleHashing = (__kCFBasicHashDoubleHashingValue << 13), 62 | kCFBasicHashExponentialHashing = (__kCFBasicHashExponentialHashingValue << 13), 63 | 64 | kCFBasicHashAggressiveGrowth = (1UL << 15), 65 | }; 66 | 67 | // Note that for a hash table without keys, the value is treated as the key, 68 | // and the value should be passed in as the key for operations which take a key. 69 | 70 | typedef struct { 71 | CFIndex idx; 72 | uintptr_t weak_key; 73 | uintptr_t weak_key2; 74 | uintptr_t weak_value; 75 | uintptr_t weak_value2; 76 | uintptr_t count; 77 | uintptr_t order; 78 | } CFBasicHashBucket; 79 | 80 | typedef struct __CFBasicHash *CFBasicHashRef; 81 | 82 | // Bit 6 in the CF_INFO_BITS of the CFRuntimeBase inside the CFBasicHashRef is the "is immutable" bit 83 | CF_INLINE Boolean CFBasicHashIsMutable(CFBasicHashRef ht) { 84 | return __CFBitfieldGetValue(((CFRuntimeBase *)ht)->_cfinfo[CF_INFO_BITS], 6, 6) ? false : true; 85 | } 86 | CF_INLINE void CFBasicHashMakeImmutable(CFBasicHashRef ht) { 87 | __CFBitfieldSetValue(((CFRuntimeBase *)ht)->_cfinfo[CF_INFO_BITS], 6, 6, 1); 88 | } 89 | 90 | 91 | typedef struct __CFBasicHashCallbacks CFBasicHashCallbacks; 92 | 93 | typedef uintptr_t (*CFBasicHashCallbackType)(CFBasicHashRef ht, uint8_t op, uintptr_t a1, uintptr_t a2, const CFBasicHashCallbacks *cb); 94 | 95 | enum { 96 | kCFBasicHashCallbackOpCopyCallbacks = 8, // Return new value; REQUIRED 97 | kCFBasicHashCallbackOpFreeCallbacks = 9, // Return 0; REQUIRED 98 | 99 | kCFBasicHashCallbackOpRetainValue = 10, // Return first arg or new value; REQUIRED 100 | kCFBasicHashCallbackOpRetainValue2 = 11, // Return first arg or new value 101 | kCFBasicHashCallbackOpRetainKey = 12, // Return first arg or new key; REQUIRED 102 | kCFBasicHashCallbackOpRetainKey2 = 13, // Return first arg or new key 103 | kCFBasicHashCallbackOpReleaseValue = 14, // Return 0; REQUIRED 104 | kCFBasicHashCallbackOpReleaseValue2 = 15, // Return 0 105 | kCFBasicHashCallbackOpReleaseKey = 16, // Return 0; REQUIRED 106 | kCFBasicHashCallbackOpReleaseKey2 = 17, // Return 0 107 | kCFBasicHashCallbackOpValueEqual = 18, // Return 0 or 1; REQUIRED 108 | kCFBasicHashCallbackOpValue2Equal = 19, // Return 0 or 1 109 | kCFBasicHashCallbackOpKeyEqual = 20, // Return 0 or 1; REQUIRED 110 | kCFBasicHashCallbackOpKey2Equal = 21, // Return 0 or 1 111 | kCFBasicHashCallbackOpHashKey = 22, // Return hash code; REQUIRED 112 | kCFBasicHashCallbackOpHashKey2 = 23, // Return hash code 113 | kCFBasicHashCallbackOpDescribeValue = 24, // Return retained CFStringRef; REQUIRED 114 | kCFBasicHashCallbackOpDescribeValue2 = 25, // Return retained CFStringRef 115 | kCFBasicHashCallbackOpDescribeKey = 26, // Return retained CFStringRef; REQUIRED 116 | kCFBasicHashCallbackOpDescribeKey2 = 27, // Return retained CFStringRef 117 | }; 118 | 119 | struct __CFBasicHashCallbacks { 120 | CFBasicHashCallbackType func; // must not be NULL 121 | uintptr_t context[0]; // variable size; any pointers in here must remain valid as long as the CFBasicHash 122 | }; 123 | 124 | extern const CFBasicHashCallbacks CFBasicHashNullCallbacks; 125 | extern const CFBasicHashCallbacks CFBasicHashStandardCallbacks; 126 | 127 | 128 | CFOptionFlags CFBasicHashGetFlags(CFBasicHashRef ht); 129 | CFIndex CFBasicHashGetNumBuckets(CFBasicHashRef ht); 130 | CFIndex CFBasicHashGetCapacity(CFBasicHashRef ht); 131 | void CFBasicHashSetCapacity(CFBasicHashRef ht, CFIndex capacity); 132 | 133 | CFIndex CFBasicHashGetCount(CFBasicHashRef ht); 134 | CFBasicHashBucket CFBasicHashGetBucket(CFBasicHashRef ht, CFIndex idx); 135 | CFBasicHashBucket CFBasicHashFindBucket(CFBasicHashRef ht, uintptr_t stack_key); 136 | CFIndex CFBasicHashGetCountOfKey(CFBasicHashRef ht, uintptr_t stack_key); 137 | CFIndex CFBasicHashGetCountOfValue(CFBasicHashRef ht, uintptr_t stack_value); 138 | Boolean CFBasicHashesAreEqual(CFBasicHashRef ht1, CFBasicHashRef ht2); 139 | void CFBasicHashApply(CFBasicHashRef ht, Boolean (^block)(CFBasicHashBucket)); 140 | void CFBasicHashGetElements(CFBasicHashRef ht, CFIndex bufferslen, uintptr_t *weak_values, uintptr_t *weak_values2, uintptr_t *weak_keys, uintptr_t *weak_keys2); 141 | 142 | void CFBasicHashAddValue(CFBasicHashRef ht, uintptr_t stack_key, uintptr_t stack_value); 143 | void CFBasicHashReplaceValue(CFBasicHashRef ht, uintptr_t stack_key, uintptr_t stack_value); 144 | void CFBasicHashSetValue(CFBasicHashRef ht, uintptr_t stack_key, uintptr_t stack_value); 145 | CFIndex CFBasicHashRemoveValue(CFBasicHashRef ht, uintptr_t stack_key); 146 | void CFBasicHashRemoveAllValues(CFBasicHashRef ht); 147 | 148 | size_t CFBasicHashGetSize(CFBasicHashRef ht, Boolean total); 149 | 150 | CFStringRef CFBasicHashCopyDescription(CFBasicHashRef ht, Boolean detailed, CFStringRef linePrefix, CFStringRef entryLinePrefix, Boolean describeElements); 151 | 152 | CFTypeID CFBasicHashGetTypeID(void); 153 | 154 | extern Boolean __CFBasicHashEqual(CFTypeRef cf1, CFTypeRef cf2); 155 | extern CFHashCode __CFBasicHashHash(CFTypeRef cf); 156 | extern CFStringRef __CFBasicHashCopyDescription(CFTypeRef cf); 157 | extern void __CFBasicHashDeallocate(CFTypeRef cf); 158 | extern unsigned long __CFBasicHashFastEnumeration(CFBasicHashRef ht, struct __objcFastEnumerationStateEquivalent2 *state, void *stackbuffer, unsigned long count); 159 | 160 | // creation functions create mutable CFBasicHashRefs 161 | CFBasicHashRef CFBasicHashCreate(CFAllocatorRef allocator, CFOptionFlags flags, const CFBasicHashCallbacks *cb); 162 | CFBasicHashRef CFBasicHashCreateCopy(CFAllocatorRef allocator, CFBasicHashRef ht); 163 | 164 | 165 | CF_EXTERN_C_END 166 | 167 | -------------------------------------------------------------------------------- /CFBitVector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFBitVector.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFBITVECTOR__) 29 | #define __COREFOUNDATION_CFBITVECTOR__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | typedef UInt32 CFBit; 36 | 37 | typedef const struct __CFBitVector * CFBitVectorRef; 38 | typedef struct __CFBitVector * CFMutableBitVectorRef; 39 | 40 | CF_EXPORT CFTypeID CFBitVectorGetTypeID(void); 41 | 42 | CF_EXPORT CFBitVectorRef CFBitVectorCreate(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex numBits); 43 | CF_EXPORT CFBitVectorRef CFBitVectorCreateCopy(CFAllocatorRef allocator, CFBitVectorRef bv); 44 | CF_EXPORT CFMutableBitVectorRef CFBitVectorCreateMutable(CFAllocatorRef allocator, CFIndex capacity); 45 | CF_EXPORT CFMutableBitVectorRef CFBitVectorCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFBitVectorRef bv); 46 | 47 | CF_EXPORT CFIndex CFBitVectorGetCount(CFBitVectorRef bv); 48 | CF_EXPORT CFIndex CFBitVectorGetCountOfBit(CFBitVectorRef bv, CFRange range, CFBit value); 49 | CF_EXPORT Boolean CFBitVectorContainsBit(CFBitVectorRef bv, CFRange range, CFBit value); 50 | CF_EXPORT CFBit CFBitVectorGetBitAtIndex(CFBitVectorRef bv, CFIndex idx); 51 | CF_EXPORT void CFBitVectorGetBits(CFBitVectorRef bv, CFRange range, UInt8 *bytes); 52 | CF_EXPORT CFIndex CFBitVectorGetFirstIndexOfBit(CFBitVectorRef bv, CFRange range, CFBit value); 53 | CF_EXPORT CFIndex CFBitVectorGetLastIndexOfBit(CFBitVectorRef bv, CFRange range, CFBit value); 54 | 55 | CF_EXPORT void CFBitVectorSetCount(CFMutableBitVectorRef bv, CFIndex count); 56 | CF_EXPORT void CFBitVectorFlipBitAtIndex(CFMutableBitVectorRef bv, CFIndex idx); 57 | CF_EXPORT void CFBitVectorFlipBits(CFMutableBitVectorRef bv, CFRange range); 58 | CF_EXPORT void CFBitVectorSetBitAtIndex(CFMutableBitVectorRef bv, CFIndex idx, CFBit value); 59 | CF_EXPORT void CFBitVectorSetBits(CFMutableBitVectorRef bv, CFRange range, CFBit value); 60 | CF_EXPORT void CFBitVectorSetAllBits(CFMutableBitVectorRef bv, CFBit value); 61 | 62 | CF_EXTERN_C_END 63 | 64 | #endif /* ! __COREFOUNDATION_CFBITVECTOR__ */ 65 | 66 | -------------------------------------------------------------------------------- /CFBundle_BinaryTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFBundle_BinaryTypes.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFBUNDLE_BINARYTYPES__) 29 | #define __COREFOUNDATION_CFBUNDLE_BINARYTYPES__ 1 30 | 31 | CF_EXTERN_C_BEGIN 32 | 33 | 34 | #if DEPLOYMENT_TARGET_MACOSX 35 | #define BINARY_SUPPORT_DYLD 1 36 | #define BINARY_SUPPORT_DLFCN 1 37 | #define USE_DYLD_PRIV 1 38 | #elif DEPLOYMENT_TARGET_EMBEDDED 39 | #define BINARY_SUPPORT_DYLD 1 40 | #define BINARY_SUPPORT_DLFCN 1 41 | #if !defined(TARGET_IPHONE_SIMULATOR) 42 | #define USE_DYLD_PRIV 1 43 | #endif 44 | #elif DEPLOYMENT_TARGET_WINDOWS 45 | #define BINARY_SUPPORT_DLL 1 46 | #else 47 | #error Unknown or unspecified DEPLOYMENT_TARGET 48 | #endif 49 | 50 | 51 | typedef enum { 52 | __CFBundleUnknownBinary, 53 | __CFBundleCFMBinary, 54 | __CFBundleDYLDExecutableBinary, 55 | __CFBundleDYLDBundleBinary, 56 | __CFBundleDYLDFrameworkBinary, 57 | __CFBundleDLLBinary, 58 | __CFBundleUnreadableBinary, 59 | __CFBundleNoBinary, 60 | __CFBundleELFBinary 61 | } __CFPBinaryType; 62 | 63 | /* Intended for eventual public consumption */ 64 | typedef enum { 65 | kCFBundleOtherExecutableType = 0, 66 | kCFBundleMachOExecutableType, 67 | kCFBundlePEFExecutableType, 68 | kCFBundleELFExecutableType, 69 | kCFBundleDLLExecutableType 70 | } CFBundleExecutableType; 71 | 72 | CF_EXTERN_C_END 73 | 74 | #endif /* ! __COREFOUNDATION_CFBUNDLE_BINARYTYPES__ */ 75 | 76 | -------------------------------------------------------------------------------- /CFByteOrder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFByteOrder.h 25 | Copyright (c) 1995-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFBYTEORDER__) 29 | #define __COREFOUNDATION_CFBYTEORDER__ 1 30 | 31 | #include 32 | #if ((TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) && !defined(CF_USE_OSBYTEORDER_H) 33 | #include 34 | #define CF_USE_OSBYTEORDER_H 1 35 | #endif 36 | 37 | CF_EXTERN_C_BEGIN 38 | 39 | enum __CFByteOrder { 40 | CFByteOrderUnknown, 41 | CFByteOrderLittleEndian, 42 | CFByteOrderBigEndian 43 | }; 44 | typedef CFIndex CFByteOrder; 45 | 46 | CF_INLINE CFByteOrder CFByteOrderGetCurrent(void) { 47 | #if CF_USE_OSBYTEORDER_H 48 | int32_t byteOrder = OSHostByteOrder(); 49 | switch (byteOrder) { 50 | case OSLittleEndian: return CFByteOrderLittleEndian; 51 | case OSBigEndian: return CFByteOrderBigEndian; 52 | default: break; 53 | } 54 | return CFByteOrderUnknown; 55 | #else 56 | #if __LITTLE_ENDIAN__ 57 | return CFByteOrderLittleEndian; 58 | #elif __BIG_ENDIAN__ 59 | return CFByteOrderBigEndian; 60 | #else 61 | return CFByteOrderUnknown; 62 | #endif 63 | #endif 64 | } 65 | 66 | CF_INLINE uint16_t CFSwapInt16(uint16_t arg) { 67 | #if CF_USE_OSBYTEORDER_H 68 | return OSSwapInt16(arg); 69 | #else 70 | uint16_t result; 71 | result = (uint16_t)(((arg << 8) & 0xFF00) | ((arg >> 8) & 0xFF)); 72 | return result; 73 | #endif 74 | } 75 | 76 | CF_INLINE uint32_t CFSwapInt32(uint32_t arg) { 77 | #if CF_USE_OSBYTEORDER_H 78 | return OSSwapInt32(arg); 79 | #else 80 | uint32_t result; 81 | result = ((arg & 0xFF) << 24) | ((arg & 0xFF00) << 8) | ((arg >> 8) & 0xFF00) | ((arg >> 24) & 0xFF); 82 | return result; 83 | #endif 84 | } 85 | 86 | CF_INLINE uint64_t CFSwapInt64(uint64_t arg) { 87 | #if CF_USE_OSBYTEORDER_H 88 | return OSSwapInt64(arg); 89 | #else 90 | union CFSwap { 91 | uint64_t sv; 92 | uint32_t ul[2]; 93 | } tmp, result; 94 | tmp.sv = arg; 95 | result.ul[0] = CFSwapInt32(tmp.ul[1]); 96 | result.ul[1] = CFSwapInt32(tmp.ul[0]); 97 | return result.sv; 98 | #endif 99 | } 100 | 101 | CF_INLINE uint16_t CFSwapInt16BigToHost(uint16_t arg) { 102 | #if CF_USE_OSBYTEORDER_H 103 | return OSSwapBigToHostInt16(arg); 104 | #elif __BIG_ENDIAN__ 105 | return arg; 106 | #else 107 | return CFSwapInt16(arg); 108 | #endif 109 | } 110 | 111 | CF_INLINE uint32_t CFSwapInt32BigToHost(uint32_t arg) { 112 | #if CF_USE_OSBYTEORDER_H 113 | return OSSwapBigToHostInt32(arg); 114 | #elif __BIG_ENDIAN__ 115 | return arg; 116 | #else 117 | return CFSwapInt32(arg); 118 | #endif 119 | } 120 | 121 | CF_INLINE uint64_t CFSwapInt64BigToHost(uint64_t arg) { 122 | #if CF_USE_OSBYTEORDER_H 123 | return OSSwapBigToHostInt64(arg); 124 | #elif __BIG_ENDIAN__ 125 | return arg; 126 | #else 127 | return CFSwapInt64(arg); 128 | #endif 129 | } 130 | 131 | CF_INLINE uint16_t CFSwapInt16HostToBig(uint16_t arg) { 132 | #if CF_USE_OSBYTEORDER_H 133 | return OSSwapHostToBigInt16(arg); 134 | #elif __BIG_ENDIAN__ 135 | return arg; 136 | #else 137 | return CFSwapInt16(arg); 138 | #endif 139 | } 140 | 141 | CF_INLINE uint32_t CFSwapInt32HostToBig(uint32_t arg) { 142 | #if CF_USE_OSBYTEORDER_H 143 | return OSSwapHostToBigInt32(arg); 144 | #elif __BIG_ENDIAN__ 145 | return arg; 146 | #else 147 | return CFSwapInt32(arg); 148 | #endif 149 | } 150 | 151 | CF_INLINE uint64_t CFSwapInt64HostToBig(uint64_t arg) { 152 | #if CF_USE_OSBYTEORDER_H 153 | return OSSwapHostToBigInt64(arg); 154 | #elif __BIG_ENDIAN__ 155 | return arg; 156 | #else 157 | return CFSwapInt64(arg); 158 | #endif 159 | } 160 | 161 | CF_INLINE uint16_t CFSwapInt16LittleToHost(uint16_t arg) { 162 | #if CF_USE_OSBYTEORDER_H 163 | return OSSwapLittleToHostInt16(arg); 164 | #elif __LITTLE_ENDIAN__ 165 | return arg; 166 | #else 167 | return CFSwapInt16(arg); 168 | #endif 169 | } 170 | 171 | CF_INLINE uint32_t CFSwapInt32LittleToHost(uint32_t arg) { 172 | #if CF_USE_OSBYTEORDER_H 173 | return OSSwapLittleToHostInt32(arg); 174 | #elif __LITTLE_ENDIAN__ 175 | return arg; 176 | #else 177 | return CFSwapInt32(arg); 178 | #endif 179 | } 180 | 181 | CF_INLINE uint64_t CFSwapInt64LittleToHost(uint64_t arg) { 182 | #if CF_USE_OSBYTEORDER_H 183 | return OSSwapLittleToHostInt64(arg); 184 | #elif __LITTLE_ENDIAN__ 185 | return arg; 186 | #else 187 | return CFSwapInt64(arg); 188 | #endif 189 | } 190 | 191 | CF_INLINE uint16_t CFSwapInt16HostToLittle(uint16_t arg) { 192 | #if CF_USE_OSBYTEORDER_H 193 | return OSSwapHostToLittleInt16(arg); 194 | #elif __LITTLE_ENDIAN__ 195 | return arg; 196 | #else 197 | return CFSwapInt16(arg); 198 | #endif 199 | } 200 | 201 | CF_INLINE uint32_t CFSwapInt32HostToLittle(uint32_t arg) { 202 | #if CF_USE_OSBYTEORDER_H 203 | return OSSwapHostToLittleInt32(arg); 204 | #elif __LITTLE_ENDIAN__ 205 | return arg; 206 | #else 207 | return CFSwapInt32(arg); 208 | #endif 209 | } 210 | 211 | CF_INLINE uint64_t CFSwapInt64HostToLittle(uint64_t arg) { 212 | #if CF_USE_OSBYTEORDER_H 213 | return OSSwapHostToLittleInt64(arg); 214 | #elif __LITTLE_ENDIAN__ 215 | return arg; 216 | #else 217 | return CFSwapInt64(arg); 218 | #endif 219 | } 220 | 221 | typedef struct {uint32_t v;} CFSwappedFloat32; 222 | typedef struct {uint64_t v;} CFSwappedFloat64; 223 | 224 | CF_INLINE CFSwappedFloat32 CFConvertFloat32HostToSwapped(Float32 arg) { 225 | union CFSwap { 226 | Float32 v; 227 | CFSwappedFloat32 sv; 228 | } result; 229 | result.v = arg; 230 | #if __LITTLE_ENDIAN__ 231 | result.sv.v = CFSwapInt32(result.sv.v); 232 | #endif 233 | return result.sv; 234 | } 235 | 236 | CF_INLINE Float32 CFConvertFloat32SwappedToHost(CFSwappedFloat32 arg) { 237 | union CFSwap { 238 | Float32 v; 239 | CFSwappedFloat32 sv; 240 | } result; 241 | result.sv = arg; 242 | #if __LITTLE_ENDIAN__ 243 | result.sv.v = CFSwapInt32(result.sv.v); 244 | #endif 245 | return result.v; 246 | } 247 | 248 | CF_INLINE CFSwappedFloat64 CFConvertFloat64HostToSwapped(Float64 arg) { 249 | union CFSwap { 250 | Float64 v; 251 | CFSwappedFloat64 sv; 252 | } result; 253 | result.v = arg; 254 | #if __LITTLE_ENDIAN__ 255 | result.sv.v = CFSwapInt64(result.sv.v); 256 | #endif 257 | return result.sv; 258 | } 259 | 260 | CF_INLINE Float64 CFConvertFloat64SwappedToHost(CFSwappedFloat64 arg) { 261 | union CFSwap { 262 | Float64 v; 263 | CFSwappedFloat64 sv; 264 | } result; 265 | result.sv = arg; 266 | #if __LITTLE_ENDIAN__ 267 | result.sv.v = CFSwapInt64(result.sv.v); 268 | #endif 269 | return result.v; 270 | } 271 | 272 | CF_INLINE CFSwappedFloat32 CFConvertFloatHostToSwapped(float arg) { 273 | union CFSwap { 274 | float v; 275 | CFSwappedFloat32 sv; 276 | } result; 277 | result.v = arg; 278 | #if __LITTLE_ENDIAN__ 279 | result.sv.v = CFSwapInt32(result.sv.v); 280 | #endif 281 | return result.sv; 282 | } 283 | 284 | CF_INLINE float CFConvertFloatSwappedToHost(CFSwappedFloat32 arg) { 285 | union CFSwap { 286 | float v; 287 | CFSwappedFloat32 sv; 288 | } result; 289 | result.sv = arg; 290 | #if __LITTLE_ENDIAN__ 291 | result.sv.v = CFSwapInt32(result.sv.v); 292 | #endif 293 | return result.v; 294 | } 295 | 296 | CF_INLINE CFSwappedFloat64 CFConvertDoubleHostToSwapped(double arg) { 297 | union CFSwap { 298 | double v; 299 | CFSwappedFloat64 sv; 300 | } result; 301 | result.v = arg; 302 | #if __LITTLE_ENDIAN__ 303 | result.sv.v = CFSwapInt64(result.sv.v); 304 | #endif 305 | return result.sv; 306 | } 307 | 308 | CF_INLINE double CFConvertDoubleSwappedToHost(CFSwappedFloat64 arg) { 309 | union CFSwap { 310 | double v; 311 | CFSwappedFloat64 sv; 312 | } result; 313 | result.sv = arg; 314 | #if __LITTLE_ENDIAN__ 315 | result.sv.v = CFSwapInt64(result.sv.v); 316 | #endif 317 | return result.v; 318 | } 319 | 320 | CF_EXTERN_C_END 321 | 322 | #endif /* ! __COREFOUNDATION_CFBYTEORDER__ */ 323 | 324 | -------------------------------------------------------------------------------- /CFCalendar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFCalendar.h 25 | Copyright (c) 2004-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFCALENDAR__) 29 | #define __COREFOUNDATION_CFCALENDAR__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | typedef struct __CFCalendar * CFCalendarRef; 41 | 42 | CF_EXPORT 43 | CFTypeID CFCalendarGetTypeID(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 44 | 45 | CF_EXPORT 46 | CFCalendarRef CFCalendarCopyCurrent(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 47 | 48 | CF_EXPORT 49 | CFCalendarRef CFCalendarCreateWithIdentifier(CFAllocatorRef allocator, CFStringRef identifier) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 50 | // Create a calendar. The identifiers are the kCF*Calendar 51 | // constants in CFLocale.h. 52 | 53 | CF_EXPORT 54 | CFStringRef CFCalendarGetIdentifier(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 55 | // Returns the calendar's identifier. 56 | 57 | CF_EXPORT 58 | CFLocaleRef CFCalendarCopyLocale(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 59 | 60 | CF_EXPORT 61 | void CFCalendarSetLocale(CFCalendarRef calendar, CFLocaleRef locale) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 62 | 63 | CF_EXPORT 64 | CFTimeZoneRef CFCalendarCopyTimeZone(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 65 | 66 | CF_EXPORT 67 | void CFCalendarSetTimeZone(CFCalendarRef calendar, CFTimeZoneRef tz) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 68 | 69 | CF_EXPORT 70 | CFIndex CFCalendarGetFirstWeekday(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 71 | 72 | CF_EXPORT 73 | void CFCalendarSetFirstWeekday(CFCalendarRef calendar, CFIndex wkdy) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 74 | 75 | CF_EXPORT 76 | CFIndex CFCalendarGetMinimumDaysInFirstWeek(CFCalendarRef calendar) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 77 | 78 | CF_EXPORT 79 | void CFCalendarSetMinimumDaysInFirstWeek(CFCalendarRef calendar, CFIndex mwd) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 80 | 81 | 82 | enum { 83 | kCFCalendarUnitEra = (1UL << 1), 84 | kCFCalendarUnitYear = (1UL << 2), 85 | kCFCalendarUnitMonth = (1UL << 3), 86 | kCFCalendarUnitDay = (1UL << 4), 87 | kCFCalendarUnitHour = (1UL << 5), 88 | kCFCalendarUnitMinute = (1UL << 6), 89 | kCFCalendarUnitSecond = (1UL << 7), 90 | kCFCalendarUnitWeek = (1UL << 8), 91 | kCFCalendarUnitWeekday = (1UL << 9), 92 | kCFCalendarUnitWeekdayOrdinal = (1UL << 10), 93 | #if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED 94 | kCFCalendarUnitQuarter = (1UL << 11), 95 | #endif 96 | }; 97 | typedef CFOptionFlags CFCalendarUnit; 98 | 99 | CF_EXPORT 100 | CFRange CFCalendarGetMinimumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 101 | 102 | CF_EXPORT 103 | CFRange CFCalendarGetMaximumRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 104 | 105 | CF_EXPORT 106 | CFRange CFCalendarGetRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 107 | 108 | CF_EXPORT 109 | CFIndex CFCalendarGetOrdinalityOfUnit(CFCalendarRef calendar, CFCalendarUnit smallerUnit, CFCalendarUnit biggerUnit, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 110 | 111 | CF_EXPORT 112 | Boolean CFCalendarGetTimeRangeOfUnit(CFCalendarRef calendar, CFCalendarUnit unit, CFAbsoluteTime at, CFAbsoluteTime *startp, CFTimeInterval *tip) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 113 | 114 | CF_EXPORT 115 | Boolean CFCalendarComposeAbsoluteTime(CFCalendarRef calendar, /* out */ CFAbsoluteTime *at, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 116 | 117 | CF_EXPORT 118 | Boolean CFCalendarDecomposeAbsoluteTime(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 119 | 120 | 121 | enum { 122 | kCFCalendarComponentsWrap = (1UL << 0) // option for adding 123 | }; 124 | 125 | CF_EXPORT 126 | Boolean CFCalendarAddComponents(CFCalendarRef calendar, /* inout */ CFAbsoluteTime *at, CFOptionFlags options, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 127 | 128 | CF_EXPORT 129 | Boolean CFCalendarGetComponentDifference(CFCalendarRef calendar, CFAbsoluteTime startingAT, CFAbsoluteTime resultAT, CFOptionFlags options, const char *componentDesc, ...) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 130 | 131 | 132 | CF_EXTERN_C_END 133 | 134 | #endif 135 | 136 | #endif /* ! __COREFOUNDATION_CFCALENDAR__ */ 137 | 138 | -------------------------------------------------------------------------------- /CFCharacterSetBitmaps.bitmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevestreza/CoreFoundation/38a055167790581012eabc29972f60f801efcd1a/CFCharacterSetBitmaps.bitmap -------------------------------------------------------------------------------- /CFCharacterSetPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFCharacterSetPriv.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFCHARACTERSETPRIV__) 29 | #define __COREFOUNDATION_CFCHARACTERSETPRIV__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED 36 | /*! 37 | @function CFCharacterSetIsSurrogateHighCharacter 38 | Reports whether or not the character is a high surrogate. 39 | @param character The character to be checked. 40 | @result true, if character is a high surrogate, otherwise false. 41 | */ 42 | CF_INLINE Boolean CFCharacterSetIsSurrogateHighCharacter(UniChar character) { 43 | return ((character >= 0xD800UL) && (character <= 0xDBFFUL) ? true : false); 44 | } 45 | 46 | /*! 47 | @function CFCharacterSetIsSurrogateLowCharacter 48 | Reports whether or not the character is a low surrogate. 49 | @param character The character to be checked. 50 | @result true, if character is a low surrogate, otherwise false. 51 | */ 52 | CF_INLINE Boolean CFCharacterSetIsSurrogateLowCharacter(UniChar character) { 53 | return ((character >= 0xDC00UL) && (character <= 0xDFFFUL) ? true : false); 54 | } 55 | 56 | /*! 57 | @function CFCharacterSetGetLongCharacterForSurrogatePair 58 | Returns the UTF-32 value corresponding to the surrogate pair passed in. 59 | @param surrogateHigh The high surrogate character. If this parameter 60 | is not a valid high surrogate character, the behavior is undefined. 61 | @param surrogateLow The low surrogate character. If this parameter 62 | is not a valid low surrogate character, the behavior is undefined. 63 | @result The UTF-32 value for the surrogate pair. 64 | */ 65 | CF_INLINE UTF32Char CFCharacterSetGetLongCharacterForSurrogatePair(UniChar surrogateHigh, UniChar surrogateLow) { 66 | return ((surrogateHigh - 0xD800UL) << 10) + (surrogateLow - 0xDC00UL) + 0x0010000UL; 67 | } 68 | #endif 69 | 70 | /* Check to see if the character represented by the surrogate pair surrogateHigh & surrogateLow is in the chraracter set */ 71 | CF_EXPORT Boolean CFCharacterSetIsSurrogatePairMember(CFCharacterSetRef theSet, UniChar surrogateHigh, UniChar surrogateLow) ; 72 | 73 | /* Keyed-coding support 74 | */ 75 | enum { 76 | kCFCharacterSetKeyedCodingTypeBitmap = 1, 77 | kCFCharacterSetKeyedCodingTypeBuiltin = 2, 78 | kCFCharacterSetKeyedCodingTypeRange = 3, 79 | kCFCharacterSetKeyedCodingTypeString = 4, 80 | kCFCharacterSetKeyedCodingTypeBuiltinAndBitmap = 5 81 | }; 82 | typedef CFIndex CFCharacterSetKeyedCodingType; 83 | 84 | CF_EXPORT CFCharacterSetKeyedCodingType _CFCharacterSetGetKeyedCodingType(CFCharacterSetRef cset); 85 | CF_EXPORT CFCharacterSetPredefinedSet _CFCharacterSetGetKeyedCodingBuiltinType(CFCharacterSetRef cset); 86 | CF_EXPORT CFRange _CFCharacterSetGetKeyedCodingRange(CFCharacterSetRef cset); 87 | CF_EXPORT CFStringRef _CFCharacterSetCreateKeyedCodingString(CFCharacterSetRef cset); 88 | CF_EXPORT bool _CFCharacterSetIsInverted(CFCharacterSetRef cset); 89 | CF_EXPORT void _CFCharacterSetSetIsInverted(CFCharacterSetRef cset, bool flag); 90 | 91 | CF_EXTERN_C_END 92 | 93 | #endif /* ! __COREFOUNDATION_CFCHARACTERSETPRIV__ */ 94 | 95 | -------------------------------------------------------------------------------- /CFData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFData.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFDATA__) 29 | #define __COREFOUNDATION_CFDATA__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | typedef const struct __CFData * CFDataRef; 36 | typedef struct __CFData * CFMutableDataRef; 37 | 38 | CF_EXPORT 39 | CFTypeID CFDataGetTypeID(void); 40 | 41 | CF_EXPORT 42 | CFDataRef CFDataCreate(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length); 43 | 44 | CF_EXPORT 45 | CFDataRef CFDataCreateWithBytesNoCopy(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length, CFAllocatorRef bytesDeallocator); 46 | /* Pass kCFAllocatorNull as bytesDeallocator to assure the bytes aren't freed */ 47 | 48 | CF_EXPORT 49 | CFDataRef CFDataCreateCopy(CFAllocatorRef allocator, CFDataRef theData); 50 | 51 | CF_EXPORT 52 | CFMutableDataRef CFDataCreateMutable(CFAllocatorRef allocator, CFIndex capacity); 53 | 54 | CF_EXPORT 55 | CFMutableDataRef CFDataCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFDataRef theData); 56 | 57 | CF_EXPORT 58 | CFIndex CFDataGetLength(CFDataRef theData); 59 | 60 | CF_EXPORT 61 | const UInt8 *CFDataGetBytePtr(CFDataRef theData); 62 | 63 | CF_EXPORT 64 | UInt8 *CFDataGetMutableBytePtr(CFMutableDataRef theData); 65 | 66 | CF_EXPORT 67 | void CFDataGetBytes(CFDataRef theData, CFRange range, UInt8 *buffer); 68 | 69 | CF_EXPORT 70 | void CFDataSetLength(CFMutableDataRef theData, CFIndex length); 71 | 72 | CF_EXPORT 73 | void CFDataIncreaseLength(CFMutableDataRef theData, CFIndex extraLength); 74 | 75 | CF_EXPORT 76 | void CFDataAppendBytes(CFMutableDataRef theData, const UInt8 *bytes, CFIndex length); 77 | 78 | CF_EXPORT 79 | void CFDataReplaceBytes(CFMutableDataRef theData, CFRange range, const UInt8 *newBytes, CFIndex newLength); 80 | 81 | CF_EXPORT 82 | void CFDataDeleteBytes(CFMutableDataRef theData, CFRange range); 83 | 84 | #if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED 85 | enum { 86 | kCFDataSearchBackwards = 1UL << 0, 87 | kCFDataSearchAnchored = 1UL << 1 88 | }; 89 | #endif 90 | typedef CFOptionFlags CFDataSearchFlags; 91 | 92 | CF_EXPORT 93 | CFRange CFDataFind(CFDataRef theData, CFDataRef dataToFind, CFRange searchRange, CFDataSearchFlags compareOptions) AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER; 94 | 95 | CF_EXTERN_C_END 96 | 97 | #endif /* ! __COREFOUNDATION_CFDATA__ */ 98 | 99 | -------------------------------------------------------------------------------- /CFDate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFDate.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFDATE__) 29 | #define __COREFOUNDATION_CFDATE__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | typedef double CFTimeInterval; 36 | typedef CFTimeInterval CFAbsoluteTime; 37 | /* absolute time is the time interval since the reference date */ 38 | /* the reference date (epoch) is 00:00:00 1 January 2001. */ 39 | 40 | CF_EXPORT 41 | CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); 42 | 43 | CF_EXPORT 44 | const CFTimeInterval kCFAbsoluteTimeIntervalSince1970; 45 | CF_EXPORT 46 | const CFTimeInterval kCFAbsoluteTimeIntervalSince1904; 47 | 48 | typedef const struct __CFDate * CFDateRef; 49 | 50 | CF_EXPORT 51 | CFTypeID CFDateGetTypeID(void); 52 | 53 | CF_EXPORT 54 | CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime at); 55 | 56 | CF_EXPORT 57 | CFAbsoluteTime CFDateGetAbsoluteTime(CFDateRef theDate); 58 | 59 | CF_EXPORT 60 | CFTimeInterval CFDateGetTimeIntervalSinceDate(CFDateRef theDate, CFDateRef otherDate); 61 | 62 | CF_EXPORT 63 | CFComparisonResult CFDateCompare(CFDateRef theDate, CFDateRef otherDate, void *context); 64 | 65 | typedef const struct __CFTimeZone * CFTimeZoneRef; 66 | 67 | typedef struct { 68 | SInt32 year; 69 | SInt8 month; 70 | SInt8 day; 71 | SInt8 hour; 72 | SInt8 minute; 73 | double second; 74 | } CFGregorianDate; 75 | 76 | typedef struct { 77 | SInt32 years; 78 | SInt32 months; 79 | SInt32 days; 80 | SInt32 hours; 81 | SInt32 minutes; 82 | double seconds; 83 | } CFGregorianUnits; 84 | 85 | enum { 86 | kCFGregorianUnitsYears = (1UL << 0), 87 | kCFGregorianUnitsMonths = (1UL << 1), 88 | kCFGregorianUnitsDays = (1UL << 2), 89 | kCFGregorianUnitsHours = (1UL << 3), 90 | kCFGregorianUnitsMinutes = (1UL << 4), 91 | kCFGregorianUnitsSeconds = (1UL << 5), 92 | kCFGregorianAllUnits = 0x00FFFFFF 93 | }; 94 | typedef CFOptionFlags CFGregorianUnitFlags; 95 | 96 | CF_EXPORT 97 | Boolean CFGregorianDateIsValid(CFGregorianDate gdate, CFOptionFlags unitFlags); 98 | 99 | CF_EXPORT 100 | CFAbsoluteTime CFGregorianDateGetAbsoluteTime(CFGregorianDate gdate, CFTimeZoneRef tz); 101 | 102 | CF_EXPORT 103 | CFGregorianDate CFAbsoluteTimeGetGregorianDate(CFAbsoluteTime at, CFTimeZoneRef tz); 104 | 105 | CF_EXPORT 106 | CFAbsoluteTime CFAbsoluteTimeAddGregorianUnits(CFAbsoluteTime at, CFTimeZoneRef tz, CFGregorianUnits units); 107 | 108 | CF_EXPORT 109 | CFGregorianUnits CFAbsoluteTimeGetDifferenceAsGregorianUnits(CFAbsoluteTime at1, CFAbsoluteTime at2, CFTimeZoneRef tz, CFOptionFlags unitFlags); 110 | 111 | CF_EXPORT 112 | SInt32 CFAbsoluteTimeGetDayOfWeek(CFAbsoluteTime at, CFTimeZoneRef tz); 113 | 114 | CF_EXPORT 115 | SInt32 CFAbsoluteTimeGetDayOfYear(CFAbsoluteTime at, CFTimeZoneRef tz); 116 | 117 | CF_EXPORT 118 | SInt32 CFAbsoluteTimeGetWeekOfYear(CFAbsoluteTime at, CFTimeZoneRef tz); 119 | 120 | CF_EXTERN_C_END 121 | 122 | #endif /* ! __COREFOUNDATION_CFDATE__ */ 123 | 124 | -------------------------------------------------------------------------------- /CFError_Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFError_Private.h 25 | Copyright (c) 2006-2009, Apple Inc. All rights reserved. 26 | 27 | This is Apple-internal SPI for CFError. 28 | */ 29 | 30 | #if !defined(__COREFOUNDATION_CFERRORPRIVATE__) 31 | #define __COREFOUNDATION_CFERRORPRIVATE__ 1 32 | 33 | #include 34 | 35 | CF_EXTERN_C_BEGIN 36 | 37 | /* This callback function is consulted if a key is not present in the userInfo dictionary. Note that setting a callback for the same domain again simply replaces the previous callback. Set NULL as the callback to remove it. 38 | */ 39 | typedef CFTypeRef (*CFErrorUserInfoKeyCallBack)(CFErrorRef err, CFStringRef key); 40 | CF_EXPORT void CFErrorSetCallBackForDomain(CFStringRef domainName, CFErrorUserInfoKeyCallBack callBack) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 41 | CF_EXPORT CFErrorUserInfoKeyCallBack CFErrorGetCallBackForDomain(CFStringRef domainName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 42 | 43 | 44 | /* A key for "true" debugging descriptions which should never be shown to the user. It's only used when the CFError is shown to the console, and nothing else is available. For instance the rather terse and techie OSStatus descriptions are in this boat. 45 | */ 46 | CF_EXPORT const CFStringRef kCFErrorDebugDescriptionKey AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 47 | 48 | 49 | CF_EXTERN_C_END 50 | 51 | #endif /* ! __COREFOUNDATION_CFERRORPRIVATE__ */ 52 | 53 | -------------------------------------------------------------------------------- /CFICUConverters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * CFICUConverters.h 26 | * CoreFoundation 27 | * 28 | * Created by Aki Inoue on 07/12/04. 29 | * Copyright (c) 2007-2009, Apple Inc. All rights reserved. 30 | * 31 | */ 32 | 33 | #include 34 | 35 | __private_extern__ const char *__CFStringEncodingGetICUName(CFStringEncoding encoding); 36 | 37 | __private_extern__ CFStringEncoding __CFStringEncodingGetFromICUName(const char *icuName); 38 | 39 | 40 | __private_extern__ CFIndex __CFStringEncodingICUToBytes(const char *icuName, uint32_t flags, const UniChar *characters, CFIndex numChars, CFIndex *usedCharLen, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 41 | __private_extern__ CFIndex __CFStringEncodingICUToUnicode(const char *icuName, uint32_t flags, const uint8_t *bytes, CFIndex numBytes, CFIndex *usedByteLen, UniChar *characters, CFIndex maxCharLen, CFIndex *usedCharLen); 42 | __private_extern__ CFIndex __CFStringEncodingICUCharLength(const char *icuName, uint32_t flags, const uint8_t *bytes, CFIndex numBytes); 43 | __private_extern__ CFIndex __CFStringEncodingICUByteLength(const char *icuName, uint32_t flags, const UniChar *characters, CFIndex numChars); 44 | 45 | // The caller is responsible for freeing the memory (use CFAllocatorDeallocate) 46 | __private_extern__ CFStringEncoding *__CFStringEncodingCreateICUEncodings(CFAllocatorRef allocator, CFIndex *numberOfIndex); 47 | 48 | #if DEPLOYMENT_TARGET_WINDOWS 49 | __private_extern__ void __CFStringEncodingICUThreadDataCleaner(void *context); 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /CFLocaleInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | CFLocaleInternal.h 26 | Copyright (c) 2008-2009, Apple Inc. All rights reserved. 27 | */ 28 | 29 | /* 30 | This file is for the use of the CoreFoundation project only. 31 | */ 32 | 33 | #include 34 | 35 | CF_EXPORT CFStringRef const kCFLocaleAlternateQuotationBeginDelimiterKey; 36 | CF_EXPORT CFStringRef const kCFLocaleAlternateQuotationEndDelimiterKey; 37 | CF_EXPORT CFStringRef const kCFLocaleQuotationBeginDelimiterKey; 38 | CF_EXPORT CFStringRef const kCFLocaleQuotationEndDelimiterKey; 39 | CF_EXPORT CFStringRef const kCFLocaleCalendarIdentifierKey; // *** 40 | CF_EXPORT CFStringRef const kCFLocaleCalendarKey; 41 | CF_EXPORT CFStringRef const kCFLocaleCollationIdentifierKey; // *** 42 | CF_EXPORT CFStringRef const kCFLocaleCollatorIdentifierKey; 43 | CF_EXPORT CFStringRef const kCFLocaleCountryCodeKey; 44 | CF_EXPORT CFStringRef const kCFLocaleCurrencyCodeKey; // *** 45 | CF_EXPORT CFStringRef const kCFLocaleCurrencySymbolKey; 46 | CF_EXPORT CFStringRef const kCFLocaleDecimalSeparatorKey; 47 | CF_EXPORT CFStringRef const kCFLocaleExemplarCharacterSetKey; 48 | CF_EXPORT CFStringRef const kCFLocaleGroupingSeparatorKey; 49 | CF_EXPORT CFStringRef const kCFLocaleIdentifierKey; 50 | CF_EXPORT CFStringRef const kCFLocaleLanguageCodeKey; 51 | CF_EXPORT CFStringRef const kCFLocaleMeasurementSystemKey; 52 | CF_EXPORT CFStringRef const kCFLocaleScriptCodeKey; 53 | CF_EXPORT CFStringRef const kCFLocaleUsesMetricSystemKey; 54 | CF_EXPORT CFStringRef const kCFLocaleVariantCodeKey; 55 | 56 | CF_EXPORT CFStringRef const kCFDateFormatterAMSymbolKey; 57 | CF_EXPORT CFStringRef const kCFDateFormatterCalendarKey; 58 | CF_EXPORT CFStringRef const kCFDateFormatterCalendarIdentifierKey; 59 | CF_EXPORT CFStringRef const kCFDateFormatterDefaultDateKey; 60 | CF_EXPORT CFStringRef const kCFDateFormatterDefaultFormatKey; 61 | CF_EXPORT CFStringRef const kCFDateFormatterDoesRelativeDateFormattingKey; 62 | CF_EXPORT CFStringRef const kCFDateFormatterEraSymbolsKey; 63 | CF_EXPORT CFStringRef const kCFDateFormatterGregorianStartDateKey; 64 | CF_EXPORT CFStringRef const kCFDateFormatterIsLenientKey; 65 | CF_EXPORT CFStringRef const kCFDateFormatterLongEraSymbolsKey; 66 | CF_EXPORT CFStringRef const kCFDateFormatterMonthSymbolsKey; 67 | CF_EXPORT CFStringRef const kCFDateFormatterPMSymbolKey; 68 | CF_EXPORT CFStringRef const kCFDateFormatterQuarterSymbolsKey; 69 | CF_EXPORT CFStringRef const kCFDateFormatterShortMonthSymbolsKey; 70 | CF_EXPORT CFStringRef const kCFDateFormatterShortQuarterSymbolsKey; 71 | CF_EXPORT CFStringRef const kCFDateFormatterShortStandaloneMonthSymbolsKey; 72 | CF_EXPORT CFStringRef const kCFDateFormatterShortStandaloneQuarterSymbolsKey; 73 | CF_EXPORT CFStringRef const kCFDateFormatterShortStandaloneWeekdaySymbolsKey; 74 | CF_EXPORT CFStringRef const kCFDateFormatterShortWeekdaySymbolsKey; 75 | CF_EXPORT CFStringRef const kCFDateFormatterStandaloneMonthSymbolsKey; 76 | CF_EXPORT CFStringRef const kCFDateFormatterStandaloneQuarterSymbolsKey; 77 | CF_EXPORT CFStringRef const kCFDateFormatterStandaloneWeekdaySymbolsKey; 78 | CF_EXPORT CFStringRef const kCFDateFormatterTimeZoneKey; 79 | CF_EXPORT CFStringRef const kCFDateFormatterTwoDigitStartDateKey; 80 | CF_EXPORT CFStringRef const kCFDateFormatterVeryShortMonthSymbolsKey; 81 | CF_EXPORT CFStringRef const kCFDateFormatterVeryShortStandaloneMonthSymbolsKey; 82 | CF_EXPORT CFStringRef const kCFDateFormatterVeryShortStandaloneWeekdaySymbolsKey; 83 | CF_EXPORT CFStringRef const kCFDateFormatterVeryShortWeekdaySymbolsKey; 84 | CF_EXPORT CFStringRef const kCFDateFormatterWeekdaySymbolsKey; 85 | 86 | CF_EXPORT CFStringRef const kCFNumberFormatterAlwaysShowDecimalSeparatorKey; 87 | CF_EXPORT CFStringRef const kCFNumberFormatterCurrencyCodeKey; 88 | CF_EXPORT CFStringRef const kCFNumberFormatterCurrencyDecimalSeparatorKey; 89 | CF_EXPORT CFStringRef const kCFNumberFormatterCurrencyGroupingSeparatorKey; 90 | CF_EXPORT CFStringRef const kCFNumberFormatterCurrencySymbolKey; 91 | CF_EXPORT CFStringRef const kCFNumberFormatterDecimalSeparatorKey; 92 | CF_EXPORT CFStringRef const kCFNumberFormatterDefaultFormatKey; 93 | CF_EXPORT CFStringRef const kCFNumberFormatterExponentSymbolKey; 94 | CF_EXPORT CFStringRef const kCFNumberFormatterFormatWidthKey; 95 | CF_EXPORT CFStringRef const kCFNumberFormatterGroupingSeparatorKey; 96 | CF_EXPORT CFStringRef const kCFNumberFormatterGroupingSizeKey; 97 | CF_EXPORT CFStringRef const kCFNumberFormatterInfinitySymbolKey; 98 | CF_EXPORT CFStringRef const kCFNumberFormatterInternationalCurrencySymbolKey; 99 | CF_EXPORT CFStringRef const kCFNumberFormatterIsLenientKey; 100 | CF_EXPORT CFStringRef const kCFNumberFormatterMaxFractionDigitsKey; 101 | CF_EXPORT CFStringRef const kCFNumberFormatterMaxIntegerDigitsKey; 102 | CF_EXPORT CFStringRef const kCFNumberFormatterMaxSignificantDigitsKey; 103 | CF_EXPORT CFStringRef const kCFNumberFormatterMinFractionDigitsKey; 104 | CF_EXPORT CFStringRef const kCFNumberFormatterMinIntegerDigitsKey; 105 | CF_EXPORT CFStringRef const kCFNumberFormatterMinSignificantDigitsKey; 106 | CF_EXPORT CFStringRef const kCFNumberFormatterMinusSignKey; 107 | CF_EXPORT CFStringRef const kCFNumberFormatterMultiplierKey; 108 | CF_EXPORT CFStringRef const kCFNumberFormatterNaNSymbolKey; 109 | CF_EXPORT CFStringRef const kCFNumberFormatterNegativePrefixKey; 110 | CF_EXPORT CFStringRef const kCFNumberFormatterNegativeSuffixKey; 111 | CF_EXPORT CFStringRef const kCFNumberFormatterPaddingCharacterKey; 112 | CF_EXPORT CFStringRef const kCFNumberFormatterPaddingPositionKey; 113 | CF_EXPORT CFStringRef const kCFNumberFormatterPerMillSymbolKey; 114 | CF_EXPORT CFStringRef const kCFNumberFormatterPercentSymbolKey; 115 | CF_EXPORT CFStringRef const kCFNumberFormatterPlusSignKey; 116 | CF_EXPORT CFStringRef const kCFNumberFormatterPositivePrefixKey; 117 | CF_EXPORT CFStringRef const kCFNumberFormatterPositiveSuffixKey; 118 | CF_EXPORT CFStringRef const kCFNumberFormatterRoundingIncrementKey; 119 | CF_EXPORT CFStringRef const kCFNumberFormatterRoundingModeKey; 120 | CF_EXPORT CFStringRef const kCFNumberFormatterSecondaryGroupingSizeKey; 121 | CF_EXPORT CFStringRef const kCFNumberFormatterUseGroupingSeparatorKey; 122 | CF_EXPORT CFStringRef const kCFNumberFormatterUseSignificantDigitsKey; 123 | CF_EXPORT CFStringRef const kCFNumberFormatterZeroSymbolKey; 124 | 125 | CF_EXPORT CFStringRef const kCFCalendarIdentifierGregorian; 126 | CF_EXPORT CFStringRef const kCFCalendarIdentifierBuddhist; 127 | CF_EXPORT CFStringRef const kCFCalendarIdentifierJapanese; 128 | CF_EXPORT CFStringRef const kCFCalendarIdentifierIslamic; 129 | CF_EXPORT CFStringRef const kCFCalendarIdentifierIslamicCivil; 130 | CF_EXPORT CFStringRef const kCFCalendarIdentifierHebrew; 131 | CF_EXPORT CFStringRef const kCFCalendarIdentifierChinese; 132 | CF_EXPORT CFStringRef const kCFCalendarIdentifierRepublicOfChina; 133 | CF_EXPORT CFStringRef const kCFCalendarIdentifierPersian; 134 | CF_EXPORT CFStringRef const kCFCalendarIdentifierIndian; 135 | CF_EXPORT CFStringRef const kCFCalendarIdentifierISO8601; 136 | CF_EXPORT CFStringRef const kCFCalendarIdentifierCoptic; 137 | CF_EXPORT CFStringRef const kCFCalendarIdentifierEthiopicAmeteMihret; 138 | CF_EXPORT CFStringRef const kCFCalendarIdentifierEthiopicAmeteAlem; 139 | 140 | 141 | -------------------------------------------------------------------------------- /CFLogUtilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFLogUtilities.h 25 | Copyright (c) 2004-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | /* 29 | APPLE SPI: NOT TO BE USED OUTSIDE APPLE! 30 | */ 31 | 32 | #if !defined(__COREFOUNDATION_CFLOGUTILITIES__) 33 | #define __COREFOUNDATION_CFLOGUTILITIES__ 1 34 | 35 | #include 36 | #include 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | 41 | enum { // Legal level values for CFLog() 42 | kCFLogLevelEmergency = 0, 43 | kCFLogLevelAlert = 1, 44 | kCFLogLevelCritical = 2, 45 | kCFLogLevelError = 3, 46 | kCFLogLevelWarning = 4, 47 | kCFLogLevelNotice = 5, 48 | kCFLogLevelInfo = 6, 49 | kCFLogLevelDebug = 7, 50 | }; 51 | 52 | CF_EXPORT void CFLog(int32_t level, CFStringRef format, ...); 53 | /* Passing in a level value which is outside the range of 0-7 will cause the the call to do nothing. 54 | CFLog() logs the message using the asl.h API, and uses the level parameter as the log level. 55 | Note that the asl subsystem ignores some log levels by default. 56 | CFLog() is not fast, and is not going to be guaranteed to be fast. 57 | Even "no-op" CFLogs are not necessarily fast. 58 | If you care about performance, you shouldn't be logging. 59 | */ 60 | 61 | CF_EXTERN_C_END 62 | 63 | #endif /* ! __COREFOUNDATION_CFLOGUTILITIES__ */ 64 | 65 | -------------------------------------------------------------------------------- /CFMachPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFMachPort.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFMACHPORT__) 29 | #define __COREFOUNDATION_CFMACHPORT__ 1 30 | 31 | #include 32 | #include 33 | 34 | CF_EXTERN_C_BEGIN 35 | 36 | typedef struct __CFMachPort * CFMachPortRef; 37 | 38 | typedef struct { 39 | CFIndex version; 40 | void * info; 41 | const void *(*retain)(const void *info); 42 | void (*release)(const void *info); 43 | CFStringRef (*copyDescription)(const void *info); 44 | } CFMachPortContext; 45 | 46 | typedef void (*CFMachPortCallBack)(CFMachPortRef port, void *msg, CFIndex size, void *info); 47 | typedef void (*CFMachPortInvalidationCallBack)(CFMachPortRef port, void *info); 48 | 49 | CF_EXPORT CFTypeID CFMachPortGetTypeID(void); 50 | 51 | CF_EXPORT CFMachPortRef CFMachPortCreate(CFAllocatorRef allocator, CFMachPortCallBack callout, CFMachPortContext *context, Boolean *shouldFreeInfo); 52 | CF_EXPORT CFMachPortRef CFMachPortCreateWithPort(CFAllocatorRef allocator, mach_port_t portNum, CFMachPortCallBack callout, CFMachPortContext *context, Boolean *shouldFreeInfo); 53 | 54 | CF_EXPORT mach_port_t CFMachPortGetPort(CFMachPortRef port); 55 | CF_EXPORT void CFMachPortGetContext(CFMachPortRef port, CFMachPortContext *context); 56 | CF_EXPORT void CFMachPortInvalidate(CFMachPortRef port); 57 | CF_EXPORT Boolean CFMachPortIsValid(CFMachPortRef port); 58 | CF_EXPORT CFMachPortInvalidationCallBack CFMachPortGetInvalidationCallBack(CFMachPortRef port); 59 | CF_EXPORT void CFMachPortSetInvalidationCallBack(CFMachPortRef port, CFMachPortInvalidationCallBack callout); 60 | 61 | CF_EXPORT CFRunLoopSourceRef CFMachPortCreateRunLoopSource(CFAllocatorRef allocator, CFMachPortRef port, CFIndex order); 62 | 63 | CF_EXTERN_C_END 64 | 65 | #endif /* ! __COREFOUNDATION_CFMACHPORT__ */ 66 | 67 | -------------------------------------------------------------------------------- /CFMessagePort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFMessagePort.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFMESSAGEPORT__) 29 | #define __COREFOUNDATION_CFMESSAGEPORT__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 35 | #include 36 | #endif 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | typedef struct __CFMessagePort * CFMessagePortRef; 41 | 42 | enum { 43 | kCFMessagePortSuccess = 0, 44 | kCFMessagePortSendTimeout = -1, 45 | kCFMessagePortReceiveTimeout = -2, 46 | kCFMessagePortIsInvalid = -3, 47 | kCFMessagePortTransportError = -4, 48 | kCFMessagePortBecameInvalidError = -5 49 | }; 50 | 51 | typedef struct { 52 | CFIndex version; 53 | void * info; 54 | const void *(*retain)(const void *info); 55 | void (*release)(const void *info); 56 | CFStringRef (*copyDescription)(const void *info); 57 | } CFMessagePortContext; 58 | 59 | typedef CFDataRef (*CFMessagePortCallBack)(CFMessagePortRef local, SInt32 msgid, CFDataRef data, void *info); 60 | /* If callout wants to keep a hold of the data past the return of the callout, it must COPY the data. This includes the case where the data is given to some routine which _might_ keep a hold of it; System will release returned CFData. */ 61 | typedef void (*CFMessagePortInvalidationCallBack)(CFMessagePortRef ms, void *info); 62 | 63 | CF_EXPORT CFTypeID CFMessagePortGetTypeID(void); 64 | 65 | CF_EXPORT CFMessagePortRef CFMessagePortCreateLocal(CFAllocatorRef allocator, CFStringRef name, CFMessagePortCallBack callout, CFMessagePortContext *context, Boolean *shouldFreeInfo); 66 | CF_EXPORT CFMessagePortRef CFMessagePortCreateRemote(CFAllocatorRef allocator, CFStringRef name); 67 | 68 | CF_EXPORT Boolean CFMessagePortIsRemote(CFMessagePortRef ms); 69 | CF_EXPORT CFStringRef CFMessagePortGetName(CFMessagePortRef ms); 70 | CF_EXPORT Boolean CFMessagePortSetName(CFMessagePortRef ms, CFStringRef newName); 71 | CF_EXPORT void CFMessagePortGetContext(CFMessagePortRef ms, CFMessagePortContext *context); 72 | CF_EXPORT void CFMessagePortInvalidate(CFMessagePortRef ms); 73 | CF_EXPORT Boolean CFMessagePortIsValid(CFMessagePortRef ms); 74 | CF_EXPORT CFMessagePortInvalidationCallBack CFMessagePortGetInvalidationCallBack(CFMessagePortRef ms); 75 | CF_EXPORT void CFMessagePortSetInvalidationCallBack(CFMessagePortRef ms, CFMessagePortInvalidationCallBack callout); 76 | 77 | /* NULL replyMode argument means no return value expected, dont wait for it */ 78 | CF_EXPORT SInt32 CFMessagePortSendRequest(CFMessagePortRef remote, SInt32 msgid, CFDataRef data, CFTimeInterval sendTimeout, CFTimeInterval rcvTimeout, CFStringRef replyMode, CFDataRef *returnData); 79 | 80 | CF_EXPORT CFRunLoopSourceRef CFMessagePortCreateRunLoopSource(CFAllocatorRef allocator, CFMessagePortRef local, CFIndex order); 81 | 82 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 83 | CF_EXPORT void CFMessagePortSetDispatchQueue(CFMessagePortRef ms, dispatch_queue_t queue) AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER; 84 | #endif 85 | 86 | CF_EXTERN_C_END 87 | 88 | #endif /* ! __COREFOUNDATION_CFMESSAGEPORT__ */ 89 | 90 | -------------------------------------------------------------------------------- /CFNumber.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFNumber.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFNUMBER__) 29 | #define __COREFOUNDATION_CFNUMBER__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | typedef const struct __CFBoolean * CFBooleanRef; 36 | 37 | CF_EXPORT 38 | const CFBooleanRef kCFBooleanTrue; 39 | CF_EXPORT 40 | const CFBooleanRef kCFBooleanFalse; 41 | 42 | CF_EXPORT 43 | CFTypeID CFBooleanGetTypeID(void); 44 | 45 | CF_EXPORT 46 | Boolean CFBooleanGetValue(CFBooleanRef boolean); 47 | 48 | enum { 49 | /* Fixed-width types */ 50 | kCFNumberSInt8Type = 1, 51 | kCFNumberSInt16Type = 2, 52 | kCFNumberSInt32Type = 3, 53 | kCFNumberSInt64Type = 4, 54 | kCFNumberFloat32Type = 5, 55 | kCFNumberFloat64Type = 6, /* 64-bit IEEE 754 */ 56 | /* Basic C types */ 57 | kCFNumberCharType = 7, 58 | kCFNumberShortType = 8, 59 | kCFNumberIntType = 9, 60 | kCFNumberLongType = 10, 61 | kCFNumberLongLongType = 11, 62 | kCFNumberFloatType = 12, 63 | kCFNumberDoubleType = 13, 64 | /* Other */ 65 | kCFNumberCFIndexType = 14, 66 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 67 | kCFNumberNSIntegerType = 15, 68 | kCFNumberCGFloatType = 16, 69 | kCFNumberMaxType = 16 70 | #else 71 | kCFNumberMaxType = 14 72 | #endif 73 | }; 74 | typedef CFIndex CFNumberType; 75 | 76 | typedef const struct __CFNumber * CFNumberRef; 77 | 78 | CF_EXPORT 79 | const CFNumberRef kCFNumberPositiveInfinity; 80 | CF_EXPORT 81 | const CFNumberRef kCFNumberNegativeInfinity; 82 | CF_EXPORT 83 | const CFNumberRef kCFNumberNaN; 84 | 85 | CF_EXPORT 86 | CFTypeID CFNumberGetTypeID(void); 87 | 88 | /* 89 | Creates a CFNumber with the given value. The type of number pointed 90 | to by the valuePtr is specified by type. If type is a floating point 91 | type and the value represents one of the infinities or NaN, the 92 | well-defined CFNumber for that value is returned. If either of 93 | valuePtr or type is an invalid value, the result is undefined. 94 | */ 95 | CF_EXPORT 96 | CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr); 97 | 98 | /* 99 | Returns the storage format of the CFNumber's value. Note that 100 | this is not necessarily the type provided in CFNumberCreate(). 101 | */ 102 | CF_EXPORT 103 | CFNumberType CFNumberGetType(CFNumberRef number); 104 | 105 | /* 106 | Returns the size in bytes of the type of the number. 107 | */ 108 | CF_EXPORT 109 | CFIndex CFNumberGetByteSize(CFNumberRef number); 110 | 111 | /* 112 | Returns true if the type of the CFNumber's value is one of 113 | the defined floating point types. 114 | */ 115 | CF_EXPORT 116 | Boolean CFNumberIsFloatType(CFNumberRef number); 117 | 118 | /* 119 | Copies the CFNumber's value into the space pointed to by 120 | valuePtr, as the specified type. If conversion needs to take 121 | place, the conversion rules follow human expectation and not 122 | C's promotion and truncation rules. If the conversion is 123 | lossy, or the value is out of range, false is returned. Best 124 | attempt at conversion will still be in *valuePtr. 125 | */ 126 | CF_EXPORT 127 | Boolean CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr); 128 | 129 | /* 130 | Compares the two CFNumber instances. If conversion of the 131 | types of the values is needed, the conversion and comparison 132 | follow human expectations and not C's promotion and comparison 133 | rules. Negative zero compares less than positive zero. 134 | Positive infinity compares greater than everything except 135 | itself, to which it compares equal. Negative infinity compares 136 | less than everything except itself, to which it compares equal. 137 | Unlike standard practice, if both numbers are NaN, then they 138 | compare equal; if only one of the numbers is NaN, then the NaN 139 | compares greater than the other number if it is negative, and 140 | smaller than the other number if it is positive. (Note that in 141 | CFEqual() with two CFNumbers, if either or both of the numbers 142 | is NaN, true is returned.) 143 | */ 144 | CF_EXPORT 145 | CFComparisonResult CFNumberCompare(CFNumberRef number, CFNumberRef otherNumber, void *context); 146 | 147 | CF_EXTERN_C_END 148 | 149 | #endif /* ! __COREFOUNDATION_CFNUMBER__ */ 150 | 151 | -------------------------------------------------------------------------------- /CFPlugIn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFPlugIn.c 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | Responsibility: Doug Davidson 27 | */ 28 | 29 | #include "CFBundle_Internal.h" 30 | #include "CFInternal.h" 31 | 32 | CONST_STRING_DECL(kCFPlugInDynamicRegistrationKey, "CFPlugInDynamicRegistration") 33 | CONST_STRING_DECL(kCFPlugInDynamicRegisterFunctionKey, "CFPlugInDynamicRegisterFunction") 34 | CONST_STRING_DECL(kCFPlugInUnloadFunctionKey, "CFPlugInUnloadFunction") 35 | CONST_STRING_DECL(kCFPlugInFactoriesKey, "CFPlugInFactories") 36 | CONST_STRING_DECL(kCFPlugInTypesKey, "CFPlugInTypes") 37 | 38 | __private_extern__ void __CFPlugInInitialize(void) { 39 | } 40 | 41 | /* ===================== Finding factories and creating instances ===================== */ 42 | /* For plugIn hosts. */ 43 | /* Functions for finding factories to create specific types and actually creating instances of a type. */ 44 | 45 | CF_EXPORT CFArrayRef CFPlugInFindFactoriesForPlugInType(CFUUIDRef typeID) { 46 | CFArrayRef array = _CFPFactoryFindForType(typeID); 47 | CFMutableArrayRef result = NULL; 48 | 49 | if (array) { 50 | SInt32 i, c = CFArrayGetCount(array); 51 | result = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks); 52 | for (i = 0; i < c; i++) CFArrayAppendValue(result, _CFPFactoryGetFactoryID((_CFPFactory *)CFArrayGetValueAtIndex(array, i))); 53 | } 54 | return result; 55 | } 56 | 57 | CF_EXPORT CFArrayRef CFPlugInFindFactoriesForPlugInTypeInPlugIn(CFUUIDRef typeID, CFPlugInRef plugIn) { 58 | CFArrayRef array = _CFPFactoryFindForType(typeID); 59 | CFMutableArrayRef result = NULL; 60 | 61 | if (array) { 62 | SInt32 i, c = CFArrayGetCount(array); 63 | _CFPFactory *factory; 64 | result = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks); 65 | for (i = 0; i < c; i++) { 66 | factory = (_CFPFactory *)CFArrayGetValueAtIndex(array, i); 67 | if (_CFPFactoryGetPlugIn(factory) == plugIn) CFArrayAppendValue(result, _CFPFactoryGetFactoryID(factory)); 68 | } 69 | } 70 | return result; 71 | } 72 | 73 | CF_EXPORT void *CFPlugInInstanceCreate(CFAllocatorRef allocator, CFUUIDRef factoryID, CFUUIDRef typeID) { 74 | _CFPFactory *factory = _CFPFactoryFind(factoryID, true); 75 | void *result = NULL; 76 | if (!factory) { 77 | /* MF:!!! No such factory. */ 78 | CFLog(__kCFLogPlugIn, CFSTR("Cannot find factory %@"), factoryID); 79 | } else { 80 | if (!_CFPFactorySupportsType(factory, typeID)) { 81 | /* MF:!!! Factory does not support type. */ 82 | CFLog(__kCFLogPlugIn, CFSTR("Factory %@ does not support type %@"), factoryID, typeID); 83 | } else { 84 | result = _CFPFactoryCreateInstance(allocator, factory, typeID); 85 | } 86 | } 87 | return result; 88 | } 89 | 90 | /* ===================== Registering factories and types ===================== */ 91 | /* For plugIn writers who must dynamically register things. */ 92 | /* Functions to register factory functions and to associate factories with types. */ 93 | 94 | CF_EXPORT Boolean CFPlugInRegisterFactoryFunction(CFUUIDRef factoryID, CFPlugInFactoryFunction func) { 95 | // Create factories without plugIns from default allocator 96 | // MF:!!! Should probably check that this worked, and maybe do some pre-checking to see if it already exists 97 | // _CFPFactory *factory = 98 | (void)_CFPFactoryCreate(kCFAllocatorSystemDefault, factoryID, func); 99 | return true; 100 | } 101 | 102 | CF_EXPORT Boolean CFPlugInRegisterFactoryFunctionByName(CFUUIDRef factoryID, CFPlugInRef plugIn, CFStringRef functionName) { 103 | // Create factories with plugIns from plugIn's allocator 104 | // MF:!!! Should probably check that this worked, and maybe do some pre-checking to see if it already exists 105 | // _CFPFactory *factory = 106 | (void)_CFPFactoryCreateByName(CFGetAllocator(plugIn), factoryID, plugIn, functionName); 107 | return true; 108 | } 109 | 110 | CF_EXPORT Boolean CFPlugInUnregisterFactory(CFUUIDRef factoryID) { 111 | _CFPFactory *factory = _CFPFactoryFind(factoryID, true); 112 | 113 | if (!factory) { 114 | /* MF:!!! Error. No factory registered for this ID. */ 115 | } else { 116 | _CFPFactoryDisable(factory); 117 | } 118 | return true; 119 | } 120 | 121 | CF_EXPORT Boolean CFPlugInRegisterPlugInType(CFUUIDRef factoryID, CFUUIDRef typeID) { 122 | _CFPFactory *factory = _CFPFactoryFind(factoryID, true); 123 | 124 | if (!factory) { 125 | /* MF:!!! Error. Factory must be registered (and not disabled) before types can be associated with it. */ 126 | } else { 127 | _CFPFactoryAddType(factory, typeID); 128 | } 129 | return true; 130 | } 131 | 132 | CF_EXPORT Boolean CFPlugInUnregisterPlugInType(CFUUIDRef factoryID, CFUUIDRef typeID) { 133 | _CFPFactory *factory = _CFPFactoryFind(factoryID, true); 134 | 135 | if (!factory) { 136 | /* MF:!!! Error. Could not find factory. */ 137 | } else { 138 | _CFPFactoryRemoveType(factory, typeID); 139 | } 140 | return true; 141 | } 142 | 143 | 144 | /* ================= Registering instances ================= */ 145 | /* When a new instance of a type is created, the instance is responsible for registering itself with the factory that created it and unregistering when it deallocates. */ 146 | /* This means that an instance must keep track of the CFUUIDRef of the factory that created it so it can unregister when it goes away. */ 147 | 148 | CF_EXPORT void CFPlugInAddInstanceForFactory(CFUUIDRef factoryID) { 149 | _CFPFactory *factory = _CFPFactoryFind(factoryID, true); 150 | 151 | if (!factory) { 152 | /* MF:!!! Error. Could not find factory. */ 153 | } else { 154 | _CFPFactoryAddInstance(factory); 155 | } 156 | } 157 | 158 | CF_EXPORT void CFPlugInRemoveInstanceForFactory(CFUUIDRef factoryID) { 159 | _CFPFactory *factory = _CFPFactoryFind(factoryID, true); 160 | 161 | if (!factory) { 162 | /* MF:!!! Error. Could not find factory. */ 163 | } else { 164 | _CFPFactoryRemoveInstance(factory); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /CFPlugIn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFPlugIn.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFPLUGIN__) 29 | #define __COREFOUNDATION_CFPLUGIN__ 1 30 | 31 | #if !defined(COREFOUNDATION_CFPLUGINCOM_SEPARATE) 32 | #define COREFOUNDATION_CFPLUGINCOM_SEPARATE 1 33 | #endif 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | /* ================ Standard Info.plist keys for plugIns ================ */ 45 | 46 | CF_EXPORT 47 | const CFStringRef kCFPlugInDynamicRegistrationKey; 48 | CF_EXPORT 49 | const CFStringRef kCFPlugInDynamicRegisterFunctionKey; 50 | CF_EXPORT 51 | const CFStringRef kCFPlugInUnloadFunctionKey; 52 | CF_EXPORT 53 | const CFStringRef kCFPlugInFactoriesKey; 54 | CF_EXPORT 55 | const CFStringRef kCFPlugInTypesKey; 56 | 57 | /* ================= Function prototypes for various callbacks ================= */ 58 | /* Function types that plugIn authors can implement for various purposes. */ 59 | 60 | typedef void (*CFPlugInDynamicRegisterFunction)(CFPlugInRef plugIn); 61 | typedef void (*CFPlugInUnloadFunction)(CFPlugInRef plugIn); 62 | typedef void *(*CFPlugInFactoryFunction)(CFAllocatorRef allocator, CFUUIDRef typeUUID); 63 | 64 | /* ================= Creating PlugIns ================= */ 65 | 66 | CF_EXPORT 67 | CFTypeID CFPlugInGetTypeID(void); 68 | 69 | CF_EXPORT 70 | CFPlugInRef CFPlugInCreate(CFAllocatorRef allocator, CFURLRef plugInURL); 71 | /* Might return an existing instance with the ref-count bumped. */ 72 | 73 | CF_EXPORT 74 | CFBundleRef CFPlugInGetBundle(CFPlugInRef plugIn); 75 | 76 | /* ================= Controlling load on demand ================= */ 77 | /* For plugIns. */ 78 | /* PlugIns that do static registration are load on demand by default. */ 79 | /* PlugIns that do dynamic registration are not load on demand by default. */ 80 | /* A dynamic registration function can call CFPlugInSetLoadOnDemand(). */ 81 | 82 | CF_EXPORT 83 | void CFPlugInSetLoadOnDemand(CFPlugInRef plugIn, Boolean flag); 84 | 85 | CF_EXPORT 86 | Boolean CFPlugInIsLoadOnDemand(CFPlugInRef plugIn); 87 | 88 | /* ================= Finding factories and creating instances ================= */ 89 | /* For plugIn hosts. */ 90 | /* Functions for finding factories to create specific types and actually creating instances of a type. */ 91 | 92 | CF_EXPORT 93 | CFArrayRef CFPlugInFindFactoriesForPlugInType(CFUUIDRef typeUUID); 94 | /* This function finds all the factories from any plugin for the given type. Returns an array that the caller must release. */ 95 | 96 | CF_EXPORT 97 | CFArrayRef CFPlugInFindFactoriesForPlugInTypeInPlugIn(CFUUIDRef typeUUID, CFPlugInRef plugIn); 98 | /* This function restricts the result to factories from the given plug-in that can create the given type. Returns an array that the caller must release. */ 99 | 100 | CF_EXPORT 101 | void *CFPlugInInstanceCreate(CFAllocatorRef allocator, CFUUIDRef factoryUUID, CFUUIDRef typeUUID); 102 | /* This function returns the IUnknown interface for the new instance. */ 103 | 104 | /* ================= Registering factories and types ================= */ 105 | /* For plugIn writers who must dynamically register things. */ 106 | /* Functions to register factory functions and to associate factories with types. */ 107 | 108 | CF_EXPORT 109 | Boolean CFPlugInRegisterFactoryFunction(CFUUIDRef factoryUUID, CFPlugInFactoryFunction func); 110 | 111 | CF_EXPORT 112 | Boolean CFPlugInRegisterFactoryFunctionByName(CFUUIDRef factoryUUID, CFPlugInRef plugIn, CFStringRef functionName); 113 | 114 | CF_EXPORT 115 | Boolean CFPlugInUnregisterFactory(CFUUIDRef factoryUUID); 116 | 117 | CF_EXPORT 118 | Boolean CFPlugInRegisterPlugInType(CFUUIDRef factoryUUID, CFUUIDRef typeUUID); 119 | 120 | CF_EXPORT 121 | Boolean CFPlugInUnregisterPlugInType(CFUUIDRef factoryUUID, CFUUIDRef typeUUID); 122 | 123 | /* ================= Registering instances ================= */ 124 | /* When a new instance of a type is created, the instance is responsible for registering itself with the factory that created it and unregistering when it deallocates. */ 125 | /* This means that an instance must keep track of the CFUUIDRef of the factory that created it so it can unregister when it goes away. */ 126 | 127 | CF_EXPORT 128 | void CFPlugInAddInstanceForFactory(CFUUIDRef factoryID); 129 | 130 | CF_EXPORT 131 | void CFPlugInRemoveInstanceForFactory(CFUUIDRef factoryID); 132 | 133 | 134 | /* Obsolete API */ 135 | 136 | typedef struct __CFPlugInInstance *CFPlugInInstanceRef; 137 | 138 | typedef Boolean (*CFPlugInInstanceGetInterfaceFunction)(CFPlugInInstanceRef instance, CFStringRef interfaceName, void **ftbl); 139 | typedef void (*CFPlugInInstanceDeallocateInstanceDataFunction)(void *instanceData); 140 | 141 | CF_EXPORT 142 | Boolean CFPlugInInstanceGetInterfaceFunctionTable(CFPlugInInstanceRef instance, CFStringRef interfaceName, void **ftbl); 143 | CF_EXPORT 144 | CFStringRef CFPlugInInstanceGetFactoryName(CFPlugInInstanceRef instance); 145 | CF_EXPORT 146 | void *CFPlugInInstanceGetInstanceData(CFPlugInInstanceRef instance); 147 | CF_EXPORT 148 | CFTypeID CFPlugInInstanceGetTypeID(void); 149 | CF_EXPORT 150 | CFPlugInInstanceRef CFPlugInInstanceCreateWithInstanceDataSize(CFAllocatorRef allocator, CFIndex instanceDataSize, CFPlugInInstanceDeallocateInstanceDataFunction deallocateInstanceFunction, CFStringRef factoryName, CFPlugInInstanceGetInterfaceFunction getInterfaceFunction); 151 | 152 | CF_EXTERN_C_END 153 | 154 | #if !COREFOUNDATION_CFPLUGINCOM_SEPARATE 155 | #include 156 | #endif /* !COREFOUNDATION_CFPLUGINCOM_SEPARATE */ 157 | 158 | #endif /* ! __COREFOUNDATION_CFPLUGIN__ */ 159 | 160 | -------------------------------------------------------------------------------- /CFPlugInCOM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFPlugInCOM.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFPLUGINCOM__) 29 | #define __COREFOUNDATION_CFPLUGINCOM__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | /* ================= IUnknown definition (C struct) ================= */ 36 | 37 | /* All interface structs must have an IUnknownStruct at the beginning. */ 38 | /* The _reserved field is part of the Microsoft COM binary standard on Macintosh. */ 39 | /* You can declare new C struct interfaces by defining a new struct that includes "IUNKNOWN_C_GUTS;" before the first field of the struct. */ 40 | 41 | typedef SInt32 HRESULT; 42 | typedef UInt32 ULONG; 43 | typedef void *LPVOID; 44 | typedef CFUUIDBytes REFIID; 45 | 46 | #define SUCCEEDED(Status) ((HRESULT)(Status) >= 0) 47 | #define FAILED(Status) ((HRESULT)(Status)<0) 48 | 49 | /* Macros for more detailed HRESULT analysis */ 50 | #define IS_ERROR(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR) 51 | #define HRESULT_CODE(hr) ((hr) & 0xFFFF) 52 | #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) 53 | #define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) 54 | #define SEVERITY_SUCCESS 0 55 | #define SEVERITY_ERROR 1 56 | 57 | /* Creating an HRESULT from its component pieces */ 58 | #define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) 59 | 60 | /* Pre-defined success HRESULTS */ 61 | #define S_OK ((HRESULT)0x00000000L) 62 | #define S_FALSE ((HRESULT)0x00000001L) 63 | 64 | /* Common error HRESULTS */ 65 | #define E_UNEXPECTED ((HRESULT)0x8000FFFFL) 66 | #define E_NOTIMPL ((HRESULT)0x80000001L) 67 | #define E_OUTOFMEMORY ((HRESULT)0x80000002L) 68 | #define E_INVALIDARG ((HRESULT)0x80000003L) 69 | #define E_NOINTERFACE ((HRESULT)0x80000004L) 70 | #define E_POINTER ((HRESULT)0x80000005L) 71 | #define E_HANDLE ((HRESULT)0x80000006L) 72 | #define E_ABORT ((HRESULT)0x80000007L) 73 | #define E_FAIL ((HRESULT)0x80000008L) 74 | #define E_ACCESSDENIED ((HRESULT)0x80000009L) 75 | 76 | /* This macro should be used when defining all interface functions (as it is for the IUnknown functions below). */ 77 | #define STDMETHODCALLTYPE 78 | 79 | /* The __RPC_FAR macro is for COM source compatibility only. This macro is used a lot in COM interface definitions. If your CFPlugIn interfaces need to be COM interfaces as well, you can use this macro to get better source compatibility. It is not used in the IUnknown definition below, because when doing COM, you will be using the Microsoft supplied IUnknown interface anyway. */ 80 | #define __RPC_FAR 81 | 82 | /* The IUnknown interface */ 83 | #define IUnknownUUID CFUUIDGetConstantUUIDWithBytes(kCFAllocatorSystemDefault, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) 84 | 85 | #define IUNKNOWN_C_GUTS \ 86 | void *_reserved; \ 87 | HRESULT (STDMETHODCALLTYPE *QueryInterface)(void *thisPointer, REFIID iid, LPVOID *ppv); \ 88 | ULONG (STDMETHODCALLTYPE *AddRef)(void *thisPointer); \ 89 | ULONG (STDMETHODCALLTYPE *Release)(void *thisPointer) 90 | 91 | typedef struct IUnknownVTbl { 92 | IUNKNOWN_C_GUTS; 93 | } IUnknownVTbl; 94 | 95 | CF_EXTERN_C_END 96 | 97 | 98 | /* C++ specific stuff */ 99 | #if defined(__cplusplus) 100 | /* ================= IUnknown definition (C++ class) ================= */ 101 | 102 | /* This is a definition of IUnknown as a pure abstract virtual C++ class. This class will work only with compilers that can produce COM-compatible object layouts for C++ classes. egcs can not do this. MetroWerks can do this (if you subclass from __comobject) */ 103 | 104 | class IUnknown 105 | #if defined(__MWERKS__) && TARGET_OS_WIN32 106 | : __comobject 107 | #endif 108 | { 109 | public: 110 | virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) = 0; 111 | virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; 112 | virtual ULONG STDMETHODCALLTYPE Release(void) = 0; 113 | }; 114 | 115 | #endif /* __cplusplus */ 116 | 117 | #endif /* ! __COREFOUNDATION_CFPLUGINCOM__ */ 118 | 119 | -------------------------------------------------------------------------------- /CFPlugIn_Factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFPlugIn_Factory.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFPLUGIN_FACTORY__) 29 | #define __COREFOUNDATION_CFPLUGIN_FACTORY__ 1 30 | 31 | #include "CFBundle_Internal.h" 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | typedef struct __CFPFactory { 36 | CFAllocatorRef _allocator; 37 | 38 | CFUUIDRef _uuid; 39 | Boolean _enabled; 40 | char _padding[3]; 41 | SInt32 _instanceCount; 42 | 43 | CFPlugInFactoryFunction _func; 44 | 45 | CFPlugInRef _plugIn; 46 | CFStringRef _funcName; 47 | 48 | CFMutableArrayRef _types; 49 | } _CFPFactory; 50 | 51 | extern _CFPFactory *_CFPFactoryCreate(CFAllocatorRef allocator, CFUUIDRef factoryID, CFPlugInFactoryFunction func); 52 | extern _CFPFactory *_CFPFactoryCreateByName(CFAllocatorRef allocator, CFUUIDRef factoryID, CFPlugInRef plugIn, CFStringRef funcName); 53 | 54 | extern _CFPFactory *_CFPFactoryFind(CFUUIDRef factoryID, Boolean enabled); 55 | 56 | extern CFUUIDRef _CFPFactoryGetFactoryID(_CFPFactory *factory); 57 | extern CFPlugInRef _CFPFactoryGetPlugIn(_CFPFactory *factory); 58 | 59 | extern void *_CFPFactoryCreateInstance(CFAllocatorRef allocator, _CFPFactory *factory, CFUUIDRef typeID); 60 | extern void _CFPFactoryDisable(_CFPFactory *factory); 61 | extern Boolean _CFPFactoryIsEnabled(_CFPFactory *factory); 62 | 63 | extern void _CFPFactoryFlushFunctionCache(_CFPFactory *factory); 64 | 65 | extern void _CFPFactoryAddType(_CFPFactory *factory, CFUUIDRef typeID); 66 | extern void _CFPFactoryRemoveType(_CFPFactory *factory, CFUUIDRef typeID); 67 | 68 | extern Boolean _CFPFactorySupportsType(_CFPFactory *factory, CFUUIDRef typeID); 69 | extern CFArrayRef _CFPFactoryFindForType(CFUUIDRef typeID); 70 | 71 | /* These methods are called by CFPlugInInstance when an instance is created or destroyed. If a factory's instance count goes to 0 and the factory has been disabled, the factory is destroyed. */ 72 | extern void _CFPFactoryAddInstance(_CFPFactory *factory); 73 | extern void _CFPFactoryRemoveInstance(_CFPFactory *factory); 74 | 75 | CF_EXTERN_C_END 76 | 77 | #endif /* ! __COREFOUNDATION_CFPLUGIN_FACTORY__ */ 78 | 79 | -------------------------------------------------------------------------------- /CFPlugIn_Instance.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFPlugIn_Instance.c 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | Responsibility: Doug Davidson 27 | */ 28 | 29 | #include "CFBundle_Internal.h" 30 | #include "CFInternal.h" 31 | 32 | static CFTypeID __kCFPlugInInstanceTypeID = _kCFRuntimeNotATypeID; 33 | 34 | struct __CFPlugInInstance { 35 | CFRuntimeBase _base; 36 | 37 | _CFPFactory *factory; 38 | 39 | CFPlugInInstanceGetInterfaceFunction getInterfaceFunction; 40 | CFPlugInInstanceDeallocateInstanceDataFunction deallocateInstanceDataFunction; 41 | 42 | #ifdef _MSC_VER 43 | #pragma warning(push) 44 | #pragma warning(disable : 4200) 45 | #endif //_MSC_VER 46 | uint8_t _instanceData[0]; 47 | #ifdef _MSC_VER 48 | #pragma warning(pop) 49 | #endif //_MSC_VER 50 | }; 51 | 52 | static CFStringRef __CFPlugInInstanceCopyDescription(CFTypeRef cf) { 53 | /* MF:!!! Implement me */ 54 | return CFSTR("Some CFPlugInInstance"); 55 | } 56 | 57 | static void __CFPlugInInstanceDeallocate(CFTypeRef cf) { 58 | CFPlugInInstanceRef instance = (CFPlugInInstanceRef)cf; 59 | 60 | __CFGenericValidateType(cf, __kCFPlugInInstanceTypeID); 61 | 62 | if (instance->deallocateInstanceDataFunction) { 63 | FAULT_CALLBACK((void **)&(instance->deallocateInstanceDataFunction)); 64 | (void)INVOKE_CALLBACK1(instance->deallocateInstanceDataFunction, (void *)(&instance->_instanceData[0])); 65 | } 66 | 67 | if (instance->factory) _CFPFactoryRemoveInstance(instance->factory); 68 | } 69 | 70 | static const CFRuntimeClass __CFPlugInInstanceClass = { 71 | 0, 72 | "CFPlugInInstance", 73 | NULL, // init 74 | NULL, // copy 75 | __CFPlugInInstanceDeallocate, 76 | NULL, // equal 77 | NULL, // hash 78 | NULL, // 79 | __CFPlugInInstanceCopyDescription 80 | }; 81 | 82 | __private_extern__ void __CFPlugInInstanceInitialize(void) { 83 | __kCFPlugInInstanceTypeID = _CFRuntimeRegisterClass(&__CFPlugInInstanceClass); 84 | } 85 | 86 | CFTypeID CFPlugInInstanceGetTypeID(void) { 87 | return __kCFPlugInInstanceTypeID; 88 | } 89 | 90 | CF_EXPORT CFPlugInInstanceRef CFPlugInInstanceCreateWithInstanceDataSize(CFAllocatorRef allocator, CFIndex instanceDataSize, CFPlugInInstanceDeallocateInstanceDataFunction deallocateInstanceFunction, CFStringRef factoryName, CFPlugInInstanceGetInterfaceFunction getInterfaceFunction) { 91 | CFPlugInInstanceRef instance; 92 | UInt32 size; 93 | size = sizeof(struct __CFPlugInInstance) + instanceDataSize - sizeof(CFRuntimeBase); 94 | instance = (CFPlugInInstanceRef)_CFRuntimeCreateInstance(allocator, __kCFPlugInInstanceTypeID, size, NULL); 95 | if (!instance) return NULL; 96 | 97 | instance->factory = _CFPFactoryFind((CFUUIDRef)factoryName, true); 98 | if (instance->factory) _CFPFactoryAddInstance(instance->factory); 99 | instance->getInterfaceFunction = getInterfaceFunction; 100 | instance->deallocateInstanceDataFunction = deallocateInstanceFunction; 101 | 102 | return instance; 103 | } 104 | 105 | CF_EXPORT Boolean CFPlugInInstanceGetInterfaceFunctionTable(CFPlugInInstanceRef instance, CFStringRef interfaceName, void **ftbl) { 106 | void *myFtbl; 107 | Boolean result = false; 108 | 109 | if (instance->getInterfaceFunction) { 110 | FAULT_CALLBACK((void **)&(instance->getInterfaceFunction)); 111 | result = INVOKE_CALLBACK3(instance->getInterfaceFunction, instance, interfaceName, &myFtbl) ? true : false; 112 | } 113 | if (ftbl) *ftbl = (result ? myFtbl : NULL); 114 | return result; 115 | } 116 | 117 | CF_EXPORT CFStringRef CFPlugInInstanceGetFactoryName(CFPlugInInstanceRef instance) { 118 | return (CFStringRef)_CFPFactoryGetFactoryID(instance->factory); 119 | } 120 | 121 | CF_EXPORT void *CFPlugInInstanceGetInstanceData(CFPlugInInstanceRef instance) { 122 | return (void *)(&instance->_instanceData[0]); 123 | } 124 | 125 | -------------------------------------------------------------------------------- /CFPreferences.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFPreferences.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFPREFERENCES__) 29 | #define __COREFOUNDATION_CFPREFERENCES__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | CF_EXTERN_C_BEGIN 36 | 37 | CF_EXPORT 38 | const CFStringRef kCFPreferencesAnyApplication; 39 | CF_EXPORT 40 | const CFStringRef kCFPreferencesCurrentApplication; 41 | CF_EXPORT 42 | const CFStringRef kCFPreferencesAnyHost; 43 | CF_EXPORT 44 | const CFStringRef kCFPreferencesCurrentHost; 45 | CF_EXPORT 46 | const CFStringRef kCFPreferencesAnyUser; 47 | CF_EXPORT 48 | const CFStringRef kCFPreferencesCurrentUser; 49 | 50 | /* NOTE: All CFPropertyListRef values returned from 51 | CFPreferences API should be assumed to be immutable. 52 | */ 53 | 54 | /* The "App" functions search the various sources of defaults that 55 | apply to the given application, and should never be called with 56 | kCFPreferencesAnyApplication - only kCFPreferencesCurrentApplication 57 | or an application's ID (its bundle identifier). 58 | */ 59 | 60 | /* Searches the various sources of application defaults to find the 61 | value for the given key. key must not be NULL. If a value is found, 62 | it returns it; otherwise returns NULL. Caller must release the 63 | returned value */ 64 | CF_EXPORT 65 | CFPropertyListRef CFPreferencesCopyAppValue(CFStringRef key, CFStringRef applicationID); 66 | 67 | /* Convenience to interpret a preferences value as a boolean directly. 68 | Returns false if the key doesn't exist, or has an improper format; under 69 | those conditions, keyExistsAndHasValidFormat (if non-NULL) is set to false */ 70 | CF_EXPORT 71 | Boolean CFPreferencesGetAppBooleanValue(CFStringRef key, CFStringRef applicationID, Boolean *keyExistsAndHasValidFormat); 72 | 73 | /* Convenience to interpret a preferences value as an integer directly. 74 | Returns 0 if the key doesn't exist, or has an improper format; under 75 | those conditions, keyExistsAndHasValidFormat (if non-NULL) is set to false */ 76 | CF_EXPORT 77 | CFIndex CFPreferencesGetAppIntegerValue(CFStringRef key, CFStringRef applicationID, Boolean *keyExistsAndHasValidFormat); 78 | 79 | /* Sets the given value for the given key in the "normal" place for 80 | application preferences. key must not be NULL. If value is NULL, 81 | key is removed instead. */ 82 | CF_EXPORT 83 | void CFPreferencesSetAppValue(CFStringRef key, CFPropertyListRef value, CFStringRef applicationID); 84 | 85 | /* Adds the preferences for the given suite to the app preferences for 86 | the specified application. To write to the suite domain, use 87 | CFPreferencesSetValue(), below, using the suiteName in place 88 | of the appName */ 89 | CF_EXPORT 90 | void CFPreferencesAddSuitePreferencesToApp(CFStringRef applicationID, CFStringRef suiteID); 91 | 92 | CF_EXPORT 93 | void CFPreferencesRemoveSuitePreferencesFromApp(CFStringRef applicationID, CFStringRef suiteID); 94 | 95 | /* Writes all changes in all sources of application defaults. 96 | Returns success or failure. */ 97 | CF_EXPORT 98 | Boolean CFPreferencesAppSynchronize(CFStringRef applicationID); 99 | 100 | /* The primitive get mechanism; all arguments must be non-NULL 101 | (use the constants above for common values). Only the exact 102 | location specified by app-user-host is searched. The returned 103 | CFType must be released by the caller when it is finished with it. */ 104 | CF_EXPORT 105 | CFPropertyListRef CFPreferencesCopyValue(CFStringRef key, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName); 106 | 107 | /* Convenience to fetch multiple keys at once. Keys in 108 | keysToFetch that are not present in the returned dictionary 109 | are not present in the domain. If keysToFetch is NULL, all 110 | keys are fetched. */ 111 | CF_EXPORT 112 | CFDictionaryRef CFPreferencesCopyMultiple(CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName); 113 | 114 | /* The primitive set function; all arguments except value must be 115 | non-NULL. If value is NULL, the given key is removed */ 116 | CF_EXPORT 117 | void CFPreferencesSetValue(CFStringRef key, CFPropertyListRef value, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName); 118 | 119 | /* Convenience to set multiple values at once. Behavior is undefined 120 | if a key is in both keysToSet and keysToRemove */ 121 | CF_EXPORT 122 | void CFPreferencesSetMultiple(CFDictionaryRef keysToSet, CFArrayRef keysToRemove, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName); 123 | 124 | CF_EXPORT 125 | Boolean CFPreferencesSynchronize(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName); 126 | 127 | /* Constructs and returns the list of the name of all applications 128 | which have preferences in the scope of the given user and host. 129 | The returned value must be released by the caller; neither argument 130 | may be NULL. */ 131 | CF_EXPORT 132 | CFArrayRef CFPreferencesCopyApplicationList(CFStringRef userName, CFStringRef hostName); 133 | 134 | /* Constructs and returns the list of all keys set in the given 135 | location. The returned value must be released by the caller; 136 | all arguments must be non-NULL */ 137 | CF_EXPORT 138 | CFArrayRef CFPreferencesCopyKeyList(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName); 139 | 140 | 141 | CF_EXTERN_C_END 142 | 143 | #endif /* ! __COREFOUNDATION_CFPREFERENCES__ */ 144 | 145 | -------------------------------------------------------------------------------- /CFRunLoop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFRunLoop.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFRUNLOOP__) 29 | #define __COREFOUNDATION_CFRUNLOOP__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 36 | #include 37 | #endif 38 | 39 | CF_EXTERN_C_BEGIN 40 | 41 | typedef struct __CFRunLoop * CFRunLoopRef; 42 | 43 | typedef struct __CFRunLoopSource * CFRunLoopSourceRef; 44 | 45 | typedef struct __CFRunLoopObserver * CFRunLoopObserverRef; 46 | 47 | typedef struct __CFRunLoopTimer * CFRunLoopTimerRef; 48 | 49 | /* Reasons for CFRunLoopRunInMode() to Return */ 50 | enum { 51 | kCFRunLoopRunFinished = 1, 52 | kCFRunLoopRunStopped = 2, 53 | kCFRunLoopRunTimedOut = 3, 54 | kCFRunLoopRunHandledSource = 4 55 | }; 56 | 57 | /* Run Loop Observer Activities */ 58 | enum { 59 | kCFRunLoopEntry = (1UL << 0), 60 | kCFRunLoopBeforeTimers = (1UL << 1), 61 | kCFRunLoopBeforeSources = (1UL << 2), 62 | kCFRunLoopBeforeWaiting = (1UL << 5), 63 | kCFRunLoopAfterWaiting = (1UL << 6), 64 | kCFRunLoopExit = (1UL << 7), 65 | kCFRunLoopAllActivities = 0x0FFFFFFFU 66 | }; 67 | typedef CFOptionFlags CFRunLoopActivity; 68 | 69 | CF_EXPORT const CFStringRef kCFRunLoopDefaultMode; 70 | CF_EXPORT const CFStringRef kCFRunLoopCommonModes; 71 | 72 | CF_EXPORT CFTypeID CFRunLoopGetTypeID(void); 73 | 74 | CF_EXPORT CFRunLoopRef CFRunLoopGetCurrent(void); 75 | CF_EXPORT CFRunLoopRef CFRunLoopGetMain(void) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER; 76 | 77 | CF_EXPORT CFStringRef CFRunLoopCopyCurrentMode(CFRunLoopRef rl); 78 | 79 | CF_EXPORT CFArrayRef CFRunLoopCopyAllModes(CFRunLoopRef rl); 80 | 81 | CF_EXPORT void CFRunLoopAddCommonMode(CFRunLoopRef rl, CFStringRef mode); 82 | 83 | CF_EXPORT CFAbsoluteTime CFRunLoopGetNextTimerFireDate(CFRunLoopRef rl, CFStringRef mode); 84 | 85 | CF_EXPORT void CFRunLoopRun(void); 86 | CF_EXPORT SInt32 CFRunLoopRunInMode(CFStringRef mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled); 87 | CF_EXPORT Boolean CFRunLoopIsWaiting(CFRunLoopRef rl); 88 | CF_EXPORT void CFRunLoopWakeUp(CFRunLoopRef rl); 89 | CF_EXPORT void CFRunLoopStop(CFRunLoopRef rl); 90 | 91 | #if __BLOCKS__ && MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED 92 | CF_EXPORT void CFRunLoopPerformBlock(CFRunLoopRef rl, CFTypeRef mode, void (^block)(void)) AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER; 93 | #endif 94 | 95 | CF_EXPORT Boolean CFRunLoopContainsSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFStringRef mode); 96 | CF_EXPORT void CFRunLoopAddSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFStringRef mode); 97 | CF_EXPORT void CFRunLoopRemoveSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFStringRef mode); 98 | 99 | CF_EXPORT Boolean CFRunLoopContainsObserver(CFRunLoopRef rl, CFRunLoopObserverRef observer, CFStringRef mode); 100 | CF_EXPORT void CFRunLoopAddObserver(CFRunLoopRef rl, CFRunLoopObserverRef observer, CFStringRef mode); 101 | CF_EXPORT void CFRunLoopRemoveObserver(CFRunLoopRef rl, CFRunLoopObserverRef observer, CFStringRef mode); 102 | 103 | CF_EXPORT Boolean CFRunLoopContainsTimer(CFRunLoopRef rl, CFRunLoopTimerRef timer, CFStringRef mode); 104 | CF_EXPORT void CFRunLoopAddTimer(CFRunLoopRef rl, CFRunLoopTimerRef timer, CFStringRef mode); 105 | CF_EXPORT void CFRunLoopRemoveTimer(CFRunLoopRef rl, CFRunLoopTimerRef timer, CFStringRef mode); 106 | 107 | typedef struct { 108 | CFIndex version; 109 | void * info; 110 | const void *(*retain)(const void *info); 111 | void (*release)(const void *info); 112 | CFStringRef (*copyDescription)(const void *info); 113 | Boolean (*equal)(const void *info1, const void *info2); 114 | CFHashCode (*hash)(const void *info); 115 | void (*schedule)(void *info, CFRunLoopRef rl, CFStringRef mode); 116 | void (*cancel)(void *info, CFRunLoopRef rl, CFStringRef mode); 117 | void (*perform)(void *info); 118 | } CFRunLoopSourceContext; 119 | 120 | typedef struct { 121 | CFIndex version; 122 | void * info; 123 | const void *(*retain)(const void *info); 124 | void (*release)(const void *info); 125 | CFStringRef (*copyDescription)(const void *info); 126 | Boolean (*equal)(const void *info1, const void *info2); 127 | CFHashCode (*hash)(const void *info); 128 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 129 | mach_port_t (*getPort)(void *info); 130 | void * (*perform)(void *msg, CFIndex size, CFAllocatorRef allocator, void *info); 131 | #else 132 | void * (*getPort)(void *info); 133 | void (*perform)(void *info); 134 | #endif 135 | } CFRunLoopSourceContext1; 136 | 137 | CF_EXPORT CFTypeID CFRunLoopSourceGetTypeID(void); 138 | 139 | CF_EXPORT CFRunLoopSourceRef CFRunLoopSourceCreate(CFAllocatorRef allocator, CFIndex order, CFRunLoopSourceContext *context); 140 | 141 | CF_EXPORT CFIndex CFRunLoopSourceGetOrder(CFRunLoopSourceRef source); 142 | CF_EXPORT void CFRunLoopSourceInvalidate(CFRunLoopSourceRef source); 143 | CF_EXPORT Boolean CFRunLoopSourceIsValid(CFRunLoopSourceRef source); 144 | CF_EXPORT void CFRunLoopSourceGetContext(CFRunLoopSourceRef source, CFRunLoopSourceContext *context); 145 | CF_EXPORT void CFRunLoopSourceSignal(CFRunLoopSourceRef source); 146 | 147 | typedef struct { 148 | CFIndex version; 149 | void * info; 150 | const void *(*retain)(const void *info); 151 | void (*release)(const void *info); 152 | CFStringRef (*copyDescription)(const void *info); 153 | } CFRunLoopObserverContext; 154 | 155 | typedef void (*CFRunLoopObserverCallBack)(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info); 156 | 157 | CF_EXPORT CFTypeID CFRunLoopObserverGetTypeID(void); 158 | 159 | CF_EXPORT CFRunLoopObserverRef CFRunLoopObserverCreate(CFAllocatorRef allocator, CFOptionFlags activities, Boolean repeats, CFIndex order, CFRunLoopObserverCallBack callout, CFRunLoopObserverContext *context); 160 | 161 | CF_EXPORT CFOptionFlags CFRunLoopObserverGetActivities(CFRunLoopObserverRef observer); 162 | CF_EXPORT Boolean CFRunLoopObserverDoesRepeat(CFRunLoopObserverRef observer); 163 | CF_EXPORT CFIndex CFRunLoopObserverGetOrder(CFRunLoopObserverRef observer); 164 | CF_EXPORT void CFRunLoopObserverInvalidate(CFRunLoopObserverRef observer); 165 | CF_EXPORT Boolean CFRunLoopObserverIsValid(CFRunLoopObserverRef observer); 166 | CF_EXPORT void CFRunLoopObserverGetContext(CFRunLoopObserverRef observer, CFRunLoopObserverContext *context); 167 | 168 | typedef struct { 169 | CFIndex version; 170 | void * info; 171 | const void *(*retain)(const void *info); 172 | void (*release)(const void *info); 173 | CFStringRef (*copyDescription)(const void *info); 174 | } CFRunLoopTimerContext; 175 | 176 | typedef void (*CFRunLoopTimerCallBack)(CFRunLoopTimerRef timer, void *info); 177 | 178 | CF_EXPORT CFTypeID CFRunLoopTimerGetTypeID(void); 179 | 180 | CF_EXPORT CFRunLoopTimerRef CFRunLoopTimerCreate(CFAllocatorRef allocator, CFAbsoluteTime fireDate, CFTimeInterval interval, CFOptionFlags flags, CFIndex order, CFRunLoopTimerCallBack callout, CFRunLoopTimerContext *context); 181 | CF_EXPORT CFAbsoluteTime CFRunLoopTimerGetNextFireDate(CFRunLoopTimerRef timer); 182 | CF_EXPORT void CFRunLoopTimerSetNextFireDate(CFRunLoopTimerRef timer, CFAbsoluteTime fireDate); 183 | CF_EXPORT CFTimeInterval CFRunLoopTimerGetInterval(CFRunLoopTimerRef timer); 184 | CF_EXPORT Boolean CFRunLoopTimerDoesRepeat(CFRunLoopTimerRef timer); 185 | CF_EXPORT CFIndex CFRunLoopTimerGetOrder(CFRunLoopTimerRef timer); 186 | CF_EXPORT void CFRunLoopTimerInvalidate(CFRunLoopTimerRef timer); 187 | CF_EXPORT Boolean CFRunLoopTimerIsValid(CFRunLoopTimerRef timer); 188 | CF_EXPORT void CFRunLoopTimerGetContext(CFRunLoopTimerRef timer, CFRunLoopTimerContext *context); 189 | 190 | CF_EXTERN_C_END 191 | 192 | #endif /* ! __COREFOUNDATION_CFRUNLOOP__ */ 193 | 194 | -------------------------------------------------------------------------------- /CFStreamInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #if !defined(__COREFOUNDATION_CFSTREAMINTERNAL__) 25 | #define __COREFOUNDATION_CFSTREAMINTERNAL__ 1 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | CF_EXTERN_C_BEGIN 33 | 34 | 35 | // Older versions of the callbacks; v0 callbacks match v1 callbacks, except that create, finalize, and copyDescription are missing. 36 | typedef Boolean (*_CFStreamCBOpenV1)(struct _CFStream *stream, CFStreamError *error, Boolean *openComplete, void *info); 37 | typedef Boolean (*_CFStreamCBOpenCompletedV1)(struct _CFStream *stream, CFStreamError *error, void *info); 38 | typedef CFIndex (*_CFStreamCBReadV1)(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, Boolean *atEOF, void *info); 39 | typedef const UInt8 *(*_CFStreamCBGetBufferV1)(CFReadStreamRef sream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFStreamError *error, Boolean *atEOF, void *info); 40 | typedef Boolean (*_CFStreamCBCanReadV1)(CFReadStreamRef, void *info); 41 | typedef CFIndex (*_CFStreamCBWriteV1)(CFWriteStreamRef, const UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, void *info); 42 | typedef Boolean (*_CFStreamCBCanWriteV1)(CFWriteStreamRef, void *info); 43 | 44 | struct _CFStreamCallBacksV1 { 45 | CFIndex version; 46 | void *(*create)(struct _CFStream *stream, void *info); 47 | void (*finalize)(struct _CFStream *stream, void *info); 48 | CFStringRef (*copyDescription)(struct _CFStream *stream, void *info); 49 | 50 | _CFStreamCBOpenV1 open; 51 | _CFStreamCBOpenCompletedV1 openCompleted; 52 | _CFStreamCBReadV1 read; 53 | _CFStreamCBGetBufferV1 getBuffer; 54 | _CFStreamCBCanReadV1 canRead; 55 | _CFStreamCBWriteV1 write; 56 | _CFStreamCBCanWriteV1 canWrite; 57 | void (*close)(struct _CFStream *stream, void *info); 58 | 59 | CFTypeRef (*copyProperty)(struct _CFStream *stream, CFStringRef propertyName, void *info); 60 | Boolean (*setProperty)(struct _CFStream *stream, CFStringRef propertyName, CFTypeRef propertyValue, void *info); 61 | void (*requestEvents)(struct _CFStream *stream, CFOptionFlags events, void *info); 62 | void (*schedule)(struct _CFStream *stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info); 63 | void (*unschedule)(struct _CFStream *stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info); 64 | }; 65 | 66 | // These two are defined in CFSocketStream.c because that's where the glue for CFNetwork is. 67 | __private_extern__ CFErrorRef _CFErrorFromStreamError(CFAllocatorRef alloc, CFStreamError *err); 68 | __private_extern__ CFStreamError _CFStreamErrorFromError(CFErrorRef error); 69 | 70 | CF_EXTERN_C_END 71 | 72 | #endif /* ! __COREFOUNDATION_CFSTREAMINTERNAL__ */ 73 | 74 | 75 | -------------------------------------------------------------------------------- /CFStreamPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFStreamPriv.h 25 | Copyright (c) 2000-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFSTREAMPRIV__) 29 | #define __COREFOUNDATION_CFSTREAMPRIV__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | CF_EXTERN_C_BEGIN 36 | 37 | struct _CFStream; 38 | struct _CFStreamClient { 39 | CFStreamClientContext cbContext; 40 | void (*cb)(struct _CFStream *, CFStreamEventType, void *); 41 | CFOptionFlags when; 42 | CFRunLoopSourceRef rlSource; 43 | CFMutableArrayRef runLoopsAndModes; 44 | CFOptionFlags whatToSignal; 45 | }; 46 | 47 | #define CFStreamCurrentVersion 2 48 | 49 | // A unified set of callbacks so we can use a single structure for all struct _CFStreams. 50 | struct _CFStreamCallBacks { 51 | CFIndex version; 52 | void *(*create)(struct _CFStream *stream, void *info); 53 | void (*finalize)(struct _CFStream *stream, void *info); 54 | CFStringRef (*copyDescription)(struct _CFStream *stream, void *info); 55 | 56 | Boolean (*open)(struct _CFStream *stream, CFErrorRef *error, Boolean *openComplete, void *info); 57 | Boolean (*openCompleted)(struct _CFStream *stream, CFErrorRef *error, void *info); 58 | CFIndex (*read)(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFErrorRef *error, Boolean *atEOF, void *info); 59 | const UInt8 *(*getBuffer)(CFReadStreamRef sream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFErrorRef *error, Boolean *atEOF, void *info); 60 | Boolean (*canRead)(CFReadStreamRef, CFErrorRef *error, void *info); 61 | CFIndex (*write)(CFWriteStreamRef, const UInt8 *buffer, CFIndex bufferLength, CFErrorRef *error, void *info); 62 | Boolean (*canWrite)(CFWriteStreamRef, CFErrorRef *error, void *info); 63 | void (*close)(struct _CFStream *stream, void *info); 64 | 65 | CFTypeRef (*copyProperty)(struct _CFStream *stream, CFStringRef propertyName, void *info); 66 | Boolean (*setProperty)(struct _CFStream *stream, CFStringRef propertyName, CFTypeRef propertyValue, void *info); 67 | void (*requestEvents)(struct _CFStream *stream, CFOptionFlags events, void *info); 68 | void (*schedule)(struct _CFStream *stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info); 69 | void (*unschedule)(struct _CFStream *stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info); 70 | }; 71 | 72 | struct _CFStream { 73 | CFRuntimeBase _cfBase; 74 | CFOptionFlags flags; 75 | CFErrorRef error; // if callBacks->version < 2, this is actually a pointer to a CFStreamError 76 | struct _CFStreamClient *client; 77 | void *info; 78 | const struct _CFStreamCallBacks *callBacks; // This will not exist (will not be allocated) if the callbacks are from our known, "blessed" set. 79 | void *_reserved1; 80 | }; 81 | 82 | 83 | CF_INLINE void *_CFStreamGetInfoPointer(struct _CFStream *stream) { 84 | return stream->info; 85 | } 86 | 87 | 88 | // cb version must be > 0 89 | CF_EXPORT struct _CFStream *_CFStreamCreateWithConstantCallbacks(CFAllocatorRef alloc, void *info, const struct _CFStreamCallBacks *cb, Boolean isReading); 90 | 91 | // Only available for streams created with _CFStreamCreateWithConstantCallbacks, above. cb's version must be 1 92 | CF_EXPORT void _CFStreamSetInfoPointer(struct _CFStream *stream, void *info, const struct _CFStreamCallBacks *cb); 93 | 94 | /* 95 | ** _CFStreamSourceScheduleWithRunLoop 96 | ** 97 | ** Schedules the given run loop source on the given run loop and mode. It then 98 | ** adds the loop and mode pair to the runLoopsAndModes list. The list is 99 | ** simply a linear list of a loop reference followed by a mode reference. 100 | ** 101 | ** source Run loop source to be scheduled 102 | ** 103 | ** runLoopsAndModes List of run loop/mode pairs on which the source is scheduled 104 | ** 105 | ** runLoop Run loop on which the source is being scheduled 106 | ** 107 | ** runLoopMode Run loop mode on which the source is being scheduled 108 | */ 109 | CF_EXPORT 110 | void _CFStreamSourceScheduleWithRunLoop(CFRunLoopSourceRef source, CFMutableArrayRef runLoopsAndModes, CFRunLoopRef runLoop, CFStringRef runLoopMode); 111 | 112 | 113 | /* 114 | ** _CFStreamSourceUnscheduleFromRunLoop 115 | ** 116 | ** Unschedule the given source from the given run loop and mode. It then will 117 | ** guarantee that the source remains scheduled on the list of run loop and mode 118 | ** pairs in the runLoopsAndModes list. The list is simply a linear list of a 119 | ** loop reference followed by a mode reference. 120 | ** 121 | ** source Run loop source to be unscheduled 122 | ** 123 | ** runLoopsAndModes List of run loop/mode pairs on which the source is scheduled 124 | ** 125 | ** runLoop Run loop from which the source is being unscheduled 126 | ** 127 | ** runLoopMode Run loop mode from which the source is being unscheduled 128 | */ 129 | CF_EXPORT 130 | void _CFStreamSourceUnscheduleFromRunLoop(CFRunLoopSourceRef source, CFMutableArrayRef runLoopsAndModes, CFRunLoopRef runLoop, CFStringRef runLoopMode); 131 | 132 | 133 | /* 134 | ** _CFStreamSourceScheduleWithAllRunLoops 135 | ** 136 | ** Schedules the given run loop source on all the run loops and modes in the list. 137 | ** The list is simply a linear list of a loop reference followed by a mode reference. 138 | ** 139 | ** source Run loop source to be unscheduled 140 | ** 141 | ** runLoopsAndModes List of run loop/mode pairs on which the source is scheduled 142 | */ 143 | CF_EXPORT 144 | void _CFStreamSourceScheduleWithAllRunLoops(CFRunLoopSourceRef source, CFArrayRef runLoopsAndModes); 145 | 146 | 147 | /* 148 | ** _CFStreamSourceUnscheduleFromRunLoop 149 | ** 150 | ** Unschedule the given source from all the run loops and modes in the list. 151 | ** The list is simply a linear list of a loop reference followed by a mode 152 | ** reference. 153 | ** 154 | ** source Run loop source to be unscheduled 155 | ** 156 | ** runLoopsAndModes List of run loop/mode pairs on which the source is scheduled 157 | */ 158 | CF_EXPORT 159 | void _CFStreamSourceUncheduleFromAllRunLoops(CFRunLoopSourceRef source, CFArrayRef runLoopsAndModes); 160 | 161 | CF_EXPORT 162 | CFReadStreamRef _CFReadStreamCreateFromFileDescriptor(CFAllocatorRef alloc, int fd); 163 | 164 | CF_EXPORT 165 | CFWriteStreamRef _CFWriteStreamCreateFromFileDescriptor(CFAllocatorRef alloc, int fd); 166 | 167 | 168 | 169 | #define SECURITY_NONE (0) 170 | #define SECURITY_SSLv2 (1) 171 | #define SECURITY_SSLv3 (2) 172 | #define SECURITY_SSLv32 (3) 173 | #define SECURITY_TLS (4) 174 | 175 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 176 | // This symbol is exported from CFNetwork (see CFSocketStream.i). Only __MACH__ systems will 177 | // get this symbol from CoreFoundation. 178 | extern const int kCFStreamErrorDomainSSL; 179 | #endif 180 | 181 | /* 182 | * Additional SPI for CFNetwork for select side read buffering 183 | */ 184 | CF_EXPORT 185 | Boolean __CFSocketGetBytesAvailable(CFSocketRef s, CFIndex* ctBytesAvailable); 186 | 187 | CF_EXPORT 188 | CFIndex __CFSocketRead(CFSocketRef s, UInt8* buffer, CFIndex length, int* error); 189 | 190 | /* 191 | * This define can be removed once 6030579 is removed 192 | */ 193 | #define CFNETWORK_6030579 1 194 | 195 | CF_EXPORT 196 | void __CFSocketSetSocketReadBufferAttrs(CFSocketRef s, CFTimeInterval timeout, CFIndex length); 197 | 198 | CF_EXTERN_C_END 199 | 200 | #endif /* ! __COREFOUNDATION_CFSTREAMPRIV__ */ 201 | 202 | -------------------------------------------------------------------------------- /CFStringDefaultEncoding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFStringDefaultEncoding.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFSTRINGDEFAULTENCODING__) 29 | #define __COREFOUNDATION_CFSTRINGDEFAULTENCODING__ 1 30 | 31 | #include 32 | 33 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | CF_EXTERN_C_BEGIN 44 | 45 | #define __kCFUserEncodingEnvVariableName ("__CF_USER_TEXT_ENCODING") 46 | #define __kCFMaxDefaultEncodingFileLength (64) 47 | #define __kCFUserEncodingFileName ("/.CFUserTextEncoding") 48 | 49 | CF_EXPORT void _CFStringGetUserDefaultEncoding(UInt32 *oScriptValue, UInt32 *oRegionValue); 50 | CF_EXPORT void _CFStringGetInstallationEncodingAndRegion(uint32_t *encoding, uint32_t *region); 51 | CF_EXPORT Boolean _CFStringSaveUserDefaultEncoding(UInt32 iScriptValue, UInt32 iRegionValue); 52 | 53 | CF_INLINE void __CFStringGetUserDefaultEncoding(UInt32 *oScriptValue, UInt32 *oRegionValue) { _CFStringGetUserDefaultEncoding(oScriptValue, oRegionValue); } 54 | CF_INLINE void __CFStringGetInstallationEncodingAndRegion(uint32_t *encoding, uint32_t *region) { _CFStringGetInstallationEncodingAndRegion(encoding, region); } 55 | CF_INLINE void __CFStringSaveUserDefaultEncoding(UInt32 iScriptValue, UInt32 iRegionValue) { _CFStringSaveUserDefaultEncoding(iScriptValue, iRegionValue); } 56 | 57 | CF_EXTERN_C_END 58 | 59 | #endif 60 | 61 | #endif /* ! __COREFOUNDATION_CFSTRINGDEFAULTENCODING__ */ 62 | 63 | 64 | -------------------------------------------------------------------------------- /CFStringEncodingConverter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFStringEncodingConverter.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFSTRINGENCODINGCONVERTER__) 29 | #define __COREFOUNDATION_CFSTRINGENCODINGCONVERTER__ 1 30 | 31 | #include 32 | 33 | 34 | CF_EXTERN_C_BEGIN 35 | 36 | /* Values for flags argument for the conversion functions below. These can be combined, but the three NonSpacing behavior flags are exclusive. 37 | */ 38 | // kCFStringEncodingBasicDirectionLeftToRight ~ kCFStringEncodingPrependBOM will probably be deprecated and superceded by kCFStringEncodingPartialInput flag 39 | enum { 40 | kCFStringEncodingAllowLossyConversion = (1UL << 0), // Uses fallback functions to substitutes non mappable chars 41 | kCFStringEncodingBasicDirectionLeftToRight = (1UL << 1), // Converted with original direction left-to-right. 42 | kCFStringEncodingBasicDirectionRightToLeft = (1UL << 2), // Converted with original direction right-to-left. 43 | kCFStringEncodingSubstituteCombinings = (1UL << 3), // Uses fallback function to combining chars. 44 | kCFStringEncodingComposeCombinings = (1UL << 4), // Checks mappable precomposed equivalents for decomposed sequences. This is the default behavior. 45 | kCFStringEncodingIgnoreCombinings = (1UL << 5), // Ignores combining chars. 46 | kCFStringEncodingUseCanonical = (1UL << 6), // Always use canonical form 47 | kCFStringEncodingUseHFSPlusCanonical = (1UL << 7), // Always use canonical form but leaves 0x2000 ranges 48 | kCFStringEncodingPrependBOM = (1UL << 8), // Prepend BOM sequence (i.e. ISO2022KR) 49 | kCFStringEncodingDisableCorporateArea = (1UL << 9), // Disable the usage of 0xF8xx area for Apple proprietary chars in converting to UniChar, resulting loosely mapping. 50 | kCFStringEncodingASCIICompatibleConversion = (1UL << 10), // This flag forces strict ASCII compatible converion. i.e. MacJapanese 0x5C maps to Unicode 0x5C. 51 | kCFStringEncodingLenientUTF8Conversion = (1UL << 11), // 10.1 (Puma) compatible lenient UTF-8 conversion. 52 | kCFStringEncodingPartialInput = (1UL << 12), // input buffer is a part of stream 53 | kCFStringEncodingPartialOutput = (1UL << 13) // output buffer streaming 54 | }; 55 | 56 | /* Return values for CFStringEncodingUnicodeToBytes & CFStringEncodingBytesToUnicode functions 57 | */ 58 | enum { 59 | kCFStringEncodingConversionSuccess = 0, 60 | kCFStringEncodingInvalidInputStream = 1, 61 | kCFStringEncodingInsufficientOutputBufferLength = 2, 62 | kCFStringEncodingConverterUnavailable = 3 63 | }; 64 | 65 | /* Macro to shift lossByte argument. 66 | */ 67 | #define CFStringEncodingLossyByteToMask(lossByte) ((uint32_t)(lossByte << 24)|kCFStringEncodingAllowLossyConversion) 68 | #define CFStringEncodingMaskToLossyByte(flags) ((uint8_t)(flags >> 24)) 69 | 70 | /* Macros for streaming support 71 | */ 72 | #define CFStringEncodingStreamIDMask (0x00FF0000) 73 | #define CFStringEncodingStreamIDFromMask(mask) ((mask >> 16) & 0xFF) 74 | #define CFStringEncodingStreamIDToMask(identifier) ((uint32_t)((identifier & 0xFF) << 16)) 75 | 76 | /* Converts characters into the specified encoding. Returns the constants defined above. 77 | If maxByteLen is 0, bytes is ignored. You can pass lossyByte by passing the value in flags argument. 78 | i.e. CFStringEncodingUnicodeToBytes(encoding, CFStringEncodingLossyByteToMask(lossByte), ....) 79 | */ 80 | CF_EXPORT uint32_t CFStringEncodingUnicodeToBytes(uint32_t encoding, uint32_t flags, const UniChar *characters, CFIndex numChars, CFIndex *usedCharLen, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 81 | 82 | /* Converts bytes in the specified encoding into unicode. Returns the constants defined above. 83 | maxCharLen & usdCharLen are in UniChar length, not byte length. 84 | If maxCharLen is 0, characters is ignored. 85 | */ 86 | CF_EXPORT uint32_t CFStringEncodingBytesToUnicode(uint32_t encoding, uint32_t flags, const uint8_t *bytes, CFIndex numBytes, CFIndex *usedByteLen, UniChar *characters, CFIndex maxCharLen, CFIndex *usedCharLen); 87 | 88 | /* Fallback functions used when allowLossy 89 | */ 90 | typedef CFIndex (*CFStringEncodingToBytesFallbackProc)(const UniChar *characters, CFIndex numChars, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 91 | typedef CFIndex (*CFStringEncodingToUnicodeFallbackProc)(const uint8_t *bytes, CFIndex numBytes, UniChar *characters, CFIndex maxCharLen, CFIndex *usedCharLen); 92 | 93 | CF_EXPORT bool CFStringEncodingIsValidEncoding(uint32_t encoding); 94 | 95 | /* Returns kCFStringEncodingInvalidId terminated encoding list 96 | */ 97 | CF_EXPORT const CFStringEncoding *CFStringEncodingListOfAvailableEncodings(void); 98 | 99 | /* Returns required length of destination buffer for conversion. These functions are faster than specifying 0 to maxByteLen (maxCharLen), but unnecessarily optimal length 100 | */ 101 | CF_EXPORT CFIndex CFStringEncodingCharLengthForBytes(uint32_t encoding, uint32_t flags, const uint8_t *bytes, CFIndex numBytes); 102 | CF_EXPORT CFIndex CFStringEncodingByteLengthForCharacters(uint32_t encoding, uint32_t flags, const UniChar *characters, CFIndex numChars); 103 | 104 | /* Can register functions used for lossy conversion. Reregisters default procs if NULL 105 | */ 106 | CF_EXPORT void CFStringEncodingRegisterFallbackProcedures(uint32_t encoding, CFStringEncodingToBytesFallbackProc toBytes, CFStringEncodingToUnicodeFallbackProc toUnicode); 107 | 108 | CF_EXTERN_C_END 109 | 110 | #endif /* ! __COREFOUNDATION_CFSTRINGENCODINGCONVERTER__ */ 111 | 112 | -------------------------------------------------------------------------------- /CFStringEncodingConverterExt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFStringEncodingConverterExt.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFSTRINGENCODINGCONVERETEREXT__) 29 | #define __COREFOUNDATION_CFSTRINGENCODINGCONVERETEREXT__ 1 30 | 31 | #include 32 | 33 | CF_EXTERN_C_BEGIN 34 | 35 | #define MAX_DECOMPOSED_LENGTH (10) 36 | 37 | enum { 38 | kCFStringEncodingConverterStandard = 0, 39 | kCFStringEncodingConverterCheapEightBit = 1, 40 | kCFStringEncodingConverterStandardEightBit = 2, 41 | kCFStringEncodingConverterCheapMultiByte = 3, 42 | kCFStringEncodingConverterPlatformSpecific = 4, // Other fields are ignored 43 | kCFStringEncodingConverterICU = 5 // Other fields are ignored 44 | }; 45 | 46 | /* kCFStringEncodingConverterStandard */ 47 | typedef CFIndex (*CFStringEncodingToBytesProc)(uint32_t flags, const UniChar *characters, CFIndex numChars, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 48 | typedef CFIndex (*CFStringEncodingToUnicodeProc)(uint32_t flags, const uint8_t *bytes, CFIndex numBytes, UniChar *characters, CFIndex maxCharLen, CFIndex *usedCharLen); 49 | /* kCFStringEncodingConverterCheapEightBit */ 50 | typedef bool (*CFStringEncodingCheapEightBitToBytesProc)(uint32_t flags, UniChar character, uint8_t *byte); 51 | typedef bool (*CFStringEncodingCheapEightBitToUnicodeProc)(uint32_t flags, uint8_t byte, UniChar *character); 52 | /* kCFStringEncodingConverterStandardEightBit */ 53 | typedef uint16_t (*CFStringEncodingStandardEightBitToBytesProc)(uint32_t flags, const UniChar *characters, CFIndex numChars, uint8_t *byte); 54 | typedef uint16_t (*CFStringEncodingStandardEightBitToUnicodeProc)(uint32_t flags, uint8_t byte, UniChar *characters); 55 | /* kCFStringEncodingConverterCheapMultiByte */ 56 | typedef uint16_t (*CFStringEncodingCheapMultiByteToBytesProc)(uint32_t flags, UniChar character, uint8_t *bytes); 57 | typedef uint16_t (*CFStringEncodingCheapMultiByteToUnicodeProc)(uint32_t flags, const uint8_t *bytes, CFIndex numBytes, UniChar *character); 58 | 59 | typedef CFIndex (*CFStringEncodingToBytesLenProc)(uint32_t flags, const UniChar *characters, CFIndex numChars); 60 | typedef CFIndex (*CFStringEncodingToUnicodeLenProc)(uint32_t flags, const uint8_t *bytes, CFIndex numBytes); 61 | 62 | typedef CFIndex (*CFStringEncodingToBytesPrecomposeProc)(uint32_t flags, const UniChar *character, CFIndex numChars, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 63 | typedef bool (*CFStringEncodingIsValidCombiningCharacterProc)(UniChar character); 64 | 65 | typedef struct { 66 | void *toBytes; 67 | void *toUnicode; 68 | uint16_t maxBytesPerChar; 69 | uint16_t maxDecomposedCharLen; 70 | uint8_t encodingClass; 71 | uint32_t :24; 72 | CFStringEncodingToBytesLenProc toBytesLen; 73 | CFStringEncodingToUnicodeLenProc toUnicodeLen; 74 | CFStringEncodingToBytesFallbackProc toBytesFallback; 75 | CFStringEncodingToUnicodeFallbackProc toUnicodeFallback; 76 | CFStringEncodingToBytesPrecomposeProc toBytesPrecompose; 77 | CFStringEncodingIsValidCombiningCharacterProc isValidCombiningChar; 78 | } CFStringEncodingConverter; 79 | 80 | extern const CFStringEncodingConverter *CFStringEncodingGetConverter(uint32_t encoding); 81 | 82 | enum { 83 | kCFStringEncodingGetConverterSelector = 0, 84 | kCFStringEncodingIsDecomposableCharacterSelector = 1, 85 | kCFStringEncodingDecomposeCharacterSelector = 2, 86 | kCFStringEncodingIsValidLatin1CombiningCharacterSelector = 3, 87 | kCFStringEncodingPrecomposeLatin1CharacterSelector = 4 88 | }; 89 | 90 | extern const void *CFStringEncodingGetAddressForSelector(uint32_t selector); 91 | 92 | #define BOOTSTRAPFUNC_NAME CFStringEncodingBootstrap 93 | typedef const CFStringEncodingConverter* (*CFStringEncodingBootstrapProc)(uint32_t encoding, const void *getSelector); 94 | 95 | /* Latin precomposition */ 96 | /* This function does not precompose recursively nor to U+01E0 and U+01E1. 97 | */ 98 | extern bool CFStringEncodingIsValidCombiningCharacterForLatin1(UniChar character); 99 | extern UniChar CFStringEncodingPrecomposeLatinCharacter(const UniChar *character, CFIndex numChars, CFIndex *usedChars); 100 | 101 | /* Convenience functions for converter development */ 102 | typedef struct _CFStringEncodingUnicodeTo8BitCharMap { 103 | UniChar _u; 104 | uint8_t _c; 105 | uint8_t :8; 106 | } CFStringEncodingUnicodeTo8BitCharMap; 107 | 108 | /* Binary searches CFStringEncodingUnicodeTo8BitCharMap */ 109 | CF_INLINE bool CFStringEncodingUnicodeTo8BitEncoding(const CFStringEncodingUnicodeTo8BitCharMap *theTable, CFIndex numElem, UniChar character, uint8_t *ch) { 110 | const CFStringEncodingUnicodeTo8BitCharMap *p, *q, *divider; 111 | 112 | if ((character < theTable[0]._u) || (character > theTable[numElem-1]._u)) { 113 | return 0; 114 | } 115 | p = theTable; 116 | q = p + (numElem-1); 117 | while (p <= q) { 118 | divider = p + ((q - p) >> 1); /* divide by 2 */ 119 | if (character < divider->_u) { q = divider - 1; } 120 | else if (character > divider->_u) { p = divider + 1; } 121 | else { *ch = divider->_c; return 1; } 122 | } 123 | return 0; 124 | } 125 | 126 | 127 | CF_EXTERN_C_END 128 | 129 | #endif /* ! __COREFOUNDATION_CFSTRINGENCODINGCONVERETEREXT__ */ 130 | 131 | -------------------------------------------------------------------------------- /CFStringEncodingConverterPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFStringEncodingConverterPriv.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFSTRINGENCODINGCONVERTERPRIV__) 29 | #define __COREFOUNDATION_CFSTRINGENCODINGCONVERTERPRIV__ 1 30 | 31 | #include 32 | #include "CFStringEncodingConverterExt.h" 33 | 34 | extern const CFStringEncodingConverter __CFConverterASCII; 35 | extern const CFStringEncodingConverter __CFConverterISOLatin1; 36 | extern const CFStringEncodingConverter __CFConverterMacRoman; 37 | extern const CFStringEncodingConverter __CFConverterWinLatin1; 38 | extern const CFStringEncodingConverter __CFConverterNextStepLatin; 39 | extern const CFStringEncodingConverter __CFConverterUTF8; 40 | 41 | extern CFStringEncoding *__CFStringEncodingCreateListOfAvailablePlatformConverters(CFAllocatorRef allocator, CFIndex *numberOfConverters); 42 | extern const CFStringEncodingConverter *__CFStringEncodingGetExternalConverter(uint32_t encoding); 43 | extern CFIndex __CFStringEncodingPlatformUnicodeToBytes(uint32_t encoding, uint32_t flags, const UniChar *characters, CFIndex numChars, CFIndex *usedCharLen, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 44 | extern CFIndex __CFStringEncodingPlatformBytesToUnicode(uint32_t encoding, uint32_t flags, const uint8_t *bytes, CFIndex numBytes, CFIndex *usedByteLen, UniChar *characters, CFIndex maxCharLen, CFIndex *usedCharLen); 45 | extern CFIndex __CFStringEncodingPlatformCharLengthForBytes(uint32_t encoding, uint32_t flags, const uint8_t *bytes, CFIndex numBytes); 46 | extern CFIndex __CFStringEncodingPlatformByteLengthForCharacters(uint32_t encoding, uint32_t flags, const UniChar *characters, CFIndex numChars); 47 | 48 | #endif /* ! __COREFOUNDATION_CFSTRINGENCODINGCONVERTERPRIV__ */ 49 | 50 | -------------------------------------------------------------------------------- /CFStringEncodingDatabase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * CFStringEncodingDatabase.h 26 | * CoreFoundation 27 | * 28 | * Created by Aki Inoue on 07/12/05. 29 | * Copyright (c) 2007-2009, Apple Inc. All rights reserved. 30 | * 31 | */ 32 | 33 | #include 34 | 35 | __private_extern__ uint16_t __CFStringEncodingGetWindowsCodePage(CFStringEncoding encoding); 36 | __private_extern__ CFStringEncoding __CFStringEncodingGetFromWindowsCodePage(uint16_t codepage); 37 | 38 | __private_extern__ bool __CFStringEncodingGetCanonicalName(CFStringEncoding encoding, char *buffer, CFIndex bufferSize); 39 | __private_extern__ CFStringEncoding __CFStringEncodingGetFromCanonicalName(const char *canonicalName); 40 | 41 | __private_extern__ CFStringEncoding __CFStringEncodingGetMostCompatibleMacScript(CFStringEncoding encoding); 42 | 43 | __private_extern__ const char *__CFStringEncodingGetName(CFStringEncoding encoding); // Returns simple non-localizd name 44 | -------------------------------------------------------------------------------- /CFSystemDirectories.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFSystemDirectories.c 25 | Copyright (c) 1997-2009, Apple Inc. All rights reserved. 26 | Responsibility: Ali Ozer 27 | */ 28 | 29 | /* 30 | This file defines CFCopySearchPathForDirectoriesInDomains(). 31 | On MacOS 8, this function returns empty array. 32 | On Mach, it calls the System.framework enumeration functions. 33 | On Windows, it calls the enumeration functions defined here. 34 | */ 35 | 36 | #include 37 | #include "CFInternal.h" 38 | 39 | #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED 40 | 41 | /* We use the System framework implementation on Mach. 42 | */ 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | CFSearchPathEnumerationState __CFStartSearchPathEnumeration(CFSearchPathDirectory dir, CFSearchPathDomainMask domainMask) { 49 | return NSStartSearchPathEnumeration(dir, domainMask); 50 | } 51 | 52 | CFSearchPathEnumerationState __CFGetNextSearchPathEnumeration(CFSearchPathEnumerationState state, uint8_t *path, CFIndex pathSize) { 53 | CFSearchPathEnumerationState result; 54 | // NSGetNextSearchPathEnumeration requires a MAX_PATH size 55 | if (pathSize < PATH_MAX) { 56 | uint8_t tempPath[PATH_MAX]; 57 | result = NSGetNextSearchPathEnumeration(state, (char *)tempPath); 58 | strlcpy((char *)path, (char *)tempPath, pathSize); 59 | } else { 60 | result = NSGetNextSearchPathEnumeration(state, (char *)path); 61 | } 62 | return result; 63 | } 64 | 65 | #endif 66 | 67 | 68 | #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS_SYNC 69 | 70 | CFArrayRef CFCopySearchPathForDirectoriesInDomains(CFSearchPathDirectory directory, CFSearchPathDomainMask domainMask, Boolean expandTilde) { 71 | CFMutableArrayRef array; 72 | CFSearchPathEnumerationState state; 73 | CFIndex homeLen = -1; 74 | char cPath[CFMaxPathSize], home[CFMaxPathSize]; 75 | 76 | array = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks); 77 | state = __CFStartSearchPathEnumeration(directory, domainMask); 78 | while ((state = __CFGetNextSearchPathEnumeration(state, (uint8_t *)cPath, sizeof(cPath)))) { 79 | CFURLRef url = NULL; 80 | if (expandTilde && (cPath[0] == '~')) { 81 | if (homeLen < 0) { 82 | CFURLRef homeURL = CFCopyHomeDirectoryURLForUser(NULL); 83 | if (homeURL) { 84 | CFURLGetFileSystemRepresentation(homeURL, true, (uint8_t *)home, CFMaxPathSize); 85 | homeLen = strlen(home); 86 | CFRelease(homeURL); 87 | } 88 | } 89 | if (homeLen + strlen(cPath) < CFMaxPathSize) { 90 | home[homeLen] = '\0'; 91 | strlcat(home, &cPath[1], sizeof(home)); 92 | url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorSystemDefault, (uint8_t *)home, strlen(home), true); 93 | } 94 | } else { 95 | url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorSystemDefault, (uint8_t *)cPath, strlen(cPath), true); 96 | } 97 | if (url) { 98 | CFArrayAppendValue(array, url); 99 | CFRelease(url); 100 | } 101 | } 102 | return array; 103 | } 104 | 105 | #endif 106 | 107 | #undef numDirs 108 | #undef numApplicationDirs 109 | #undef numLibraryDirs 110 | #undef numDomains 111 | #undef invalidDomains 112 | #undef invalidDomains 113 | 114 | -------------------------------------------------------------------------------- /CFTimeZone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFTimeZone.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFTIMEZONE__) 29 | #define __COREFOUNDATION_CFTIMEZONE__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | CF_EXPORT 41 | CFTypeID CFTimeZoneGetTypeID(void); 42 | 43 | CF_EXPORT 44 | CFTimeZoneRef CFTimeZoneCopySystem(void); 45 | 46 | CF_EXPORT 47 | void CFTimeZoneResetSystem(void); 48 | 49 | CF_EXPORT 50 | CFTimeZoneRef CFTimeZoneCopyDefault(void); 51 | 52 | CF_EXPORT 53 | void CFTimeZoneSetDefault(CFTimeZoneRef tz); 54 | 55 | CF_EXPORT 56 | CFArrayRef CFTimeZoneCopyKnownNames(void); 57 | 58 | CF_EXPORT 59 | CFDictionaryRef CFTimeZoneCopyAbbreviationDictionary(void); 60 | 61 | CF_EXPORT 62 | void CFTimeZoneSetAbbreviationDictionary(CFDictionaryRef dict); 63 | 64 | CF_EXPORT 65 | CFTimeZoneRef CFTimeZoneCreate(CFAllocatorRef allocator, CFStringRef name, CFDataRef data); 66 | 67 | CF_EXPORT 68 | CFTimeZoneRef CFTimeZoneCreateWithTimeIntervalFromGMT(CFAllocatorRef allocator, CFTimeInterval ti); 69 | 70 | CF_EXPORT 71 | CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef name, Boolean tryAbbrev); 72 | 73 | CF_EXPORT 74 | CFStringRef CFTimeZoneGetName(CFTimeZoneRef tz); 75 | 76 | CF_EXPORT 77 | CFDataRef CFTimeZoneGetData(CFTimeZoneRef tz); 78 | 79 | CF_EXPORT 80 | CFTimeInterval CFTimeZoneGetSecondsFromGMT(CFTimeZoneRef tz, CFAbsoluteTime at); 81 | 82 | CF_EXPORT 83 | CFStringRef CFTimeZoneCopyAbbreviation(CFTimeZoneRef tz, CFAbsoluteTime at); 84 | 85 | CF_EXPORT 86 | Boolean CFTimeZoneIsDaylightSavingTime(CFTimeZoneRef tz, CFAbsoluteTime at); 87 | 88 | CF_EXPORT 89 | CFTimeInterval CFTimeZoneGetDaylightSavingTimeOffset(CFTimeZoneRef tz, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 90 | 91 | CF_EXPORT 92 | CFAbsoluteTime CFTimeZoneGetNextDaylightSavingTimeTransition(CFTimeZoneRef tz, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 93 | 94 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 95 | enum { 96 | kCFTimeZoneNameStyleStandard, 97 | kCFTimeZoneNameStyleShortStandard, 98 | kCFTimeZoneNameStyleDaylightSaving, 99 | kCFTimeZoneNameStyleShortDaylightSaving, 100 | kCFTimeZoneNameStyleGeneric, 101 | kCFTimeZoneNameStyleShortGeneric 102 | }; 103 | typedef CFIndex CFTimeZoneNameStyle; 104 | 105 | CF_EXPORT 106 | CFStringRef CFTimeZoneCopyLocalizedName(CFTimeZoneRef tz, CFTimeZoneNameStyle style, CFLocaleRef locale) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 107 | #endif 108 | 109 | CF_EXPORT 110 | const CFStringRef kCFTimeZoneSystemTimeZoneDidChangeNotification AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 111 | 112 | CF_EXTERN_C_END 113 | 114 | #endif /* ! __COREFOUNDATION_CFTIMEZONE__ */ 115 | 116 | -------------------------------------------------------------------------------- /CFURLAccess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFURLAccess.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFURLACCESS__) 29 | #define __COREFOUNDATION_CFURLACCESS__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | CF_EXTERN_C_BEGIN 40 | 41 | 42 | 43 | /* Attempts to read the data and properties for the given URL. If 44 | only interested in one of the resourceData and properties, pass NULL 45 | for the other. If properties is non-NULL and desiredProperties is 46 | NULL, then all properties are fetched. Returns success or failure; 47 | note that as much work as possible is done even if false is returned. 48 | So for instance if one property is not available, the others are 49 | fetched anyway. errorCode is set to 0 on success, and some other 50 | value on failure. If non-NULL, it is the caller 's responsibility 51 | to release resourceData and properties. 52 | 53 | Apple reserves for its use all negative error code values; these 54 | values represent errors common to any scheme. Scheme-specific error 55 | codes should be positive, non-zero, and should be used only if one of 56 | the predefined Apple error codes does not apply. Error codes should 57 | be publicized and documented with the scheme-specific properties. 58 | 59 | NOTE: When asking for the resource data, this call will allocate the entire 60 | resource in memory. This can be very expensive, depending on the size of the 61 | resource (file). Please use CFStream or other techniques if you are downloading 62 | large files. 63 | 64 | */ 65 | CF_EXPORT 66 | Boolean CFURLCreateDataAndPropertiesFromResource(CFAllocatorRef alloc, CFURLRef url, CFDataRef *resourceData, CFDictionaryRef *properties, CFArrayRef desiredProperties, SInt32 *errorCode) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 67 | 68 | /* Attempts to write the given data and properties to the given URL. 69 | If dataToWrite is NULL, only properties are written out (use 70 | CFURLDestroyResource() to delete a resource). Properties not present 71 | in propertiesToWrite are left unchanged, hence if propertiesToWrite 72 | is NULL or empty, the URL's properties are not changed at all. 73 | Returns success or failure; errorCode is set as for 74 | CFURLCreateDataAndPropertiesFromResource(), above. 75 | */ 76 | CF_EXPORT 77 | Boolean CFURLWriteDataAndPropertiesToResource(CFURLRef url, CFDataRef dataToWrite, CFDictionaryRef propertiesToWrite, SInt32 *errorCode) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 78 | 79 | /* Destroys the resource indicated by url. */ 80 | /* Returns success or failure; errorCode set as above. */ 81 | CF_EXPORT 82 | Boolean CFURLDestroyResource(CFURLRef url, SInt32 *errorCode) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 83 | 84 | /* Convenience method which calls through to CFURLCreateDataAndPropertiesFromResource(). */ 85 | /* Returns NULL on error and sets errorCode accordingly. */ 86 | CF_EXPORT 87 | CFTypeRef CFURLCreatePropertyFromResource(CFAllocatorRef alloc, CFURLRef url, CFStringRef property, SInt32 *errorCode) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 88 | 89 | 90 | /* Common error codes (returned only by the older APIs that predate CFError) */ 91 | enum { 92 | kCFURLUnknownError = -10, 93 | kCFURLUnknownSchemeError = -11, 94 | kCFURLResourceNotFoundError = -12, 95 | kCFURLResourceAccessViolationError = -13, 96 | kCFURLRemoteHostUnavailableError = -14, 97 | kCFURLImproperArgumentsError = -15, 98 | kCFURLUnknownPropertyKeyError = -16, 99 | kCFURLPropertyKeyUnavailableError = -17, 100 | kCFURLTimeoutError = -18 101 | }; 102 | typedef CFIndex CFURLError; 103 | 104 | /* Older property keys */ 105 | 106 | CF_EXPORT 107 | const CFStringRef kCFURLFileExists AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 108 | CF_EXPORT 109 | const CFStringRef kCFURLFileDirectoryContents AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 110 | CF_EXPORT 111 | const CFStringRef kCFURLFileLength AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 112 | CF_EXPORT 113 | const CFStringRef kCFURLFileLastModificationTime AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 114 | CF_EXPORT 115 | const CFStringRef kCFURLFilePOSIXMode AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 116 | CF_EXPORT 117 | const CFStringRef kCFURLFileOwnerID AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 118 | CF_EXPORT 119 | const CFStringRef kCFURLHTTPStatusCode AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 120 | CF_EXPORT 121 | const CFStringRef kCFURLHTTPStatusLine AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; 122 | 123 | /* The value of kCFURLFileExists is a CFBoolean */ 124 | /* The value of kCFURLFileDirectoryContents is a CFArray containing CFURLs. An empty array means the directory exists, but is empty */ 125 | /* The value of kCFURLFileLength is a CFNumber giving the file's length in bytes */ 126 | /* The value of kCFURLFileLastModificationTime is a CFDate */ 127 | /* The value of kCFURLFilePOSIXMode is a CFNumber as given in stat.h */ 128 | /* The value of kCFURLFileOwnerID is a CFNumber representing the owner's uid */ 129 | 130 | /* Properties for the http: scheme. Except for the common error codes, above, errorCode will be set to the HTTP response status code upon failure. Any HTTP header name can also be used as a property */ 131 | /* The value of kCFURLHTTPStatusCode is a CFNumber */ 132 | /* The value of kCFURLHTTPStatusLine is a CFString */ 133 | 134 | CF_EXTERN_C_END 135 | 136 | #endif /* ! __COREFOUNDATION_CFURLACCESS__ */ 137 | 138 | -------------------------------------------------------------------------------- /CFUUID.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFUUID.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFUUID__) 29 | #define __COREFOUNDATION_CFUUID__ 1 30 | 31 | #include 32 | #include 33 | 34 | CF_EXTERN_C_BEGIN 35 | 36 | typedef const struct __CFUUID * CFUUIDRef; 37 | 38 | typedef struct { 39 | UInt8 byte0; 40 | UInt8 byte1; 41 | UInt8 byte2; 42 | UInt8 byte3; 43 | UInt8 byte4; 44 | UInt8 byte5; 45 | UInt8 byte6; 46 | UInt8 byte7; 47 | UInt8 byte8; 48 | UInt8 byte9; 49 | UInt8 byte10; 50 | UInt8 byte11; 51 | UInt8 byte12; 52 | UInt8 byte13; 53 | UInt8 byte14; 54 | UInt8 byte15; 55 | } CFUUIDBytes; 56 | /* The CFUUIDBytes struct is a 128-bit struct that contains the 57 | raw UUID. A CFUUIDRef can provide such a struct from the 58 | CFUUIDGetUUIDBytes() function. This struct is suitable for 59 | passing to APIs that expect a raw UUID. 60 | */ 61 | 62 | CF_EXPORT 63 | CFTypeID CFUUIDGetTypeID(void); 64 | 65 | CF_EXPORT 66 | CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc); 67 | /* Create and return a brand new unique identifier */ 68 | 69 | CF_EXPORT 70 | CFUUIDRef CFUUIDCreateWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15); 71 | /* Create and return an identifier with the given contents. This may return an existing instance with its ref count bumped because of uniquing. */ 72 | 73 | CF_EXPORT 74 | CFUUIDRef CFUUIDCreateFromString(CFAllocatorRef alloc, CFStringRef uuidStr); 75 | /* Converts from a string representation to the UUID. This may return an existing instance with its ref count bumped because of uniquing. */ 76 | 77 | CF_EXPORT 78 | CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid); 79 | /* Converts from a UUID to its string representation. */ 80 | 81 | CF_EXPORT 82 | CFUUIDRef CFUUIDGetConstantUUIDWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15); 83 | /* This returns an immortal CFUUIDRef that should not be released. It can be used in headers to declare UUID constants with #define. */ 84 | 85 | CF_EXPORT 86 | CFUUIDBytes CFUUIDGetUUIDBytes(CFUUIDRef uuid); 87 | 88 | CF_EXPORT 89 | CFUUIDRef CFUUIDCreateFromUUIDBytes(CFAllocatorRef alloc, CFUUIDBytes bytes); 90 | 91 | CF_EXTERN_C_END 92 | 93 | #endif /* ! __COREFOUNDATION_CFUUID__ */ 94 | 95 | -------------------------------------------------------------------------------- /CFUniCharPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFUniCharPriv.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFUNICHARPRIV__) 29 | #define __COREFOUNDATION_CFUNICHARPRIV__ 1 30 | 31 | #include 32 | #include 33 | 34 | #define kCFUniCharRecursiveDecompositionFlag (1UL << 30) 35 | #define kCFUniCharNonBmpFlag (1UL << 31) 36 | #define CFUniCharConvertCountToFlag(count) ((count & 0x1F) << 24) 37 | #define CFUniCharConvertFlagToCount(flag) ((flag >> 24) & 0x1F) 38 | 39 | enum { 40 | kCFUniCharCanonicalDecompMapping = (kCFUniCharCaseFold + 1), 41 | kCFUniCharCanonicalPrecompMapping, 42 | kCFUniCharCompatibilityDecompMapping 43 | }; 44 | 45 | CF_EXPORT const void *CFUniCharGetMappingData(uint32_t type); 46 | 47 | #endif /* ! __COREFOUNDATION_CFUNICHARPRIV__ */ 48 | 49 | -------------------------------------------------------------------------------- /CFUniCharPropertyDatabase.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevestreza/CoreFoundation/38a055167790581012eabc29972f60f801efcd1a/CFUniCharPropertyDatabase.data -------------------------------------------------------------------------------- /CFUnicodeData-B.mapping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevestreza/CoreFoundation/38a055167790581012eabc29972f60f801efcd1a/CFUnicodeData-B.mapping -------------------------------------------------------------------------------- /CFUnicodeData-L.mapping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevestreza/CoreFoundation/38a055167790581012eabc29972f60f801efcd1a/CFUnicodeData-L.mapping -------------------------------------------------------------------------------- /CFUnicodeDecomposition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * CFUnicodeDecomposition.h 26 | * CoreFoundation 27 | * 28 | * Created by aki on Wed Oct 03 2001. 29 | * Copyright (c) 2001-2009, Apple Inc. All rights reserved. 30 | * 31 | */ 32 | 33 | #if !defined(__COREFOUNDATION_CFUNICODEDECOMPOSITION__) 34 | #define __COREFOUNDATION_CFUNICODEDECOMPOSITION__ 1 35 | 36 | #include 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | CF_INLINE bool CFUniCharIsDecomposableCharacter(UTF32Char character, bool isHFSPlusCanonical) { 41 | if (isHFSPlusCanonical && !isHFSPlusCanonical) return false; // hack to get rid of "unused" warning 42 | if (character < 0x80) return false; 43 | return CFUniCharIsMemberOf(character, kCFUniCharHFSPlusDecomposableCharacterSet); 44 | } 45 | 46 | CF_EXPORT CFIndex CFUniCharDecomposeCharacter(UTF32Char character, UTF32Char *convertedChars, CFIndex maxBufferLength); 47 | CF_EXPORT CFIndex CFUniCharCompatibilityDecompose(UTF32Char *convertedChars, CFIndex length, CFIndex maxBufferLength); 48 | 49 | CF_EXPORT bool CFUniCharDecompose(const UTF16Char *src, CFIndex length, CFIndex *consumedLength, void *dst, CFIndex maxLength, CFIndex *filledLength, bool needToReorder, uint32_t dstFormat, bool isHFSPlus); 50 | 51 | CF_EXPORT void CFUniCharPrioritySort(UTF32Char *characters, CFIndex length); 52 | 53 | CF_EXTERN_C_END 54 | 55 | #endif /* ! __COREFOUNDATION_CFUNICODEDECOMPOSITION__ */ 56 | 57 | -------------------------------------------------------------------------------- /CFUnicodePrecomposition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * CFUnicodePrecomposition.h 26 | * CoreFoundation 27 | * 28 | * Created by aki on Wed Oct 03 2001. 29 | * Copyright (c) 2001-2009, Apple Inc. All rights reserved. 30 | * 31 | */ 32 | 33 | #if !defined(__COREFOUNDATION_CFUNICODEPRECOMPOSITION__) 34 | #define __COREFOUNDATION_CFUNICODEPRECOMPOSITION__ 1 35 | 36 | #include 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | // As you can see, this function cannot precompose Hangul Jamo 41 | CF_EXPORT UTF32Char CFUniCharPrecomposeCharacter(UTF32Char base, UTF32Char combining); 42 | 43 | CF_EXPORT bool CFUniCharPrecompose(const UTF16Char *characters, CFIndex length, CFIndex *consumedLength, UTF16Char *precomposed, CFIndex maxLength, CFIndex *filledLength); 44 | 45 | CF_EXTERN_C_END 46 | 47 | #endif /* ! __COREFOUNDATION_CFUNICODEPRECOMPOSITION__ */ 48 | 49 | -------------------------------------------------------------------------------- /CFUserNotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFUserNotification.h 25 | Copyright (c) 2000-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFUSERNOTIFICATION__) 29 | #define __COREFOUNDATION_CFUSERNOTIFICATION__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | CF_EXTERN_C_BEGIN 39 | 40 | typedef struct __CFUserNotification * CFUserNotificationRef; 41 | 42 | /* A CFUserNotification is a notification intended to be presented to a 43 | user at the console (if one is present). This is for the use of processes 44 | that do not otherwise have user interfaces, but may need occasional 45 | interaction with a user. There is a parallel API for this functionality 46 | at the System framework level, described in UNCUserNotification.h. 47 | 48 | The contents of the notification can include a header, a message, textfields, 49 | a popup button, radio buttons or checkboxes, a progress indicator, and up to 50 | three ordinary buttons. All of these items are optional, but a default 51 | button will be supplied even if not specified unless the 52 | kCFUserNotificationNoDefaultButtonFlag is set. 53 | 54 | The contents of the notification are specified in the dictionary used to 55 | create the notification, whose keys should be taken from the list of constants 56 | below, and whose values should be either strings or arrays of strings 57 | (except for kCFUserNotificationProgressIndicatorValueKey, in which case the 58 | value should be a number between 0 and 1, for a "definite" progress indicator, 59 | or a boolean, for an "indefinite" progress indicator). Additionally, URLs can 60 | optionally be supplied for an icon, a sound, and a bundle whose Localizable.strings 61 | files will be used to localize strings. 62 | 63 | Certain request flags are specified when a notification is created. 64 | These specify an alert level for the notification, determine whether 65 | radio buttons or check boxes are to be used, specify which if any of these 66 | are checked by default, specify whether any of the textfields are to 67 | be secure textfields, and determine which popup item should be selected 68 | by default. A timeout is also specified, which determines how long the 69 | notification should be supplied to the user (if zero, it will not timeout). 70 | 71 | A CFUserNotification is dispatched for presentation when it is created. 72 | If any reply is required, it may be awaited in one of two ways: either 73 | synchronously, using CFUserNotificationReceiveResponse, or asynchronously, 74 | using a run loop source. CFUserNotificationReceiveResponse has a timeout 75 | parameter that determines how long it will block (zero meaning indefinitely) 76 | and it may be called as many times as necessary until a response arrives. 77 | If a notification has not yet received a response, it may be updated with 78 | new information, or it may be cancelled. Notifications may not be reused. 79 | 80 | When a response arrives, it carries with it response flags that describe 81 | which button was used to dismiss the notification, which checkboxes or 82 | radio buttons were checked, and what the selection of the popup was. 83 | It also carries a response dictionary, which describes the contents 84 | of the textfields. */ 85 | 86 | typedef void (*CFUserNotificationCallBack)(CFUserNotificationRef userNotification, CFOptionFlags responseFlags); 87 | 88 | CF_EXPORT 89 | CFTypeID CFUserNotificationGetTypeID(void); 90 | 91 | CF_EXPORT 92 | CFUserNotificationRef CFUserNotificationCreate(CFAllocatorRef allocator, CFTimeInterval timeout, CFOptionFlags flags, SInt32 *error, CFDictionaryRef dictionary); 93 | 94 | CF_EXPORT 95 | SInt32 CFUserNotificationReceiveResponse(CFUserNotificationRef userNotification, CFTimeInterval timeout, CFOptionFlags *responseFlags); 96 | 97 | CF_EXPORT 98 | CFStringRef CFUserNotificationGetResponseValue(CFUserNotificationRef userNotification, CFStringRef key, CFIndex idx); 99 | 100 | CF_EXPORT 101 | CFDictionaryRef CFUserNotificationGetResponseDictionary(CFUserNotificationRef userNotification); 102 | 103 | CF_EXPORT 104 | SInt32 CFUserNotificationUpdate(CFUserNotificationRef userNotification, CFTimeInterval timeout, CFOptionFlags flags, CFDictionaryRef dictionary); 105 | 106 | CF_EXPORT 107 | SInt32 CFUserNotificationCancel(CFUserNotificationRef userNotification); 108 | 109 | CF_EXPORT 110 | CFRunLoopSourceRef CFUserNotificationCreateRunLoopSource(CFAllocatorRef allocator, CFUserNotificationRef userNotification, CFUserNotificationCallBack callout, CFIndex order); 111 | 112 | /* Convenience functions for handling the simplest and most common cases: 113 | a one-way notification, and a notification with up to three buttons. */ 114 | 115 | CF_EXPORT 116 | SInt32 CFUserNotificationDisplayNotice(CFTimeInterval timeout, CFOptionFlags flags, CFURLRef iconURL, CFURLRef soundURL, CFURLRef localizationURL, CFStringRef alertHeader, CFStringRef alertMessage, CFStringRef defaultButtonTitle); 117 | 118 | CF_EXPORT 119 | SInt32 CFUserNotificationDisplayAlert(CFTimeInterval timeout, CFOptionFlags flags, CFURLRef iconURL, CFURLRef soundURL, CFURLRef localizationURL, CFStringRef alertHeader, CFStringRef alertMessage, CFStringRef defaultButtonTitle, CFStringRef alternateButtonTitle, CFStringRef otherButtonTitle, CFOptionFlags *responseFlags); 120 | 121 | 122 | /* Flags */ 123 | 124 | enum { 125 | kCFUserNotificationStopAlertLevel = 0, 126 | kCFUserNotificationNoteAlertLevel = 1, 127 | kCFUserNotificationCautionAlertLevel = 2, 128 | kCFUserNotificationPlainAlertLevel = 3 129 | }; 130 | 131 | enum { 132 | kCFUserNotificationDefaultResponse = 0, 133 | kCFUserNotificationAlternateResponse = 1, 134 | kCFUserNotificationOtherResponse = 2, 135 | kCFUserNotificationCancelResponse = 3 136 | }; 137 | 138 | enum { 139 | kCFUserNotificationNoDefaultButtonFlag = (1UL << 5), 140 | kCFUserNotificationUseRadioButtonsFlag = (1UL << 6) 141 | }; 142 | 143 | CF_INLINE CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i) {return ((CFOptionFlags)(1UL << (8 + i)));} 144 | CF_INLINE CFOptionFlags CFUserNotificationSecureTextField(CFIndex i) {return ((CFOptionFlags)(1UL << (16 + i)));} 145 | CF_INLINE CFOptionFlags CFUserNotificationPopUpSelection(CFIndex n) {return ((CFOptionFlags)(n << 24));} 146 | 147 | 148 | /* Keys */ 149 | 150 | CF_EXPORT 151 | const CFStringRef kCFUserNotificationIconURLKey; 152 | 153 | CF_EXPORT 154 | const CFStringRef kCFUserNotificationSoundURLKey; 155 | 156 | CF_EXPORT 157 | const CFStringRef kCFUserNotificationLocalizationURLKey; 158 | 159 | CF_EXPORT 160 | const CFStringRef kCFUserNotificationAlertHeaderKey; 161 | 162 | CF_EXPORT 163 | const CFStringRef kCFUserNotificationAlertMessageKey; 164 | 165 | CF_EXPORT 166 | const CFStringRef kCFUserNotificationDefaultButtonTitleKey; 167 | 168 | CF_EXPORT 169 | const CFStringRef kCFUserNotificationAlternateButtonTitleKey; 170 | 171 | CF_EXPORT 172 | const CFStringRef kCFUserNotificationOtherButtonTitleKey; 173 | 174 | CF_EXPORT 175 | const CFStringRef kCFUserNotificationProgressIndicatorValueKey; 176 | 177 | CF_EXPORT 178 | const CFStringRef kCFUserNotificationPopUpTitlesKey; 179 | 180 | CF_EXPORT 181 | const CFStringRef kCFUserNotificationTextFieldTitlesKey; 182 | 183 | CF_EXPORT 184 | const CFStringRef kCFUserNotificationCheckBoxTitlesKey; 185 | 186 | CF_EXPORT 187 | const CFStringRef kCFUserNotificationTextFieldValuesKey; 188 | 189 | #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED 190 | CF_EXPORT 191 | const CFStringRef kCFUserNotificationPopUpSelectionKey AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; 192 | #endif 193 | 194 | #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 195 | CF_EXPORT 196 | const CFStringRef kCFUserNotificationAlertTopMostKey; 197 | 198 | CF_EXPORT 199 | const CFStringRef kCFUserNotificationKeyboardTypesKey; 200 | #endif 201 | 202 | CF_EXTERN_C_END 203 | 204 | #endif /* ! __COREFOUNDATION_CFUSERNOTIFICATION__ */ 205 | 206 | -------------------------------------------------------------------------------- /CFVersion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation PROJECT:CoreFoundation-550 SYSTEM:Darwin DEVELOPER:unknown BUILT:" __DATE__ " " __TIME__ "\n"; 25 | double kCFCoreFoundationVersionNumber = (double)550; 26 | -------------------------------------------------------------------------------- /CFWindowsMessageQueue.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFWindowsMessageQueue.c 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | Responsibility: Christopher Kane 27 | */ 28 | 29 | #if DEPLOYMENT_TARGET_WINDOWS 30 | 31 | #include "CFWindowsMessageQueue.h" 32 | #include "CFInternal.h" 33 | 34 | extern DWORD __CFRunLoopGetWindowsMessageQueueMask(CFRunLoopRef rl, CFStringRef mode); 35 | extern void __CFRunLoopSetWindowsMessageQueueMask(CFRunLoopRef rl, DWORD mask, CFStringRef mode); 36 | 37 | struct __CFWindowsMessageQueue { 38 | CFRuntimeBase _base; 39 | CFAllocatorRef _allocator; 40 | CFSpinLock_t _lock; 41 | DWORD _mask; 42 | CFRunLoopSourceRef _source; 43 | CFMutableArrayRef _runLoops; 44 | }; 45 | 46 | /* Bit 3 in the base reserved bits is used for invalid state */ 47 | 48 | CF_INLINE Boolean __CFWindowsMessageQueueIsValid(CFWindowsMessageQueueRef wmq) { 49 | return (Boolean)__CFBitfieldGetValue(((const CFRuntimeBase *)wmq)->_cfinfo[CF_INFO_BITS], 3, 3); 50 | } 51 | 52 | CF_INLINE void __CFWindowsMessageQueueSetValid(CFWindowsMessageQueueRef wmq) { 53 | __CFBitfieldSetValue(((CFRuntimeBase *)wmq)->_cfinfo[CF_INFO_BITS], 3, 3, 1); 54 | } 55 | 56 | CF_INLINE void __CFWindowsMessageQueueUnsetValid(CFWindowsMessageQueueRef wmq) { 57 | __CFBitfieldSetValue(((CFRuntimeBase *)wmq)->_cfinfo[CF_INFO_BITS], 3, 3, 0); 58 | } 59 | 60 | CF_INLINE void __CFWindowsMessageQueueLock(CFWindowsMessageQueueRef wmq) { 61 | __CFSpinLock(&(wmq->_lock)); 62 | } 63 | 64 | CF_INLINE void __CFWindowsMessageQueueUnlock(CFWindowsMessageQueueRef wmq) { 65 | __CFSpinUnlock(&(wmq->_lock)); 66 | } 67 | 68 | static Boolean __CFWindowsMessageQueueEqual(CFTypeRef cf1, CFTypeRef cf2) { 69 | CFWindowsMessageQueueRef wmq1 = (CFWindowsMessageQueueRef)cf1; 70 | CFWindowsMessageQueueRef wmq2 = (CFWindowsMessageQueueRef)cf2; 71 | return (wmq1 == wmq2); 72 | } 73 | 74 | static CFHashCode __CFWindowsMessageQueueHash(CFTypeRef cf) { 75 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)cf; 76 | return (CFHashCode)wmq; 77 | } 78 | 79 | static CFStringRef __CFWindowsMessageQueueCopyDescription(CFTypeRef cf) { 80 | /* Some commentary, possibly as out of date as much of the rest of the file was 81 | #warning CF: this and many other CopyDescription functions are probably 82 | #warning CF: broken, in that some of these fields being printed out can 83 | #warning CF: be NULL, when the object is in the invalid state 84 | */ 85 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)cf; 86 | CFMutableStringRef result; 87 | result = CFStringCreateMutable(CFGetAllocator(wmq), 0); 88 | __CFWindowsMessageQueueLock(wmq); 89 | /* More commentary, which we don't really need to see with every build 90 | #warning CF: here, and probably everywhere with a per-instance lock, 91 | #warning CF: the locked state will always be true because we lock, 92 | #warning CF: and you cannot call description if the object is locked; 93 | #warning CF: probably should not lock description, and call it unsafe 94 | */ 95 | CFStringAppendFormat(result, NULL, CFSTR("{locked = %s, valid = %s, mask = 0x%x,\n run loops = %@}"), cf, CFGetAllocator(wmq), "unknown", (__CFWindowsMessageQueueIsValid(wmq) ? "Yes" : "No"), (UInt32)wmq->_mask, wmq->_runLoops); 96 | __CFWindowsMessageQueueUnlock(wmq); 97 | return result; 98 | } 99 | 100 | CFAllocatorRef __CFWindowsMessageQueueGetAllocator(CFTypeRef cf) { 101 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)cf; 102 | return wmq->_allocator; 103 | } 104 | 105 | static void __CFWindowsMessageQueueDeallocate(CFTypeRef cf) { 106 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)cf; 107 | CFAllocatorRef allocator = CFGetAllocator(wmq); 108 | CFAllocatorDeallocate(allocator, wmq); 109 | CFRelease(allocator); 110 | } 111 | 112 | static CFTypeID __kCFWindowsMessageQueueTypeID = _kCFRuntimeNotATypeID; 113 | 114 | static const CFRuntimeClass __CFWindowsMessageQueueClass = { 115 | 0, 116 | "CFWindowsMessageQueue", 117 | NULL, // init 118 | NULL, // copy 119 | __CFWindowsMessageQueueDeallocate, 120 | __CFWindowsMessageQueueEqual, 121 | __CFWindowsMessageQueueHash, 122 | NULL, // 123 | __CFWindowsMessageQueueCopyDescription 124 | }; 125 | 126 | __private_extern__ void __CFWindowsMessageQueueInitialize(void) { 127 | __kCFWindowsMessageQueueTypeID = _CFRuntimeRegisterClass(&__CFWindowsMessageQueueClass); 128 | } 129 | 130 | CFTypeID CFWindowsMessageQueueGetTypeID(void) { 131 | return __kCFWindowsMessageQueueTypeID; 132 | } 133 | 134 | CFWindowsMessageQueueRef CFWindowsMessageQueueCreate(CFAllocatorRef allocator, uint32_t mask) { 135 | CFWindowsMessageQueueRef memory; 136 | UInt32 size = sizeof(struct __CFWindowsMessageQueue) - sizeof(CFRuntimeBase); 137 | memory = (CFWindowsMessageQueueRef)_CFRuntimeCreateInstance(allocator, __kCFWindowsMessageQueueTypeID, size, NULL); 138 | if (NULL == memory) { 139 | return NULL; 140 | } 141 | __CFWindowsMessageQueueSetValid(memory); 142 | 143 | CF_SPINLOCK_INIT_FOR_STRUCTS(memory->_lock); 144 | memory->_mask = (DWORD)mask; 145 | memory->_source = NULL; 146 | memory->_runLoops = CFArrayCreateMutable(allocator, 0, NULL); 147 | return memory; 148 | } 149 | 150 | void CFWindowsMessageQueueInvalidate(CFWindowsMessageQueueRef wmq) { 151 | __CFGenericValidateType(wmq, __kCFWindowsMessageQueueTypeID); 152 | CFRetain(wmq); 153 | __CFWindowsMessageQueueLock(wmq); 154 | if (__CFWindowsMessageQueueIsValid(wmq)) { 155 | SInt32 idx; 156 | __CFWindowsMessageQueueUnsetValid(wmq); 157 | for (idx = CFArrayGetCount(wmq->_runLoops); idx--;) { 158 | CFRunLoopWakeUp((CFRunLoopRef)CFArrayGetValueAtIndex(wmq->_runLoops, idx)); 159 | } 160 | CFRelease(wmq->_runLoops); 161 | wmq->_runLoops = NULL; 162 | if (NULL != wmq->_source) { 163 | CFRunLoopSourceInvalidate(wmq->_source); 164 | CFRelease(wmq->_source); 165 | wmq->_source = NULL; 166 | } 167 | } 168 | __CFWindowsMessageQueueUnlock(wmq); 169 | CFRelease(wmq); 170 | } 171 | 172 | Boolean CFWindowsMessageQueueIsValid(CFWindowsMessageQueueRef wmq) { 173 | __CFGenericValidateType(wmq, __kCFWindowsMessageQueueTypeID); 174 | return __CFWindowsMessageQueueIsValid(wmq); 175 | } 176 | 177 | uint32_t CFWindowsMessageQueueGetMask(CFWindowsMessageQueueRef wmq) { 178 | __CFGenericValidateType(wmq, __kCFWindowsMessageQueueTypeID); 179 | return wmq->_mask; 180 | } 181 | 182 | static void __CFWindowsMessageQueueSchedule(void *info, CFRunLoopRef rl, CFStringRef mode) { 183 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)info; 184 | __CFWindowsMessageQueueLock(wmq); 185 | if (__CFWindowsMessageQueueIsValid(wmq)) { 186 | uint32_t mask; 187 | CFArrayAppendValue(wmq->_runLoops, rl); 188 | mask = __CFRunLoopGetWindowsMessageQueueMask(rl, mode); 189 | mask |= wmq->_mask; 190 | __CFRunLoopSetWindowsMessageQueueMask(rl, mask, mode); 191 | } 192 | __CFWindowsMessageQueueUnlock(wmq); 193 | } 194 | 195 | static void __CFWindowsMessageQueueCancel(void *info, CFRunLoopRef rl, CFStringRef mode) { 196 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)info; 197 | __CFWindowsMessageQueueLock(wmq); 198 | //#warning CF: should fix up run loop modes mask here, if not done 199 | //#warning CF: previously by the invalidation, where it should also 200 | //#warning CF: be done 201 | if (NULL != wmq->_runLoops) { 202 | SInt32 idx = CFArrayGetFirstIndexOfValue(wmq->_runLoops, CFRangeMake(0, CFArrayGetCount(wmq->_runLoops)), rl); 203 | if (0 <= idx) CFArrayRemoveValueAtIndex(wmq->_runLoops, idx); 204 | } 205 | __CFWindowsMessageQueueUnlock(wmq); 206 | } 207 | 208 | static void __CFWindowsMessageQueuePerform(void *info) { 209 | CFWindowsMessageQueueRef wmq = (CFWindowsMessageQueueRef)info; 210 | __CFWindowsMessageQueueLock(wmq); 211 | if (!__CFWindowsMessageQueueIsValid(wmq)) { 212 | __CFWindowsMessageQueueUnlock(wmq); 213 | return; 214 | } 215 | __CFWindowsMessageQueueUnlock(wmq); 216 | extern void do_WIN32_MSG(); 217 | do_WIN32_MSG(); 218 | } 219 | 220 | CFRunLoopSourceRef CFWindowsMessageQueueCreateRunLoopSource(CFAllocatorRef allocator, CFWindowsMessageQueueRef wmq, CFIndex order) { 221 | CFRunLoopSourceRef result = NULL; 222 | __CFWindowsMessageQueueLock(wmq); 223 | if (NULL == wmq->_source) { 224 | CFRunLoopSourceContext context; 225 | context.version = 0; 226 | context.info = (void *)wmq; 227 | context.retain = CFRetain; 228 | context.release = CFRelease; 229 | context.copyDescription = __CFWindowsMessageQueueCopyDescription; 230 | context.equal = __CFWindowsMessageQueueEqual; 231 | context.hash = __CFWindowsMessageQueueHash; 232 | context.schedule = __CFWindowsMessageQueueSchedule; 233 | context.cancel = __CFWindowsMessageQueueCancel; 234 | context.perform = __CFWindowsMessageQueuePerform; 235 | wmq->_source = CFRunLoopSourceCreate(allocator, order, &context); 236 | } 237 | CFRetain(wmq->_source); /* This retain is for the receiver */ 238 | result = wmq->_source; 239 | __CFWindowsMessageQueueUnlock(wmq); 240 | return result; 241 | } 242 | 243 | #endif 244 | 245 | -------------------------------------------------------------------------------- /CFWindowsMessageQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFWindowsMessageQueue.h 25 | Copyright (c) 1999-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFWINDOWSMESSAGEQUEUE__) 29 | #define __COREFOUNDATION_CFWINDOWSMESSAGEQUEUE__ 1 30 | 31 | #if DEPLOYMENT_TARGET_WINDOWS 32 | 33 | #include 34 | #include 35 | 36 | 37 | typedef struct __CFWindowsMessageQueue * CFWindowsMessageQueueRef; 38 | 39 | CF_EXPORT CFTypeID CFWindowsMessageQueueGetTypeID(void); 40 | 41 | CF_EXPORT CFWindowsMessageQueueRef CFWindowsMessageQueueCreate(CFAllocatorRef allocator, uint32_t /* DWORD */ mask); 42 | 43 | CF_EXPORT uint32_t CFWindowsMessageQueueGetMask(CFWindowsMessageQueueRef wmq); 44 | CF_EXPORT void CFWindowsMessageQueueInvalidate(CFWindowsMessageQueueRef wmq); 45 | CF_EXPORT Boolean CFWindowsMessageQueueIsValid(CFWindowsMessageQueueRef wmq); 46 | 47 | CF_EXPORT CFRunLoopSourceRef CFWindowsMessageQueueCreateRunLoopSource(CFAllocatorRef allocator, CFWindowsMessageQueueRef wmq, CFIndex order); 48 | 49 | #endif 50 | 51 | #endif /* ! __COREFOUNDATION_CFWINDOWSMESSAGEQUEUE__ */ 52 | 53 | -------------------------------------------------------------------------------- /CFXMLInputStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFXMLInputStream.h 25 | Copyright (c) 2000-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFXMLINPUTSTREAM__) 29 | #define __COREFOUNDATION_CFXMLINPUTSTREAM__ 1 30 | 31 | #include 32 | #include "CFInternal.h" 33 | #include 34 | #include 35 | #include 36 | 37 | struct __CFXMLNode { 38 | // additionalData currently always points off the bottom of this struct; we could just eliminate it. Also, we may want to add a flags/version argument, and could use it to mark whether the node was the special one that CFXMLParser mucks with, as well as whether the allocator was "special" (could save us the alloc instance variable, below) -- REW, 3/8/2000 39 | CFRuntimeBase _cfBase; 40 | CFIndex version; 41 | CFXMLNodeTypeCode dataTypeID; 42 | CFStringRef dataString; 43 | void *additionalData; 44 | }; 45 | 46 | struct __CFXMLInputStream { 47 | CFDataRef data; // The XML data 48 | CFURLRef url; // the source URL for the data 49 | CFStringEncoding encoding; // the data's encoding 50 | const UInt8 *currentByte; // pointer into data at the first byte not yet translated to a character 51 | 52 | UniChar *charBuffer; // the buffer of characters translated from data 53 | UniChar *currentChar; // pointer into charBuffer at the current stream location. MUST be NULL if there are no more characters in charBuffer to consume. 54 | UniChar *mark; // The point at which the mark was dropped. NULL if the mark is currently unset. 55 | UniChar *parserMark; // mark available only for the parser's use 56 | CFIndex bufferLength; // The number of meaningful characters in charBuffer 57 | CFIndex bufferCapacity; // The current maximum capacity of charBuffer in UniChars 58 | 59 | CFIndex charIndex, lineNum; // location in the file 60 | UInt32 flags; // See #defines below for bit flag meanings 61 | CFMutableSetRef nameSet; // set of all names we've encountered; used for uniquing 62 | CFMutableStringRef tempString; 63 | 64 | CFAllocatorRef allocator; // This is unfortunate; this is always the same as the parser's allocator. We'd like to get rid of it at some point, but that would mean adding an allocator to all the function calls, which means risking that the allocator passed in gets out-of-sync. Maybe once we have CFStreams, we can encapsulate it all in that. REW, 5/22/2000 65 | }; 66 | 67 | // whether the stream has been opened for reading 68 | #define STREAM_OPEN 0x1 69 | // whether the encoding matches ASCII over 0x0-0x7F 70 | #define ENCODING_MATCHES_ASCII 0x2 71 | // whether the encoding is Unicode with the "natural" byte ordering 72 | #define ENCODING_IS_UNICODE_NATURAL 0x4 73 | // whether the encoding is Unicode with the bytes swapped 74 | #define ENCODING_IS_UNICODE_SWAPPED 0x8 75 | // whether the stream has encountered an error in encodings. 76 | #define ENCODING_COMPOSITION_ERROR 0x10 77 | 78 | typedef struct __CFXMLInputStream _CFXMLInputStream; 79 | 80 | void _initializeInputStream(_CFXMLInputStream *stream, CFAllocatorRef alloc, CFURLRef dataSource, CFDataRef xmlData); 81 | Boolean _openInputStream(_CFXMLInputStream *stream); // None of the subsequent calls will work until the input stream has been opened 82 | void _freeInputStream(_CFXMLInputStream *stream); 83 | 84 | CFStringEncoding _inputStreamGetEncoding(_CFXMLInputStream *stream); 85 | CFIndex _inputStreamCurrentLocation(_CFXMLInputStream *stream); 86 | CFIndex _inputStreamCurrentLine(_CFXMLInputStream *stream); 87 | Boolean _inputStreamAtEOF(_CFXMLInputStream *stream); 88 | Boolean _inputStreamComposingErrorOccurred(_CFXMLInputStream *stream); 89 | 90 | Boolean _inputStreamPeekCharacter(_CFXMLInputStream *stream, UniChar *ch); 91 | Boolean _inputStreamGetCharacter(_CFXMLInputStream *stream, UniChar *ch); 92 | Boolean _inputStreamReturnCharacter(_CFXMLInputStream *stream, UniChar ch); 93 | void _inputStreamSetMark(_CFXMLInputStream *stream); 94 | void _inputStreamClearMark(_CFXMLInputStream *stream); 95 | void _inputStreamGetCharactersFromMark(_CFXMLInputStream *stream, CFMutableStringRef string); 96 | void _inputStreamBackUpToMark(_CFXMLInputStream *stream); 97 | void _inputStringInitialize(_CFXMLInputStream *stream, UniChar *characters, CFIndex length); 98 | CFIndex _inputStreamSkipWhitespace(_CFXMLInputStream *stream, CFMutableStringRef str); 99 | Boolean _inputStreamScanToCharacters(_CFXMLInputStream *stream, const UniChar *scanChars, CFIndex numChars, CFMutableStringRef str); 100 | Boolean _inputStreamMatchString(_CFXMLInputStream *stream, const UniChar *stringToMatch, CFIndex length); 101 | Boolean _inputStreamScanQuotedString(_CFXMLInputStream *stream, CFMutableStringRef str); 102 | Boolean _inputStreamScanXMLName(_CFXMLInputStream *stream, Boolean isNMToken, CFStringRef *str); 103 | 104 | /* Returns the character index within the current line of the current parse location */ 105 | /* To add someday -- CF_EXPORT 106 | CFIndex CFXMLParserGetOffsetInCurrentLine(CFXMLParserRef parser); */ 107 | 108 | #endif /* ! __COREFOUNDATION_CFXMLINPUTSTREAM__ */ 109 | 110 | -------------------------------------------------------------------------------- /CFXMLNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFXMLNode.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | /* CFXMLParser (and thus CFXMLNode) will be officially deprecated in a future release of Mac OS X. 29 | Clients should be aware of the fact that CFXMLParser has some serious deficiencies in terms of both 30 | performance and standards compliance and should migrate their XML parsing to NSXMLParser, NSXMLDocument, or 31 | other XML parsing technologies that will suit their needs better than CFXMLParser. 32 | */ 33 | 34 | #if !defined(__COREFOUNDATION_CFXMLNODE__) 35 | #define __COREFOUNDATION_CFXMLNODE__ 1 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | CF_EXTERN_C_BEGIN 44 | 45 | enum { 46 | kCFXMLNodeCurrentVersion = 1 47 | }; 48 | 49 | typedef const struct __CFXMLNode * CFXMLNodeRef; 50 | typedef CFTreeRef CFXMLTreeRef; 51 | 52 | /* An CFXMLNode describes an individual XML construct - like a tag, or a comment, or a string 53 | of character data. Each CFXMLNode contains 3 main pieces of information - the node's type, 54 | the data string, and a pointer to an additional data structure. The node's type ID is an enum 55 | value of type CFXMLNodeTypeID. The data string is always a CFStringRef; the meaning of the 56 | string is dependent on the node's type ID. The format of the additional data is also dependent 57 | on the node's type; in general, there is a custom structure for each type that requires 58 | additional data. See below for the mapping from type ID to meaning of the data string and 59 | structure of the additional data. Note that these structures are versioned, and may change 60 | as the parser changes. The current version can always be identified by kCFXMLNodeCurrentVersion; 61 | earlier versions can be identified and used by passing earlier values for the version number 62 | (although the older structures would have been removed from the header). 63 | 64 | An CFXMLTree is simply a CFTree whose context data is known to be an CFXMLNodeRef. As 65 | such, an CFXMLTree can be used to represent an entire XML document; the CFTree 66 | provides the tree structure of the document, while the CFXMLNodes identify and describe 67 | the nodes of the tree. An XML document can be parsed to a CFXMLTree, and a CFXMLTree 68 | can generate the data for the equivalent XML document - see CFXMLParser.h for more 69 | information on parsing XML. 70 | */ 71 | 72 | /* Type codes for the different possible XML nodes; this list may grow.*/ 73 | enum { 74 | kCFXMLNodeTypeDocument = 1, 75 | kCFXMLNodeTypeElement = 2, 76 | kCFXMLNodeTypeAttribute = 3, 77 | kCFXMLNodeTypeProcessingInstruction = 4, 78 | kCFXMLNodeTypeComment = 5, 79 | kCFXMLNodeTypeText = 6, 80 | kCFXMLNodeTypeCDATASection = 7, 81 | kCFXMLNodeTypeDocumentFragment = 8, 82 | kCFXMLNodeTypeEntity = 9, 83 | kCFXMLNodeTypeEntityReference = 10, 84 | kCFXMLNodeTypeDocumentType = 11, 85 | kCFXMLNodeTypeWhitespace = 12, 86 | kCFXMLNodeTypeNotation = 13, 87 | kCFXMLNodeTypeElementTypeDeclaration = 14, 88 | kCFXMLNodeTypeAttributeListDeclaration = 15 89 | }; 90 | typedef CFIndex CFXMLNodeTypeCode; 91 | 92 | typedef struct { 93 | CFDictionaryRef attributes; 94 | CFArrayRef attributeOrder; 95 | Boolean isEmpty; 96 | char _reserved[3]; 97 | } CFXMLElementInfo; 98 | 99 | typedef struct { 100 | CFStringRef dataString; 101 | } CFXMLProcessingInstructionInfo; 102 | 103 | typedef struct { 104 | CFURLRef sourceURL; 105 | CFStringEncoding encoding; 106 | } CFXMLDocumentInfo; 107 | 108 | typedef struct { 109 | CFURLRef systemID; 110 | CFStringRef publicID; 111 | } CFXMLExternalID; 112 | 113 | typedef struct { 114 | CFXMLExternalID externalID; 115 | } CFXMLDocumentTypeInfo; 116 | 117 | typedef struct { 118 | CFXMLExternalID externalID; 119 | } CFXMLNotationInfo; 120 | 121 | typedef struct { 122 | /* This is expected to change in future versions */ 123 | CFStringRef contentDescription; 124 | } CFXMLElementTypeDeclarationInfo; 125 | 126 | typedef struct { 127 | /* This is expected to change in future versions */ 128 | CFStringRef attributeName; 129 | CFStringRef typeString; 130 | CFStringRef defaultString; 131 | } CFXMLAttributeDeclarationInfo; 132 | 133 | typedef struct { 134 | CFIndex numberOfAttributes; 135 | CFXMLAttributeDeclarationInfo *attributes; 136 | } CFXMLAttributeListDeclarationInfo; 137 | 138 | enum { 139 | kCFXMLEntityTypeParameter, /* Implies parsed, internal */ 140 | kCFXMLEntityTypeParsedInternal, 141 | kCFXMLEntityTypeParsedExternal, 142 | kCFXMLEntityTypeUnparsed, 143 | kCFXMLEntityTypeCharacter 144 | }; 145 | typedef CFIndex CFXMLEntityTypeCode; 146 | 147 | typedef struct { 148 | CFXMLEntityTypeCode entityType; 149 | CFStringRef replacementText; /* NULL if entityType is external or unparsed */ 150 | CFXMLExternalID entityID; /* entityID.systemID will be NULL if entityType is internal */ 151 | CFStringRef notationName; /* NULL if entityType is parsed */ 152 | } CFXMLEntityInfo; 153 | 154 | typedef struct { 155 | CFXMLEntityTypeCode entityType; 156 | } CFXMLEntityReferenceInfo; 157 | 158 | /* 159 | dataTypeCode meaning of dataString format of infoPtr 160 | =========== ===================== ================= 161 | kCFXMLNodeTypeDocument CFXMLDocumentInfo * 162 | kCFXMLNodeTypeElement tag name CFXMLElementInfo * 163 | kCFXMLNodeTypeAttribute 164 | kCFXMLNodeTypeProcessingInstruction name of the target CFXMLProcessingInstructionInfo * 165 | kCFXMLNodeTypeComment text of the comment NULL 166 | kCFXMLNodeTypeText the text's contents NULL 167 | kCFXMLNodeTypeCDATASection text of the CDATA NULL 168 | kCFXMLNodeTypeDocumentFragment 169 | kCFXMLNodeTypeEntity name of the entity CFXMLEntityInfo * 170 | kCFXMLNodeTypeEntityReference name of the referenced entity CFXMLEntityReferenceInfo * 171 | kCFXMLNodeTypeDocumentType name given as top-level element CFXMLDocumentTypeInfo * 172 | kCFXMLNodeTypeWhitespace text of the whitespace NULL 173 | kCFXMLNodeTypeNotation notation name CFXMLNotationInfo * 174 | kCFXMLNodeTypeElementTypeDeclaration tag name CFXMLElementTypeDeclarationInfo * 175 | kCFXMLNodeTypeAttributeListDeclaration tag name CFXMLAttributeListDeclarationInfo * 176 | */ 177 | 178 | CF_EXPORT 179 | CFTypeID CFXMLNodeGetTypeID(void); 180 | 181 | /* Creates a new node based on xmlType, dataString, and additionalInfoPtr. version (together with xmlType) determines the expected structure of additionalInfoPtr */ 182 | CF_EXPORT 183 | CFXMLNodeRef CFXMLNodeCreate(CFAllocatorRef alloc, CFXMLNodeTypeCode xmlType, CFStringRef dataString, const void *additionalInfoPtr, CFIndex version); 184 | 185 | /* Creates a copy of origNode (which may not be NULL). */ 186 | CF_EXPORT 187 | CFXMLNodeRef CFXMLNodeCreateCopy(CFAllocatorRef alloc, CFXMLNodeRef origNode); 188 | 189 | CF_EXPORT 190 | CFXMLNodeTypeCode CFXMLNodeGetTypeCode(CFXMLNodeRef node); 191 | 192 | CF_EXPORT 193 | CFStringRef CFXMLNodeGetString(CFXMLNodeRef node); 194 | 195 | CF_EXPORT 196 | const void *CFXMLNodeGetInfoPtr(CFXMLNodeRef node); 197 | 198 | CF_EXPORT 199 | CFIndex CFXMLNodeGetVersion(CFXMLNodeRef node); 200 | 201 | /* CFXMLTreeRef */ 202 | 203 | /* Creates a childless, parentless tree from node */ 204 | CF_EXPORT 205 | CFXMLTreeRef CFXMLTreeCreateWithNode(CFAllocatorRef allocator, CFXMLNodeRef node); 206 | 207 | /* Extracts and returns the node stored in xmlTree */ 208 | CF_EXPORT 209 | CFXMLNodeRef CFXMLTreeGetNode(CFXMLTreeRef xmlTree); 210 | 211 | CF_EXTERN_C_END 212 | 213 | #endif /* ! __COREFOUNDATION_CFXMLNODE__ */ 214 | 215 | -------------------------------------------------------------------------------- /CoreFoundation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CoreFoundation.h 25 | Copyright (c) 1998-2009, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_COREFOUNDATION__) 29 | #define __COREFOUNDATION_COREFOUNDATION__ 1 30 | #define __COREFOUNDATION__ 1 31 | 32 | #if !defined(CF_EXCLUDE_CSTD_HEADERS) 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #if defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__) 52 | 53 | #include 54 | #include 55 | #include 56 | 57 | #endif 58 | 59 | #endif 60 | 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | #include 88 | #include 89 | #include 90 | #include 91 | #include 92 | #include 93 | 94 | 95 | #if (TARGET_OS_MAC || TARGET_OS_WIN32) 96 | #include 97 | #endif 98 | 99 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 100 | #include 101 | #include 102 | #endif 103 | #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) 104 | #include 105 | #include 106 | #include 107 | #endif 108 | #if TARGET_OS_WIN32 109 | #include 110 | #include 111 | #endif 112 | 113 | #endif /* ! __COREFOUNDATION_COREFOUNDATION__ */ 114 | 115 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en_US 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.apple.CoreFoundation 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | CoreFoundation 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 6.6.4 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 550.42 23 | CarbonLazyValues 24 | 25 | CodeFragmentManager 26 | 27 | CoreFoundation 28 | CFMPriv_CoreFoundation 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | install: 2 | DSTBASE="$(DSTROOT)/System/Library/Frameworks" ./BuildCFLite 3 | -------------------------------------------------------------------------------- /PropertyList.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | --------------------------------------------------------------------------------