├── APPLE_LICENSE ├── BuildCFLite ├── BuildCFLite.windows ├── CFApplicationPreferences.c ├── CFArray.c ├── CFArray.h ├── CFBag.c ├── CFBag.h ├── CFBase.c ├── CFBase.h ├── 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 ├── CFFileDescriptor.c ├── CFFileDescriptor.h ├── CFFileUtilities.c ├── CFInternal.h ├── CFLite.sln ├── CFLocale.c ├── CFLocale.h ├── CFLocaleIdentifier.c ├── CFLogUtilities.h ├── CFMachPort.c ├── CFMachPort.h ├── CFMessagePort.c ├── CFMessagePort.h ├── CFNotificationCenter.c ├── CFNotificationCenter.h ├── CFNumber.c ├── CFNumber.h ├── CFNumberFormatter.c ├── CFNumberFormatter.h ├── CFPlatform.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 ├── CFRunLoopPriv.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 ├── 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 ├── CHANGES ├── CONTRIBUTORS ├── Cocotron ├── Cocotron.c └── CoreFoundation.xcodeproj │ └── project.pbxproj ├── CoreFoundation.h ├── CoreFoundation.pc.in ├── ForFoundationOnly.h ├── INSTALL ├── Info.plist ├── LICENSE ├── Makefile ├── Makefile.am ├── Makefile.in ├── README ├── TODO ├── XCode_Configs ├── ConfigDebug.xcconfig ├── ConfigRelease.xcconfig └── Config_Master.xcconfig ├── aclocal.m4 ├── auto_stubs.h ├── compat ├── Makefile.am ├── Makefile.in ├── dirent.c ├── dirent.h ├── flsl.c ├── gettimeofday.c ├── strlcat.c └── strlcpy.c ├── config ├── compile ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh ├── missing └── mkinstalldirs ├── configure ├── configure.ac ├── examples ├── Allocator │ ├── Allocator.vcproj │ ├── AllocatorExample.c │ ├── Makefile.am │ └── Makefile.in ├── CFLocalServer │ ├── Client.c │ ├── Common.c │ ├── Common.h │ ├── Makefile.am │ ├── Makefile.in │ ├── Protocol.h │ ├── README │ └── Server.c ├── CFMessagePort │ ├── Makefile.am │ ├── Makefile.in │ ├── client.c │ └── server.c ├── CFRunLoopTimerExample │ ├── CFRunLoopTimerExample.c │ ├── CFRunLoopTimerExample.vcproj │ ├── Makefile.am │ └── Makefile.in ├── CFTest │ ├── Chiquitita.xml │ ├── Makefile.am │ ├── Makefile.in │ ├── mac │ │ └── CFTest.xcodeproj │ │ │ └── project.pbxproj │ ├── source │ │ ├── main │ │ │ ├── CFTest.cpp │ │ │ ├── CFTest.h │ │ │ ├── main.cpp │ │ │ └── stdafx.h │ │ └── shared │ │ │ ├── CFUtils.cpp │ │ │ ├── CFUtils.h │ │ │ ├── SuperString.cpp │ │ │ └── SuperString.h │ ├── test.xml │ ├── win_cw │ │ ├── CFTest.mcp │ │ ├── MyMFCHeaders.h │ │ └── MyMFCHeaders.pch++ │ └── win_vs │ │ ├── CFTest.sln │ │ └── CFTest.vcproj ├── DNSServiceMetaQuery │ ├── DNSServiceMetaQuery.c │ ├── DNSServiceMetaQuery.vcproj │ ├── Makefile.am │ ├── Makefile.in │ └── README.txt ├── DisplayURL │ ├── DisplayURL.c │ ├── DisplayURL.vcproj │ ├── Makefile.am │ ├── Makefile.in │ └── README.txt ├── Makefile.am ├── Makefile.in ├── ReadPListExample │ ├── Makefile.am │ ├── Makefile.in │ ├── ReadPListExample.cpp │ ├── ReadPListExample.vcproj │ └── schema.xml ├── SimpleWebServer │ ├── Makefile.am │ ├── Makefile.in │ └── SimpleWebServer.c ├── StringExample │ ├── Makefile.am │ ├── Makefile.in │ ├── StringExample.c │ └── StringExample.vcproj └── WritePListExample │ ├── Makefile.am │ ├── Makefile.in │ ├── WritePListExample.cpp │ ├── WritePListExample.vcproj │ └── data │ └── expected_schema.xml ├── icu ├── bin │ ├── WHAT_IS_THIS.txt │ ├── icudt40.dll │ ├── icuin40.dll │ └── icuuc40.dll ├── lib │ ├── WHAT_IS_THIS.txt │ ├── icuin.lib │ └── icuuc.lib └── unicode │ ├── basictz.h │ ├── brkiter.h │ ├── calendar.h │ ├── caniter.h │ ├── chariter.h │ ├── choicfmt.h │ ├── coleitr.h │ ├── coll.h │ ├── curramt.h │ ├── currunit.h │ ├── datefmt.h │ ├── dbbi.h │ ├── dcfmtsym.h │ ├── decimfmt.h │ ├── docmain.h │ ├── dtfmtsym.h │ ├── dtintrv.h │ ├── dtitvfmt.h │ ├── dtitvinf.h │ ├── dtptngen.h │ ├── dtrule.h │ ├── fieldpos.h │ ├── fmtable.h │ ├── format.h │ ├── gregocal.h │ ├── locid.h │ ├── measfmt.h │ ├── measunit.h │ ├── measure.h │ ├── msgfmt.h │ ├── normlzr.h │ ├── numfmt.h │ ├── parseerr.h │ ├── parsepos.h │ ├── platform.h │ ├── plurfmt.h │ ├── plurrule.h │ ├── ppalmos.h │ ├── putil.h │ ├── pwin32.h │ ├── rbbi.h │ ├── rbnf.h │ ├── rbtz.h │ ├── regex.h │ ├── rep.h │ ├── resbund.h │ ├── schriter.h │ ├── search.h │ ├── simpletz.h │ ├── smpdtfmt.h │ ├── sortkey.h │ ├── strenum.h │ ├── stsearch.h │ ├── symtable.h │ ├── tblcoll.h │ ├── timezone.h │ ├── translit.h │ ├── tzrule.h │ ├── tztrans.h │ ├── ubidi.h │ ├── ubrk.h │ ├── ucal.h │ ├── ucasemap.h │ ├── ucat.h │ ├── uchar.h │ ├── uchriter.h │ ├── uclean.h │ ├── ucnv.h │ ├── ucnv_cb.h │ ├── ucnv_err.h │ ├── ucol.h │ ├── ucoleitr.h │ ├── uconfig.h │ ├── ucsdet.h │ ├── ucurr.h │ ├── udat.h │ ├── udata.h │ ├── udatpg.h │ ├── udeprctd.h │ ├── udraft.h │ ├── uenum.h │ ├── uidna.h │ ├── uintrnal.h │ ├── uiter.h │ ├── uloc.h │ ├── ulocdata.h │ ├── umachine.h │ ├── umisc.h │ ├── umsg.h │ ├── unifilt.h │ ├── unifunct.h │ ├── unimatch.h │ ├── unirepl.h │ ├── uniset.h │ ├── unistr.h │ ├── unorm.h │ ├── unum.h │ ├── uobject.h │ ├── uobslete.h │ ├── urbtok.h │ ├── uregex.h │ ├── urename.h │ ├── urep.h │ ├── ures.h │ ├── uscript.h │ ├── usearch.h │ ├── uset.h │ ├── usetiter.h │ ├── ushape.h │ ├── usprep.h │ ├── ustdio.h │ ├── ustream.h │ ├── ustring.h │ ├── usystem.h │ ├── utext.h │ ├── utf.h │ ├── utf16.h │ ├── utf32.h │ ├── utf8.h │ ├── utf_old.h │ ├── utmscale.h │ ├── utrace.h │ ├── utrans.h │ ├── utypes.h │ ├── uversion.h │ └── vtzone.h ├── include ├── AssertMacros.h ├── AvailabilityMacros.h ├── Makefile.am ├── Makefile.in ├── TargetConditionals.h ├── c99 │ ├── stdbool.h │ └── stdint.h ├── config.h.in └── mach_support │ ├── bootstrap_priv.h │ └── vproc_priv.h ├── m4 └── acinclude.m4 ├── macosx └── CFLite.xcodeproj │ └── project.pbxproj ├── tests ├── Make_win32.bat ├── Makefile.am ├── Makefile.in └── date_test.c └── windows └── CFLiteLib.vcproj /BuildCFLite: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | echo "Setup ..." 4 | 5 | ALL_CFILES=`ls *.c` 6 | ALL_HFILES=`ls *.h` 7 | 8 | MACHINE_TYPE=`uname -p` 9 | UNICODE_DATA_FILE="UNKNOWN" 10 | 11 | if [ "$MACHINE_TYPE" == "i386" ]; then 12 | UNICODE_DATA_FILE="CFUnicodeData-L.mapping" 13 | fi 14 | 15 | if [ "$MACHINE_TYPE" == "powerpc" ]; then 16 | UNICODE_DATA_FILE="CFUnicodeData-B.mapping" 17 | fi 18 | 19 | 20 | 21 | 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" 22 | 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" 23 | 24 | OBJBASE=../CF-Objects 25 | ARCHFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64" 26 | CFLAGS="-c -pipe -std=gnu99 -g -Wmost -Wno-trigraphs -mmacosx-version-min=10.5 -fconstant-cfstrings -fexceptions -DCF_BUILDING_CF=1 -DDEPLOYMENT_TARGET_MACOSX=1 -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_5 -DU_SHOW_DRAFT_API=1 -I$OBJBASE -I. -I./include/mach_support -DVERSION=476.17" 27 | LFLAGS="-dynamiclib -mmacosx-version-min=10.5 -twolevel_namespace -init ___CFInitialize -compatibility_version 150 -current_version 476 -sectcreate __UNICODE __csbitmaps CFCharacterSetBitmaps.bitmap -sectcreate __UNICODE __properties CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data $UNICODE_DATA_FILE -segprot __UNICODE r r" 28 | 29 | /bin/rm -rf $OBJBASE 30 | /bin/mkdir -p $OBJBASE 31 | /bin/mkdir $OBJBASE/normal 32 | /bin/mkdir $OBJBASE/CoreFoundation 33 | /bin/cp $ALL_HFILES $OBJBASE/CoreFoundation 34 | if [ $? -ne 0 ]; then 35 | echo "Setup failed" 36 | exit 1 37 | fi 38 | 39 | Build () { 40 | echo "Compiling $STYLE ..." 41 | for F in $ALL_CFILES ; do 42 | echo /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o 43 | /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o 44 | if [ $? -ne 0 ]; then 45 | echo "*** Compiling $STYLE failed ***" 46 | exit 1 47 | fi 48 | done 49 | echo "Linking $STYLE ..." 50 | echo /usr/bin/gcc $STYLE_LFLAGS -install_name /System/Library/Frameworks/CFLite.framework/Versions/A/CFLite_$STYLE $ARCHFLAGS $LFLAGS $OBJBASE/$STYLE/*.o -licucore.A -lobjc -o $OBJBASE/CFLite_$STYLE 51 | /usr/bin/gcc $STYLE_LFLAGS -install_name /System/Library/Frameworks/CFLite.framework/Versions/A/CFLite_$STYLE $ARCHFLAGS $LFLAGS $OBJBASE/$STYLE/*.o -licucore.A -lobjc -o $OBJBASE/CFLite_$STYLE 52 | if [ $? -ne 0 ]; then 53 | echo "*** Linking $STYLE failed ***" 54 | exit 1 55 | fi 56 | } 57 | 58 | STYLE=normal 59 | STYLE_CFLAGS="-O0" 60 | STYLE_LFLAGS= 61 | Build 62 | 63 | echo "Building done." 64 | 65 | echo "Installing ..." 66 | if [ -z "$DSTBASE" ]; then DSTBASE=../CF-Root ; fi 67 | 68 | /bin/rm -rf $DSTBASE/CFLite.framework 69 | /bin/mkdir -p $DSTBASE/CFLite.framework/Versions/A/Resources 70 | /bin/mkdir -p $DSTBASE/CFLite.framework/Versions/A/Headers 71 | /bin/mkdir -p $DSTBASE/CFLite.framework/Versions/A/PrivateHeaders 72 | /bin/ln -sf A $DSTBASE/CFLite.framework/Versions/Current 73 | /bin/ln -sf Versions/Current/Resources $DSTBASE/CFLite.framework/Resources 74 | /bin/ln -sf Versions/Current/Headers $DSTBASE/CFLite.framework/Headers 75 | /bin/ln -sf Versions/Current/PrivateHeaders $DSTBASE/CFLite.framework/PrivateHeaders 76 | /bin/ln -sf Versions/Current/CFLite $DSTBASE/CFLite.framework/CFLite 77 | /bin/cp Info.plist $DSTBASE/CFLite.framework/Versions/A/Resources 78 | /bin/mkdir -p $DSTBASE/CFLite.framework/Versions/A/Resources/en.lproj 79 | /bin/cp $PUBLIC_HEADERS $DSTBASE/CFLite.framework/Versions/A/Headers 80 | /bin/cp $PRIVATE_HEADERS $DSTBASE/CFLite.framework/Versions/A/PrivateHeaders 81 | #/usr/bin/strip -S -o $DSTBASE/CFLite.framework/Versions/A/CFLite $OBJBASE/CFLite_normal 82 | /bin/cp $OBJBASE/CFLite_normal $DSTBASE/CFLite.framework/Versions/A/CFLite 83 | /usr/sbin/chown -RH -f root:wheel $DSTBASE/CFLite.framework 84 | /bin/chmod -RH a-w,a+rX $DSTBASE/CFLite.framework 85 | /bin/chmod -RH u+w $DSTBASE 86 | 87 | install_name_tool -id /System/Library/Frameworks/CFLite.framework/Versions/A/CFLite $DSTBASE/CFLite.framework/Versions/A/CFLite 88 | 89 | echo "Installing done. The framework is in $DSTBASE" 90 | 91 | exit 0 92 | 93 | -------------------------------------------------------------------------------- /CFBag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFBag.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFBAG__) 38 | #define __COREFOUNDATION_CFBAG__ 1 39 | 40 | #include 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | typedef const void * (*CFBagRetainCallBack)(CFAllocatorRef allocator, const void *value); 45 | typedef void (*CFBagReleaseCallBack)(CFAllocatorRef allocator, const void *value); 46 | typedef CFStringRef (*CFBagCopyDescriptionCallBack)(const void *value); 47 | typedef Boolean (*CFBagEqualCallBack)(const void *value1, const void *value2); 48 | typedef CFHashCode (*CFBagHashCallBack)(const void *value); 49 | typedef struct { 50 | CFIndex version; 51 | CFBagRetainCallBack retain; 52 | CFBagReleaseCallBack release; 53 | CFBagCopyDescriptionCallBack copyDescription; 54 | CFBagEqualCallBack equal; 55 | CFBagHashCallBack hash; 56 | } CFBagCallBacks; 57 | 58 | CF_EXPORT 59 | const CFBagCallBacks kCFTypeBagCallBacks; 60 | CF_EXPORT 61 | const CFBagCallBacks kCFCopyStringBagCallBacks; 62 | 63 | typedef void (*CFBagApplierFunction)(const void *value, void *context); 64 | 65 | typedef const struct __CFBag * CFBagRef; 66 | typedef struct __CFBag * CFMutableBagRef; 67 | 68 | CF_EXPORT 69 | CFTypeID CFBagGetTypeID(void); 70 | 71 | CF_EXPORT 72 | CFBagRef CFBagCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFBagCallBacks *callBacks); 73 | 74 | CF_EXPORT 75 | CFBagRef CFBagCreateCopy(CFAllocatorRef allocator, CFBagRef theBag); 76 | 77 | CF_EXPORT 78 | CFMutableBagRef CFBagCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFBagCallBacks *callBacks); 79 | 80 | CF_EXPORT 81 | CFMutableBagRef CFBagCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFBagRef theBag); 82 | 83 | CF_EXPORT 84 | CFIndex CFBagGetCount(CFBagRef theBag); 85 | 86 | CF_EXPORT 87 | CFIndex CFBagGetCountOfValue(CFBagRef theBag, const void *value); 88 | 89 | CF_EXPORT 90 | Boolean CFBagContainsValue(CFBagRef theBag, const void *value); 91 | 92 | CF_EXPORT 93 | const void *CFBagGetValue(CFBagRef theBag, const void *value); 94 | 95 | CF_EXPORT 96 | Boolean CFBagGetValueIfPresent(CFBagRef theBag, const void *candidate, const void **value); 97 | 98 | CF_EXPORT 99 | void CFBagGetValues(CFBagRef theBag, const void **values); 100 | 101 | CF_EXPORT 102 | void CFBagApplyFunction(CFBagRef theBag, CFBagApplierFunction applier, void *context); 103 | 104 | CF_EXPORT 105 | void CFBagAddValue(CFMutableBagRef theBag, const void *value); 106 | 107 | CF_EXPORT 108 | void CFBagReplaceValue(CFMutableBagRef theBag, const void *value); 109 | 110 | CF_EXPORT 111 | void CFBagSetValue(CFMutableBagRef theBag, const void *value); 112 | 113 | CF_EXPORT 114 | void CFBagRemoveValue(CFMutableBagRef theBag, const void *value); 115 | 116 | CF_EXPORT 117 | void CFBagRemoveAllValues(CFMutableBagRef theBag); 118 | 119 | CF_EXTERN_C_END 120 | 121 | #endif /* ! __COREFOUNDATION_CFBAG__ */ 122 | 123 | -------------------------------------------------------------------------------- /CFBitVector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFBitVector.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFBITVECTOR__) 38 | #define __COREFOUNDATION_CFBITVECTOR__ 1 39 | 40 | #include 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | typedef UInt32 CFBit; 45 | 46 | typedef const struct __CFBitVector * CFBitVectorRef; 47 | typedef struct __CFBitVector * CFMutableBitVectorRef; 48 | 49 | CF_EXPORT CFTypeID CFBitVectorGetTypeID(void); 50 | 51 | CF_EXPORT CFBitVectorRef CFBitVectorCreate(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex numBits); 52 | CF_EXPORT CFBitVectorRef CFBitVectorCreateCopy(CFAllocatorRef allocator, CFBitVectorRef bv); 53 | CF_EXPORT CFMutableBitVectorRef CFBitVectorCreateMutable(CFAllocatorRef allocator, CFIndex capacity); 54 | CF_EXPORT CFMutableBitVectorRef CFBitVectorCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFBitVectorRef bv); 55 | 56 | CF_EXPORT CFIndex CFBitVectorGetCount(CFBitVectorRef bv); 57 | CF_EXPORT CFIndex CFBitVectorGetCountOfBit(CFBitVectorRef bv, CFRange range, CFBit value); 58 | CF_EXPORT Boolean CFBitVectorContainsBit(CFBitVectorRef bv, CFRange range, CFBit value); 59 | CF_EXPORT CFBit CFBitVectorGetBitAtIndex(CFBitVectorRef bv, CFIndex idx); 60 | CF_EXPORT void CFBitVectorGetBits(CFBitVectorRef bv, CFRange range, UInt8 *bytes); 61 | CF_EXPORT CFIndex CFBitVectorGetFirstIndexOfBit(CFBitVectorRef bv, CFRange range, CFBit value); 62 | CF_EXPORT CFIndex CFBitVectorGetLastIndexOfBit(CFBitVectorRef bv, CFRange range, CFBit value); 63 | 64 | CF_EXPORT void CFBitVectorSetCount(CFMutableBitVectorRef bv, CFIndex count); 65 | CF_EXPORT void CFBitVectorFlipBitAtIndex(CFMutableBitVectorRef bv, CFIndex idx); 66 | CF_EXPORT void CFBitVectorFlipBits(CFMutableBitVectorRef bv, CFRange range); 67 | CF_EXPORT void CFBitVectorSetBitAtIndex(CFMutableBitVectorRef bv, CFIndex idx, CFBit value); 68 | CF_EXPORT void CFBitVectorSetBits(CFMutableBitVectorRef bv, CFRange range, CFBit value); 69 | CF_EXPORT void CFBitVectorSetAllBits(CFMutableBitVectorRef bv, CFBit value); 70 | 71 | CF_EXTERN_C_END 72 | 73 | #endif /* ! __COREFOUNDATION_CFBITVECTOR__ */ 74 | 75 | -------------------------------------------------------------------------------- /CFBundle_BinaryTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFBundle_BinaryTypes.h 34 | Copyright (c) 1999-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFBUNDLE_BINARYTYPES__) 38 | #define __COREFOUNDATION_CFBUNDLE_BINARYTYPES__ 1 39 | 40 | CF_EXTERN_C_BEGIN 41 | 42 | 43 | #if DEPLOYMENT_TARGET_MACOSX 44 | #if !defined(DISABLE_DYLD_USAGE) 45 | #define BINARY_SUPPORT_DYLD 1 46 | #endif 47 | #if !defined(DISABLE_DLFCN_USAGE) 48 | #define BINARY_SUPPORT_DLFCN 1 49 | #endif 50 | #elif DEPLOYMENT_TARGET_WINDOWS 51 | #define BINARY_SUPPORT_DLL 1 52 | #elif DEPLOYMENT_TARGET_LINUX 53 | #define BINARY_SUPPORT_DLFCN 1 54 | #else 55 | #error Unknown or unspecified DEPLOYMENT_TARGET 56 | #endif 57 | 58 | 59 | typedef enum { 60 | __CFBundleUnknownBinary, 61 | __CFBundleCFMBinary, 62 | __CFBundleDYLDExecutableBinary, 63 | __CFBundleDYLDBundleBinary, 64 | __CFBundleDYLDFrameworkBinary, 65 | __CFBundleDLLBinary, 66 | __CFBundleUnreadableBinary, 67 | __CFBundleNoBinary, 68 | __CFBundleELFBinary 69 | } __CFPBinaryType; 70 | 71 | /* Intended for eventual public consumption */ 72 | typedef enum { 73 | kCFBundleOtherExecutableType = 0, 74 | kCFBundleMachOExecutableType, 75 | kCFBundlePEFExecutableType, 76 | kCFBundleELFExecutableType, 77 | kCFBundleDLLExecutableType 78 | } CFBundleExecutableType; 79 | 80 | CF_EXTERN_C_END 81 | 82 | #endif /* ! __COREFOUNDATION_CFBUNDLE_BINARYTYPES__ */ 83 | 84 | -------------------------------------------------------------------------------- /CFCharacterSetBitmaps.bitmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/CFCharacterSetBitmaps.bitmap -------------------------------------------------------------------------------- /CFCharacterSetPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFCharacterSetPriv.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFCHARACTERSETPRIV__) 38 | #define __COREFOUNDATION_CFCHARACTERSETPRIV__ 1 39 | 40 | #include 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED 45 | /*! 46 | @function CFCharacterSetIsSurrogateHighCharacter 47 | Reports whether or not the character is a high surrogate. 48 | @param character The character to be checked. 49 | @result true, if character is a high surrogate, otherwise false. 50 | */ 51 | CF_INLINE Boolean CFCharacterSetIsSurrogateHighCharacter(UniChar character) { 52 | return ((character >= 0xD800UL) && (character <= 0xDBFFUL) ? true : false); 53 | } 54 | 55 | /*! 56 | @function CFCharacterSetIsSurrogateLowCharacter 57 | Reports whether or not the character is a low surrogate. 58 | @param character The character to be checked. 59 | @result true, if character is a low surrogate, otherwise false. 60 | */ 61 | CF_INLINE Boolean CFCharacterSetIsSurrogateLowCharacter(UniChar character) { 62 | return ((character >= 0xDC00UL) && (character <= 0xDFFFUL) ? true : false); 63 | } 64 | 65 | /*! 66 | @function CFCharacterSetGetLongCharacterForSurrogatePair 67 | Returns the UTF-32 value corresponding to the surrogate pair passed in. 68 | @param surrogateHigh The high surrogate character. If this parameter 69 | is not a valid high surrogate character, the behavior is undefined. 70 | @param surrogateLow The low surrogate character. If this parameter 71 | is not a valid low surrogate character, the behavior is undefined. 72 | @result The UTF-32 value for the surrogate pair. 73 | */ 74 | CF_INLINE UTF32Char CFCharacterSetGetLongCharacterForSurrogatePair(UniChar surrogateHigh, UniChar surrogateLow) { 75 | return ((surrogateHigh - 0xD800UL) << 10) + (surrogateLow - 0xDC00UL) + 0x0010000UL; 76 | } 77 | #endif 78 | 79 | /* Check to see if the character represented by the surrogate pair surrogateHigh & surrogateLow is in the chraracter set */ 80 | CF_EXPORT Boolean CFCharacterSetIsSurrogatePairMember(CFCharacterSetRef theSet, UniChar surrogateHigh, UniChar surrogateLow) ; 81 | 82 | /* Keyed-coding support 83 | */ 84 | enum { 85 | kCFCharacterSetKeyedCodingTypeBitmap = 1, 86 | kCFCharacterSetKeyedCodingTypeBuiltin = 2, 87 | kCFCharacterSetKeyedCodingTypeRange = 3, 88 | kCFCharacterSetKeyedCodingTypeString = 4, 89 | kCFCharacterSetKeyedCodingTypeBuiltinAndBitmap = 5 90 | }; 91 | typedef CFIndex CFCharacterSetKeyedCodingType; 92 | 93 | CF_EXPORT CFCharacterSetKeyedCodingType _CFCharacterSetGetKeyedCodingType(CFCharacterSetRef cset); 94 | CF_EXPORT CFCharacterSetPredefinedSet _CFCharacterSetGetKeyedCodingBuiltinType(CFCharacterSetRef cset); 95 | CF_EXPORT CFRange _CFCharacterSetGetKeyedCodingRange(CFCharacterSetRef cset); 96 | CF_EXPORT CFStringRef _CFCharacterSetCreateKeyedCodingString(CFCharacterSetRef cset); 97 | CF_EXPORT bool _CFCharacterSetIsInverted(CFCharacterSetRef cset); 98 | CF_EXPORT void _CFCharacterSetSetIsInverted(CFCharacterSetRef cset, bool flag); 99 | 100 | CF_EXTERN_C_END 101 | 102 | #endif /* ! __COREFOUNDATION_CFCHARACTERSETPRIV__ */ 103 | 104 | -------------------------------------------------------------------------------- /CFData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFData.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFDATA__) 38 | #define __COREFOUNDATION_CFDATA__ 1 39 | 40 | #include 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | typedef const struct __CFData * CFDataRef; 45 | typedef struct __CFData * CFMutableDataRef; 46 | 47 | CF_EXPORT 48 | CFTypeID CFDataGetTypeID(void); 49 | 50 | CF_EXPORT 51 | CFDataRef CFDataCreate(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length); 52 | 53 | CF_EXPORT 54 | CFDataRef CFDataCreateWithBytesNoCopy(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length, CFAllocatorRef bytesDeallocator); 55 | /* Pass kCFAllocatorNull as bytesDeallocator to assure the bytes aren't freed */ 56 | 57 | CF_EXPORT 58 | CFDataRef CFDataCreateCopy(CFAllocatorRef allocator, CFDataRef theData); 59 | 60 | CF_EXPORT 61 | CFMutableDataRef CFDataCreateMutable(CFAllocatorRef allocator, CFIndex capacity); 62 | 63 | CF_EXPORT 64 | CFMutableDataRef CFDataCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFDataRef theData); 65 | 66 | CF_EXPORT 67 | CFIndex CFDataGetLength(CFDataRef theData); 68 | 69 | CF_EXPORT 70 | const UInt8 *CFDataGetBytePtr(CFDataRef theData); 71 | 72 | CF_EXPORT 73 | UInt8 *CFDataGetMutableBytePtr(CFMutableDataRef theData); 74 | 75 | CF_EXPORT 76 | void CFDataGetBytes(CFDataRef theData, CFRange range, UInt8 *buffer); 77 | 78 | CF_EXPORT 79 | void CFDataSetLength(CFMutableDataRef theData, CFIndex length); 80 | 81 | CF_EXPORT 82 | void CFDataIncreaseLength(CFMutableDataRef theData, CFIndex extraLength); 83 | 84 | CF_EXPORT 85 | void CFDataAppendBytes(CFMutableDataRef theData, const UInt8 *bytes, CFIndex length); 86 | 87 | CF_EXPORT 88 | void CFDataReplaceBytes(CFMutableDataRef theData, CFRange range, const UInt8 *newBytes, CFIndex newLength); 89 | 90 | CF_EXPORT 91 | void CFDataDeleteBytes(CFMutableDataRef theData, CFRange range); 92 | 93 | CF_EXTERN_C_END 94 | 95 | #endif /* ! __COREFOUNDATION_CFDATA__ */ 96 | 97 | -------------------------------------------------------------------------------- /CFDate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFDate.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFDATE__) 38 | #define __COREFOUNDATION_CFDATE__ 1 39 | 40 | #include 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | typedef double CFTimeInterval; 45 | typedef CFTimeInterval CFAbsoluteTime; 46 | /* absolute time is the time interval since the reference date */ 47 | /* the reference date (epoch) is 00:00:00 1 January 2001. */ 48 | 49 | CF_EXPORT 50 | CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); 51 | 52 | CF_EXPORT 53 | const CFTimeInterval kCFAbsoluteTimeIntervalSince1970; 54 | CF_EXPORT 55 | const CFTimeInterval kCFAbsoluteTimeIntervalSince1904; 56 | 57 | typedef const struct __CFDate * CFDateRef; 58 | 59 | CF_EXPORT 60 | CFTypeID CFDateGetTypeID(void); 61 | 62 | CF_EXPORT 63 | CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime at); 64 | 65 | CF_EXPORT 66 | CFAbsoluteTime CFDateGetAbsoluteTime(CFDateRef theDate); 67 | 68 | CF_EXPORT 69 | CFTimeInterval CFDateGetTimeIntervalSinceDate(CFDateRef theDate, CFDateRef otherDate); 70 | 71 | CF_EXPORT 72 | CFComparisonResult CFDateCompare(CFDateRef theDate, CFDateRef otherDate, void *context); 73 | 74 | typedef const struct __CFTimeZone * CFTimeZoneRef; 75 | 76 | typedef struct _CFGregorianDate { 77 | SInt32 year; 78 | SInt8 month; 79 | SInt8 day; 80 | SInt8 hour; 81 | SInt8 minute; 82 | double second; 83 | } CFGregorianDate; 84 | 85 | typedef struct { 86 | SInt32 years; 87 | SInt32 months; 88 | SInt32 days; 89 | SInt32 hours; 90 | SInt32 minutes; 91 | double seconds; 92 | } CFGregorianUnits; 93 | 94 | enum { 95 | kCFGregorianUnitsYears = (1 << 0), 96 | kCFGregorianUnitsMonths = (1 << 1), 97 | kCFGregorianUnitsDays = (1 << 2), 98 | kCFGregorianUnitsHours = (1 << 3), 99 | kCFGregorianUnitsMinutes = (1 << 4), 100 | kCFGregorianUnitsSeconds = (1 << 5), 101 | #if 0 102 | kCFGregorianUnitsTimeZone = (1 << 8), 103 | kCFGregorianUnitsDayOfWeek = (1 << 9), 104 | #endif 105 | kCFGregorianAllUnits = 0x00FFFFFF 106 | }; 107 | typedef CFOptionFlags CFGregorianUnitFlags; 108 | 109 | CF_EXPORT 110 | Boolean CFGregorianDateIsValid(CFGregorianDate gdate, CFOptionFlags unitFlags); 111 | 112 | CF_EXPORT 113 | CFAbsoluteTime CFGregorianDateGetAbsoluteTime(CFGregorianDate gdate, CFTimeZoneRef tz); 114 | 115 | CF_EXPORT 116 | CFGregorianDate CFAbsoluteTimeGetGregorianDate(CFAbsoluteTime at, CFTimeZoneRef tz); 117 | 118 | CF_EXPORT 119 | CFAbsoluteTime CFAbsoluteTimeAddGregorianUnits(CFAbsoluteTime at, CFTimeZoneRef tz, CFGregorianUnits units); 120 | 121 | CF_EXPORT 122 | CFGregorianUnits CFAbsoluteTimeGetDifferenceAsGregorianUnits(CFAbsoluteTime at1, CFAbsoluteTime at2, CFTimeZoneRef tz, CFOptionFlags unitFlags); 123 | 124 | CF_EXPORT 125 | SInt32 CFAbsoluteTimeGetDayOfWeek(CFAbsoluteTime at, CFTimeZoneRef tz); 126 | 127 | CF_EXPORT 128 | SInt32 CFAbsoluteTimeGetDayOfYear(CFAbsoluteTime at, CFTimeZoneRef tz); 129 | 130 | CF_EXPORT 131 | SInt32 CFAbsoluteTimeGetWeekOfYear(CFAbsoluteTime at, CFTimeZoneRef tz); 132 | 133 | CF_EXTERN_C_END 134 | 135 | #endif /* ! __COREFOUNDATION_CFDATE__ */ 136 | 137 | -------------------------------------------------------------------------------- /CFError_Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFError_Private.h 34 | Copyright (c) 2006-2007, Apple Inc. All rights reserved. 35 | 36 | This is Apple-internal SPI for CFError. 37 | */ 38 | 39 | #if !defined(__COREFOUNDATION_CFERRORPRIVATE__) 40 | #define __COREFOUNDATION_CFERRORPRIVATE__ 1 41 | 42 | #include 43 | 44 | CF_EXTERN_C_BEGIN 45 | 46 | /* 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. 47 | */ 48 | typedef CFTypeRef (*CFErrorUserInfoKeyCallBack)(CFErrorRef err, CFStringRef key); 49 | CF_EXPORT void CFErrorSetCallBackForDomain(CFStringRef domainName, CFErrorUserInfoKeyCallBack callBack) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 50 | CF_EXPORT CFErrorUserInfoKeyCallBack CFErrorGetCallBackForDomain(CFStringRef domainName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 51 | 52 | /* 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. 53 | */ 54 | CF_EXPORT const CFStringRef kCFErrorDebugDescription AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 55 | 56 | 57 | CF_EXTERN_C_END 58 | 59 | #endif /* ! __COREFOUNDATION_CFERRORPRIVATE__ */ 60 | 61 | -------------------------------------------------------------------------------- /CFFileDescriptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CFFileDescriptor.h 3 | * 4 | * Stuart Crook, 2/3/09 5 | */ 6 | 7 | #if !defined(__COREFOUNDATION_CFFILEDESCRIPTOR__) 8 | #define __COREFOUNDATION_CFFILEDESCRIPTOR__ 1 9 | 10 | #include 11 | #include 12 | 13 | #if (MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED) || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX 14 | 15 | CF_EXTERN_C_BEGIN 16 | 17 | typedef int CFFileDescriptorNativeDescriptor; 18 | 19 | typedef struct __CFFileDescriptor * CFFileDescriptorRef; 20 | 21 | /* Callback Reason Types */ 22 | enum { 23 | kCFFileDescriptorReadCallBack = 1 << 0, 24 | kCFFileDescriptorWriteCallBack = 1 << 1 25 | }; 26 | 27 | typedef void (*CFFileDescriptorCallBack)(CFFileDescriptorRef f, CFOptionFlags callBackTypes, void *info); 28 | 29 | typedef struct { 30 | CFIndex version; 31 | void * info; 32 | void * (*retain)(void *info); 33 | void (*release)(void *info); 34 | CFStringRef (*copyDescription)(void *info); 35 | } CFFileDescriptorContext; 36 | 37 | CF_EXPORT CFTypeID CFFileDescriptorGetTypeID(void); 38 | 39 | CF_EXPORT CFFileDescriptorRef CFFileDescriptorCreate(CFAllocatorRef allocator, CFFileDescriptorNativeDescriptor fd, Boolean closeOnInvalidate, CFFileDescriptorCallBack callout, const CFFileDescriptorContext *context); 40 | 41 | CF_EXPORT CFFileDescriptorNativeDescriptor CFFileDescriptorGetNativeDescriptor(CFFileDescriptorRef f); 42 | 43 | CF_EXPORT void CFFileDescriptorGetContext(CFFileDescriptorRef f, CFFileDescriptorContext *context); 44 | 45 | CF_EXPORT void CFFileDescriptorEnableCallBacks(CFFileDescriptorRef f, CFOptionFlags callBackTypes); 46 | CF_EXPORT void CFFileDescriptorDisableCallBacks(CFFileDescriptorRef f, CFOptionFlags callBackTypes); 47 | 48 | CF_EXPORT void CFFileDescriptorInvalidate(CFFileDescriptorRef f); 49 | CF_EXPORT Boolean CFFileDescriptorIsValid(CFFileDescriptorRef f); 50 | 51 | CF_EXPORT CFRunLoopSourceRef CFFileDescriptorCreateRunLoopSource(CFAllocatorRef allocator, CFFileDescriptorRef f, CFIndex order); 52 | 53 | CF_EXTERN_C_END 54 | 55 | #endif 56 | 57 | #endif /* ! __COREFOUNDATION_CFFILEDESCRIPTOR__ */ 58 | 59 | -------------------------------------------------------------------------------- /CFLogUtilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFLogUtilities.h 34 | Copyright (c) 2004-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | /* 38 | APPLE SPI: NOT TO BE USED OUTSIDE APPLE! 39 | */ 40 | 41 | #if !defined(__COREFOUNDATION_CFLOGUTILITIES__) 42 | #define __COREFOUNDATION_CFLOGUTILITIES__ 1 43 | 44 | #include 45 | #include 46 | 47 | CF_EXTERN_C_BEGIN 48 | 49 | 50 | enum { // Legal level values for CFLog() 51 | kCFLogLevelEmergency = 0, 52 | kCFLogLevelAlert = 1, 53 | kCFLogLevelCritical = 2, 54 | kCFLogLevelError = 3, 55 | kCFLogLevelWarning = 4, 56 | kCFLogLevelNotice = 5, 57 | kCFLogLevelInfo = 6, 58 | kCFLogLevelDebug = 7, 59 | }; 60 | 61 | CF_EXPORT void CFLog(int32_t level, CFStringRef format, ...); 62 | /* Passing in a level value which is outside the range of 0-7 will cause the the call to do nothing. 63 | CFLog() logs the message using the asl.h API, and uses the level parameter as the log level. 64 | Note that the asl subsystem ignores some log levels by default. 65 | CFLog() is not fast, and is not going to be guaranteed to be fast. 66 | Even "no-op" CFLogs are not necessarily fast. 67 | If you care about performance, you shouldn't be logging. 68 | */ 69 | 70 | CF_EXTERN_C_END 71 | 72 | #endif /* ! __COREFOUNDATION_CFLOGUTILITIES__ */ 73 | 74 | -------------------------------------------------------------------------------- /CFMachPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFMachPort.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFMACHPORT__) 38 | #define __COREFOUNDATION_CFMACHPORT__ 1 39 | 40 | #if DEPLOYMENT_TARGET_MACOSX 41 | 42 | #include 43 | #include 44 | 45 | CF_EXTERN_C_BEGIN 46 | 47 | typedef struct __CFMachPort * CFMachPortRef; 48 | 49 | typedef struct { 50 | CFIndex version; 51 | void * info; 52 | const void *(*retain)(const void *info); 53 | void (*release)(const void *info); 54 | CFStringRef (*copyDescription)(const void *info); 55 | } CFMachPortContext; 56 | 57 | typedef void (*CFMachPortCallBack)(CFMachPortRef port, void *msg, CFIndex size, void *info); 58 | typedef void (*CFMachPortInvalidationCallBack)(CFMachPortRef port, void *info); 59 | 60 | CF_EXPORT CFTypeID CFMachPortGetTypeID(void); 61 | 62 | CF_EXPORT CFMachPortRef CFMachPortCreate(CFAllocatorRef allocator, CFMachPortCallBack callout, CFMachPortContext *context, Boolean *shouldFreeInfo); 63 | CF_EXPORT CFMachPortRef CFMachPortCreateWithPort(CFAllocatorRef allocator, mach_port_t portNum, CFMachPortCallBack callout, CFMachPortContext *context, Boolean *shouldFreeInfo); 64 | 65 | CF_EXPORT mach_port_t CFMachPortGetPort(CFMachPortRef port); 66 | CF_EXPORT void CFMachPortGetContext(CFMachPortRef port, CFMachPortContext *context); 67 | CF_EXPORT void CFMachPortInvalidate(CFMachPortRef port); 68 | CF_EXPORT Boolean CFMachPortIsValid(CFMachPortRef port); 69 | CF_EXPORT CFMachPortInvalidationCallBack CFMachPortGetInvalidationCallBack(CFMachPortRef port); 70 | CF_EXPORT void CFMachPortSetInvalidationCallBack(CFMachPortRef port, CFMachPortInvalidationCallBack callout); 71 | 72 | CF_EXPORT CFRunLoopSourceRef CFMachPortCreateRunLoopSource(CFAllocatorRef allocator, CFMachPortRef port, CFIndex order); 73 | 74 | CF_EXTERN_C_END 75 | 76 | #endif /* DEPLOYMENT_TARGET_MACOSX */ 77 | #endif /* ! __COREFOUNDATION_CFMACHPORT__ */ 78 | 79 | -------------------------------------------------------------------------------- /CFMessagePort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFMessagePort.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFMESSAGEPORT__) 38 | #define __COREFOUNDATION_CFMESSAGEPORT__ 1 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | CF_EXTERN_C_BEGIN 45 | 46 | typedef struct __CFMessagePort * CFMessagePortRef; 47 | 48 | enum { 49 | kCFMessagePortSuccess = 0, 50 | kCFMessagePortSendTimeout = -1, 51 | kCFMessagePortReceiveTimeout = -2, 52 | kCFMessagePortIsInvalid = -3, 53 | kCFMessagePortTransportError = -4 54 | }; 55 | 56 | typedef struct { 57 | CFIndex version; 58 | void * info; 59 | const void *(*retain)(const void *info); 60 | void (*release)(const void *info); 61 | CFStringRef (*copyDescription)(const void *info); 62 | } CFMessagePortContext; 63 | 64 | typedef CFDataRef (*CFMessagePortCallBack)(CFMessagePortRef local, SInt32 msgid, CFDataRef data, void *info); 65 | /* 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. */ 66 | typedef void (*CFMessagePortInvalidationCallBack)(CFMessagePortRef ms, void *info); 67 | 68 | CF_EXPORT CFTypeID CFMessagePortGetTypeID(void); 69 | 70 | CF_EXPORT CFMessagePortRef CFMessagePortCreateLocal(CFAllocatorRef allocator, CFStringRef name, CFMessagePortCallBack callout, CFMessagePortContext *context, Boolean *shouldFreeInfo); 71 | CF_EXPORT CFMessagePortRef CFMessagePortCreateRemote(CFAllocatorRef allocator, CFStringRef name); 72 | 73 | CF_EXPORT Boolean CFMessagePortIsRemote(CFMessagePortRef ms); 74 | CF_EXPORT CFStringRef CFMessagePortGetName(CFMessagePortRef ms); 75 | CF_EXPORT Boolean CFMessagePortSetName(CFMessagePortRef ms, CFStringRef newName); 76 | CF_EXPORT void CFMessagePortGetContext(CFMessagePortRef ms, CFMessagePortContext *context); 77 | CF_EXPORT void CFMessagePortInvalidate(CFMessagePortRef ms); 78 | CF_EXPORT Boolean CFMessagePortIsValid(CFMessagePortRef ms); 79 | CF_EXPORT CFMessagePortInvalidationCallBack CFMessagePortGetInvalidationCallBack(CFMessagePortRef ms); 80 | CF_EXPORT void CFMessagePortSetInvalidationCallBack(CFMessagePortRef ms, CFMessagePortInvalidationCallBack callout); 81 | 82 | /* NULL replyMode argument means no return value expected, dont wait for it */ 83 | CF_EXPORT SInt32 CFMessagePortSendRequest(CFMessagePortRef remote, SInt32 msgid, CFDataRef data, CFTimeInterval sendTimeout, CFTimeInterval rcvTimeout, CFStringRef replyMode, CFDataRef *returnData); 84 | 85 | CF_EXPORT CFRunLoopSourceRef CFMessagePortCreateRunLoopSource(CFAllocatorRef allocator, CFMessagePortRef local, CFIndex order); 86 | 87 | CF_EXTERN_C_END 88 | 89 | #endif /* ! __COREFOUNDATION_CFMESSAGEPORT__ */ 90 | 91 | -------------------------------------------------------------------------------- /CFNotificationCenter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CFNotificationCenter.h 3 | * 4 | * Stuart Crook, 26/2/09 5 | */ 6 | 7 | #if !defined(__COREFOUNDATION_CFNOTIFICATIONCENTER__) 8 | #define __COREFOUNDATION_CFNOTIFICATIONCENTER__ 1 9 | 10 | #include 11 | #include 12 | 13 | CF_EXTERN_C_BEGIN 14 | 15 | typedef struct __CFNotificationCenter * CFNotificationCenterRef; 16 | 17 | typedef void (*CFNotificationCallback)(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo); 18 | 19 | enum { 20 | CFNotificationSuspensionBehaviorDrop = 1, 21 | CFNotificationSuspensionBehaviorCoalesce = 2, 22 | CFNotificationSuspensionBehaviorHold = 3, 23 | CFNotificationSuspensionBehaviorDeliverImmediately = 4 24 | }; 25 | typedef CFIndex CFNotificationSuspensionBehavior; 26 | 27 | CF_EXPORT CFTypeID CFNotificationCenterGetTypeID(void); 28 | 29 | CF_EXPORT CFNotificationCenterRef CFNotificationCenterGetLocalCenter(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 30 | 31 | CF_EXPORT CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void); 32 | 33 | CF_EXPORT CFNotificationCenterRef CFNotificationCenterGetDarwinNotifyCenter(void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 34 | 35 | CF_EXPORT void CFNotificationCenterAddObserver(CFNotificationCenterRef center, const void *observer, CFNotificationCallback callBack, CFStringRef name, const void *object, CFNotificationSuspensionBehavior suspensionBehavior); 36 | 37 | CF_EXPORT void CFNotificationCenterRemoveObserver(CFNotificationCenterRef center, const void *observer, CFStringRef name, const void *object); 38 | CF_EXPORT void CFNotificationCenterRemoveEveryObserver(CFNotificationCenterRef center, const void *observer); 39 | 40 | CF_EXPORT void CFNotificationCenterPostNotification(CFNotificationCenterRef center, CFStringRef name, const void *object, CFDictionaryRef userInfo, Boolean deliverImmediately); 41 | 42 | #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED 43 | 44 | enum { 45 | kCFNotificationDeliverImmediately = (1 << 0), 46 | kCFNotificationPostToAllSessions = (1 << 1) 47 | }; 48 | 49 | void CFNotificationCenterPostNotificationWithOptions(CFNotificationCenterRef center, CFStringRef name, const void *object, CFDictionaryRef userInfo, CFOptionFlags options) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; 50 | 51 | #endif 52 | 53 | 54 | CF_EXTERN_C_END 55 | 56 | #endif /* ! __COREFOUNDATION_CFNOTIFICATIONCENTER__ */ 57 | 58 | -------------------------------------------------------------------------------- /CFPlugIn_Factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFPlugIn_Factory.h 34 | Copyright (c) 1999-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFPLUGIN_FACTORY__) 38 | #define __COREFOUNDATION_CFPLUGIN_FACTORY__ 1 39 | 40 | #include "CFBundle_Internal.h" 41 | 42 | CF_EXTERN_C_BEGIN 43 | 44 | typedef struct __CFPFactory { 45 | CFAllocatorRef _allocator; 46 | 47 | CFUUIDRef _uuid; 48 | Boolean _enabled; 49 | char _padding[3]; 50 | SInt32 _instanceCount; 51 | 52 | CFPlugInFactoryFunction _func; 53 | 54 | CFPlugInRef _plugIn; 55 | CFStringRef _funcName; 56 | 57 | CFMutableArrayRef _types; 58 | } _CFPFactory; 59 | 60 | extern _CFPFactory *_CFPFactoryCreate(CFAllocatorRef allocator, CFUUIDRef factoryID, CFPlugInFactoryFunction func); 61 | extern _CFPFactory *_CFPFactoryCreateByName(CFAllocatorRef allocator, CFUUIDRef factoryID, CFPlugInRef plugIn, CFStringRef funcName); 62 | 63 | extern _CFPFactory *_CFPFactoryFind(CFUUIDRef factoryID, Boolean enabled); 64 | 65 | extern CFUUIDRef _CFPFactoryGetFactoryID(_CFPFactory *factory); 66 | extern CFPlugInRef _CFPFactoryGetPlugIn(_CFPFactory *factory); 67 | 68 | extern void *_CFPFactoryCreateInstance(CFAllocatorRef allocator, _CFPFactory *factory, CFUUIDRef typeID); 69 | extern void _CFPFactoryDisable(_CFPFactory *factory); 70 | extern Boolean _CFPFactoryIsEnabled(_CFPFactory *factory); 71 | 72 | extern void _CFPFactoryFlushFunctionCache(_CFPFactory *factory); 73 | 74 | extern void _CFPFactoryAddType(_CFPFactory *factory, CFUUIDRef typeID); 75 | extern void _CFPFactoryRemoveType(_CFPFactory *factory, CFUUIDRef typeID); 76 | 77 | extern Boolean _CFPFactorySupportsType(_CFPFactory *factory, CFUUIDRef typeID); 78 | extern CFArrayRef _CFPFactoryFindForType(CFUUIDRef typeID); 79 | 80 | /* 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. */ 81 | extern void _CFPFactoryAddInstance(_CFPFactory *factory); 82 | extern void _CFPFactoryRemoveInstance(_CFPFactory *factory); 83 | 84 | CF_EXTERN_C_END 85 | 86 | #endif /* ! __COREFOUNDATION_CFPLUGIN_FACTORY__ */ 87 | 88 | -------------------------------------------------------------------------------- /CFStreamInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | #if !defined(__COREFOUNDATION_CFSTREAMINTERNAL__) 34 | #define __COREFOUNDATION_CFSTREAMINTERNAL__ 1 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | CF_EXTERN_C_BEGIN 42 | 43 | 44 | // Older versions of the callbacks; v0 callbacks match v1 callbacks, except that create, finalize, and copyDescription are missing. 45 | typedef Boolean (*_CFStreamCBOpenV1)(struct _CFStream *stream, CFStreamError *error, Boolean *openComplete, void *info); 46 | typedef Boolean (*_CFStreamCBOpenCompletedV1)(struct _CFStream *stream, CFStreamError *error, void *info); 47 | typedef CFIndex (*_CFStreamCBReadV1)(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, Boolean *atEOF, void *info); 48 | typedef const UInt8 *(*_CFStreamCBGetBufferV1)(CFReadStreamRef sream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFStreamError *error, Boolean *atEOF, void *info); 49 | typedef Boolean (*_CFStreamCBCanReadV1)(CFReadStreamRef, void *info); 50 | typedef CFIndex (*_CFStreamCBWriteV1)(CFWriteStreamRef, const UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, void *info); 51 | typedef Boolean (*_CFStreamCBCanWriteV1)(CFWriteStreamRef, void *info); 52 | 53 | struct _CFStreamCallBacksV1 { 54 | CFIndex version; 55 | void *(*create)(struct _CFStream *stream, void *info); 56 | void (*finalize)(struct _CFStream *stream, void *info); 57 | CFStringRef (*copyDescription)(struct _CFStream *stream, void *info); 58 | 59 | _CFStreamCBOpenV1 open; 60 | _CFStreamCBOpenCompletedV1 openCompleted; 61 | _CFStreamCBReadV1 read; 62 | _CFStreamCBGetBufferV1 getBuffer; 63 | _CFStreamCBCanReadV1 canRead; 64 | _CFStreamCBWriteV1 write; 65 | _CFStreamCBCanWriteV1 canWrite; 66 | void (*close)(struct _CFStream *stream, void *info); 67 | 68 | CFTypeRef (*copyProperty)(struct _CFStream *stream, CFStringRef propertyName, void *info); 69 | Boolean (*setProperty)(struct _CFStream *stream, CFStringRef propertyName, CFTypeRef propertyValue, void *info); 70 | void (*requestEvents)(struct _CFStream *stream, CFOptionFlags events, void *info); 71 | void (*schedule)(struct _CFStream *stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info); 72 | void (*unschedule)(struct _CFStream *stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void *info); 73 | }; 74 | 75 | // These two are defined in CFSocketStream.c because that's where the glue for CFNetwork is. 76 | __private_extern__ CFErrorRef _CFErrorFromStreamError(CFAllocatorRef alloc, CFStreamError *err); 77 | __private_extern__ CFStreamError _CFStreamErrorFromError(CFErrorRef error); 78 | 79 | CF_EXTERN_C_END 80 | 81 | #endif /* ! __COREFOUNDATION_CFSTREAMINTERNAL__ */ 82 | 83 | 84 | -------------------------------------------------------------------------------- /CFStringEncodingConverterPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFStringEncodingConverterPriv.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFSTRINGENCODINGCONVERTERPRIV__) 38 | #define __COREFOUNDATION_CFSTRINGENCODINGCONVERTERPRIV__ 1 39 | 40 | #include 41 | #include "CFStringEncodingConverterExt.h" 42 | 43 | #define MAX_IANA_ALIASES (4) 44 | 45 | typedef CFIndex (*_CFToBytesProc)(const void *converter, uint32_t flags, const UniChar *characters, CFIndex numChars, uint8_t *bytes, CFIndex maxByteLen, CFIndex *usedByteLen); 46 | typedef CFIndex (*_CFToUnicodeProc)(const void *converter, uint32_t flags, const uint8_t *bytes, CFIndex numBytes, UniChar *characters, CFIndex maxCharLen, CFIndex *usedCharLen); 47 | 48 | typedef struct { 49 | _CFToBytesProc toBytes; 50 | _CFToUnicodeProc toUnicode; 51 | _CFToUnicodeProc toCanonicalUnicode; 52 | void *_toBytes; // original proc 53 | void *_toUnicode; // original proc 54 | uint16_t maxLen; 55 | uint16_t :16; 56 | CFStringEncodingToBytesLenProc toBytesLen; 57 | CFStringEncodingToUnicodeLenProc toUnicodeLen; 58 | CFStringEncodingToBytesFallbackProc toBytesFallback; 59 | CFStringEncodingToUnicodeFallbackProc toUnicodeFallback; 60 | CFStringEncodingToBytesPrecomposeProc toBytesPrecompose; 61 | CFStringEncodingIsValidCombiningCharacterProc isValidCombiningChar; 62 | } _CFEncodingConverter; 63 | 64 | typedef struct { 65 | uint32_t encoding; 66 | _CFEncodingConverter *converter; 67 | const char *encodingName; 68 | const char *ianaNames[MAX_IANA_ALIASES]; 69 | const char *loadablePath; 70 | CFStringEncodingBootstrapProc bootstrap; 71 | CFStringEncodingToBytesFallbackProc toBytesFallback; 72 | CFStringEncodingToUnicodeFallbackProc toUnicodeFallback; 73 | uint32_t scriptCode; 74 | } _CFConverterEntry; 75 | 76 | extern const CFStringEncodingConverter __CFConverterASCII; 77 | extern const CFStringEncodingConverter __CFConverterISOLatin1; 78 | extern const CFStringEncodingConverter __CFConverterMacRoman; 79 | extern const CFStringEncodingConverter __CFConverterWinLatin1; 80 | extern const CFStringEncodingConverter __CFConverterNextStepLatin; 81 | extern const CFStringEncodingConverter __CFConverterUTF8; 82 | 83 | 84 | #endif /* ! __COREFOUNDATION_CFSTRINGENCODINGCONVERTERPRIV__ */ 85 | 86 | -------------------------------------------------------------------------------- /CFTimeZone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFTimeZone.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFTIMEZONE__) 38 | #define __COREFOUNDATION_CFTIMEZONE__ 1 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | CF_EXTERN_C_BEGIN 48 | 49 | CF_EXPORT 50 | CFTypeID CFTimeZoneGetTypeID(void); 51 | 52 | CF_EXPORT 53 | CFTimeZoneRef CFTimeZoneCopySystem(void); 54 | 55 | CF_EXPORT 56 | void CFTimeZoneResetSystem(void); 57 | 58 | CF_EXPORT 59 | CFTimeZoneRef CFTimeZoneCopyDefault(void); 60 | 61 | CF_EXPORT 62 | void CFTimeZoneSetDefault(CFTimeZoneRef tz); 63 | 64 | CF_EXPORT 65 | CFArrayRef CFTimeZoneCopyKnownNames(void); 66 | 67 | CF_EXPORT 68 | CFDictionaryRef CFTimeZoneCopyAbbreviationDictionary(void); 69 | 70 | CF_EXPORT 71 | void CFTimeZoneSetAbbreviationDictionary(CFDictionaryRef dict); 72 | 73 | CF_EXPORT 74 | CFTimeZoneRef CFTimeZoneCreate(CFAllocatorRef allocator, CFStringRef name, CFDataRef data); 75 | 76 | CF_EXPORT 77 | CFTimeZoneRef CFTimeZoneCreateWithTimeIntervalFromGMT(CFAllocatorRef allocator, CFTimeInterval ti); 78 | 79 | CF_EXPORT 80 | CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef name, Boolean tryAbbrev); 81 | 82 | CF_EXPORT 83 | CFStringRef CFTimeZoneGetName(CFTimeZoneRef tz); 84 | 85 | CF_EXPORT 86 | CFDataRef CFTimeZoneGetData(CFTimeZoneRef tz); 87 | 88 | CF_EXPORT 89 | CFTimeInterval CFTimeZoneGetDSTOffset(CFTimeZoneRef tz, CFAbsoluteTime at); 90 | 91 | CF_EXPORT 92 | CFAbsoluteTime CFTimeZoneGetNextDSTSwitch(CFTimeZoneRef tz, CFAbsoluteTime at); 93 | 94 | CF_EXPORT 95 | CFTimeInterval CFTimeZoneGetSecondsFromGMT(CFTimeZoneRef tz, CFAbsoluteTime at); 96 | 97 | CF_EXPORT 98 | CFStringRef CFTimeZoneCopyAbbreviation(CFTimeZoneRef tz, CFAbsoluteTime at); 99 | 100 | CF_EXPORT 101 | Boolean CFTimeZoneIsDaylightSavingTime(CFTimeZoneRef tz, CFAbsoluteTime at); 102 | 103 | CF_EXPORT 104 | CFTimeInterval CFTimeZoneGetDaylightSavingTimeOffset(CFTimeZoneRef tz, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 105 | 106 | CF_EXPORT 107 | CFAbsoluteTime CFTimeZoneGetNextDaylightSavingTimeTransition(CFTimeZoneRef tz, CFAbsoluteTime at) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 108 | 109 | #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED 110 | enum { 111 | kCFTimeZoneNameStyleStandard, 112 | kCFTimeZoneNameStyleShortStandard, 113 | kCFTimeZoneNameStyleDaylightSaving, 114 | kCFTimeZoneNameStyleShortDaylightSaving 115 | }; 116 | typedef CFIndex CFTimeZoneNameStyle; 117 | 118 | CF_EXPORT 119 | CFStringRef CFTimeZoneCopyLocalizedName(CFTimeZoneRef tz, CFTimeZoneNameStyle style, CFLocaleRef locale) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 120 | #endif 121 | 122 | CF_EXPORT 123 | const CFStringRef kCFTimeZoneSystemTimeZoneDidChangeNotification AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 124 | 125 | CF_EXTERN_C_END 126 | 127 | #endif /* ! __COREFOUNDATION_CFTIMEZONE__ */ 128 | 129 | -------------------------------------------------------------------------------- /CFUUID.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFUUID.h 34 | Copyright (c) 1999-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFUUID__) 38 | #define __COREFOUNDATION_CFUUID__ 1 39 | 40 | #include 41 | #include 42 | 43 | CF_EXTERN_C_BEGIN 44 | 45 | typedef const struct __CFUUID * CFUUIDRef; 46 | 47 | typedef struct { 48 | UInt8 byte0; 49 | UInt8 byte1; 50 | UInt8 byte2; 51 | UInt8 byte3; 52 | UInt8 byte4; 53 | UInt8 byte5; 54 | UInt8 byte6; 55 | UInt8 byte7; 56 | UInt8 byte8; 57 | UInt8 byte9; 58 | UInt8 byte10; 59 | UInt8 byte11; 60 | UInt8 byte12; 61 | UInt8 byte13; 62 | UInt8 byte14; 63 | UInt8 byte15; 64 | } CFUUIDBytes; 65 | /* The CFUUIDBytes struct is a 128-bit struct that contains the 66 | raw UUID. A CFUUIDRef can provide such a struct from the 67 | CFUUIDGetUUIDBytes() function. This struct is suitable for 68 | passing to APIs that expect a raw UUID. 69 | */ 70 | 71 | CF_EXPORT 72 | CFTypeID CFUUIDGetTypeID(void); 73 | 74 | CF_EXPORT 75 | CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc); 76 | /* Create and return a brand new unique identifier */ 77 | 78 | CF_EXPORT 79 | 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); 80 | /* Create and return an identifier with the given contents. This may return an existing instance with its ref count bumped because of uniquing. */ 81 | 82 | CF_EXPORT 83 | CFUUIDRef CFUUIDCreateFromString(CFAllocatorRef alloc, CFStringRef uuidStr); 84 | /* Converts from a string representation to the UUID. This may return an existing instance with its ref count bumped because of uniquing. */ 85 | 86 | CF_EXPORT 87 | CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid); 88 | /* Converts from a UUID to its string representation. */ 89 | 90 | CF_EXPORT 91 | 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); 92 | /* This returns an immortal CFUUIDRef that should not be released. It can be used in headers to declare UUID constants with #define. */ 93 | 94 | CF_EXPORT 95 | CFUUIDBytes CFUUIDGetUUIDBytes(CFUUIDRef uuid); 96 | 97 | CF_EXPORT 98 | CFUUIDRef CFUUIDCreateFromUUIDBytes(CFAllocatorRef alloc, CFUUIDBytes bytes); 99 | 100 | CF_EXTERN_C_END 101 | 102 | #endif /* ! __COREFOUNDATION_CFUUID__ */ 103 | 104 | -------------------------------------------------------------------------------- /CFUniCharPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CFUniCharPriv.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_CFUNICHARPRIV__) 38 | #define __COREFOUNDATION_CFUNICHARPRIV__ 1 39 | 40 | #include 41 | #include 42 | 43 | #define kCFUniCharRecursiveDecompositionFlag (1 << 30) 44 | #define kCFUniCharNonBmpFlag (1 << 31) 45 | #define CFUniCharConvertCountToFlag(count) ((count & 0x1F) << 24) 46 | #define CFUniCharConvertFlagToCount(flag) ((flag >> 24) & 0x1F) 47 | 48 | enum { 49 | kCFUniCharCanonicalDecompMapping = (kCFUniCharCaseFold + 1), 50 | kCFUniCharCanonicalPrecompMapping, 51 | kCFUniCharCompatibilityDecompMapping 52 | }; 53 | 54 | CF_EXPORT const void *CFUniCharGetMappingData(uint32_t type); 55 | 56 | #endif /* ! __COREFOUNDATION_CFUNICHARPRIV__ */ 57 | 58 | -------------------------------------------------------------------------------- /CFUniCharPropertyDatabase.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/CFUniCharPropertyDatabase.data -------------------------------------------------------------------------------- /CFUnicodeData-B.mapping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/CFUnicodeData-B.mapping -------------------------------------------------------------------------------- /CFUnicodeData-L.mapping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/CFUnicodeData-L.mapping -------------------------------------------------------------------------------- /CFUnicodeDecomposition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* 34 | * CFUnicodeDecomposition.h 35 | * CoreFoundation 36 | * 37 | * Created by aki on Wed Oct 03 2001. 38 | * Copyright (c) 2001-2007, Apple Inc. All rights reserved. 39 | * 40 | */ 41 | 42 | #if !defined(__COREFOUNDATION_CFUNICODEDECOMPOSITION__) 43 | #define __COREFOUNDATION_CFUNICODEDECOMPOSITION__ 1 44 | 45 | #include 46 | 47 | CF_EXTERN_C_BEGIN 48 | 49 | CF_INLINE bool CFUniCharIsDecomposableCharacter(UTF32Char character, bool isHFSPlusCanonical) { 50 | if (isHFSPlusCanonical && !isHFSPlusCanonical) return false; // hack to get rid of "unused" warning 51 | if (character < 0x80) return false; 52 | return CFUniCharIsMemberOf(character, kCFUniCharHFSPlusDecomposableCharacterSet); 53 | } 54 | 55 | CF_EXPORT CFIndex CFUniCharDecomposeCharacter(UTF32Char character, UTF32Char *convertedChars, CFIndex maxBufferLength); 56 | CF_EXPORT CFIndex CFUniCharCompatibilityDecompose(UTF32Char *convertedChars, CFIndex length, CFIndex maxBufferLength); 57 | 58 | CF_EXPORT bool CFUniCharDecompose(const UTF16Char *src, CFIndex length, CFIndex *consumedLength, void *dst, CFIndex maxLength, CFIndex *filledLength, bool needToReorder, uint32_t dstFormat, bool isHFSPlus); 59 | 60 | CF_EXPORT void CFUniCharPrioritySort(UTF32Char *characters, CFIndex length); 61 | 62 | CF_EXTERN_C_END 63 | 64 | #endif /* ! __COREFOUNDATION_CFUNICODEDECOMPOSITION__ */ 65 | 66 | -------------------------------------------------------------------------------- /CFUnicodePrecomposition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* 34 | * CFUnicodePrecomposition.h 35 | * CoreFoundation 36 | * 37 | * Created by aki on Wed Oct 03 2001. 38 | * Copyright (c) 2001-2007, Apple Inc. All rights reserved. 39 | * 40 | */ 41 | 42 | #if !defined(__COREFOUNDATION_CFUNICODEPRECOMPOSITION__) 43 | #define __COREFOUNDATION_CFUNICODEPRECOMPOSITION__ 1 44 | 45 | #include 46 | 47 | CF_EXTERN_C_BEGIN 48 | 49 | // As you can see, this function cannot precompose Hangul Jamo 50 | CF_EXPORT UTF32Char CFUniCharPrecomposeCharacter(UTF32Char base, UTF32Char combining); 51 | 52 | CF_EXPORT bool CFUniCharPrecompose(const UTF16Char *characters, CFIndex length, CFIndex *consumedLength, UTF16Char *precomposed, CFIndex maxLength, CFIndex *filledLength); 53 | 54 | CF_EXTERN_C_END 55 | 56 | #endif /* ! __COREFOUNDATION_CFUNICODEPRECOMPOSITION__ */ 57 | 58 | -------------------------------------------------------------------------------- /CFVersion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation PROJECT:CoreFoundation-476.17 SYSTEM:Darwin DEVELOPER:unknown BUILT:" __DATE__ " " __TIME__ "\n"; 34 | const double kCFCoreFoundationVersionNumber = (double)476.17; 35 | -------------------------------------------------------------------------------- /CFWindowsMessageQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 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 | /* CFWindowsMessageQueue.h 24 | Copyright (c) 1999-2007, Apple Inc. All rights reserved. 25 | */ 26 | 27 | #if !defined(__COREFOUNDATION_CFWINDOWSMESSAGEQUEUE__) 28 | #define __COREFOUNDATION_CFWINDOWSMESSAGEQUEUE__ 1 29 | 30 | #if DEPLOYMENT_TARGET_WINDOWS 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | CF_EXTERN_C_BEGIN 38 | 39 | typedef struct __CFWindowsMessageQueue * CFWindowsMessageQueueRef; 40 | 41 | CF_EXPORT CFTypeID CFWindowsMessageQueueGetTypeID(void); 42 | 43 | CF_EXPORT CFWindowsMessageQueueRef CFWindowsMessageQueueCreate(CFAllocatorRef allocator, DWORD mask); 44 | 45 | CF_EXPORT DWORD CFWindowsMessageQueueGetMask(CFWindowsMessageQueueRef wmq); 46 | CF_EXPORT void CFWindowsMessageQueueInvalidate(CFWindowsMessageQueueRef wmq); 47 | CF_EXPORT Boolean CFWindowsMessageQueueIsValid(CFWindowsMessageQueueRef wmq); 48 | 49 | CF_EXPORT CFRunLoopSourceRef CFWindowsMessageQueueCreateRunLoopSource(CFAllocatorRef allocator, CFWindowsMessageQueueRef wmq, CFIndex order); 50 | 51 | CF_EXTERN_C_END 52 | 53 | #endif /* DEPLOYMENT_TARGET_WINDOWS */ 54 | 55 | #endif /* ! __COREFOUNDATION_CFWINDOWSMESSAGEQUEUE__ */ 56 | 57 | -------------------------------------------------------------------------------- /CHANGES: -------------------------------------------------------------------------------- 1 | Changes and What's New in OpenCFLite 2 | ------------------------------------ 3 | 4 | 2009-03-11 v476.17.2 5 | 6 | * Fixed run loop timer support for Linux. 7 | 8 | * Updated pre-compiled ICU to v4.0 for Windows builds. 9 | 10 | * Minor updates to CFRunLoopTimerExample and StringExample examples. 11 | 12 | * Merged in David Cotter's CF-Lite project, 13 | including his additional CFTest example. 14 | 15 | * Fixed support for writing binary property lists with patch from Stuart 16 | Crook . 17 | 18 | 2007-02-11 v476.17.1 19 | 20 | * Basic, development-level run loop support for Windows and Linux. 21 | 22 | * Ensure private globals are marked as such on non-Apple GCC 23 | compilers. 24 | 25 | * Added DisplayURL, DNSServiceMetaQuery, CFLocalServer and 26 | CFRunLoopTimer examples. 27 | 28 | * Added appropriate preprocessor checks for __powerpc__ to handle 29 | PowerPC compilers that emit that rather than __ppc__. 30 | 31 | * Windows and Mac OS X build clean-ups. 32 | 33 | * Improved Linux build configuration by respecting '--with' options 34 | in preference to the presence of -config and, in general, 35 | improved behavior in cross-compilation scenarios and in error 36 | cases. 37 | 38 | 2007-02-06 v476.17.0 39 | 40 | * Initial release for Windows and Linux 41 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Contributors 2 | ------------ 3 | March 2000: partial port to Linux by Pedro Ivo Tavares (ptavares@iname.com). 4 | This was mostly integrated by ckane@apple.com by CoreFoundation-5, 5 | but the style was changed, and the hand-crafted Makefile, which is 6 | new since this port, tries to take care of some of the things that 7 | are needed for Linux (and build a libCoreFoundation.a instead of a 8 | CoreFoundation.framework), but ckane does not have a Linux box and 9 | can't finish that and test building. 10 | 11 | December 2000: port to FreeBSD by Sarwat Khan (sarwat@sarwat.net). 12 | Port to FreeBSD, except for RunLoop.subproj items. Integrated by 13 | ckane@apple.com into CoreFoundation-8. ckane also marginally 14 | improved the Linux port in that version. 15 | 16 | March 2001: CoreFoundation-9, corresponding to CoreFoundation-197 in 17 | Mac OS X, synchronizes Darwin CF with Mac OS X's released CF. 18 | 19 | May 2001: CoreFoundation-10, corresponding to CoreFoundation-206.5 20 | synchronizes Darwin CF with TOT CoreFoundation. 21 | 22 | June 2001: Linux port maintenance by Robert Thompson . 23 | 24 | July 2001: Integrated addition of headerdoc for CFBinaryHeap.h from 25 | Kevin Van Vechten . 26 | 27 | Sept 2001: CoreFoundation-14, sync with Mac OS X 10.1 28 | 29 | Oct 2001: More header doc (e.g., CFSet.h) and some CFTree implementation 30 | from Kevin Van Vechten . 31 | 32 | Jan 2002: Windows(TM) port changes from Kevin Van Vechten . 33 | 34 | Feb 2002: Some Windows(TM) port changes from Aleskey Dukhnyakov, Andrew Dzubandovsky, 35 | Roman Mukhin, and Sergey Zubarev; Orc Software 36 | 37 | ... years of work ... 38 | 39 | JAN 2009: Windows(TM) port changes from Brent Fulgham. Linux port changes 40 | from Grant Erickson. 41 | -------------------------------------------------------------------------------- /Cocotron/Cocotron.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #if DEPLOYMENT_TARGET_LINUX 7 | #include 8 | #endif 9 | 10 | typedef void* SEL; 11 | typedef void* id; 12 | 13 | SEL (*__CFGetObjCSelector)(const char *)=0; 14 | void* (*__CFGetObjCClass)(const char *)=0; 15 | extern void* (*__CFSendObjCMsg)(const void*, SEL, ...); 16 | 17 | static void __attribute__((constructor)) InitializeFoundation() { 18 | static void* hFoundation=0; 19 | #if defined(__WIN32__) 20 | if(!hFoundation) { 21 | hFoundation=LoadLibrary("Foundation.1.0.dll"); 22 | 23 | __CFGetObjCSelector=GetProcAddress(hFoundation, "sel_registerName"); 24 | __CFSendObjCMsg=GetProcAddress(hFoundation, "objc_msgSend"); 25 | __CFGetObjCClass=GetProcAddress(hFoundation, "objc_getClass"); 26 | } 27 | #endif 28 | } 29 | 30 | void* __CFISAForTypeID(CFTypeID typeid) { 31 | if(!__CFGetObjCClass) 32 | return 0; 33 | 34 | const CFRuntimeClass *cls = _CFRuntimeGetClassWithTypeID(typeid); 35 | char *name=alloca(strlen(cls->className)+3); 36 | 37 | // build e.g. "NSCFArray" from CFArray 38 | strcpy(name, "NS"); 39 | strcat(name, cls->className); 40 | 41 | void* ret = __CFGetObjCClass(name); 42 | 43 | if(!ret) 44 | ret=__CFGetObjCClass("NSCFType"); 45 | return ret; 46 | } 47 | -------------------------------------------------------------------------------- /CoreFoundation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* CoreFoundation.h 34 | Copyright (c) 1998-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(__COREFOUNDATION_COREFOUNDATION__) 38 | #define __COREFOUNDATION_COREFOUNDATION__ 1 39 | #define __COREFOUNDATION__ 1 40 | 41 | #ifdef WIN32 42 | // Must include this first, or redeclaration problems. 43 | #include 44 | #endif 45 | 46 | #if !defined(CF_EXCLUDE_CSTD_HEADERS) 47 | 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | 65 | #if defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__) 66 | 67 | #include 68 | #include 69 | #include 70 | 71 | #endif 72 | 73 | #endif 74 | 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 | #include 94 | #include 95 | #include 96 | #include 97 | #include 98 | #include 99 | #include 100 | #include 101 | #include 102 | #include 103 | #include 104 | #include 105 | #include 106 | #include 107 | #include 108 | #include 109 | #include 110 | #include 111 | 112 | 113 | #endif /* ! __COREFOUNDATION_COREFOUNDATION__ */ 114 | 115 | -------------------------------------------------------------------------------- /CoreFoundation.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | datarootdir=@datarootdir@ 5 | datadir=@datadir@ 6 | includedir=@includedir@ 7 | 8 | Name: @PACKAGE_NAME@ 9 | Version: @PACKAGE_VERSION@ 10 | Description: A portable version of Apple's Mac OS X CoreFoundation library. 11 | URL: http://opencflite.sourceforge.net/ 12 | Requires: icu >= 3.6, uuid 13 | Cflags: -I${includedir} 14 | Libs: -L${libdir} -lCoreFoundation 15 | Libs.private: @LIBS@ 16 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en_US 7 | CFBundleExecutable 8 | CFLite 9 | CFBundleIdentifier 10 | com.apple.CFLite 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | CFLite 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 6.5 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 476.17 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 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is the public Open Source distribution of Apple, Inc.'s 2 | CoreFoundation framework, sometimes known as "CF-lite" 3 | because it does not contain every facility available from the 4 | CoreFoundation framework in Mac OS X. This distribution is 5 | refered to as Open CF-lite to distinguish it from the official 6 | Apple release, and to reflect the Open Source nature of this 7 | project. 8 | 9 | This CoreFoundation corresponds to the Mac OS X 10.5.6 version 10 | of CF (CF-476.17) 11 | 12 | This distribution differs from the official Apple, Inc. release 13 | in that it is known to build and run on Mac OS X, Windows, and 14 | Linux. It would probably be trivial to port to most other 15 | POSIX-based environments (volunteers welcome!) 16 | 17 | The goal of this port is to provide a feature-compatible, cross 18 | platform version of the official CoreFoundation framework. In 19 | general, we do not propose extending functionality beyond the 20 | official Apple release so that this project can serve as a 21 | drop-in replacement. 22 | 23 | To repeat Apple's statement: 24 | 25 | --- What Apple is NOT interested in, with CF-lite: 26 | * Everybody's little convenience methods. Just because 27 | "everybody has to write their own", it does not 28 | follow immediately that it is a good idea to add it 29 | to the system libraries. It is not a goal of CF to 30 | be a "Swiss Army Knife"; that just increases the 31 | size of the binaries, and the documentation and 32 | maintenance burden. Functions to reverse a string 33 | or merge two arrays by taking alternate elements 34 | from the two arrays are not compelling. 35 | 36 | The current release is known to work on Windows at a sufficient 37 | level to run the WebKit infrastructure. 38 | 39 | Support is available from the discussion groups at http://opencflite.sf.net. 40 | 41 | Enjoy! 42 | 43 | Brent Fulgham 44 | Grant Erickson 45 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | --- Open CF-lite to-do list: 2 | * CFRunLoop tests and implementation for Windows and Linux. 3 | * Better examples 4 | * List of projects using Open CF-lite. 5 | 6 | --- Original CF-lite to-do list: 7 | [Note: when it says "Apple has code" below, that usually 8 | means "Apple has some code it could provide to start an 9 | effort here", not "Apple has some code in the pipe, don't 10 | bother with this item". Anyone known to be doing work on 11 | any of these items will be listed here, including Apple.] 12 | * Some classes have a fair number of assertions, nearly all 13 | related to parameter checking. More assertions are needed 14 | nearly everywhere. The assertions that are there have been 15 | often found to be valuable -- you just get a message about 16 | some bad parameter and there's the bug. 17 | * More header doc is needed. CFArray.h and CFDictionary.h 18 | are models. 19 | * An exception model, similar to Cocoa Foundation's. Apple 20 | has some code for this already, and try/catch model like 21 | C++ is simple enough to support; finally blocks a la Java 22 | don't seem to be practical within the confines of ANSI C. 23 | * A CFFileDescriptor is needed which can act as a run loop 24 | source. Or maybe it should be CFPipeDescriptor. This is 25 | NOT something for general file handling -- just monitoring 26 | a file descriptor which is a pipe (for which there are 27 | notifications or other async activity). 28 | 29 | -------------------------------------------------------------------------------- /XCode_Configs/ConfigDebug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Config_Master.xcconfig" 2 | 3 | //ARCHS = ppc64 x86_64 4 | 5 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 6 | GCC_DEBUGGING_SYMBOLS = default 7 | GCC_OPTIMIZATION_LEVEL = 0 8 | GCC_PREPROCESSOR_DEFINITIONS = OSMac_=1 OSWin_=0 DEPLOYMENT_TARGET_MACOSX=1 CF_BUILDING_CF=1 Debug_=1 DEBUG=1 _DEBUG=1 __STDC_LIMIT_MACROS=1 9 | -------------------------------------------------------------------------------- /XCode_Configs/ConfigRelease.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Config_Master.xcconfig" 2 | 3 | //ARCHS = ppc i386 4 | ARCHS = $(ARCHS_STANDARD_32_64_BIT) 5 | 6 | DEPLOYMENT_POSTPROCESSING = YES 7 | STRIP_INSTALLED_PRODUCT = YES 8 | STRIP_STYLE = debugging 9 | COPY_PHASE_STRIP = YES 10 | 11 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 12 | GCC_DEBUGGING_SYMBOLS = default 13 | GCC_OPTIMIZATION_LEVEL = s 14 | 15 | GCC_WARN_UNINITIALIZED_AUTOS = YES 16 | GCC_PREPROCESSOR_DEFINITIONS = OSMac_=1 OSWin_=0 DEPLOYMENT_TARGET_MACOSX=1 CF_BUILDING_CF=1 __STDC_LIMIT_MACROS=1 17 | -------------------------------------------------------------------------------- /XCode_Configs/Config_Master.xcconfig: -------------------------------------------------------------------------------- 1 | 2 | ARCHS = $(NATIVE_ARCH) 3 | VALID_ARCHS = ppc64 ppc7400 ppc970 i386 x86_64 ppc 4 | 5 | //SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk 6 | SDKROOT = /Developer/SDKs/MacOSX10.5.sdk 7 | MACOSX_DEPLOYMENT_TARGET = 10.5 8 | 9 | //ALWAYS_SEARCH_USER_PATHS = YES 10 | PREBINDING = NO 11 | ZERO_LINK = NO 12 | GCC_ENABLE_FIX_AND_CONTINUE = NO 13 | 14 | INFOPLIST_PREPROCESS = YES 15 | DEPLOYMENT_POSTPROCESSING = NO 16 | 17 | SKIP_INSTALL = YES 18 | STRIP_INSTALLED_PRODUCT = NO 19 | STRIP_STYLE = debugging 20 | COPY_PHASE_STRIP = NO 21 | DEAD_CODE_STRIPPING = NO 22 | 23 | DEBUG_INFORMATION_FORMAT = dwarf 24 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 25 | GCC_DEBUGGING_SYMBOLS = default 26 | GCC_OPTIMIZATION_LEVEL = 0 27 | 28 | GCC_PRECOMPILE_PREFIX_HEADER = YES 29 | 30 | // Compile as Obj-C++ 31 | GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp 32 | 33 | GCC_SHORT_ENUMS = NO 34 | //GCC_ONE_BYTE_BOOL = NO 35 | GCC_ENABLE_PASCAL_STRINGS = YES 36 | GCC_REUSE_STRINGS = YES 37 | 38 | // REQUIRED for C++ symbol exporting 39 | GCC_SYMBOLS_PRIVATE_EXTERN = NO 40 | GCC_ENABLE_CPP_RTTI = YES 41 | GCC_ENABLE_CPP_EXCEPTIONS = YES 42 | 43 | GCC_THREADSAFE_STATICS = YES 44 | 45 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES 46 | GCC_WARN_ABOUT_RETURN_TYPE = YES 47 | GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES 48 | GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO 49 | GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES 50 | GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES 51 | GCC_WARN_MISSING_PARENTHESES = YES 52 | GCC_WARN_CHECK_SWITCH_STATEMENTS = YES 53 | GCC_WARN_UNUSED_VARIABLE = YES 54 | GCC_WARN_UNUSED_VALUE = YES 55 | GCC_WARN_UNINITIALIZED_AUTOS = NO 56 | GCC_WARN_SHADOW = YES 57 | GCC_WARN_SIGN_COMPARE = YES 58 | GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES 59 | GCC_WARN_UNKNOWN_PRAGMAS = YES 60 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO 61 | 62 | LINKER_DISPLAYS_FILES_FOR_UNDEFINED_SYMBOLS = YES 63 | 64 | UNICODE_DATA_FILE[arch=i386] = CFUnicodeData-L.mapping 65 | UNICODE_DATA_FILE[arch=x86_64] = CFUnicodeData-L.mapping 66 | UNICODE_DATA_FILE[arch=ppc] = CFUnicodeData-B.mapping 67 | UNICODE_DATA_FILE[arch=ppc64] = CFUnicodeData-B.mapping 68 | 69 | GCC_PREPROCESSOR_DEFINITIONS = OSMac_=1 OSWin_=0 -------------------------------------------------------------------------------- /auto_stubs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham . All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | * Copyright (c) 2008 Apple Inc. All rights reserved. 13 | * 14 | * @APPLE_LICENSE_HEADER_START@ 15 | * 16 | * This file contains Original Code and/or Modifications of Original Code 17 | * as defined in and that are subject to the Apple Public Source License 18 | * Version 2.0 (the 'License'). You may not use this file except in 19 | * compliance with the License. Please obtain a copy of the License at 20 | * http://www.opensource.apple.com/apsl/ and read it before using this 21 | * file. 22 | * 23 | * The Original Code and all software distributed under the License are 24 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 25 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 28 | * Please see the License for the specific language governing rights and 29 | * limitations under the License. 30 | * 31 | * @APPLE_LICENSE_HEADER_END@ 32 | */ 33 | /* auto_stubs.h 34 | Copyright 2005-2007, Apple Inc. All rights reserved. 35 | */ 36 | 37 | #if !defined(AUTO_STUBS_H) 38 | #define AUTO_STUBS_H 1 39 | 40 | #include 41 | #include 42 | #include 43 | #if DEPLOYMENT_TARGET_MACOSX 44 | #include 45 | #endif 46 | 47 | #if defined(__GCC__) 48 | #include 49 | #endif 50 | 51 | /* Stubs for functions in libauto. */ 52 | 53 | #if !DEPLOYMENT_TARGET_MACOSX 54 | typedef unsigned long malloc_zone_t; 55 | typedef unsigned char boolean_t; 56 | #endif 57 | 58 | typedef malloc_zone_t auto_zone_t; 59 | 60 | enum { AUTO_TYPE_UNKNOWN = -1, AUTO_UNSCANNED = 1, AUTO_OBJECT = 2, AUTO_MEMORY_SCANNED = 0, AUTO_MEMORY_UNSCANNED = AUTO_UNSCANNED, AUTO_OBJECT_SCANNED = AUTO_OBJECT, AUTO_OBJECT_UNSCANNED = AUTO_OBJECT | AUTO_UNSCANNED }; 61 | typedef unsigned long auto_memory_type_t; 62 | 63 | CF_INLINE void *auto_zone(void) { return 0; } 64 | CF_INLINE void *auto_zone_allocate_object(void *zone, size_t size, auto_memory_type_t type, boolean_t rc, boolean_t clear) { return 0; } 65 | CF_INLINE const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; } 66 | CF_INLINE void auto_zone_retain(void *zone, void *ptr) {} 67 | CF_INLINE unsigned int auto_zone_release(void *zone, void *ptr) { return 0; } 68 | CF_INLINE unsigned int auto_zone_retain_count(void *zone, const void *ptr) { return 0; } 69 | CF_INLINE void auto_zone_set_layout_type(void *zone, void *ptr, auto_memory_type_t type) {} 70 | CF_INLINE void auto_zone_write_barrier_range(void *zone, void *address, size_t size) {} 71 | CF_INLINE boolean_t auto_zone_is_finalized(void *zone, const void *ptr) { return 0; } 72 | CF_INLINE size_t auto_zone_size(void *zone, const void *ptr) { return 0; } 73 | CF_INLINE void auto_register_weak_reference(void *zone, const void *referent, void **referrer, uintptr_t *counter, void **listHead, void **listElement) {} 74 | CF_INLINE void auto_unregister_weak_reference(void *zone, const void *referent, void **referrer) {} 75 | CF_INLINE void auto_zone_register_thread(void *zone) {} 76 | CF_INLINE void auto_zone_unregister_thread(void *zone) {} 77 | CF_INLINE boolean_t auto_zone_is_valid_pointer(void *zone, const void *ptr) { return 0; } 78 | CF_INLINE auto_memory_type_t auto_zone_get_layout_type(auto_zone_t *zone, void *ptr) { return AUTO_UNSCANNED; } 79 | 80 | #if defined(__OBJC__) 81 | CF_INLINE void objc_collect_if_needed(unsigned long options) {} 82 | CF_INLINE Boolean objc_collecting_enabled(void) { return 0; } 83 | CF_INLINE id objc_allocate_object(Class cls, int extra) { return 0; } 84 | CF_INLINE id objc_assign_strongCast(id val, id *dest) { return (*dest = val); } 85 | CF_INLINE id objc_assign_global(id val, id *dest) { return (*dest = val); } 86 | CF_INLINE id objc_assign_ivar(id val, id dest, unsigned int offset) { id *d = (id *)((char *)dest + offset); return (*d = val); } 87 | CF_INLINE void *objc_memmove_collectable(void *dst, const void *src, size_t size) { return memmove(dst, src, size); } 88 | CF_INLINE Boolean objc_is_finalized(void *ptr) { return 0; } 89 | #endif 90 | 91 | #endif /* ! AUTO_STUBS_H */ 92 | 93 | -------------------------------------------------------------------------------- /compat/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libcompat.la 2 | 3 | EXTRA_DIST = dirent.h dirent.c 4 | 5 | libcompat_la_SOURCES = 6 | libcompat_la_LIBADD = @LTLIBOBJS@ 7 | -------------------------------------------------------------------------------- /compat/dirent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The Windows directory handling logic is courtesy of the FreeBSD shttpd sources. 3 | */ 4 | /* 5 | * Copyright (c) 2004-2005 Sergey Lyubka 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included 15 | * in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include "dirent.h" 33 | 34 | DIR* opendir (const char *name) 35 | { 36 | DIR* dir = NULL; 37 | size_t base_length; 38 | const char* all; 39 | 40 | if (name && name[0]) { 41 | base_length = strlen(name); 42 | all = strchr("/\\", name[base_length - 1]) ? "*" : "/*"; 43 | 44 | if ((dir = (DIR*)malloc(sizeof *dir)) != NULL && 45 | (dir->name = (char*)malloc(base_length + strlen(all) + 1)) != 0) { 46 | (void) strcat(strcpy(dir->name, name), all); 47 | 48 | if ((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1) { 49 | dir->result.d_name = 0; 50 | } else { 51 | free(dir->name); 52 | free(dir); 53 | dir = 0; 54 | } 55 | } else { 56 | free(dir); 57 | dir = NULL; 58 | errno = ENOMEM; 59 | } 60 | } else { 61 | errno = EINVAL; 62 | } 63 | 64 | return (dir); 65 | } 66 | 67 | int closedir (DIR* dir) 68 | { 69 | int result = -1; 70 | 71 | if (dir) { 72 | if(dir->handle != -1) 73 | result = _findclose(dir->handle); 74 | 75 | free(dir->name); 76 | free(dir); 77 | } 78 | 79 | if (result == -1) 80 | errno = EBADF; 81 | 82 | return (result); 83 | } 84 | 85 | struct dirent* readdir (DIR *dir) 86 | { 87 | struct dirent* result = 0; 88 | 89 | if (dir && dir->handle != -1) { 90 | if (!dir->result.d_name || 91 | _findnext(dir->handle, &dir->info) != -1) { 92 | result = &dir->result; 93 | result->d_name = dir->info.name; 94 | result->d_fileno = 1; // Not real! 95 | 96 | if (dir->info.attrib & FILE_ATTRIBUTE_DIRECTORY) 97 | result->d_type = DT_DIR; 98 | else 99 | result->d_type = DT_UNKNOWN; 100 | } 101 | } else { 102 | errno = EBADF; 103 | } 104 | 105 | return (result); 106 | } 107 | -------------------------------------------------------------------------------- /compat/dirent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Windows directory handling logic is courtesy of the FreeBSD shttpd sources. 3 | */ 4 | /* 5 | * Copyright (c) 2004-2005 Sergey Lyubka 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included 15 | * in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #if !defined(__COREFOUNDATION_WINDOWS_DIRENT__) 27 | #define __COREFOUNDATION_WINDOWS_DIRENT__ 1 28 | 29 | #if defined(__cplusplus) 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | /* POSIX dirent interface */ 40 | struct dirent { 41 | char* d_name; 42 | uint8_t d_type; 43 | long d_fileno; 44 | }; 45 | 46 | typedef struct DIR { 47 | long handle; 48 | struct _finddata_t info; 49 | struct dirent result; 50 | char* name; 51 | } DIR; 52 | 53 | extern DIR* opendir (const char* name); 54 | extern struct dirent* readdir (DIR* dir); 55 | extern int closedir (DIR* dir); 56 | 57 | #define DT_UNKNOWN 0 58 | #define DT_DIR 4 59 | 60 | #if defined(__cplusplus) 61 | } 62 | #endif 63 | 64 | #endif /* __COREFOUNDATION_WINDOWS_DIRENT__ */ 65 | -------------------------------------------------------------------------------- /compat/flsl.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 4. Neither the name of the University nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | /* 31 | * Find Last Set bit 32 | */ 33 | extern int flsl(long mask) 34 | { 35 | int bit; 36 | 37 | if (mask == 0) 38 | return (0); 39 | for (bit = 1; mask != 1; bit++) 40 | mask = (unsigned long)mask >> 1; 41 | return (bit); 42 | } 43 | -------------------------------------------------------------------------------- /compat/gettimeofday.c: -------------------------------------------------------------------------------- 1 | #if !defined(__GNUC__) 2 | /* ///////////////////////////////////////////////////////////////////////////// 3 | * File: time.c 4 | * 5 | * Purpose: gettimeofday() for the Win32 platform. 6 | * 7 | * Created: 1st November 2003 8 | * Updated: 22nd April 2008 9 | * 10 | * Home: http://synesis.com.au/software/ 11 | * 12 | * Copyright (c) 2003-2008, Matthew Wilson and Synesis Software 13 | * All rights reserved. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions are met: 17 | * 18 | * - Redistributions of source code must retain the above copyright notice, this 19 | * list of conditions and the following disclaimer. 20 | * - Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * - Neither the names of Matthew Wilson and Synesis Software nor the names of 24 | * any contributors may be used to endorse or promote products derived from 25 | * this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 31 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 | * POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | * ////////////////////////////////////////////////////////////////////////// */ 40 | 41 | 42 | #ifndef UNIXEM_DOCUMENTATION_SKIP_SECTION 43 | # define _SYNSOFT_VER_C_TIME_MAJOR 2 44 | # define _SYNSOFT_VER_C_TIME_MINOR 0 45 | # define _SYNSOFT_VER_C_TIME_REVISION 8 46 | # define _SYNSOFT_VER_C_TIME_EDIT 20 47 | #endif /* !UNIXEM_DOCUMENTATION_SKIP_SECTION */ 48 | 49 | /* ///////////////////////////////////////////////////////////////////////////// 50 | * Includes 51 | */ 52 | 53 | /* If we're going to include 'windows.h', then it has to be included first, so 54 | * as to put off the defintion of timeval in sys/time.h. Regrettably, the 55 | * WinSock header defines it without any conception of sys/time.h. Thanks MS! 56 | */ 57 | #ifndef __MWERKS__ 58 | # include 59 | #endif /* !__MWERKS__ */ 60 | 61 | #if defined(_MSC_VER) 62 | #include 63 | #else 64 | #include 65 | #endif 66 | 67 | struct timezone; 68 | 69 | #include 70 | 71 | /* ///////////////////////////////////////////////////////////////////////////// 72 | * Helper functions 73 | */ 74 | 75 | /** This function is from the STLSoft libraries */ 76 | extern long FILETIMEToUNIXTime(FILETIME const *ft, long *microseconds) 77 | { 78 | #if defined(__COMO__) 79 | long long i; 80 | #else /* ? compiler */ 81 | LONGLONG i; 82 | #endif /* compiler */ 83 | 84 | i = ft->dwHighDateTime; 85 | i <<= 32; 86 | i |= ft->dwLowDateTime; 87 | 88 | #if ( ( defined(__BORLANDC__) && \ 89 | __BORLANDC__ >= 0x0582) || \ 90 | defined(__DMC__) || \ 91 | defined(__COMO__) || \ 92 | defined(__GNUC__) || \ 93 | defined(__MWERKS__)) 94 | i -= 116444736000000000LL; 95 | #else 96 | i -= 116444736000000000L; 97 | #endif /* compiler */ 98 | if(NULL != microseconds) 99 | { 100 | *microseconds = (long)((i % 10000000) / 10); 101 | } 102 | i /= 10000000; 103 | 104 | return (long)i; 105 | } 106 | 107 | /* ///////////////////////////////////////////////////////////////////////////// 108 | * API functions 109 | */ 110 | 111 | void gettimeofday(struct timeval *tv, void *dummy) 112 | { 113 | SYSTEMTIME st; 114 | FILETIME ft; 115 | 116 | ((void)dummy); 117 | 118 | GetSystemTime(&st); 119 | (void)SystemTimeToFileTime(&st, &ft); 120 | 121 | tv->tv_sec = FILETIMEToUNIXTime(&ft, &tv->tv_usec); 122 | } 123 | 124 | /* ////////////////////////////////////////////////////////////////////////// */ 125 | #endif 126 | -------------------------------------------------------------------------------- /compat/strlcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998 Todd C. Miller 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /* 21 | * Appends src to string dst of size siz (unlike strncat, siz is the 22 | * full size of dst, not space left). At most siz-1 characters 23 | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 24 | * Returns strlen(src) + MIN(siz, strlen(initial dst)). 25 | * If retval >= siz, truncation occurred. 26 | */ 27 | size_t strlcat(char *dst, const char *src, size_t siz) 28 | { 29 | char *d = dst; 30 | const char *s = src; 31 | size_t n = siz; 32 | size_t dlen; 33 | 34 | /* Find the end of dst and adjust bytes left but don't go past end */ 35 | while (n-- != 0 && *d != '\0') 36 | d++; 37 | dlen = d - dst; 38 | n = siz - dlen; 39 | 40 | if (n == 0) 41 | return(dlen + strlen(s)); 42 | while (*s != '\0') { 43 | if (n != 1) { 44 | *d++ = *s; 45 | n--; 46 | } 47 | s++; 48 | } 49 | *d = '\0'; 50 | 51 | return(dlen + (s - src)); /* count does not include NUL */ 52 | } 53 | 54 | -------------------------------------------------------------------------------- /compat/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1998 Todd C. Miller 5 | * 6 | * Permission to use, copy, modify, and distribute this software for any 7 | * purpose with or without fee is hereby granted, provided that the above 8 | * copyright notice and this permission notice appear in all copies. 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | /* 23 | * Copy src to string dst of size siz. At most siz-1 characters 24 | * will be copied. Always NUL terminates (unless siz == 0). 25 | * Returns strlen(src); if retval >= siz, truncation occurred. 26 | */ 27 | size_t strlcpy(char *dst, const char *src, size_t siz) 28 | { 29 | char *d = dst; 30 | const char *s = src; 31 | size_t n = siz; 32 | 33 | /* Copy as many bytes as will fit */ 34 | if (n != 0) { 35 | while (--n != 0) { 36 | if ((*d++ = *s++) == '\0') 37 | break; 38 | } 39 | } 40 | 41 | /* Not enough room in dst, add NUL and traverse rest of src */ 42 | if (n == 0) { 43 | if (siz != 0) 44 | *d = '\0'; /* NUL-terminate dst */ 45 | while (*s++) 46 | ; 47 | } 48 | 49 | return(s - src - 1); /* count does not include NUL */ 50 | } 51 | -------------------------------------------------------------------------------- /config/compile: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Wrapper for compilers which do not understand `-c -o'. 3 | 4 | scriptversion=2005-05-14.22 5 | 6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 7 | # Written by Tom Tromey . 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | # This file is maintained in Automake, please report 29 | # bugs to or send patches to 30 | # . 31 | 32 | case $1 in 33 | '') 34 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 35 | exit 1; 36 | ;; 37 | -h | --h*) 38 | cat <<\EOF 39 | Usage: compile [--help] [--version] PROGRAM [ARGS] 40 | 41 | Wrapper for compilers which do not understand `-c -o'. 42 | Remove `-o dest.o' from ARGS, run PROGRAM with the remaining 43 | arguments, and rename the output as expected. 44 | 45 | If you are trying to build a whole package this is not the 46 | right script to run: please start by reading the file `INSTALL'. 47 | 48 | Report bugs to . 49 | EOF 50 | exit $? 51 | ;; 52 | -v | --v*) 53 | echo "compile $scriptversion" 54 | exit $? 55 | ;; 56 | esac 57 | 58 | ofile= 59 | cfile= 60 | eat= 61 | 62 | for arg 63 | do 64 | if test -n "$eat"; then 65 | eat= 66 | else 67 | case $1 in 68 | -o) 69 | # configure might choose to run compile as `compile cc -o foo foo.c'. 70 | # So we strip `-o arg' only if arg is an object. 71 | eat=1 72 | case $2 in 73 | *.o | *.obj) 74 | ofile=$2 75 | ;; 76 | *) 77 | set x "$@" -o "$2" 78 | shift 79 | ;; 80 | esac 81 | ;; 82 | *.c) 83 | cfile=$1 84 | set x "$@" "$1" 85 | shift 86 | ;; 87 | *) 88 | set x "$@" "$1" 89 | shift 90 | ;; 91 | esac 92 | fi 93 | shift 94 | done 95 | 96 | if test -z "$ofile" || test -z "$cfile"; then 97 | # If no `-o' option was seen then we might have been invoked from a 98 | # pattern rule where we don't need one. That is ok -- this is a 99 | # normal compilation that the losing compiler can handle. If no 100 | # `.c' file was seen then we are probably linking. That is also 101 | # ok. 102 | exec "$@" 103 | fi 104 | 105 | # Name of file we expect compiler to create. 106 | cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` 107 | 108 | # Create the lock directory. 109 | # Note: use `[/.-]' here to ensure that we don't use the same name 110 | # that we are using for the .o file. Also, base the name on the expected 111 | # object file name, since that is what matters with a parallel build. 112 | lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d 113 | while true; do 114 | if mkdir "$lockdir" >/dev/null 2>&1; then 115 | break 116 | fi 117 | sleep 1 118 | done 119 | # FIXME: race condition here if user kills between mkdir and trap. 120 | trap "rmdir '$lockdir'; exit 1" 1 2 15 121 | 122 | # Run the compile. 123 | "$@" 124 | ret=$? 125 | 126 | if test -f "$cofile"; then 127 | mv "$cofile" "$ofile" 128 | elif test -f "${cofile}bj"; then 129 | mv "${cofile}bj" "$ofile" 130 | fi 131 | 132 | rmdir "$lockdir" 133 | exit $ret 134 | 135 | # Local Variables: 136 | # mode: shell-script 137 | # sh-indentation: 2 138 | # eval: (add-hook 'write-file-hooks 'time-stamp) 139 | # time-stamp-start: "scriptversion=" 140 | # time-stamp-format: "%:y-%02m-%02d.%02H" 141 | # time-stamp-end: "$" 142 | # End: 143 | -------------------------------------------------------------------------------- /config/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2006-05-11.19 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | nl=' 15 | ' 16 | IFS=" "" $nl" 17 | errstatus=0 18 | dirmode= 19 | 20 | usage="\ 21 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 22 | 23 | Create each directory DIR (with mode MODE, if specified), including all 24 | leading file name components. 25 | 26 | Report bugs to ." 27 | 28 | # process command line arguments 29 | while test $# -gt 0 ; do 30 | case $1 in 31 | -h | --help | --h*) # -h for help 32 | echo "$usage" 33 | exit $? 34 | ;; 35 | -m) # -m PERM arg 36 | shift 37 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 38 | dirmode=$1 39 | shift 40 | ;; 41 | --version) 42 | echo "$0 $scriptversion" 43 | exit $? 44 | ;; 45 | --) # stop option processing 46 | shift 47 | break 48 | ;; 49 | -*) # unknown option 50 | echo "$usage" 1>&2 51 | exit 1 52 | ;; 53 | *) # first non-opt arg 54 | break 55 | ;; 56 | esac 57 | done 58 | 59 | for file 60 | do 61 | if test -d "$file"; then 62 | shift 63 | else 64 | break 65 | fi 66 | done 67 | 68 | case $# in 69 | 0) exit 0 ;; 70 | esac 71 | 72 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 73 | # mkdir -p a/c at the same time, both will detect that a is missing, 74 | # one will create a, then the other will try to create a and die with 75 | # a "File exists" error. This is a problem when calling mkinstalldirs 76 | # from a parallel make. We use --version in the probe to restrict 77 | # ourselves to GNU mkdir, which is thread-safe. 78 | case $dirmode in 79 | '') 80 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 81 | echo "mkdir -p -- $*" 82 | exec mkdir -p -- "$@" 83 | else 84 | # On NextStep and OpenStep, the `mkdir' command does not 85 | # recognize any option. It will interpret all options as 86 | # directories to create, and then abort because `.' already 87 | # exists. 88 | test -d ./-p && rmdir ./-p 89 | test -d ./--version && rmdir ./--version 90 | fi 91 | ;; 92 | *) 93 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 94 | test ! -d ./--version; then 95 | echo "mkdir -m $dirmode -p -- $*" 96 | exec mkdir -m "$dirmode" -p -- "$@" 97 | else 98 | # Clean up after NextStep and OpenStep mkdir. 99 | for d in ./-m ./-p ./--version "./$dirmode"; 100 | do 101 | test -d $d && rmdir $d 102 | done 103 | fi 104 | ;; 105 | esac 106 | 107 | for file 108 | do 109 | case $file in 110 | /*) pathcomp=/ ;; 111 | *) pathcomp= ;; 112 | esac 113 | oIFS=$IFS 114 | IFS=/ 115 | set fnord $file 116 | shift 117 | IFS=$oIFS 118 | 119 | for d 120 | do 121 | test "x$d" = x && continue 122 | 123 | pathcomp=$pathcomp$d 124 | case $pathcomp in 125 | -*) pathcomp=./$pathcomp ;; 126 | esac 127 | 128 | if test ! -d "$pathcomp"; then 129 | echo "mkdir $pathcomp" 130 | 131 | mkdir "$pathcomp" || lasterr=$? 132 | 133 | if test ! -d "$pathcomp"; then 134 | errstatus=$lasterr 135 | else 136 | if test ! -z "$dirmode"; then 137 | echo "chmod $dirmode $pathcomp" 138 | lasterr= 139 | chmod "$dirmode" "$pathcomp" || lasterr=$? 140 | 141 | if test ! -z "$lasterr"; then 142 | errstatus=$lasterr 143 | fi 144 | fi 145 | fi 146 | fi 147 | 148 | pathcomp=$pathcomp/ 149 | done 150 | done 151 | 152 | exit $errstatus 153 | 154 | # Local Variables: 155 | # mode: shell-script 156 | # sh-indentation: 2 157 | # eval: (add-hook 'write-file-hooks 'time-stamp) 158 | # time-stamp-start: "scriptversion=" 159 | # time-stamp-format: "%:y-%02m-%02d.%02H" 160 | # time-stamp-end: "$" 161 | # End: 162 | -------------------------------------------------------------------------------- /examples/Allocator/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = Allocator.vcproj 4 | 5 | if CF_BUILD_TESTS 6 | check_PROGRAMS = AllocatorExample 7 | endif 8 | 9 | AllocatorExample_LDADD = ${top_builddir}/libCoreFoundation.la 10 | 11 | AllocatorExample_SOURCES = AllocatorExample.c 12 | 13 | if CF_BUILD_TESTS 14 | check: 15 | ${LIBTOOL} --mode execute ./AllocatorExample 16 | 17 | gdb: 18 | ${LIBTOOL} --mode execute ${@} ./AllocatorExample 19 | 20 | valgrind: 21 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./AllocatorExample 22 | endif 23 | -------------------------------------------------------------------------------- /examples/CFLocalServer/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | if CF_BUILD_TESTS 4 | check_PROGRAMS = Client Server 5 | check_LTLIBRARIES = libCommon.la 6 | endif 7 | 8 | Client_LDADD = ${top_builddir}/libCoreFoundation.la libCommon.la 9 | Server_LDADD = ${top_builddir}/libCoreFoundation.la libCommon.la 10 | 11 | Client_SOURCES = Client.c 12 | Server_SOURCES = Server.c 13 | 14 | libCommon_la_SOURCES = Common.c 15 | 16 | noinst_HEADERS = Common.h Protocol.h 17 | -------------------------------------------------------------------------------- /examples/CFMessagePort/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | if CF_BUILD_TESTS 4 | EXTRA_PROGRAMS = client server 5 | endif 6 | 7 | client_LDADD = ${top_builddir}/libCoreFoundation.la 8 | server_LDADD = ${top_builddir}/libCoreFoundation.la 9 | 10 | client_SOURCES = client.c 11 | server_SOURCES = server.c 12 | -------------------------------------------------------------------------------- /examples/CFMessagePort/client.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | main() { 4 | CFMessagePortRef remote = CFMessagePortCreateRemote(NULL, CFSTR("MyPort")); 5 | char *message = "Hello, world!"; 6 | CFDataRef data, returnData = NULL; 7 | data = CFDataCreate(NULL, (const UInt8 *)message, strlen(message)+1); 8 | if (kCFMessagePortSuccess == CFMessagePortSendRequest(remote, 0, data, 1, 1, kCFRunLoopDefaultMode, &returnData) && NULL != returnData) { 9 | printf("here is our return data: %s\n", CFDataGetBytePtr(returnData)); 10 | CFRelease(returnData); 11 | } 12 | CFRelease(data); 13 | CFRelease(remote); 14 | } 15 | -------------------------------------------------------------------------------- /examples/CFMessagePort/server.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | CFDataRef myCallBack(CFMessagePortRef local, SInt32 msgid, CFDataRef data, void *info) { 4 | char *message = "Thanks for calling!"; 5 | CFDataRef returnData = CFDataCreate(NULL, (const UInt8 *)message, strlen(message)+1); 6 | printf("here is our received data: %s\n", CFDataGetBytePtr(data)); 7 | return returnData; // as stated in header, both data and returnData will be released for us after callback returns 8 | } 9 | 10 | main() { 11 | CFMessagePortRef local = CFMessagePortCreateLocal(NULL, CFSTR("MyPort"), myCallBack, NULL, false); 12 | CFRunLoopSourceRef source = CFMessagePortCreateRunLoopSource(NULL, local, 0); 13 | CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode); 14 | CFRunLoopRun(); // will not return as long as message port is still valid and source remains on run loop 15 | CFRelease(local); 16 | } 17 | -------------------------------------------------------------------------------- /examples/CFRunLoopTimerExample/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = CFRunLoopTimerExample.vcproj 4 | 5 | if CF_BUILD_TESTS 6 | check_PROGRAMS = CFRunLoopTimerExample 7 | endif 8 | 9 | CFRunLoopTimerExample_LDADD = ${top_builddir}/libCoreFoundation.la 10 | 11 | CFRunLoopTimerExample_SOURCES = CFRunLoopTimerExample.c 12 | 13 | if CF_BUILD_TESTS 14 | check: 15 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 0.25 5.00 16 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 0.40 2.30 17 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 1.00 1.00 18 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 1.00 0.50 19 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 0.10 1.00 20 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 1.00 2.00 21 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 1.00 10.00 22 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 0.33 1.00 23 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 0.50 0.33 4.00 24 | ${LIBTOOL} --mode execute ./CFRunLoopTimerExample 0.50 1.00 2.00 8.00 25 | 26 | ddd gdb: 27 | ${LIBTOOL} --mode execute ${@} ./CFRunLoopTimerExample 28 | 29 | valgrind: 30 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./CFRunLoopTimerExample 31 | endif 32 | -------------------------------------------------------------------------------- /examples/CFTest/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = Chiquitita.xml \ 2 | test.xml \ 3 | mac/CFTest.xcodeproj/project.pbxproj \ 4 | win_cw/MyMFCHeaders.pch++ \ 5 | win_cw/CFTest.mcp \ 6 | win_cw/MyMFCHeaders.h \ 7 | win_vs/CFTest.vcproj \ 8 | win_vs/CFTest.sln 9 | 10 | noinst_HEADERS = source/shared/CFUtils.h \ 11 | source/shared/SuperString.h \ 12 | source/main/CFTest.h \ 13 | source/main/stdafx.h 14 | 15 | if CF_BUILD_TESTS 16 | EXTRA_PROGRAMS = CFTest 17 | endif 18 | 19 | CFTest_LDADD = ${top_builddir}/libCoreFoundation.la 20 | 21 | CFTest_CPPFLAGS = -D_CFTEST_ \ 22 | -I${srcdir}/source/shared \ 23 | -I${top_srcdir}/include 24 | 25 | CFTest_SOURCES = source/main/main.cpp \ 26 | source/main/CFTest.cpp \ 27 | source/shared/SuperString.cpp \ 28 | source/shared/CFUtils.cpp 29 | 30 | if CF_BUILD_TESTS 31 | ddd gdb: CFTest 32 | ${LIBTOOL} --mode execute ${@} ./CFTest 33 | 34 | valgrind: CFTest 35 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./CFTest 36 | endif 37 | -------------------------------------------------------------------------------- /examples/CFTest/source/main/CFTest.h: -------------------------------------------------------------------------------- 1 | void CFTest(); 2 | -------------------------------------------------------------------------------- /examples/CFTest/source/main/main.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SuperString.h" 3 | #include "CFTest.h" 4 | #include "stdio.h" 5 | 6 | int main() 7 | { 8 | CFTest(); 9 | 10 | #if defined(__WIN32__) 11 | #ifdef __MWERKS__ 12 | getc(stdin); 13 | #endif 14 | #endif 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /examples/CFTest/source/main/stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Add local class declarations to this file. 3 | */ 4 | #ifndef _STDAFX 5 | #define _STDAFX 6 | 7 | #ifdef _CFTEST_ 8 | #ifdef __WIN32__ 9 | #include 10 | #endif 11 | #endif 12 | 13 | #ifdef __MWERKS__ 14 | #include 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /examples/CFTest/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Application Version 6 | 1.0d49r27 7 | Current Venue 8 | Singers 9 | Library Search Paths 10 | 11 | array 12 | 13 | 14 | Major Version 15 | 1 16 | Minor Version 17 | 7 18 | Next item ID (don't change this!!) 19 | 8302 20 | Playlists 21 | 22 | 23 | Artist 24 | 25 | Ascending 26 | 1 27 | Category 28 | 29 | Columns 30 | 31 | COLUMNS 32 | 33 | 1346978632 34 | 1936673092 35 | 1851878757 36 | 1634890867 37 | 1634493037 38 | 1685222510 39 | 40 | COLWIDS 41 | 42 | 80 43 | 66 44 | 246 45 | 167 46 | 167 47 | 80 48 | 49 | SORTCOL 50 | 1936673092 51 | SORTDIR 52 | 53 | 1 54 | 1 55 | 1 56 | 1 57 | 1 58 | 1 59 | 60 | 61 | Current Playlist Item ID 62 | 1 63 | FreeDB Revision 64 | 0 65 | FreeDB extended data 66 | 67 | Genre 68 | 69 | Is Category Locked 70 | 71 | Name 72 | Library 73 | Playlist ID 74 | 1 75 | Playlist Type 76 | 1 77 | Sort By 78 | 1936673092 79 | Year 80 | 0 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /examples/CFTest/win_cw/CFTest.mcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/examples/CFTest/win_cw/CFTest.mcp -------------------------------------------------------------------------------- /examples/CFTest/win_cw/MyMFCHeaders.h: -------------------------------------------------------------------------------- 1 | #ifndef __MYMFCHEADERS_H__ 2 | #define __MYMFCHEADERS_H__ 3 | 4 | /* 5 | Generic header for any MFC configuration: 6 | 7 | To build without precompiled headers, either use your 8 | local stdafx.h or MyMFCHeaders.pch++ as the prefix file. 9 | 10 | This header can be used with debug/release or shared/static runtimes 11 | as long as the "x86 CodeGen" / "Runtime configuration" option is 12 | set to a value other than "Custom". Otherwise, use the appropriate 13 | MyMFC[DLL][D]Headers.mch for your configuration. 14 | */ 15 | 16 | /* All configurations are forced to use __cdecl / x86 multithreaded codegen */ 17 | 18 | #ifndef _MFC_PCH_CPP 19 | #ifdef _DLL 20 | #ifdef _DEBUG 21 | #define _MFC_PCH_CPP "MyMFCDLLDHeaders.mch" 22 | #else 23 | #define _MFC_PCH_CPP "MyMFCDLLHeaders.mch" 24 | #endif 25 | #else 26 | #ifdef _DEBUG 27 | #define _MFC_PCH_CPP "MyMFCDHeaders.mch" 28 | #else 29 | #define _MFC_PCH_CPP "MyMFCHeaders.mch" 30 | #endif 31 | #endif 32 | #endif 33 | 34 | #define _CFTEST_ 35 | #include _MFC_PCH_CPP 36 | 37 | #undef _MFC_PCH_CPP 38 | 39 | #endif /*__MYMFCHEADERS_H__*/ 40 | 41 | -------------------------------------------------------------------------------- /examples/CFTest/win_cw/MyMFCHeaders.pch++: -------------------------------------------------------------------------------- 1 | 2 | /* Rename these files as appropriate (MyMFCHeaders.h must match!) */ 3 | #ifndef _MFC_PCH 4 | #ifdef _DLL 5 | #ifdef _DEBUG 6 | #define _MFC_PCH "MyMFCDLLDHeaders.mch" 7 | #else 8 | #define _MFC_PCH "MyMFCDLLHeaders.mch" 9 | #endif 10 | #else 11 | #ifdef _DEBUG 12 | #define _MFC_PCH "MyMFCDHeaders.mch" 13 | #else 14 | #define _MFC_PCH "MyMFCHeaders.mch" 15 | #endif 16 | #endif 17 | #endif 18 | 19 | #pragma precompile_target _MFC_PCH 20 | 21 | /* Don't include MSL libs before MFC libs */ 22 | #if defined _MSL_USE_DEFAULT_LIBS && !_MSL_USE_DEFAULT_LIBS 23 | #define _MSL_USER_USE_DEFAULT_LIBS 0 24 | #else 25 | #define _MSL_USER_USE_DEFAULT_LIBS 1 26 | #endif 27 | #undef _MSL_USE_DEFAULT_LIBS 28 | #define _MSL_USE_DEFAULT_LIBS 0 29 | 30 | /* Force generic x86 / __cdecl library */ 31 | #define _MSL_CALLINGCONV _MSL_CALLINGCONV_CDECL 32 | #define _MSL_CDECL __cdecl 33 | 34 | #include 35 | 36 | #define _MW_BUILDING_MFC_PCH 37 | #define _AFX_MONOLITHIC 38 | #define _AFX_PORTABLE 39 | #define _AFX_NO_DEBUG_CRT 40 | 41 | /* There are no longer 3DNow! builds of MFC. 42 | This #pragma ensures you can call the x86 MFC DLL from 3DNow! code. */ 43 | #pragma mmcalls off 44 | 45 | #include "stdafx.h" 46 | 47 | #pragma mmcalls reset 48 | 49 | -------------------------------------------------------------------------------- /examples/CFTest/win_vs/CFTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CFTest", "CFTest.vcproj", "{7E679993-5CED-41C2-B57D-7EB2D765D3D2}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {7E679993-5CED-41C2-B57D-7EB2D765D3D2}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {7E679993-5CED-41C2-B57D-7EB2D765D3D2}.Debug|Win32.Build.0 = Debug|Win32 14 | {7E679993-5CED-41C2-B57D-7EB2D765D3D2}.Release|Win32.ActiveCfg = Release|Win32 15 | {7E679993-5CED-41C2-B57D-7EB2D765D3D2}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /examples/DNSServiceMetaQuery/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = DNSServiceMetaQuery.vcproj \ 4 | README.txt 5 | 6 | if CF_BUILD_TESTS 7 | EXTRA_PROGRAMS = DNSServiceMetaQuery 8 | endif 9 | 10 | DNSServiceMetaQuery_LDADD = ${top_builddir}/libCoreFoundation.la -ldns_sd 11 | 12 | DNSServiceMetaQuery_SOURCES = DNSServiceMetaQuery.c 13 | -------------------------------------------------------------------------------- /examples/DNSServiceMetaQuery/README.txt: -------------------------------------------------------------------------------- 1 | DNSServiceMetaQuery is based on the Apple, inc. example: 2 | http://developer.apple.com/samplecode/DNSServiceMetaQuery/index.html 3 | 4 | It has been modified to build using OpenCFLite. 5 | 6 | The program shows how to discover every Bonjour service type 7 | being advertised on the local network. You must have the 8 | Bonjour SDK installed (or an equivalent Zeroconf service, such 9 | as Avahi). You may need to modify project settings to point 10 | to the proper location on your system for the necessary 11 | service discovery API (dns_sd.h). 12 | 13 | This sample uses the socket-based DNSServiceDiscovery API to 14 | discover all service types being advertised on the network. 15 | Starting in Mac OS X 10.3.4, computers on the network which 16 | advertise Bonjour services will automatically register an 17 | additional PTR record with the name "_services._dns-sd._udp.local." 18 | which points to the service type and domain of the advertised 19 | service. For example: 20 | 21 | _services._dns-sd._udp.local. IN PTR _ftp._tcp.local. 22 | 23 | This sample uses DNSServiceQueryRecord() to send a Multicast 24 | DNS query for a PTR record named "_services._dns-sd._udp.local.". 25 | The result of the query will be a PTR record which points to the 26 | DNS-SD service type and domain. This sample also shows how to 27 | parse the resulting PTR record data so that you could potentially 28 | pass the results to DNSServiceBrowse(). 29 | 30 | -------------------------------------------------------------------------------- /examples/DisplayURL/DisplayURL.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 53 | 56 | 59 | 62 | 72 | 75 | 78 | 81 | 85 | 88 | 91 | 94 | 97 | 98 | 106 | 109 | 112 | 115 | 118 | 121 | 131 | 134 | 137 | 140 | 151 | 154 | 157 | 160 | 164 | 167 | 170 | 173 | 176 | 177 | 178 | 179 | 180 | 181 | 184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /examples/DisplayURL/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = DisplayURL.vcproj \ 4 | README.txt 5 | 6 | if CF_BUILD_TESTS 7 | check_PROGRAMS = DisplayURL 8 | endif 9 | 10 | DisplayURL_LDADD = ${top_builddir}/libCoreFoundation.la 11 | 12 | DisplayURL_SOURCES = DisplayURL.c 13 | 14 | if CF_BUILD_TESTS 15 | check: 16 | ${LIBTOOL} --mode execute ./DisplayURL -u http://www.apple.com/ 17 | ${LIBTOOL} --mode execute ./DisplayURL -u http://developer.apple.com/referencelibrary/GettingStarted/GS_CoreFoundation/index.html 18 | ${LIBTOOL} --mode execute ./DisplayURL -u http://opencflite.sourceforge.net/ 19 | ${LIBTOOL} --mode execute ./DisplayURL -u http://downloads.sourceforge.net:80/opencflite/opencflite-476.17.0.tar.gz 20 | ${LIBTOOL} --mode execute ./DisplayURL -u ftp://anonymous:guest@downloads.sourceforge.net:21/opencflite/opencflite-476.17.0.tar.gz 21 | ${LIBTOOL} --mode execute ./DisplayURL -u file://localhost/var/tmp 22 | ${LIBTOOL} --mode execute ./DisplayURL -u file:///etc/motd 23 | 24 | gdb: 25 | ${LIBTOOL} --mode execute ${@} ./DisplayURL 26 | 27 | valgrind: 28 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./DisplayURL 29 | endif 30 | -------------------------------------------------------------------------------- /examples/DisplayURL/README.txt: -------------------------------------------------------------------------------- 1 | DisplayURL is based on the Apple, inc. example: 2 | http://developer.apple.com/samplecode/DisplayURL/index.html#//apple_ref/doc/uid/DTS10003783 3 | 4 | It has been modified to build using OpenCFLite. Consequently, 5 | the file system routines are currently disabled. 6 | 7 | DisplayURL accepts a URL as an input string, and parses it into 8 | its various components using CFURL routines. 9 | 10 | DisplayURL [-h] [-u ] 11 | DisplayURL parses a URL's components 12 | -h Shows this help message. 13 | -u The URL to parse. 14 | 15 | The sample also illustrates how to use the CFURLGetByteRangeForComponent API. As an example you can see how CFURLGetByteRangeForComponent deconstructs the following URL into its components. 16 | 17 | > DisplayURL -u "scheme://user:pass@host:1/path/path2/file.html;params?query#fragment" 18 | url: "scheme://user:pass@host:1/path/path2/file.html;params?query#fragment" 19 | kCFURLComponentScheme: "scheme" including separators: "scheme://" 20 | kCFURLComponentNetLocation: "user:pass@host:1" including separators: "://user:pass@host:1" 21 | kCFURLComponentPath: "/path/path2/file.html" including separators: "/path/path2/file.html;" 22 | kCFURLComponentResourceSpecifier: "params?query#fragment" including separators: ";params?query#fragment" 23 | kCFURLComponentUser: "user" including separators: "://user:" 24 | kCFURLComponentPassword: "pass" including separators: ":pass@" 25 | kCFURLComponentUserInfo: "user:pass" including separators: "://user:pass@" 26 | kCFURLComponentHost: "host" including separators: "@host:" 27 | kCFURLComponentPort: "1" including separators: ":1" 28 | kCFURLComponentParameterString: "params" including separators: ";params?" 29 | kCFURLComponentQuery: "query" including separators: "?query#" 30 | kCFURLComponentFragment: "fragment" including separators: "#fragment" 31 | 32 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = ReadPListExample \ 2 | WritePListExample \ 3 | StringExample \ 4 | Allocator \ 5 | CFMessagePort \ 6 | DisplayURL \ 7 | DNSServiceMetaQuery \ 8 | CFLocalServer \ 9 | SimpleWebServer \ 10 | CFRunLoopTimerExample \ 11 | CFTest 12 | -------------------------------------------------------------------------------- /examples/ReadPListExample/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CXXFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = schema.xml \ 4 | ReadPListExample.vcproj 5 | 6 | if CF_BUILD_TESTS 7 | check_PROGRAMS = ReadPListExample 8 | endif 9 | 10 | ReadPListExample_LDADD = ${top_builddir}/libCoreFoundation.la 11 | 12 | ReadPListExample_SOURCES = ReadPListExample.cpp 13 | 14 | if CF_BUILD_TESTS 15 | check: 16 | ${LIBTOOL} --mode execute ./ReadPListExample ${srcdir}/schema.xml 17 | 18 | gdb: 19 | ${LIBTOOL} --mode execute ${@} ./ReadPListExample 20 | 21 | valgrind: 22 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./ReadPListExample 23 | endif 24 | -------------------------------------------------------------------------------- /examples/ReadPListExample/ReadPListExample.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Brent Fulgham. All rights reserved. 3 | * 4 | * This source code is a modified version of the CoreFoundation sources released by Apple Inc. under 5 | * the terms of the APSL version 2.0 (see below). 6 | * 7 | * For information about changes from the original Apple source release can be found by reviewing the 8 | * source control system for the project at https://sourceforge.net/svn/?group_id=246198. 9 | * 10 | * The original license information is as follows: 11 | * 12 | */ 13 | 14 | // 15 | // Apple's "Read a PList" example program. 16 | // Taken from http://developer.apple.com/opensource/cflite.html 17 | // 18 | 19 | #include 20 | 21 | #include 22 | 23 | static void readPropertyListFromFile (const char *path) { 24 | CFDataRef data = NULL; 25 | 26 | FILE* file = fopen (path, "r"); 27 | 28 | if (file == NULL) { 29 | fprintf(stderr, "Cannot open `%s' for reading.\n", path); 30 | } else { 31 | int result = fseek (file, 0, SEEK_END); 32 | result = ftell (file); 33 | rewind (file); 34 | 35 | char* buffer = (char*)calloc (1, result); 36 | 37 | if (buffer != NULL) { 38 | int rc = (int)fread (buffer, result, 1, file); 39 | if (rc > 0 || !ferror (file)) { 40 | data = CFDataCreate (NULL, (const UInt8*)buffer, result); 41 | } 42 | 43 | free (buffer); 44 | } 45 | 46 | fclose (file); 47 | } 48 | 49 | if (data != NULL) { 50 | CFPropertyListRef propertyList = CFPropertyListCreateFromXMLData (NULL, data, kCFPropertyListImmutable, NULL); 51 | 52 | CFShow (CFSTR ("Property list (as read from file):")); 53 | CFShow (propertyList); 54 | 55 | CFRelease(data); 56 | } 57 | } 58 | 59 | int main (int argc, const char* argv[]) { 60 | if (argc != 2) { 61 | fprintf(stderr, "Usage: %s \n", argv[0]); 62 | return 1; 63 | } 64 | 65 | readPropertyListFromFile (argv[1]); 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /examples/ReadPListExample/schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | City of Birth 6 | Springfield 7 | Kids Names 8 | 9 | John 10 | Kyra 11 | 12 | Name 13 | John Doe 14 | Pets Names 15 | 16 | Picture 17 | 18 | PEKBpYGlmYFCPA== 19 | 20 | Year Of Birth 21 | 1965 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/SimpleWebServer/Makefile.am: -------------------------------------------------------------------------------- 1 | if CF_BUILD_TESTS 2 | EXTRA_PROGRAMS = SimpleWebServer 3 | endif 4 | 5 | SimpleWebServer_LDADD = ${top_builddir}/libCoreFoundation.la 6 | 7 | SimpleWebServer_SOURCES = SimpleWebServer.c 8 | -------------------------------------------------------------------------------- /examples/StringExample/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = StringExample.vcproj 4 | 5 | if CF_BUILD_TESTS 6 | check_PROGRAMS = StringExample 7 | endif 8 | 9 | StringExample_LDADD = ${top_builddir}/libCoreFoundation.la 10 | 11 | StringExample_SOURCES = StringExample.c 12 | 13 | if CF_BUILD_TESTS 14 | check: 15 | ${LIBTOOL} --mode execute ./StringExample 16 | 17 | gdb: 18 | ${LIBTOOL} --mode execute ${@} ./StringExample 19 | 20 | valgrind: 21 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./StringExample 22 | endif 23 | -------------------------------------------------------------------------------- /examples/WritePListExample/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CXXFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = data/expected_schema.xml \ 4 | WritePListExample.vcproj 5 | 6 | if CF_BUILD_TESTS 7 | check_PROGRAMS = WritePListExample 8 | endif 9 | 10 | WritePListExample_LDADD = ${top_builddir}/libCoreFoundation.la 11 | 12 | WritePListExample_SOURCES = WritePListExample.cpp 13 | 14 | if CF_BUILD_TESTS 15 | check: 16 | ${LIBTOOL} --mode execute ./WritePListExample 17 | ${CMP} ${srcdir}/data/expected_schema.xml schema.xml 18 | 19 | gdb: 20 | ${LIBTOOL} --mode execute ${@} ./WritePListExample 21 | 22 | valgrind: 23 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./WritePListExample 24 | endif 25 | -------------------------------------------------------------------------------- /examples/WritePListExample/data/expected_schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | City of Birth 6 | Springfield 7 | Kids Names 8 | 9 | John 10 | Kyra 11 | 12 | Name 13 | John Doe 14 | Pets Names 15 | 16 | Picture 17 | 18 | PEKBpYGlmYFCPA== 19 | 20 | Year Of Birth 21 | 1965 22 | 23 | 24 | -------------------------------------------------------------------------------- /icu/bin/WHAT_IS_THIS.txt: -------------------------------------------------------------------------------- 1 | Mac OS X and Linux ship with ICU. Since WIndows does not, the distribution 2 | includes the necessary ICU 3.6 link libraries and DLLs to build CFLite.dll. 3 | 4 | Note the these are the same DLLs that ship with Safari, and want to link 5 | against MSVCR80.dll. You will get an error on startup if you do not 6 | have this dll in your path. 7 | 8 | If you are targeting minw32, you might be better of just building ICU on 9 | that system (or use the binary ICU distribution). 10 | 11 | -------------------------------------------------------------------------------- /icu/bin/icudt40.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/icu/bin/icudt40.dll -------------------------------------------------------------------------------- /icu/bin/icuin40.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/icu/bin/icuin40.dll -------------------------------------------------------------------------------- /icu/bin/icuuc40.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/icu/bin/icuuc40.dll -------------------------------------------------------------------------------- /icu/lib/WHAT_IS_THIS.txt: -------------------------------------------------------------------------------- 1 | Mac OS X and Linux ship with ICU. Since WIndows does not, the distribution includes the 2 | necessary ICU 3.6 link libraries and DLL's to build CFLite.dll. -------------------------------------------------------------------------------- /icu/lib/icuin.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/icu/lib/icuin.lib -------------------------------------------------------------------------------- /icu/lib/icuuc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/icu/lib/icuuc.lib -------------------------------------------------------------------------------- /icu/unicode/curramt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __CURRENCYAMOUNT_H__ 12 | #define __CURRENCYAMOUNT_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | #if !UCONFIG_NO_FORMATTING 17 | 18 | #include "unicode/measure.h" 19 | #include "unicode/currunit.h" 20 | 21 | /** 22 | * \file 23 | * \brief C++ API: Currency Amount Object. 24 | */ 25 | 26 | U_NAMESPACE_BEGIN 27 | 28 | /** 29 | * 30 | * A currency together with a numeric amount, such as 200 USD. 31 | * 32 | * @author Alan Liu 33 | * @stable ICU 3.0 34 | */ 35 | class U_I18N_API CurrencyAmount: public Measure { 36 | public: 37 | /** 38 | * Construct an object with the given numeric amount and the given 39 | * ISO currency code. 40 | * @param amount a numeric object; amount.isNumeric() must be TRUE 41 | * @param isoCode the 3-letter ISO 4217 currency code; must not be 42 | * NULL and must have length 3 43 | * @param ec input-output error code. If the amount or the isoCode 44 | * is invalid, then this will be set to a failing value. 45 | * @stable ICU 3.0 46 | */ 47 | CurrencyAmount(const Formattable& amount, const UChar* isoCode, 48 | UErrorCode &ec); 49 | 50 | /** 51 | * Construct an object with the given numeric amount and the given 52 | * ISO currency code. 53 | * @param amount the amount of the given currency 54 | * @param isoCode the 3-letter ISO 4217 currency code; must not be 55 | * NULL and must have length 3 56 | * @param ec input-output error code. If the isoCode is invalid, 57 | * then this will be set to a failing value. 58 | * @stable ICU 3.0 59 | */ 60 | CurrencyAmount(double amount, const UChar* isoCode, 61 | UErrorCode &ec); 62 | 63 | /** 64 | * Copy constructor 65 | * @stable ICU 3.0 66 | */ 67 | CurrencyAmount(const CurrencyAmount& other); 68 | 69 | /** 70 | * Assignment operator 71 | * @stable ICU 3.0 72 | */ 73 | CurrencyAmount& operator=(const CurrencyAmount& other); 74 | 75 | /** 76 | * Return a polymorphic clone of this object. The result will 77 | * have the same class as returned by getDynamicClassID(). 78 | * @stable ICU 3.0 79 | */ 80 | virtual UObject* clone() const; 81 | 82 | /** 83 | * Destructor 84 | * @stable ICU 3.0 85 | */ 86 | virtual ~CurrencyAmount(); 87 | 88 | /** 89 | * Returns a unique class ID for this object POLYMORPHICALLY. 90 | * This method implements a simple form of RTTI used by ICU. 91 | * @return The class ID for this object. All objects of a given 92 | * class have the same class ID. Objects of other classes have 93 | * different class IDs. 94 | * @stable ICU 3.0 95 | */ 96 | virtual UClassID getDynamicClassID() const; 97 | 98 | /** 99 | * Returns the class ID for this class. This is used to compare to 100 | * the return value of getDynamicClassID(). 101 | * @return The class ID for all objects of this class. 102 | * @stable ICU 3.0 103 | */ 104 | static UClassID U_EXPORT2 getStaticClassID(); 105 | 106 | /** 107 | * Return the currency unit object of this object. 108 | * @stable ICU 3.0 109 | */ 110 | inline const CurrencyUnit& getCurrency() const; 111 | 112 | /** 113 | * Return the ISO currency code of this object. 114 | * @stable ICU 3.0 115 | */ 116 | inline const UChar* getISOCurrency() const; 117 | }; 118 | 119 | inline const CurrencyUnit& CurrencyAmount::getCurrency() const { 120 | return (const CurrencyUnit&) getUnit(); 121 | } 122 | 123 | inline const UChar* CurrencyAmount::getISOCurrency() const { 124 | return getCurrency().getISOCurrency(); 125 | } 126 | 127 | U_NAMESPACE_END 128 | 129 | #endif // !UCONFIG_NO_FORMATTING 130 | #endif // __CURRENCYAMOUNT_H__ 131 | -------------------------------------------------------------------------------- /icu/unicode/currunit.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __CURRENCYUNIT_H__ 12 | #define __CURRENCYUNIT_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | #if !UCONFIG_NO_FORMATTING 17 | 18 | #include "unicode/measunit.h" 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: Currency Unit Information. 23 | */ 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | /** 28 | * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese 29 | * yen). This class is a thin wrapper over a UChar string that 30 | * subclasses MeasureUnit, for use with Measure and MeasureFormat. 31 | * 32 | * @author Alan Liu 33 | * @stable ICU 3.0 34 | */ 35 | class U_I18N_API CurrencyUnit: public MeasureUnit { 36 | public: 37 | /** 38 | * Construct an object with the given ISO currency code. 39 | * @param isoCode the 3-letter ISO 4217 currency code; must not be 40 | * NULL and must have length 3 41 | * @param ec input-output error code. If the isoCode is invalid, 42 | * then this will be set to a failing value. 43 | * @stable ICU 3.0 44 | */ 45 | CurrencyUnit(const UChar* isoCode, UErrorCode &ec); 46 | 47 | /** 48 | * Copy constructor 49 | * @stable ICU 3.0 50 | */ 51 | CurrencyUnit(const CurrencyUnit& other); 52 | 53 | /** 54 | * Assignment operator 55 | * @stable ICU 3.0 56 | */ 57 | CurrencyUnit& operator=(const CurrencyUnit& other); 58 | 59 | /** 60 | * Return a polymorphic clone of this object. The result will 61 | * have the same class as returned by getDynamicClassID(). 62 | * @stable ICU 3.0 63 | */ 64 | virtual UObject* clone() const; 65 | 66 | /** 67 | * Destructor 68 | * @stable ICU 3.0 69 | */ 70 | virtual ~CurrencyUnit(); 71 | 72 | /** 73 | * Equality operator. Return true if this object is equal 74 | * to the given object. 75 | * @stable ICU 3.0 76 | */ 77 | UBool operator==(const UObject& other) const; 78 | 79 | /** 80 | * Returns a unique class ID for this object POLYMORPHICALLY. 81 | * This method implements a simple form of RTTI used by ICU. 82 | * @return The class ID for this object. All objects of a given 83 | * class have the same class ID. Objects of other classes have 84 | * different class IDs. 85 | * @stable ICU 3.0 86 | */ 87 | virtual UClassID getDynamicClassID() const; 88 | 89 | /** 90 | * Returns the class ID for this class. This is used to compare to 91 | * the return value of getDynamicClassID(). 92 | * @return The class ID for all objects of this class. 93 | * @stable ICU 3.0 94 | */ 95 | static UClassID U_EXPORT2 getStaticClassID(); 96 | 97 | /** 98 | * Return the ISO currency code of this object. 99 | * @stable ICU 3.0 100 | */ 101 | inline const UChar* getISOCurrency() const; 102 | 103 | private: 104 | /** 105 | * The ISO 4217 code of this object. 106 | */ 107 | UChar isoCode[4]; 108 | }; 109 | 110 | inline const UChar* CurrencyUnit::getISOCurrency() const { 111 | return isoCode; 112 | } 113 | 114 | U_NAMESPACE_END 115 | 116 | #endif // !UCONFIG_NO_FORMATTING 117 | #endif // __CURRENCYUNIT_H__ 118 | -------------------------------------------------------------------------------- /icu/unicode/dbbi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2006 IBM Corp. All rights reserved. 4 | ********************************************************************** 5 | * Date Name Description 6 | * 12/1/99 rgillam Complete port from Java. 7 | * 01/13/2000 helena Added UErrorCode to ctors. 8 | ********************************************************************** 9 | */ 10 | 11 | #ifndef DBBI_H 12 | #define DBBI_H 13 | 14 | #include "unicode/rbbi.h" 15 | 16 | #if !UCONFIG_NO_BREAK_ITERATION 17 | 18 | /** 19 | * \file 20 | * \brief C++ API: Dictionary Based Break Iterator 21 | */ 22 | 23 | U_NAMESPACE_BEGIN 24 | 25 | /** 26 | * An obsolete subclass of RuleBasedBreakIterator. Handling of dictionary- 27 | * based break iteration has been folded into the base class. This class 28 | * is deprecated as of ICU 3.6. 29 | */ 30 | 31 | #ifndef U_HIDE_DEPRECATED_API 32 | 33 | typedef RuleBasedBreakIterator DictionaryBasedBreakIterator; 34 | 35 | #endif 36 | 37 | U_NAMESPACE_END 38 | 39 | #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /icu/unicode/dtintrv.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2008, International Business Machines Corporation and 4 | * others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * File DTINTRV.H 8 | * 9 | ******************************************************************************* 10 | */ 11 | 12 | #ifndef __DTINTRV_H__ 13 | #define __DTINTRV_H__ 14 | 15 | #include "unicode/utypes.h" 16 | #include "unicode/uobject.h" 17 | 18 | /** 19 | * \file 20 | * \brief C++ API: Date Interval data type 21 | */ 22 | 23 | 24 | U_NAMESPACE_BEGIN 25 | 26 | 27 | /** 28 | * This class represents a date interval. 29 | * It is a pair of UDate representing from UDate 1 to UDate 2. 30 | * @draft ICU 4.0 31 | **/ 32 | class U_COMMON_API DateInterval : public UObject { 33 | public: 34 | 35 | /** 36 | * Construct a DateInterval given a from date and a to date. 37 | * @param fromDate The from date in date interval. 38 | * @param toDate The to date in date interval. 39 | * @draft ICU 4.0 40 | */ 41 | DateInterval(UDate fromDate, UDate toDate); 42 | 43 | /** 44 | * destructor 45 | * @draft ICU 4.0 46 | */ 47 | virtual ~DateInterval(); 48 | 49 | /** 50 | * Get the from date. 51 | * @return the from date in dateInterval. 52 | * @draft ICU 4.0 53 | */ 54 | UDate getFromDate() const; 55 | 56 | /** 57 | * Get the to date. 58 | * @return the to date in dateInterval. 59 | * @draft ICU 4.0 60 | */ 61 | UDate getToDate() const; 62 | 63 | 64 | /** 65 | * Return the class ID for this class. This is useful only for comparing to 66 | * a return value from getDynamicClassID(). For example: 67 | *
 68 |      * .   Base* polymorphic_pointer = createPolymorphicObject();
 69 |      * .   if (polymorphic_pointer->getDynamicClassID() ==
 70 |      * .       erived::getStaticClassID()) ...
 71 |      * 
72 | * @return The class ID for all objects of this class. 73 | * @draft ICU 4.0 74 | */ 75 | static UClassID U_EXPORT2 getStaticClassID(void); 76 | 77 | /** 78 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 79 | * method is to implement a simple version of RTTI, since not all C++ 80 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 81 | * methods call this method. 82 | * 83 | * @return The class ID for this object. All objects of a 84 | * given class have the same class ID. Objects of 85 | * other classes have different class IDs. 86 | * @draft ICU 4.0 87 | */ 88 | virtual UClassID getDynamicClassID(void) const; 89 | 90 | 91 | /** 92 | * Copy constructor. 93 | * @draft ICU 4.0 94 | */ 95 | DateInterval(const DateInterval& other); 96 | 97 | /** 98 | * Default assignment operator 99 | * @draft ICU 4.0 100 | */ 101 | DateInterval& operator=(const DateInterval&); 102 | 103 | /** 104 | * Equality operator. 105 | * @return TRUE if the two DateIntervals are the same 106 | * @draft ICU 4.0 107 | */ 108 | virtual UBool operator==(const DateInterval& other) const; 109 | 110 | /** 111 | * Non-equality operator 112 | * @return TRUE if the two DateIntervals are not the same 113 | * @draft ICU 4.0 114 | */ 115 | UBool operator!=(const DateInterval& other) const; 116 | 117 | 118 | /** 119 | * clone this object. 120 | * The caller owns the result and should delete it when done. 121 | * @return a cloned DateInterval 122 | * @draft ICU 4.0 123 | */ 124 | virtual DateInterval* clone() const; 125 | 126 | private: 127 | /** 128 | * Default constructor, not implemented. 129 | * @draft ICU 4.0 130 | */ 131 | DateInterval(); 132 | 133 | UDate fromDate; 134 | UDate toDate; 135 | 136 | } ;// end class DateInterval 137 | 138 | 139 | inline UDate 140 | DateInterval::getFromDate() const { 141 | return fromDate; 142 | } 143 | 144 | 145 | inline UDate 146 | DateInterval::getToDate() const { 147 | return toDate; 148 | } 149 | 150 | 151 | inline UBool 152 | DateInterval::operator!=(const DateInterval& other) const { 153 | return ( !operator==(other) ); 154 | } 155 | 156 | 157 | U_NAMESPACE_END 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /icu/unicode/measfmt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 20, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef MEASUREFORMAT_H 12 | #define MEASUREFORMAT_H 13 | 14 | #include "unicode/utypes.h" 15 | 16 | #if !UCONFIG_NO_FORMATTING 17 | 18 | #include "unicode/format.h" 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: Formatter for measure objects. 23 | */ 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | /** 28 | * 29 | * A formatter for measure objects. This is an abstract base class. 30 | * 31 | *

To format or parse a measure object, first create a formatter 32 | * object using a MeasureFormat factory method. Then use that 33 | * object's format and parse methods. 34 | * 35 | *

This is an abstract class. 36 | * 37 | * @see Format 38 | * @author Alan Liu 39 | * @stable ICU 3.0 40 | */ 41 | class U_I18N_API MeasureFormat : public Format { 42 | 43 | public: 44 | 45 | /** 46 | * Return a formatter for CurrencyAmount objects in the given 47 | * locale. 48 | * @param locale desired locale 49 | * @param ec input-output error code 50 | * @return a formatter object, or NULL upon error 51 | * @stable ICU 3.0 52 | */ 53 | static MeasureFormat* U_EXPORT2 createCurrencyFormat(const Locale& locale, 54 | UErrorCode& ec); 55 | 56 | /** 57 | * Return a formatter for CurrencyAmount objects in the default 58 | * locale. 59 | * @param ec input-output error code 60 | * @return a formatter object, or NULL upon error 61 | * @stable ICU 3.0 62 | */ 63 | static MeasureFormat* U_EXPORT2 createCurrencyFormat(UErrorCode& ec); 64 | 65 | protected: 66 | 67 | /** 68 | * Default constructor. 69 | * @stable ICU 3.0 70 | */ 71 | MeasureFormat(); 72 | }; 73 | 74 | U_NAMESPACE_END 75 | 76 | #endif // #if !UCONFIG_NO_FORMATTING 77 | #endif // #ifndef MEASUREFORMAT_H 78 | -------------------------------------------------------------------------------- /icu/unicode/measunit.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __MEASUREUNIT_H__ 12 | #define __MEASUREUNIT_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | #if !UCONFIG_NO_FORMATTING 17 | 18 | #include "unicode/fmtable.h" 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: A unit for measuring a quantity. 23 | */ 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | /** 28 | * A unit such as length, mass, volume, currency, etc. A unit is 29 | * coupled with a numeric amount to produce a Measure. 30 | * 31 | *

This is an abstract class. 32 | * 33 | * @author Alan Liu 34 | * @stable ICU 3.0 35 | */ 36 | class U_I18N_API MeasureUnit: public UObject { 37 | public: 38 | /** 39 | * Return a polymorphic clone of this object. The result will 40 | * have the same class as returned by getDynamicClassID(). 41 | * @stable ICU 3.0 42 | */ 43 | virtual UObject* clone() const = 0; 44 | 45 | /** 46 | * Destructor 47 | * @stable ICU 3.0 48 | */ 49 | virtual ~MeasureUnit(); 50 | 51 | /** 52 | * Equality operator. Return true if this object is equal 53 | * to the given object. 54 | * @stable ICU 3.0 55 | */ 56 | virtual UBool operator==(const UObject& other) const = 0; 57 | 58 | protected: 59 | /** 60 | * Default constructor. 61 | * @stable ICU 3.0 62 | */ 63 | MeasureUnit(); 64 | }; 65 | 66 | U_NAMESPACE_END 67 | 68 | // NOTE: There is no measunit.cpp. For implementation, see measure.cpp. [alan] 69 | 70 | #endif // !UCONFIG_NO_FORMATTING 71 | #endif // __MEASUREUNIT_H__ 72 | -------------------------------------------------------------------------------- /icu/unicode/measure.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __MEASURE_H__ 12 | #define __MEASURE_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: MeasureUnit object. 19 | */ 20 | 21 | #if !UCONFIG_NO_FORMATTING 22 | 23 | #include "unicode/fmtable.h" 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | class MeasureUnit; 28 | 29 | /** 30 | * An amount of a specified unit, consisting of a number and a Unit. 31 | * For example, a length measure consists of a number and a length 32 | * unit, such as feet or meters. This is an abstract class. 33 | * Subclasses specify a concrete Unit type. 34 | * 35 | *

Measure objects are parsed and formatted by subclasses of 36 | * MeasureFormat. 37 | * 38 | *

Measure objects are immutable. 39 | * 40 | *

This is an abstract class. 41 | * 42 | * @author Alan Liu 43 | * @stable ICU 3.0 44 | */ 45 | class U_I18N_API Measure: public UObject { 46 | public: 47 | /** 48 | * Construct an object with the given numeric amount and the given 49 | * unit. After this call, the caller must not delete the given 50 | * unit object. 51 | * @param number a numeric object; amount.isNumeric() must be TRUE 52 | * @param adoptedUnit the unit object, which must not be NULL 53 | * @param ec input-output error code. If the amount or the unit 54 | * is invalid, then this will be set to a failing value. 55 | * @stable ICU 3.0 56 | */ 57 | Measure(const Formattable& number, MeasureUnit* adoptedUnit, 58 | UErrorCode& ec); 59 | 60 | /** 61 | * Copy constructor 62 | * @stable ICU 3.0 63 | */ 64 | Measure(const Measure& other); 65 | 66 | /** 67 | * Assignment operator 68 | * @stable ICU 3.0 69 | */ 70 | Measure& operator=(const Measure& other); 71 | 72 | /** 73 | * Return a polymorphic clone of this object. The result will 74 | * have the same class as returned by getDynamicClassID(). 75 | * @stable ICU 3.0 76 | */ 77 | virtual UObject* clone() const = 0; 78 | 79 | /** 80 | * Destructor 81 | * @stable ICU 3.0 82 | */ 83 | virtual ~Measure(); 84 | 85 | /** 86 | * Equality operator. Return true if this object is equal 87 | * to the given object. 88 | * @stable ICU 3.0 89 | */ 90 | UBool operator==(const UObject& other) const; 91 | 92 | /** 93 | * Return a reference to the numeric value of this object. The 94 | * numeric value may be of any numeric type supported by 95 | * Formattable. 96 | * @stable ICU 3.0 97 | */ 98 | inline const Formattable& getNumber() const; 99 | 100 | /** 101 | * Return a reference to the unit of this object. 102 | * @stable ICU 3.0 103 | */ 104 | inline const MeasureUnit& getUnit() const; 105 | 106 | protected: 107 | /** 108 | * Default constructor. 109 | * @stable ICU 3.0 110 | */ 111 | Measure(); 112 | 113 | private: 114 | /** 115 | * The numeric value of this object, e.g. 2.54 or 100. 116 | */ 117 | Formattable number; 118 | 119 | /** 120 | * The unit of this object, e.g., "millimeter" or "JPY". This is 121 | * owned by this object. 122 | */ 123 | MeasureUnit* unit; 124 | }; 125 | 126 | inline const Formattable& Measure::getNumber() const { 127 | return number; 128 | } 129 | 130 | inline const MeasureUnit& Measure::getUnit() const { 131 | return *unit; 132 | } 133 | 134 | U_NAMESPACE_END 135 | 136 | #endif // !UCONFIG_NO_FORMATTING 137 | #endif // __MEASURE_H__ 138 | -------------------------------------------------------------------------------- /icu/unicode/parseerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2005, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 03/14/00 aliu Creation. 8 | * 06/27/00 aliu Change from C++ class to C struct 9 | ********************************************************************** 10 | */ 11 | #ifndef PARSEERR_H 12 | #define PARSEERR_H 13 | 14 | #include "unicode/utypes.h" 15 | 16 | 17 | /** 18 | * \file 19 | * \brief C API: Parse Error Information 20 | */ 21 | /** 22 | * The capacity of the context strings in UParseError. 23 | * @stable ICU 2.0 24 | */ 25 | enum { U_PARSE_CONTEXT_LEN = 16 }; 26 | 27 | /** 28 | * A UParseError struct is used to returned detailed information about 29 | * parsing errors. It is used by ICU parsing engines that parse long 30 | * rules, patterns, or programs, where the text being parsed is long 31 | * enough that more information than a UErrorCode is needed to 32 | * localize the error. 33 | * 34 | *

The line, offset, and context fields are optional; parsing 35 | * engines may choose not to use to use them. 36 | * 37 | *

The preContext and postContext strings include some part of the 38 | * context surrounding the error. If the source text is "let for=7" 39 | * and "for" is the error (e.g., because it is a reserved word), then 40 | * some examples of what a parser might produce are the following: 41 | * 42 | *

43 |  * preContext   postContext
44 |  * ""           ""            The parser does not support context
45 |  * "let "       "=7"          Pre- and post-context only
46 |  * "let "       "for=7"       Pre- and post-context and error text
47 |  * ""           "for"         Error text only
48 |  * 
49 | * 50 | *

Examples of engines which use UParseError (or may use it in the 51 | * future) are Transliterator, RuleBasedBreakIterator, and 52 | * RegexPattern. 53 | * 54 | * @stable ICU 2.0 55 | */ 56 | typedef struct UParseError { 57 | 58 | /** 59 | * The line on which the error occured. If the parser uses this 60 | * field, it sets it to the line number of the source text line on 61 | * which the error appears, which will be be a value >= 1. If the 62 | * parse does not support line numbers, the value will be <= 0. 63 | * @stable ICU 2.0 64 | */ 65 | int32_t line; 66 | 67 | /** 68 | * The character offset to the error. If the line field is >= 1, 69 | * then this is the offset from the start of the line. Otherwise, 70 | * this is the offset from the start of the text. If the parser 71 | * does not support this field, it will have a value < 0. 72 | * @stable ICU 2.0 73 | */ 74 | int32_t offset; 75 | 76 | /** 77 | * Textual context before the error. Null-terminated. The empty 78 | * string if not supported by parser. 79 | * @stable ICU 2.0 80 | */ 81 | UChar preContext[U_PARSE_CONTEXT_LEN]; 82 | 83 | /** 84 | * The error itself and/or textual context after the error. 85 | * Null-terminated. The empty string if not supported by parser. 86 | * @stable ICU 2.0 87 | */ 88 | UChar postContext[U_PARSE_CONTEXT_LEN]; 89 | 90 | } UParseError; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /icu/unicode/symtable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2000-2005, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 02/04/00 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef SYMTABLE_H 11 | #define SYMTABLE_H 12 | 13 | #include "unicode/utypes.h" 14 | #include "unicode/uobject.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: An interface that defines both lookup protocol and parsing of 19 | * symbolic names. 20 | */ 21 | 22 | U_NAMESPACE_BEGIN 23 | 24 | class ParsePosition; 25 | class UnicodeFunctor; 26 | class UnicodeSet; 27 | class UnicodeString; 28 | 29 | /** 30 | * An interface that defines both lookup protocol and parsing of 31 | * symbolic names. 32 | * 33 | *

A symbol table maintains two kinds of mappings. The first is 34 | * between symbolic names and their values. For example, if the 35 | * variable with the name "start" is set to the value "alpha" 36 | * (perhaps, though not necessarily, through an expression such as 37 | * "$start=alpha"), then the call lookup("start") will return the 38 | * char[] array ['a', 'l', 'p', 'h', 'a']. 39 | * 40 | *

The second kind of mapping is between character values and 41 | * UnicodeMatcher objects. This is used by RuleBasedTransliterator, 42 | * which uses characters in the private use area to represent objects 43 | * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], 44 | * then lookupMatcher(0xE015) will return the UnicodeSet [a-z]. 45 | * 46 | *

Finally, a symbol table defines parsing behavior for symbolic 47 | * names. All symbolic names start with the SYMBOL_REF character. 48 | * When a parser encounters this character, it calls parseReference() 49 | * with the position immediately following the SYMBOL_REF. The symbol 50 | * table parses the name, if there is one, and returns it. 51 | * 52 | * @stable ICU 2.8 53 | */ 54 | class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ { 55 | public: 56 | 57 | /** 58 | * The character preceding a symbol reference name. 59 | * @stable ICU 2.8 60 | */ 61 | enum { SYMBOL_REF = 0x0024 /*$*/ }; 62 | 63 | /** 64 | * Destructor. 65 | * @stable ICU 2.8 66 | */ 67 | virtual ~SymbolTable(); 68 | 69 | /** 70 | * Lookup the characters associated with this string and return it. 71 | * Return NULL if no such name exists. The resultant 72 | * string may have length zero. 73 | * @param s the symbolic name to lookup 74 | * @return a string containing the name's value, or NULL if 75 | * there is no mapping for s. 76 | * @stable ICU 2.8 77 | */ 78 | virtual const UnicodeString* lookup(const UnicodeString& s) const = 0; 79 | 80 | /** 81 | * Lookup the UnicodeMatcher associated with the given character, and 82 | * return it. Return NULL if not found. 83 | * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. 84 | * @return the UnicodeMatcher object represented by the given 85 | * character, or NULL if there is no mapping for ch. 86 | * @stable ICU 2.8 87 | */ 88 | virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0; 89 | 90 | /** 91 | * Parse a symbol reference name from the given string, starting 92 | * at the given position. If no valid symbol reference name is 93 | * found, return the empty string and leave pos unchanged. That is, if the 94 | * character at pos cannot start a name, or if pos is at or after 95 | * text.length(), then return an empty string. This indicates an 96 | * isolated SYMBOL_REF character. 97 | * @param text the text to parse for the name 98 | * @param pos on entry, the index of the first character to parse. 99 | * This is the character following the SYMBOL_REF character. On 100 | * exit, the index after the last parsed character. If the parse 101 | * failed, pos is unchanged on exit. 102 | * @param limit the index after the last character to be parsed. 103 | * @return the parsed name, or an empty string if there is no 104 | * valid symbolic name at the given position. 105 | * @stable ICU 2.8 106 | */ 107 | virtual UnicodeString parseReference(const UnicodeString& text, 108 | ParsePosition& pos, int32_t limit) const = 0; 109 | }; 110 | U_NAMESPACE_END 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /icu/unicode/udeprctd.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2004-2008, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * file name: 8 | * encoding: US-ASCII 9 | * tab size: 8 (not used) 10 | * indentation:4 11 | * 12 | * Created by: genheaders.pl, a perl script written by Ram Viswanadha 13 | * 14 | * Contains data for commenting out APIs. 15 | * Gets included by umachine.h 16 | * 17 | * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT 18 | * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! 19 | */ 20 | 21 | #ifndef UDEPRCTD_H 22 | #define UDEPRCTD_H 23 | 24 | #ifdef U_HIDE_DEPRECATED_API 25 | 26 | # if U_DISABLE_RENAMING 27 | # define ucol_getContractions ucol_getContractions_DEPRECATED_API_DO_NOT_USE 28 | # define ucol_getLocale ucol_getLocale_DEPRECATED_API_DO_NOT_USE 29 | # define ures_countArrayItems ures_countArrayItems_DEPRECATED_API_DO_NOT_USE 30 | # define ures_getLocale ures_getLocale_DEPRECATED_API_DO_NOT_USE 31 | # define ures_getVersionNumber ures_getVersionNumber_DEPRECATED_API_DO_NOT_USE 32 | # define utrans_getAvailableID utrans_getAvailableID_DEPRECATED_API_DO_NOT_USE 33 | # define utrans_getID utrans_getID_DEPRECATED_API_DO_NOT_USE 34 | # define utrans_open utrans_open_DEPRECATED_API_DO_NOT_USE 35 | # define utrans_unregister utrans_unregister_DEPRECATED_API_DO_NOT_USE 36 | # else 37 | # define ucol_getContractions_4_0 ucol_getContractions_DEPRECATED_API_DO_NOT_USE 38 | # define ucol_getLocale_4_0 ucol_getLocale_DEPRECATED_API_DO_NOT_USE 39 | # define ures_countArrayItems_4_0 ures_countArrayItems_DEPRECATED_API_DO_NOT_USE 40 | # define ures_getLocale_4_0 ures_getLocale_DEPRECATED_API_DO_NOT_USE 41 | # define ures_getVersionNumber_4_0 ures_getVersionNumber_DEPRECATED_API_DO_NOT_USE 42 | # define utrans_getAvailableID_4_0 utrans_getAvailableID_DEPRECATED_API_DO_NOT_USE 43 | # define utrans_getID_4_0 utrans_getID_DEPRECATED_API_DO_NOT_USE 44 | # define utrans_open_4_0 utrans_open_DEPRECATED_API_DO_NOT_USE 45 | # define utrans_unregister_4_0 utrans_unregister_DEPRECATED_API_DO_NOT_USE 46 | # endif /* U_DISABLE_RENAMING */ 47 | 48 | #endif /* U_HIDE_DEPRECATED_API */ 49 | #endif /* UDEPRCTD_H */ 50 | 51 | -------------------------------------------------------------------------------- /icu/unicode/umisc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * file name: umisc.h 7 | * encoding: US-ASCII 8 | * tab size: 8 (not used) 9 | * indentation:4 10 | * 11 | * created on: 1999oct15 12 | * created by: Markus W. Scherer 13 | */ 14 | 15 | #ifndef UMISC_H 16 | #define UMISC_H 17 | 18 | #include "unicode/utypes.h" 19 | 20 | /** 21 | * \file 22 | * \brief C API:misc definitions 23 | * 24 | * This file contains miscellaneous definitions for the C APIs. 25 | */ 26 | 27 | U_CDECL_BEGIN 28 | 29 | /** A struct representing a range of text containing a specific field 30 | * @stable ICU 2.0 31 | */ 32 | typedef struct UFieldPosition { 33 | /** 34 | * The field 35 | * @stable ICU 2.0 36 | */ 37 | int32_t field; 38 | /** 39 | * The start of the text range containing field 40 | * @stable ICU 2.0 41 | */ 42 | int32_t beginIndex; 43 | /** 44 | * The limit of the text range containing field 45 | * @stable ICU 2.0 46 | */ 47 | int32_t endIndex; 48 | } UFieldPosition; 49 | 50 | #if !UCONFIG_NO_SERVICE 51 | /** 52 | * Opaque type returned by registerInstance, registerFactory and unregister for service registration. 53 | * @stable ICU 2.6 54 | */ 55 | typedef const void* URegistryKey; 56 | #endif 57 | 58 | U_CDECL_END 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /icu/unicode/unifilt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2006, International Business Machines Corporation and others. 4 | * All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 11/17/99 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef UNIFILT_H 11 | #define UNIFILT_H 12 | 13 | #include "unicode/unifunct.h" 14 | #include "unicode/unimatch.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: Unicode Filter 19 | */ 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | /** 24 | * U_ETHER is used to represent character values for positions outside 25 | * a range. For example, transliterator uses this to represent 26 | * characters outside the range contextStart..contextLimit-1. This 27 | * allows explicit matching by rules and UnicodeSets of text outside a 28 | * defined range. 29 | * @stable ICU 3.0 30 | */ 31 | #define U_ETHER ((UChar)0xFFFF) 32 | 33 | /** 34 | * 35 | * UnicodeFilter defines a protocol for selecting a 36 | * subset of the full range (U+0000 to U+10FFFF) of Unicode characters. 37 | * Currently, filters are used in conjunction with classes like {@link 38 | * Transliterator} to only process selected characters through a 39 | * transformation. 40 | * 41 | *

Note: UnicodeFilter currently stubs out two pure virtual methods 42 | * of its base class, UnicodeMatcher. These methods are toPattern() 43 | * and matchesIndexValue(). This is done so that filter classes that 44 | * are not actually used as matchers -- specifically, those in the 45 | * UnicodeFilterLogic component, and those in tests -- can continue to 46 | * work without defining these methods. As long as a filter is not 47 | * used in an RBT during real transliteration, these methods will not 48 | * be called. However, this breaks the UnicodeMatcher base class 49 | * protocol, and it is not a correct solution. 50 | * 51 | *

In the future we may revisit the UnicodeMatcher / UnicodeFilter 52 | * hierarchy and either redesign it, or simply remove the stubs in 53 | * UnicodeFilter and force subclasses to implement the full 54 | * UnicodeMatcher protocol. 55 | * 56 | * @see UnicodeFilterLogic 57 | * @stable ICU 2.0 58 | */ 59 | class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher { 60 | 61 | public: 62 | /** 63 | * Destructor 64 | * @stable ICU 2.0 65 | */ 66 | virtual ~UnicodeFilter(); 67 | 68 | /** 69 | * Returns true for characters that are in the selected 70 | * subset. In other words, if a character is to be 71 | * filtered, then contains() returns 72 | * false. 73 | * @stable ICU 2.0 74 | */ 75 | virtual UBool contains(UChar32 c) const = 0; 76 | 77 | /** 78 | * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer 79 | * and return the pointer. 80 | * @stable ICU 2.4 81 | */ 82 | virtual UnicodeMatcher* toMatcher() const; 83 | 84 | /** 85 | * Implement UnicodeMatcher API. 86 | * @stable ICU 2.4 87 | */ 88 | virtual UMatchDegree matches(const Replaceable& text, 89 | int32_t& offset, 90 | int32_t limit, 91 | UBool incremental); 92 | 93 | /** 94 | * UnicodeFunctor API. Nothing to do. 95 | * @stable ICU 2.4 96 | */ 97 | virtual void setData(const TransliterationRuleData*); 98 | 99 | /** 100 | * ICU "poor man's RTTI", returns a UClassID for the actual class. 101 | * 102 | * @stable ICU 2.2 103 | */ 104 | virtual UClassID getDynamicClassID() const = 0; 105 | 106 | /** 107 | * ICU "poor man's RTTI", returns a UClassID for this class. 108 | * 109 | * @stable ICU 2.2 110 | */ 111 | static UClassID U_EXPORT2 getStaticClassID(); 112 | 113 | protected: 114 | 115 | /* 116 | * Since this class has pure virtual functions, 117 | * a constructor can't be used. 118 | * @stable ICU 2.0 119 | */ 120 | /* UnicodeFilter();*/ 121 | }; 122 | 123 | /*inline UnicodeFilter::UnicodeFilter() {}*/ 124 | 125 | U_NAMESPACE_END 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /icu/unicode/unifunct.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2002-2005, International Business Machines Corporation 4 | * and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 01/14/2002 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef UNIFUNCT_H 11 | #define UNIFUNCT_H 12 | 13 | #include "unicode/utypes.h" 14 | #include "unicode/uobject.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: Unicode Functor 19 | */ 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | class UnicodeMatcher; 24 | class UnicodeReplacer; 25 | class TransliterationRuleData; 26 | 27 | /** 28 | * UnicodeFunctor is an abstract base class for objects 29 | * that perform match and/or replace operations on Unicode strings. 30 | * @author Alan Liu 31 | * @stable ICU 2.4 32 | */ 33 | class U_COMMON_API UnicodeFunctor : public UObject { 34 | 35 | public: 36 | 37 | /** 38 | * Destructor 39 | * @stable ICU 2.4 40 | */ 41 | virtual ~UnicodeFunctor(); 42 | 43 | /** 44 | * Return a copy of this object. All UnicodeFunctor objects 45 | * have to support cloning in order to allow classes using 46 | * UnicodeFunctor to implement cloning. 47 | * @stable ICU 2.4 48 | */ 49 | virtual UnicodeFunctor* clone() const = 0; 50 | 51 | /** 52 | * Cast 'this' to a UnicodeMatcher* pointer and return the 53 | * pointer, or null if this is not a UnicodeMatcher*. Subclasses 54 | * that mix in UnicodeMatcher as a base class must override this. 55 | * This protocol is required because a pointer to a UnicodeFunctor 56 | * cannot be cast to a pointer to a UnicodeMatcher, since 57 | * UnicodeMatcher is a mixin that does not derive from 58 | * UnicodeFunctor. 59 | * @stable ICU 2.4 60 | */ 61 | virtual UnicodeMatcher* toMatcher() const; 62 | 63 | /** 64 | * Cast 'this' to a UnicodeReplacer* pointer and return the 65 | * pointer, or null if this is not a UnicodeReplacer*. Subclasses 66 | * that mix in UnicodeReplacer as a base class must override this. 67 | * This protocol is required because a pointer to a UnicodeFunctor 68 | * cannot be cast to a pointer to a UnicodeReplacer, since 69 | * UnicodeReplacer is a mixin that does not derive from 70 | * UnicodeFunctor. 71 | * @stable ICU 2.4 72 | */ 73 | virtual UnicodeReplacer* toReplacer() const; 74 | 75 | /** 76 | * Return the class ID for this class. This is useful only for 77 | * comparing to a return value from getDynamicClassID(). 78 | * @return The class ID for all objects of this class. 79 | * @stable ICU 2.0 80 | */ 81 | static UClassID U_EXPORT2 getStaticClassID(void); 82 | 83 | /** 84 | * Returns a unique class ID polymorphically. This method 85 | * is to implement a simple version of RTTI, since not all C++ 86 | * compilers support genuine RTTI. Polymorphic operator==() and 87 | * clone() methods call this method. 88 | * 89 | *

Concrete subclasses of UnicodeFunctor should use the macro 90 | * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to 91 | * provide definitios getStaticClassID and getDynamicClassID. 92 | * 93 | * @return The class ID for this object. All objects of a given 94 | * class have the same class ID. Objects of other classes have 95 | * different class IDs. 96 | * @stable ICU 2.4 97 | */ 98 | virtual UClassID getDynamicClassID(void) const = 0; 99 | 100 | /** 101 | * Set the data object associated with this functor. The data 102 | * object provides context for functor-to-standin mapping. This 103 | * method is required when assigning a functor to a different data 104 | * object. This function MAY GO AWAY later if the architecture is 105 | * changed to pass data object pointers through the API. 106 | * @internal ICU 2.1 107 | */ 108 | virtual void setData(const TransliterationRuleData*) = 0; 109 | 110 | protected: 111 | 112 | /** 113 | * Since this class has pure virtual functions, 114 | * a constructor can't be used. 115 | * @stable ICU 2.0 116 | */ 117 | /*UnicodeFunctor();*/ 118 | 119 | }; 120 | 121 | /*inline UnicodeFunctor::UnicodeFunctor() {}*/ 122 | 123 | U_NAMESPACE_END 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /icu/unicode/unirepl.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2002-2005, International Business Machines Corporation 4 | * and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 01/14/2002 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef UNIREPL_H 11 | #define UNIREPL_H 12 | 13 | #include "unicode/utypes.h" 14 | 15 | /** 16 | * \file 17 | * \brief C++ API: UnicodeReplacer 18 | */ 19 | 20 | U_NAMESPACE_BEGIN 21 | 22 | class Replaceable; 23 | class UnicodeString; 24 | class UnicodeSet; 25 | 26 | /** 27 | * UnicodeReplacer defines a protocol for objects that 28 | * replace a range of characters in a Replaceable string with output 29 | * text. The replacement is done via the Replaceable API so as to 30 | * preserve out-of-band data. 31 | * 32 | *

This is a mixin class. 33 | * @author Alan Liu 34 | * @stable ICU 2.4 35 | */ 36 | class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ { 37 | 38 | public: 39 | 40 | /** 41 | * Destructor. 42 | * @stable ICU 2.4 43 | */ 44 | virtual ~UnicodeReplacer(); 45 | 46 | /** 47 | * Replace characters in 'text' from 'start' to 'limit' with the 48 | * output text of this object. Update the 'cursor' parameter to 49 | * give the cursor position and return the length of the 50 | * replacement text. 51 | * 52 | * @param text the text to be matched 53 | * @param start inclusive start index of text to be replaced 54 | * @param limit exclusive end index of text to be replaced; 55 | * must be greater than or equal to start 56 | * @param cursor output parameter for the cursor position. 57 | * Not all replacer objects will update this, but in a complete 58 | * tree of replacer objects, representing the entire output side 59 | * of a transliteration rule, at least one must update it. 60 | * @return the number of 16-bit code units in the text replacing 61 | * the characters at offsets start..(limit-1) in text 62 | * @stable ICU 2.4 63 | */ 64 | virtual int32_t replace(Replaceable& text, 65 | int32_t start, 66 | int32_t limit, 67 | int32_t& cursor) = 0; 68 | 69 | /** 70 | * Returns a string representation of this replacer. If the 71 | * result of calling this function is passed to the appropriate 72 | * parser, typically TransliteratorParser, it will produce another 73 | * replacer that is equal to this one. 74 | * @param result the string to receive the pattern. Previous 75 | * contents will be deleted. 76 | * @param escapeUnprintable if TRUE then convert unprintable 77 | * character to their hex escape representations, \\uxxxx or 78 | * \\Uxxxxxxxx. Unprintable characters are defined by 79 | * Utility.isUnprintable(). 80 | * @return a reference to 'result'. 81 | * @stable ICU 2.4 82 | */ 83 | virtual UnicodeString& toReplacerPattern(UnicodeString& result, 84 | UBool escapeUnprintable) const = 0; 85 | 86 | /** 87 | * Union the set of all characters that may output by this object 88 | * into the given set. 89 | * @param toUnionTo the set into which to union the output characters 90 | * @stable ICU 2.4 91 | */ 92 | virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0; 93 | }; 94 | 95 | U_NAMESPACE_END 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /icu/unicode/uobslete.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2004-2008, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * file name: 8 | * encoding: US-ASCII 9 | * tab size: 8 (not used) 10 | * indentation:4 11 | * 12 | * Created by: genheaders.pl, a perl script written by Ram Viswanadha 13 | * 14 | * Contains data for commenting out APIs. 15 | * Gets included by umachine.h 16 | * 17 | * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT 18 | * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! 19 | */ 20 | 21 | #ifndef UOBSLETE_H 22 | #define UOBSLETE_H 23 | 24 | #ifdef U_HIDE_OBSOLETE_API 25 | 26 | # if U_DISABLE_RENAMING 27 | # else 28 | # endif /* U_DISABLE_RENAMING */ 29 | 30 | #endif /* U_HIDE_OBSOLETE_API */ 31 | #endif /* UOBSLETE_H */ 32 | 33 | -------------------------------------------------------------------------------- /icu/unicode/ustream.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 2001-2007 International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * FILE NAME : ustream.h 7 | * 8 | * Modification History: 9 | * 10 | * Date Name Description 11 | * 06/25/2001 grhoten Move iostream from unistr.h 12 | ****************************************************************************** 13 | */ 14 | 15 | #ifndef USTREAM_H 16 | #define USTREAM_H 17 | 18 | #include "unicode/unistr.h" 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: Unicode iostream like API 23 | * 24 | * At this time, this API is very limited. It contains 25 | * operator<< and operator>> for UnicodeString manipulation with the 26 | * C++ I/O stream API. 27 | */ 28 | 29 | #if U_IOSTREAM_SOURCE >= 199711 30 | #include 31 | #include 32 | 33 | U_NAMESPACE_BEGIN 34 | 35 | /** 36 | * Write the contents of a UnicodeString to a C++ ostream. This functions writes 37 | * the characters in a UnicodeString to an ostream. The UChars in the 38 | * UnicodeString are converted to the char based ostream with the default 39 | * converter. 40 | * @stable 3.0 41 | */ 42 | U_IO_API std::ostream & U_EXPORT2 operator<<(std::ostream& stream, const UnicodeString& s); 43 | 44 | /** 45 | * Write the contents from a C++ istream to a UnicodeString. The UChars in the 46 | * UnicodeString are converted from the char based istream with the default 47 | * converter. 48 | * @stable 3.0 49 | */ 50 | U_IO_API std::istream & U_EXPORT2 operator>>(std::istream& stream, UnicodeString& s); 51 | U_NAMESPACE_END 52 | 53 | #elif U_IOSTREAM_SOURCE >= 198506 54 | /* and don't exist. */ 55 | #include 56 | 57 | U_NAMESPACE_BEGIN 58 | U_IO_API ostream & U_EXPORT2 operator<<(ostream& stream, const UnicodeString& s); 59 | 60 | U_IO_API istream & U_EXPORT2 operator>>(istream& stream, UnicodeString& s); 61 | U_NAMESPACE_END 62 | 63 | #endif 64 | 65 | /* No operator for UChar because it can conflict with wchar_t */ 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /icu/unicode/usystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2004-2008, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * file name: 8 | * encoding: US-ASCII 9 | * tab size: 8 (not used) 10 | * indentation:4 11 | * 12 | * Created by: genheaders.pl, a perl script written by Ram Viswanadha 13 | * 14 | * Contains data for commenting out APIs. 15 | * Gets included by umachine.h 16 | * 17 | * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT 18 | * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! 19 | */ 20 | 21 | #ifndef USYSTEM_H 22 | #define USYSTEM_H 23 | 24 | #ifdef U_HIDE_SYSTEM_API 25 | 26 | # if U_DISABLE_RENAMING 27 | # define u_cleanup u_cleanup_SYSTEM_API_DO_NOT_USE 28 | # define u_setAtomicIncDecFunctions u_setAtomicIncDecFunctions_SYSTEM_API_DO_NOT_USE 29 | # define u_setMemoryFunctions u_setMemoryFunctions_SYSTEM_API_DO_NOT_USE 30 | # define u_setMutexFunctions u_setMutexFunctions_SYSTEM_API_DO_NOT_USE 31 | # define ucnv_setDefaultName ucnv_setDefaultName_SYSTEM_API_DO_NOT_USE 32 | # define uloc_getDefault uloc_getDefault_SYSTEM_API_DO_NOT_USE 33 | # define uloc_setDefault uloc_setDefault_SYSTEM_API_DO_NOT_USE 34 | # else 35 | # define u_cleanup_4_0 u_cleanup_SYSTEM_API_DO_NOT_USE 36 | # define u_setAtomicIncDecFunctions_4_0 u_setAtomicIncDecFunctions_SYSTEM_API_DO_NOT_USE 37 | # define u_setMemoryFunctions_4_0 u_setMemoryFunctions_SYSTEM_API_DO_NOT_USE 38 | # define u_setMutexFunctions_4_0 u_setMutexFunctions_SYSTEM_API_DO_NOT_USE 39 | # define ucnv_setDefaultName_4_0 ucnv_setDefaultName_SYSTEM_API_DO_NOT_USE 40 | # define uloc_getDefault_4_0 uloc_getDefault_SYSTEM_API_DO_NOT_USE 41 | # define uloc_setDefault_4_0 uloc_setDefault_SYSTEM_API_DO_NOT_USE 42 | # endif /* U_DISABLE_RENAMING */ 43 | 44 | #endif /* U_HIDE_SYSTEM_API */ 45 | #endif /* USYSTEM_H */ 46 | 47 | -------------------------------------------------------------------------------- /icu/unicode/utf32.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * 4 | * Copyright (C) 1999-2001, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ******************************************************************************* 8 | * file name: utf32.h 9 | * encoding: US-ASCII 10 | * tab size: 8 (not used) 11 | * indentation:4 12 | * 13 | * created on: 1999sep20 14 | * created by: Markus W. Scherer 15 | */ 16 | /** 17 | * \file 18 | * \brief C API: UTF-32 macros 19 | * 20 | * This file is obsolete and its contents moved to utf_old.h. 21 | * See utf_old.h and Jitterbug 2150 and its discussion on the ICU mailing list 22 | * in September 2002. 23 | */ 24 | -------------------------------------------------------------------------------- /include/AssertMacros.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/include/AssertMacros.h -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | all: CoreFoundation 2 | 3 | check install: all 4 | 5 | CS_includedir = ${includedir} 6 | 7 | CS_include_HEADERS = AssertMacros.h \ 8 | AvailabilityMacros.h \ 9 | TargetConditionals.h 10 | 11 | EXTRA_DIST = c99/stdbool.h \ 12 | c99/stdint.h \ 13 | mach_support/bootstrap_priv.h \ 14 | mach_support/vproc_priv.h 15 | 16 | CF_SOURCE = ${top_srcdir} 17 | 18 | CoreFoundation: | ${CF_SOURCE} 19 | ${LN_S} ${CF_SOURCE} $@ 20 | -------------------------------------------------------------------------------- /include/TargetConditionals.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nevali/opencflite/03999700cf3b79975ae2f2e5f4100ea7096acb3a/include/TargetConditionals.h -------------------------------------------------------------------------------- /include/c99/stdbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Apple Inc. 3 | * All rights reserved. 4 | * 5 | */ 6 | 7 | #ifndef __STDBOOL_H__ 8 | #define __STDBOOL_H__ 1 9 | 10 | #define __bool_true_false_are_defined 1 11 | 12 | #ifndef __cplusplus 13 | 14 | #define false 0 15 | #define true 1 16 | 17 | #define bool _Bool 18 | 19 | #ifndef COCOTRON 20 | typedef unsigned char _Bool; 21 | #endif 22 | 23 | #endif /* !__cplusplus */ 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /include/mach_support/bootstrap_priv.h: -------------------------------------------------------------------------------- 1 | #ifndef _BOOTSTRAP_PRIVATE_H_ 2 | #define _BOOTSTRAP_PRIVATE_H_ 3 | /* 4 | * Copyright (c) 2007 Apple Inc. All rights reserved. 5 | * 6 | * @APPLE_APACHE_LICENSE_HEADER_START@ 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | * @APPLE_APACHE_LICENSE_HEADER_END@ 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | __BEGIN_DECLS 27 | 28 | #pragma GCC visibility push(default) 29 | 30 | #define BOOTSTRAP_PER_PID_SERVICE 0x1 31 | #define BOOTSTRAP_ALLOW_LOOKUP 0x2 32 | #define BOOTSTRAP_DENY_JOB_CREATION 0x4 33 | 34 | kern_return_t bootstrap_register2(mach_port_t bp, name_t service_name, mach_port_t sp, uint64_t flags); 35 | 36 | kern_return_t bootstrap_look_up2(mach_port_t bp, name_t service_name, mach_port_t *sp, pid_t target_pid, uint64_t flags); 37 | 38 | kern_return_t bootstrap_look_up_per_user(mach_port_t bp, name_t service_name, uid_t target_user, mach_port_t *sp); 39 | 40 | kern_return_t bootstrap_set_policy(mach_port_t bp, pid_t target_pid, uint64_t flags, const char *target_service); 41 | 42 | #pragma GCC visibility pop 43 | 44 | __END_DECLS 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/mach_support/vproc_priv.h: -------------------------------------------------------------------------------- 1 | #ifndef _VPROC_PRIVATE_H_ 2 | #define _VPROC_PRIVATE_H_ 3 | /* 4 | * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. 5 | * 6 | * @APPLE_APACHE_LICENSE_HEADER_START@ 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | * @APPLE_APACHE_LICENSE_HEADER_END@ 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | __BEGIN_DECLS 31 | 32 | #pragma GCC visibility push(default) 33 | 34 | /* DO NOT use this. This is a hack for launchctl */ 35 | #define VPROC_MAGIC_UNLOAD_SIGNAL 0x4141504C 36 | 37 | typedef enum { 38 | VPROC_GSK_LAST_EXIT_STATUS = 1, 39 | VPROC_GSK_GLOBAL_ON_DEMAND, 40 | VPROC_GSK_MGR_UID, 41 | VPROC_GSK_MGR_PID, 42 | VPROC_GSK_IS_MANAGED, 43 | VPROC_GSK_BASIC_KEEPALIVE, 44 | VPROC_GSK_START_INTERVAL, 45 | VPROC_GSK_IDLE_TIMEOUT, 46 | VPROC_GSK_EXIT_TIMEOUT, 47 | VPROC_GSK_ENVIRONMENT, 48 | VPROC_GSK_ALLJOBS, 49 | VPROC_GSK_GLOBAL_LOG_MASK, 50 | VPROC_GSK_GLOBAL_UMASK, 51 | } vproc_gsk_t; 52 | 53 | vproc_err_t vproc_swap_integer(vproc_t vp, vproc_gsk_t key, int64_t *inval, int64_t *outval); 54 | vproc_err_t vproc_swap_complex(vproc_t vp, vproc_gsk_t key, launch_data_t inval, launch_data_t *outval); 55 | 56 | vproc_err_t _vproc_get_last_exit_status(int *wstatus); 57 | vproc_err_t _vproc_set_global_on_demand(bool val); 58 | 59 | typedef void (*_vprocmgr_log_drain_callback_t)(struct timeval *when, pid_t from_pid, pid_t about_pid, uid_t sender_uid, gid_t sender_gid, int priority, const char *from_name, const char *about_name, const char *session_name, const char *msg); 60 | 61 | vproc_err_t _vprocmgr_log_drain(vproc_t vp, pthread_mutex_t *optional_mutex_around_callback, _vprocmgr_log_drain_callback_t func); 62 | 63 | vproc_err_t _vproc_send_signal_by_label(const char *label, int sig); 64 | vproc_err_t _vproc_kickstart_by_label(const char *label, pid_t *out_pid, mach_port_t *out_port_name); 65 | vproc_err_t _vproc_wait_by_label(const char *label, int *out_wstatus); 66 | 67 | void _vproc_log(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3))); 68 | void _vproc_log_error(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3))); 69 | 70 | #define VPROCMGR_SESSION_LOGINWINDOW "LoginWindow" 71 | #define VPROCMGR_SESSION_BACKGROUND "Background" 72 | #define VPROCMGR_SESSION_AQUA "Aqua" 73 | #define VPROCMGR_SESSION_STANDARDIO "StandardIO" 74 | #define VPROCMGR_SESSION_SYSTEM "System" 75 | 76 | vproc_err_t _vprocmgr_move_subset_to_user(uid_t target_user, const char *session_type); 77 | 78 | #pragma GCC visibility pop 79 | 80 | __END_DECLS 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /m4/acinclude.m4: -------------------------------------------------------------------------------- 1 | # CF_BSD_SOURCE 2 | # -------------- 3 | AC_DEFUN([CF_BSD_SOURCE], 4 | [AH_VERBATIM([_BSD_SOURCE], 5 | [/* Enable BSD extensions on systems that have them. */ 6 | #ifndef _BSD_SOURCE 7 | # undef _BSD_SOURCE 8 | #endif])dnl 9 | AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl 10 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl 11 | AC_DEFINE([_BSD_SOURCE]) 12 | ]) 13 | 14 | # CF_REPLACE_STRLN_FUNC(SUFFIX...) 15 | # 16 | # Determine whether one or both of strl and strn exist 17 | # and then how to handle their presence or absence accordingly. 18 | # -------------------------------------------------------------------- 19 | AC_DEFUN([CF_REPLACE_STRLN_FUNC], 20 | [ 21 | AC_REQUIRE([AC_CHECK_FUNCS]) 22 | AC_REQUIRE([AC_REPLACE_FUNCS]) 23 | AC_CHECK_FUNCS([strl$1 strn$1]) 24 | if test "x${ac_cv_func_strl$1}" = "xno"; then 25 | AC_MSG_CHECKING([how to handle missing strl$1]) 26 | if test "x${ac_cv_func_strn$1}" = "xyes"; then 27 | AC_MSG_RESULT([mapped to strn$1]) 28 | AC_DEFINE([strl$1], 29 | [strn$1], 30 | [Define this if the target system has strn$1 but not strl$1.]) 31 | else 32 | AC_MSG_RESULT([using local implementation]) 33 | AC_REPLACE_FUNCS([strl$1]) 34 | fi 35 | fi 36 | ]) 37 | -------------------------------------------------------------------------------- /tests/Make_win32.bat: -------------------------------------------------------------------------------- 1 | cl /I../dist/include /D"WIN32" /D"_WIN32_WINNT=0x0501" /D"WINVER=0x0501" date_test.c ../dist/lib/CFLite.lib 2 | 3 | xcopy date_test.exe ..\dist\bin /Y 4 | 5 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I${top_srcdir}/include 2 | 3 | EXTRA_DIST = Make_win32.bat 4 | 5 | if CF_BUILD_TESTS 6 | check_PROGRAMS = date_test 7 | endif 8 | 9 | date_test_LDADD = ${top_builddir}/libCoreFoundation.la 10 | 11 | date_test_SOURCES = date_test.c 12 | 13 | if CF_BUILD_TESTS 14 | check: 15 | ${LIBTOOL} --mode execute ./date_test 16 | 17 | gdb: 18 | ${LIBTOOL} --mode execute ${@} ./date_test 19 | 20 | valgrind: 21 | ${LIBTOOL} --mode execute ${@} ${VALGRINDFLAGS} ./date_test 22 | endif 23 | -------------------------------------------------------------------------------- /tests/date_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * date_test.c 3 | * CFLite 4 | * 5 | * A compilation of various examples from the "Date and Times Programming Guide for CoreFoundation". 6 | * 7 | * http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFDatesAndTimes/CFDatesAndTimes.html 8 | * 9 | */ 10 | 11 | #include 12 | 13 | #include 14 | 15 | bool check_date_constructors () 16 | { 17 | CFAbsoluteTime absTime; 18 | CFDateRef aCFDate; 19 | 20 | CFShow(CFSTR("Checking date constructors:")); 21 | 22 | absTime = CFAbsoluteTimeGetCurrent(); 23 | aCFDate = CFDateCreate(kCFAllocatorDefault, absTime); 24 | 25 | CFShow(CFSTR("Absolute Time is")); 26 | printf("The current absolute time is %f\n", absTime); 27 | CFShow(CFSTR("Equivalent CFDate object is")); 28 | CFShow(aCFDate); 29 | 30 | printf("\n"); 31 | 32 | return true; 33 | } 34 | 35 | bool check_date_comparison () 36 | { 37 | CFDateRef date1, date2; 38 | 39 | // Standard Core Foundation comparison result. 40 | CFComparisonResult result; 41 | 42 | CFShow(CFSTR("Checking date comparison functions:")); 43 | 44 | // Create two CFDates from absolute time. 45 | date1 = CFDateCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent()); 46 | date2 = CFDateCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent()); 47 | 48 | // Pass NULL for the context param. 49 | result = CFDateCompare(date1, date2, NULL); 50 | 51 | switch (result) { 52 | case kCFCompareLessThan: 53 | CFShow(CFSTR("date1 is before date2!\n")); 54 | break; 55 | case kCFCompareEqualTo: 56 | CFShow(CFSTR("date1 is the same as date2!\n")); 57 | break; 58 | case kCFCompareGreaterThan: 59 | CFShow(CFSTR("date1 is after date2!\n")); 60 | break; 61 | } 62 | 63 | printf("\n"); 64 | 65 | return true; 66 | } 67 | 68 | bool check_gregorian_dates () 69 | { 70 | Boolean status; 71 | CFGregorianDate gregDate; 72 | CFAbsoluteTime absTime; 73 | 74 | long weekOfYear, dayOfWeek; 75 | 76 | CFShow(CFSTR("Checking Gregorian date functions")); 77 | 78 | // Construct a Gregorian date. 79 | gregDate.year = 1999; 80 | gregDate.month = 11; 81 | gregDate.day = 23; 82 | gregDate.hour = 17; 83 | gregDate.minute = 33; 84 | gregDate.second = 22.7; 85 | 86 | // Check the validity of the date. 87 | status = CFGregorianDateIsValid(gregDate, kCFGregorianAllUnits); 88 | printf("Is my Gregorian date valid? %d\n", status); 89 | 90 | // Convert the Gregorian date to absolute time. 91 | absTime = CFGregorianDateGetAbsoluteTime(gregDate, NULL); 92 | printf("The Absolute Time from a Gregorian date is: %f\n", absTime); 93 | 94 | CFShow(CFSTR("This corresponds to the following:")); 95 | weekOfYear = CFAbsoluteTimeGetWeekOfYear (absTime, NULL); 96 | dayOfWeek = CFAbsoluteTimeGetDayOfWeek (absTime, NULL); 97 | 98 | printf("Week of the year for %d-%d-%d is %ld\n", gregDate.month, gregDate.day, gregDate.year, weekOfYear); 99 | printf("Day of the week for %d-%d-%d is %ld\n", gregDate.month, gregDate.day, gregDate.year, dayOfWeek); 100 | 101 | printf("\n"); 102 | 103 | return true; 104 | } 105 | 106 | int main (int argc, const char** argv) 107 | { 108 | check_date_constructors (); 109 | check_date_comparison (); 110 | check_gregorian_dates (); 111 | return 0; 112 | } --------------------------------------------------------------------------------