├── tests ├── FoundationTests │ ├── NSBundleTests │ │ ├── 0.asset │ │ ├── 0.bundle │ │ │ ├── 0.asset │ │ │ └── 0-0.bundle │ │ │ │ ├── 0-0.asset │ │ │ │ └── 0-0-0.bundle │ │ │ │ └── 0-0-0.asset │ │ ├── folderref0 │ │ │ ├── 0.asset │ │ │ └── folderref0-0 │ │ │ │ ├── 0.asset │ │ │ │ └── 0.bundle │ │ │ │ └── 0.asset │ │ └── ihavehiddenfile │ │ │ └── .hidden │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── SpecialCharactersJSONTest.json │ ├── Default.png │ ├── utf8.txt │ ├── Default@2x.png │ ├── stringData.bin │ ├── Default-568h@2x.png │ ├── data.json │ ├── Localizable.strings │ ├── main.m │ ├── update.plist │ ├── FoundationTests-Prefix.pch │ ├── FoundationTestsActivity.java │ ├── FoundationTestsActivity.m │ ├── AndroidManifest.xml │ ├── ATestPlist.plist │ ├── FoundationTests-Info.plist │ └── FoundationTestsAndroid-Info.plist ├── README.md ├── src │ ├── NSStringTests+ExternalSymbols.m │ ├── NSNullTests.m │ ├── NSAttributedStringHelper.h │ ├── NSAttributedStringHelper.m │ ├── ConnectionDelegate.h │ ├── NSBlockTests.m │ ├── NSThreadTests.m │ ├── NSPointerFunctionsTests.m │ └── NSLocaleTests.m └── FoundationTestsMac │ └── FoundationTestsMac-Prefix.pch ├── .gitignore ├── System ├── CoreFoundation │ ├── src │ │ ├── MakefileVersion │ │ ├── pthread │ │ │ └── private.h │ │ ├── CFUnicodeData-B.mapping │ │ ├── CFUnicodeData-L.mapping │ │ ├── CFCharacterSetBitmaps.bitmap │ │ ├── CFUniCharPropertyDatabase.data │ │ ├── NSMethodSignatureInternal.h │ │ ├── NSZombie.m │ │ ├── NSZombie.h │ │ ├── NSGenericDeallocHandler.h │ │ ├── NSInvocationInternal.h │ │ ├── _CFUtilities.h │ │ ├── NSMessageBuilder.h │ │ ├── NSConstantString.m │ │ ├── NSObjCRuntimeInternal.h │ │ ├── CFStubs.m │ │ ├── Info.plist │ │ ├── NSNull.m │ │ ├── NSSharedKeySet.h │ │ ├── PropertyList.dtd │ │ ├── NSGenericDeallocHandler.m │ │ ├── NSSharedKeyDictionary.h │ │ ├── NSCFType.m │ │ ├── NSEnumerator.m │ │ ├── CFVersion.c │ │ └── CFUtilities.h │ ├── include │ │ └── CoreFoundation │ │ │ ├── CFArray.h │ │ │ ├── CFBag.h │ │ │ ├── CFBase.h │ │ │ ├── CFData.h │ │ │ ├── CFDate.h │ │ │ ├── CFError.h │ │ │ ├── CFSet.h │ │ │ ├── CFTree.h │ │ │ ├── CFURL.h │ │ │ ├── CFUUID.h │ │ │ ├── CFBundle.h │ │ │ ├── CFLocale.h │ │ │ ├── CFNumber.h │ │ │ ├── CFPlugIn.h │ │ │ ├── CFRunLoop.h │ │ │ ├── CFSocket.h │ │ │ ├── CFStream.h │ │ │ ├── CFString.h │ │ │ ├── CFXMLNode.h │ │ │ ├── CFBinaryHeap.h │ │ │ ├── CFBitVector.h │ │ │ ├── CFByteOrder.h │ │ │ ├── CFCalendar.h │ │ │ ├── CFDictionary.h │ │ │ ├── CFMachPort.h │ │ │ ├── CFPlugInCOM.h │ │ │ ├── CFTimeZone.h │ │ │ ├── CFURLAccess.h │ │ │ ├── CFUtilities.h │ │ │ ├── CFXMLParser.h │ │ │ ├── CFAvailability.h │ │ │ ├── CFCharacterSet.h │ │ │ ├── CFFileSecurity.h │ │ │ ├── CFMessagePort.h │ │ │ ├── CFPreferences.h │ │ │ ├── CFPropertyList.h │ │ │ ├── CoreFoundation.h │ │ │ ├── CFDateFormatter.h │ │ │ ├── CFFileDescriptor.h │ │ │ ├── CFNumberFormatter.h │ │ │ ├── CFStringTokenizer.h │ │ │ ├── CFURLEnumerator.h │ │ │ ├── CFAttributedString.h │ │ │ ├── CFStringEncodingExt.h │ │ │ ├── CFUserNotification.h │ │ │ └── CFNotificationCenter.h │ ├── CoreFoundation │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── CoreFoundation-Info.plist │ └── CoreFoundation.xcodeproj │ │ └── xcuserdata │ │ └── paulb.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── CFNetwork │ ├── include │ │ └── CFNetwork │ │ │ ├── CFHost.h │ │ │ ├── CFNetwork.h │ │ │ ├── CFFTPStream.h │ │ │ ├── CFHTTPMessage.h │ │ │ ├── CFHTTPStream.h │ │ │ ├── CFNetServices.h │ │ │ ├── CFNetworkDefs.h │ │ │ ├── CFSocketStream.h │ │ │ ├── CFNetDiagnostics.h │ │ │ └── CFHTTPAuthentication.h │ ├── CFNetwork │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── CFNetwork-Info.plist │ ├── src │ │ ├── PACSupport.js │ │ ├── Headers │ │ │ ├── CFHost.h │ │ │ ├── CFNetwork.h │ │ │ ├── CFFTPStream.h │ │ │ ├── CFHTTPStream.h │ │ │ ├── CFHostPriv.h │ │ │ ├── CFServerPriv.h │ │ │ ├── CFHTTPMessage.h │ │ │ ├── CFNetServices.h │ │ │ ├── CFNetworkDefs.h │ │ │ ├── CFNetworkPriv.h │ │ │ ├── CFSocketStream.h │ │ │ ├── CFFTPStreamPriv.h │ │ │ ├── CFHTTPMessagePriv.h │ │ │ ├── CFHTTPServerPriv.h │ │ │ ├── CFHTTPStreamPriv.h │ │ │ ├── CFNetDiagnostics.h │ │ │ ├── CFNetServicesPriv.h │ │ │ ├── CFSocketStreamPriv.h │ │ │ ├── CFHTTPAuthentication.h │ │ │ ├── CFHTTPConnectionPriv.h │ │ │ └── CFNetDiagnosticsPriv.h │ │ ├── URL │ │ │ └── _CFURLAccess.c │ │ ├── HTTP │ │ │ └── SPNEGO │ │ │ │ └── spnegoDER.h │ │ ├── English.lproj │ │ │ ├── InfoPlist.strings │ │ │ └── Localizable.strings │ │ ├── Utils │ │ │ ├── CFRuntimeUtils.h │ │ │ ├── CFRuntimeUtils.c │ │ │ └── CFHTTPUtils.h │ │ └── resolv_stub.c │ ├── private_include │ │ └── CFNetwork │ │ │ ├── CFURLCredential.h │ │ │ ├── CFURLAuthChallenge.h │ │ │ ├── CFHTTPCookieStorage.h │ │ │ └── CFHTTPCookie.h │ └── CFNetwork.xcodeproj │ │ └── xcuserdata │ │ └── paulb.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── Foundation │ ├── src │ │ ├── NSLogInternal.h │ │ ├── NSCFType.h │ │ ├── NSErrorInternal.h │ │ ├── NSRunLoopModesInternal.h │ │ ├── NSBOMEncoding.h │ │ ├── NSLikePredicateOperator.h │ │ ├── build-predicate-parser.sh │ │ ├── NSURLCredentialInternal.h │ │ ├── NSObjCRuntimeInternal.h │ │ ├── NSTokenMatchingPredicateOperator.h │ │ ├── NSBetweenPredicateOperator.h │ │ ├── NSFileCoordinator.m │ │ ├── NSFileManagerInternal.h │ │ ├── NSURLCredential.m │ │ ├── NSURLProtectionSpaceInternal.h │ │ ├── NSCustomPredicateOperator.h │ │ ├── _NSFileIO.h │ │ ├── NSKeyedArchiverInternal.h │ │ ├── NSURLAuthenticationChallengeInternal.h │ │ ├── NSXPCCoder.m │ │ ├── NSKeyValueObservationInfo.h │ │ ├── NSInPredicateOperator.h │ │ ├── NSNotificationInternal.h │ │ ├── NSStringPredicateOperator.h │ │ ├── NSFastEnumerationEnumerator.h │ │ ├── NSMatchingPredicateOperator.h │ │ ├── NSURLCredentialStorage.m │ │ ├── NSURLRequestInternal.h │ │ ├── NSThreadInternal.h │ │ ├── NSURLCacheInternal.h │ │ ├── NSCompoundPredicateOperator.h │ │ ├── NSHTTPCookie+private.h │ │ ├── NSSpellCheckingResult.h │ │ ├── NSNestedDictionary.h │ │ ├── NSEqualityPredicateOperator.h │ │ ├── NSComparisonPredicateOperator.h │ │ ├── NSLikePredicateOperator.m │ │ ├── NSKeyValueComputedProperty.h │ │ ├── NSURLSession.m │ │ ├── NSUUIDInternal.h │ │ ├── NSURLError.m │ │ ├── NSSubstringPredicateOperator.h │ │ ├── NSProgress.m │ │ ├── NSMutableStringProxyForMutableAttributedStringInternal.h │ │ ├── NSSpellCheckingResult.m │ │ ├── NSLinkCheckingResult.h │ │ ├── NSGrammarCheckingResult.h │ │ ├── NSTimeZone.m │ │ ├── NSFilesystemItemRemoveOperation.h │ │ ├── NSObjectInternal.m │ │ ├── NSUbiquitousKeyValueStoreInternal.h │ │ ├── NSDataDetector.m │ │ ├── NSOrthographyCheckingResult.h │ │ ├── _NSPredicateOperatorUtilities.h │ │ ├── NSKeyValueNestedProperty.h │ │ ├── NSKeyValueUnnestedProperty.h │ │ ├── NSLocalizableString.h │ │ ├── NSRunLoopModes.m │ │ ├── NSLinkCheckingResult.m │ │ ├── NSAddressCheckingResult.h │ │ ├── NSKeyValueContainerClass.h │ │ ├── NSTransitInformationCheckingResult.h │ │ ├── NSPhoneNumberCheckingResult.h │ │ ├── NSURLProtocolInternal.h │ │ ├── NSGrammarCheckingResult.m │ │ ├── NSOrthographyCheckingResult.m │ │ ├── NSDateInternal.h │ │ ├── NSTimerInternal.h │ │ ├── NSConcreteScanner.h │ │ ├── NSKeyValueObservance.h │ │ ├── NSURLInternal.h │ │ ├── NSURLResponseInternal.h │ │ ├── NSSubstitutionCheckingResult.h │ │ ├── NSAutoreleasePool.m │ │ ├── NSFileAttributes.h │ │ ├── NSAddressCheckingResult.m │ │ ├── NSRangeCheck.h │ │ ├── NSTransitInformationCheckingResult.m │ │ ├── NSMutableStringProxyForMutableAttributedString.m │ │ ├── NSPlatform.m │ │ ├── NSPhoneNumberCheckingResult.m │ │ ├── NSLocaleInternal.h │ │ ├── NSSubstitutionCheckingResult.m │ │ ├── NSCharacterSetInternal.h │ │ ├── NSKeyValueChangeDictionary.h │ │ ├── NSKeyValueObservationInfo.m │ │ ├── NSOrderedSetInternal.h │ │ ├── NSPointerArrayInternal.h │ │ ├── NSDate.m │ │ ├── NSJSONSerializationInternal.h │ │ ├── NSKeyValueContainerClass.m │ │ ├── NSTimeZoneInternal.h │ │ ├── NSBOMEncoding.m │ │ ├── NSValueTransformerInternal.h │ │ ├── NSDirectoryEnumerator.h │ │ └── CFInternal.h │ ├── Foundation │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── Foundation-Info.plist │ ├── include │ │ └── Foundation │ │ │ ├── NSNull.h │ │ │ ├── NSAutoreleasePool.h │ │ │ ├── NSProgress.h │ │ │ ├── NSUUID.h │ │ │ ├── NSMethodSignature.h │ │ │ ├── NSEnumerator.h │ │ │ ├── NSProxy.h │ │ │ ├── NSCompoundPredicate.h │ │ │ ├── NSIndexPath.h │ │ │ ├── NSInvocation.h │ │ │ ├── NSValueTransformer.h │ │ │ ├── NSURLCredentialStorage.h │ │ │ ├── NSOrthography.h │ │ │ ├── NSCache.h │ │ │ ├── NSURLResponse.h │ │ │ ├── NSFormatter.h │ │ │ ├── NSNotificationQueue.h │ │ │ ├── NSJSONSerialization.h │ │ │ ├── NSProcessInfo.h │ │ │ ├── NSTimer.h │ │ │ ├── NSHTTPCookieStorage.h │ │ │ ├── NSPointerArray.h │ │ │ ├── NSRange.h │ │ │ ├── NSNotification.h │ │ │ ├── NSLock.h │ │ │ ├── NSSortDescriptor.h │ │ │ ├── NSScanner.h │ │ │ ├── NSURLCredential.h │ │ │ ├── NSURLAuthenticationChallenge.h │ │ │ ├── NSURLCache.h │ │ │ ├── NSHTTPCookie.h │ │ │ ├── NSByteCountFormatter.h │ │ │ ├── NSFileVersion.h │ │ │ ├── NSPredicate.h │ │ │ ├── NSFilePresenter.h │ │ │ └── NSMapTable.h │ └── Foundation.xcodeproj │ │ └── xcuserdata │ │ └── paulb.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── ApportableSystemFramework.xcconfig ├── ApportableSDKOverrides.xcconfig ├── ApportableSystemRelease.xcconfig ├── v │ └── src │ │ └── memtrace.h └── ApportableSystem.xcconfig ├── docs ├── images │ ├── sb │ │ ├── edit.png │ │ ├── ls.png │ │ ├── scheme.png │ │ ├── edit-app.png │ │ ├── run-log.png │ │ └── breakpoint.png │ ├── hello │ │ ├── nslog.png │ │ ├── printf.png │ │ ├── breakpoint.png │ │ ├── pre-connect.png │ │ ├── name-project.png │ │ ├── post-connect.png │ │ ├── create-project.png │ │ └── new-jni-project.png │ └── tests │ │ ├── test-results.png │ │ ├── android-scheme.png │ │ └── ios-test-results.png ├── tests.md └── hello.md ├── XcodeTemplates └── JNI Application.xctemplate │ ├── TemplateIcon.icns │ ├── ___PACKAGENAMEASIDENTIFIER___Activity.m │ ├── ___PACKAGENAMEASIDENTIFIER___Activity.java │ └── AndroidManifest.xml ├── authors.md └── CONTRIBUTING.md /tests/FoundationTests/NSBundleTests/0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/0.bundle/0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/folderref0/0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | FoundationTests 2 | =============== 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata/ 2 | *.xcworkspace/ 3 | **/.gitignore 4 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/MakefileVersion: -------------------------------------------------------------------------------- 1 | VERSION=855.11 2 | -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/ihavehiddenfile/.hidden: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/0.bundle/0-0.bundle/0-0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/folderref0/folderref0-0/0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFHost.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFHost.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFArray.h: -------------------------------------------------------------------------------- 1 | ../../src/CFArray.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFBag.h: -------------------------------------------------------------------------------- 1 | ../../src/CFBag.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFBase.h: -------------------------------------------------------------------------------- 1 | ../../src/CFBase.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFData.h: -------------------------------------------------------------------------------- 1 | ../../src/CFData.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFDate.h: -------------------------------------------------------------------------------- 1 | ../../src/CFDate.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFError.h: -------------------------------------------------------------------------------- 1 | ../../src/CFError.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFSet.h: -------------------------------------------------------------------------------- 1 | ../../src/CFSet.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFTree.h: -------------------------------------------------------------------------------- 1 | ../../src/CFTree.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFURL.h: -------------------------------------------------------------------------------- 1 | ../../src/CFURL.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFUUID.h: -------------------------------------------------------------------------------- 1 | ../../src/CFUUID.h -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFNetwork.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFNetwork.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFBundle.h: -------------------------------------------------------------------------------- 1 | ../../src/CFBundle.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFLocale.h: -------------------------------------------------------------------------------- 1 | ../../src/CFLocale.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFNumber.h: -------------------------------------------------------------------------------- 1 | ../../src/CFNumber.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFPlugIn.h: -------------------------------------------------------------------------------- 1 | ../../src/CFPlugIn.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFRunLoop.h: -------------------------------------------------------------------------------- 1 | ../../src/CFRunLoop.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFSocket.h: -------------------------------------------------------------------------------- 1 | ../../src/CFSocket.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFStream.h: -------------------------------------------------------------------------------- 1 | ../../src/CFStream.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFString.h: -------------------------------------------------------------------------------- 1 | ../../src/CFString.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFXMLNode.h: -------------------------------------------------------------------------------- 1 | ../../src/CFXMLNode.h -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/folderref0/folderref0-0/0.bundle/0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFFTPStream.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFFTPStream.h -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFHTTPMessage.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFHTTPMessage.h -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFHTTPStream.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFHTTPStream.h -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFNetServices.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFNetServices.h -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFNetworkDefs.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFNetworkDefs.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFBinaryHeap.h: -------------------------------------------------------------------------------- 1 | ../../src/CFBinaryHeap.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFBitVector.h: -------------------------------------------------------------------------------- 1 | ../../src/CFBitVector.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFByteOrder.h: -------------------------------------------------------------------------------- 1 | ../../src/CFByteOrder.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFCalendar.h: -------------------------------------------------------------------------------- 1 | ../../src/CFCalendar.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFDictionary.h: -------------------------------------------------------------------------------- 1 | ../../src/CFDictionary.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFMachPort.h: -------------------------------------------------------------------------------- 1 | ../../src/CFMachPort.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFPlugInCOM.h: -------------------------------------------------------------------------------- 1 | ../../src/CFPlugInCOM.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFTimeZone.h: -------------------------------------------------------------------------------- 1 | ../../src/CFTimeZone.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFURLAccess.h: -------------------------------------------------------------------------------- 1 | ../../src/CFURLAccess.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFUtilities.h: -------------------------------------------------------------------------------- 1 | ../../src/CFUtilities.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFXMLParser.h: -------------------------------------------------------------------------------- 1 | ../../src/CFXMLParser.h -------------------------------------------------------------------------------- /tests/FoundationTests/NSBundleTests/0.bundle/0-0.bundle/0-0-0.bundle/0-0-0.asset: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFSocketStream.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFSocketStream.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFAvailability.h: -------------------------------------------------------------------------------- 1 | ../../src/CFAvailability.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFCharacterSet.h: -------------------------------------------------------------------------------- 1 | ../../src/CFCharacterSet.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFFileSecurity.h: -------------------------------------------------------------------------------- 1 | ../../src/CFFileSecurity.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFMessagePort.h: -------------------------------------------------------------------------------- 1 | ../../src/CFMessagePort.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFPreferences.h: -------------------------------------------------------------------------------- 1 | ../../src/CFPreferences.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFPropertyList.h: -------------------------------------------------------------------------------- 1 | ../../src/CFPropertyList.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CoreFoundation.h: -------------------------------------------------------------------------------- 1 | ../../src/CoreFoundation.h -------------------------------------------------------------------------------- /System/Foundation/src/NSLogInternal.h: -------------------------------------------------------------------------------- 1 | const char *_NSPrintForDebugger(id object); 2 | -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFNetDiagnostics.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFNetDiagnostics.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFDateFormatter.h: -------------------------------------------------------------------------------- 1 | ../../src/CFDateFormatter.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFFileDescriptor.h: -------------------------------------------------------------------------------- 1 | ../../src/CFFileDescriptor.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFNumberFormatter.h: -------------------------------------------------------------------------------- 1 | ../../src/CFNumberFormatter.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFStringTokenizer.h: -------------------------------------------------------------------------------- 1 | ../../src/CFStringTokenizer.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFURLEnumerator.h: -------------------------------------------------------------------------------- 1 | ../../src/CFURLEnumerator.h -------------------------------------------------------------------------------- /System/CFNetwork/include/CFNetwork/CFHTTPAuthentication.h: -------------------------------------------------------------------------------- 1 | ../../src/Headers/CFHTTPAuthentication.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFAttributedString.h: -------------------------------------------------------------------------------- 1 | ../../src/CFAttributedString.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFStringEncodingExt.h: -------------------------------------------------------------------------------- 1 | ../../src/CFStringEncodingExt.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFUserNotification.h: -------------------------------------------------------------------------------- 1 | ../../src/CFUserNotification.h -------------------------------------------------------------------------------- /System/CoreFoundation/include/CoreFoundation/CFNotificationCenter.h: -------------------------------------------------------------------------------- 1 | ../../src/CFNotificationCenter.h -------------------------------------------------------------------------------- /docs/images/sb/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/sb/edit.png -------------------------------------------------------------------------------- /docs/images/sb/ls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/sb/ls.png -------------------------------------------------------------------------------- /tests/FoundationTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /System/CFNetwork/CFNetwork/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /System/Foundation/Foundation/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /docs/images/sb/scheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/sb/scheme.png -------------------------------------------------------------------------------- /docs/images/hello/nslog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/nslog.png -------------------------------------------------------------------------------- /docs/images/hello/printf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/printf.png -------------------------------------------------------------------------------- /docs/images/sb/edit-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/sb/edit-app.png -------------------------------------------------------------------------------- /docs/images/sb/run-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/sb/run-log.png -------------------------------------------------------------------------------- /tests/FoundationTests/SpecialCharactersJSONTest.json: -------------------------------------------------------------------------------- 1 | { 2 | "crazyCharacters": "Hello,\n“foo bar.”\n" 3 | } -------------------------------------------------------------------------------- /System/CoreFoundation/CoreFoundation/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /docs/images/sb/breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/sb/breakpoint.png -------------------------------------------------------------------------------- /System/CoreFoundation/src/pthread/private.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern pthread_t pthread_main_thread_np(); 4 | -------------------------------------------------------------------------------- /docs/images/hello/breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/breakpoint.png -------------------------------------------------------------------------------- /docs/images/hello/pre-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/pre-connect.png -------------------------------------------------------------------------------- /tests/FoundationTests/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/tests/FoundationTests/Default.png -------------------------------------------------------------------------------- /tests/FoundationTests/utf8.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetür adipisicing élit, sed do eiusmod tempor incididunt. -------------------------------------------------------------------------------- /System/CFNetwork/src/PACSupport.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/PACSupport.js -------------------------------------------------------------------------------- /System/Foundation/src/NSCFType.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface __NSCFType : NSObject 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /docs/images/hello/name-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/name-project.png -------------------------------------------------------------------------------- /docs/images/hello/post-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/post-connect.png -------------------------------------------------------------------------------- /docs/images/tests/test-results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/tests/test-results.png -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHost.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHost.h -------------------------------------------------------------------------------- /docs/images/hello/create-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/create-project.png -------------------------------------------------------------------------------- /docs/images/hello/new-jni-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/hello/new-jni-project.png -------------------------------------------------------------------------------- /docs/images/tests/android-scheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/tests/android-scheme.png -------------------------------------------------------------------------------- /docs/images/tests/ios-test-results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/docs/images/tests/ios-test-results.png -------------------------------------------------------------------------------- /tests/FoundationTests/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/tests/FoundationTests/Default@2x.png -------------------------------------------------------------------------------- /tests/FoundationTests/stringData.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/tests/FoundationTests/stringData.bin -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetwork.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetwork.h -------------------------------------------------------------------------------- /System/CFNetwork/src/URL/_CFURLAccess.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/URL/_CFURLAccess.c -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFFTPStream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFFTPStream.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPStream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPStream.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHostPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHostPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFServerPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFServerPriv.h -------------------------------------------------------------------------------- /tests/FoundationTests/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/tests/FoundationTests/Default-568h@2x.png -------------------------------------------------------------------------------- /System/CFNetwork/src/HTTP/SPNEGO/spnegoDER.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/HTTP/SPNEGO/spnegoDER.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPMessage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPMessage.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetServices.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetServices.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetworkDefs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetworkDefs.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetworkPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetworkPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFSocketStream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFSocketStream.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFFTPStreamPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFFTPStreamPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPMessagePriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPMessagePriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPServerPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPServerPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPStreamPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPStreamPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetDiagnostics.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetDiagnostics.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetServicesPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetServicesPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFSocketStreamPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFSocketStreamPriv.h -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFUnicodeData-B.mapping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CoreFoundation/src/CFUnicodeData-B.mapping -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFUnicodeData-L.mapping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CoreFoundation/src/CFUnicodeData-L.mapping -------------------------------------------------------------------------------- /System/Foundation/src/NSErrorInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSError (Internal) 4 | + (NSError *)_outOfMemoryError; 5 | @end 6 | -------------------------------------------------------------------------------- /System/Foundation/src/NSRunLoopModesInternal.h: -------------------------------------------------------------------------------- 1 | @class NSString; 2 | 3 | extern NSString *NSDefaultRunLoopMode; 4 | extern NSString *NSRunLoopCommonModes; 5 | -------------------------------------------------------------------------------- /System/CFNetwork/src/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPAuthentication.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPAuthentication.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFHTTPConnectionPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFHTTPConnectionPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/Headers/CFNetDiagnosticsPriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/Headers/CFNetDiagnosticsPriv.h -------------------------------------------------------------------------------- /System/CFNetwork/src/English.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CFNetwork/src/English.lproj/Localizable.strings -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFCharacterSetBitmaps.bitmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CoreFoundation/src/CFCharacterSetBitmaps.bitmap -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFUniCharPropertyDatabase.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/System/CoreFoundation/src/CFUniCharPropertyDatabase.data -------------------------------------------------------------------------------- /XcodeTemplates/JNI Application.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apportable/Foundation/HEAD/XcodeTemplates/JNI Application.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSNull.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSNull : NSObject 4 | 5 | + (NSNull *)null; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /System/Foundation/src/NSBOMEncoding.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | void _NSDetectEncodingFromBOM(uint32_t BOM, NSStringEncoding *encoding, NSUInteger *length) CF_PRIVATE; 4 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSMethodSignatureInternal.h: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | NSUInteger size; 3 | NSUInteger alignment; 4 | size_t offset; 5 | char *type; 6 | } NSMethodType; 7 | -------------------------------------------------------------------------------- /System/Foundation/src/NSLikePredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSMatchingPredicateOperator.h" 2 | 3 | CF_PRIVATE 4 | @interface NSLikePredicateOperator : NSMatchingPredicateOperator 5 | @end 6 | -------------------------------------------------------------------------------- /tests/FoundationTests/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": 0, 3 | "key" : ["a value", "another value"], 4 | "decimals" : 1.34, 5 | "number" : 2384, 6 | "dictionary" : {"oneKey": -1.2} 7 | } -------------------------------------------------------------------------------- /System/Foundation/src/build-predicate-parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | yacc NSPredicateParser.ym 4 | lex NSPredicateLexer.lm 5 | sed -i '' 's/^#line/\/\/ &/' NSPredicateLexer.m NSPredicateParser.tab.c 6 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLCredentialInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSURLCredential (Internal) 4 | - (id)_initWithCFURLCredential:(CFURLCredentialRef)cfspace; 5 | @end 6 | -------------------------------------------------------------------------------- /System/Foundation/Foundation.xcodeproj/xcuserdata/paulb.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /System/Foundation/src/NSObjCRuntimeInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | Class NSClassFromObject(id object); 4 | id NSAutoreleaseObject(id obj); 5 | NSString *_NSNewStringFromCString(const char *cString); 6 | -------------------------------------------------------------------------------- /tests/src/NSStringTests+ExternalSymbols.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+ExternalSymbols.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | NSString *const externalFoo = @"foo"; 9 | -------------------------------------------------------------------------------- /System/Foundation/src/NSTokenMatchingPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSStringPredicateOperator.h" 2 | 3 | #define NSTokenMatchingPredicateOperatorType 1000 4 | 5 | CF_PRIVATE 6 | @interface NSTokenMatchingPredicateOperator : NSStringPredicateOperator 7 | @end 8 | -------------------------------------------------------------------------------- /tests/FoundationTestsMac/FoundationTestsMac-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FoundationTestsMac' target in the 'FoundationTestsMac' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /System/Foundation/src/NSBetweenPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | CF_PRIVATE 4 | @interface NSBetweenPredicateOperator : NSPredicateOperator 5 | - (BOOL)performPrimitiveOperationUsingObject:(id)obj andObject:(NSArray *)array; 6 | @end 7 | -------------------------------------------------------------------------------- /tests/FoundationTests/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | FoundationTests 4 | 5 | Created by Glenna Buford on 12/4/13. 6 | Copyright (c) 2013 Apportable. All rights reserved. 7 | */ 8 | 9 | 10 | "Hello,\n“foo bar.”\n" = "Hello,\n“foo bar.”\n"; -------------------------------------------------------------------------------- /System/Foundation/src/NSFileCoordinator.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileCoordinator.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @implementation NSFileCoordinator 11 | @end 12 | -------------------------------------------------------------------------------- /System/Foundation/src/NSFileManagerInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString; 4 | 5 | @interface NSFileManager (Internal) 6 | - (BOOL)getFileSystemRepresentation:(char *)buffer maxLength:(NSUInteger)maxLength withPath:(NSString *)path; 7 | @end 8 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLCredential.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLCredential.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @implementation NSURLCredential 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLProtectionSpaceInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NSURLProtectionSpace (Internal) 5 | - (id)_initWithCFURLProtectionSpace:(CFURLProtectionSpaceRef)cfspace; 6 | @end 7 | -------------------------------------------------------------------------------- /System/Foundation/src/NSCustomPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | CF_PRIVATE 4 | @interface NSCustomPredicateOperator : NSPredicateOperator 5 | 6 | - (id)initWithCustomSelector:(SEL)customSelector modifier:(NSComparisonPredicateModifier)modifier; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSZombie.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSZombie.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSZombie.h" 9 | 10 | @implementation _NSZombie_ 11 | 12 | + (void)initialize 13 | { 14 | 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSAutoreleasePool.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_AUTOMATED_REFCOUNT_UNAVAILABLE 4 | @interface NSAutoreleasePool : NSObject 5 | 6 | + (void)addObject:(id)anObject; 7 | - (void)addObject:(id)anObject; 8 | - (void)drain; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /System/Foundation/src/_NSFileIO.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | void *_NSReadBytesFromFile(NSString *path, NSDataReadingOptions readOptionsMask, NSUInteger *length, BOOL *vm, NSError **err) CF_PRIVATE; 4 | BOOL _NSWriteBytesToFile(NSData *data, id pathOrURL, NSDataWritingOptions options, NSError **errorPtr) CF_PRIVATE; 5 | -------------------------------------------------------------------------------- /System/CFNetwork/src/Utils/CFRuntimeUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef __CFRUNTIMEUTILS__ 2 | #define __CFRUNTIMEUTILS__ 3 | 4 | #include "CFRuntime.h" 5 | 6 | CF_EXTERN_C_BEGIN 7 | 8 | CF_EXPORT void _CFRuntimeRegisterClassOnce(CFTypeID* typeID, const CFRuntimeClass* cls); 9 | 10 | CF_EXTERN_C_END 11 | 12 | #endif // __CFRUNTIMEUTILS__ 13 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSZombie.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #define ZOMBIE_PREFIX "_NSZombie_" 5 | 6 | extern uint8_t __CFZombieEnabled; 7 | extern uint8_t __CFDeallocateZombies; 8 | 9 | NS_ROOT_CLASS 10 | @interface _NSZombie_ { 11 | Class isa; 12 | } 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyedArchiverInternal.h: -------------------------------------------------------------------------------- 1 | #import "NSKeyedArchiver.h" 2 | 3 | @interface NSKeyedArchiver (Internal) 4 | 5 | - (void)_encodePropertyList:(id)plistObject forKey:(NSString *)key; 6 | 7 | @end 8 | 9 | @interface NSKeyedUnarchiver (Internal) 10 | 11 | - (id)_decodePropertyListForKey:(NSString *)key; 12 | 13 | @end -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSProgress.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSProgress : NSObject 4 | 5 | + (id)currentProgress; 6 | + (id)progressWithTotalUnitCount:(int64_t)unitCount; 7 | 8 | @property(readonly, getter=isCancelled) BOOL cancelled; 9 | @property int64_t completedUnitCount; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLAuthenticationChallengeInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NSURLConnectionInternal.h" 3 | 4 | @interface NSURLAuthenticationChallenge (Internal) 5 | - (id)_initWithCFAuthChallenge:(CFURLAuthChallengeRef)cfchallenge sender:(id)sender; 6 | @end 7 | -------------------------------------------------------------------------------- /System/Foundation/src/NSXPCCoder.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSXPCCoder.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSCoderInternal.h" 9 | 10 | @implementation NSXPCCoder 11 | 12 | - (void)dealloc 13 | { 14 | [_userInfo release]; 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /System/ApportableSystemFramework.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ApportableSystem.xcconfig 3 | // 4 | // Created by Paul Beusterien on 5/7/14. 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | SDKROOT = apportablesdk1.0 9 | 10 | #include "ApportableSDKOverrides.xcconfig" 11 | 12 | INSTALL_PATH = /System/Library/Frameworks 13 | 14 | -------------------------------------------------------------------------------- /System/CFNetwork/private_include/CFNetwork/CFURLCredential.h: -------------------------------------------------------------------------------- 1 | #ifndef __CFURLCREDENTIAL__ 2 | #define __CFURLCREDENTIAL__ 3 | 4 | #include 5 | 6 | #if PRAGMA_ONCE 7 | #pragma once 8 | #endif 9 | 10 | __BEGIN_DECLS 11 | 12 | typedef struct _CFURLCredential *CFURLCredentialRef; 13 | 14 | __END_DECLS 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /System/ApportableSDKOverrides.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ApportableSDKOverrides.xcconfig 3 | // 4 | // Created by Paul Beusterien on 7/30/14. 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | SDKROOT = sbandroid 9 | SDK_INSTALL_PATH = /Application Support/Developer/Shared/Xcode/Platforms/Android.platform/Developer/SDKs/SBAndroid.sdk/ 10 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueObservationInfo.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray, NSKeyValueObservance; 4 | 5 | CF_PRIVATE 6 | @interface NSKeyValueObservationInfo : NSObject 7 | - (NSArray *)observances; 8 | - (void)addObservance:(NSKeyValueObservance *)observance; 9 | - (void)removeObservance:(NSKeyValueObservance *)observance; 10 | @end 11 | -------------------------------------------------------------------------------- /System/ApportableSystemRelease.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ApportableSystem.xcconfig 3 | // 4 | // Created by Paul Beusterien on 7/15/14. 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #include "ApportableSystem.xcconfig" 9 | 10 | DEPLOYMENT_POSTPROCESSING = YES # Run strip on release builds 11 | ONLY_ACTIVE_ARCH = YES # Fat binaries not supported yet 12 | -------------------------------------------------------------------------------- /System/Foundation/src/NSInPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | @interface NSInPredicateOperator : NSPredicateOperator 4 | 5 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier options:(NSComparisonPredicateOptions)options; 6 | - (NSComparisonPredicateOptions)flags; 7 | - (id)stringVersion; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /System/Foundation/src/NSNotificationInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | CF_PRIVATE 4 | @interface NSConcreteNotification : NSNotification 5 | + (id)newTempNotificationWithName:(NSString *)name object:(id)anObject userInfo:(NSDictionary *)aUserInfo; 6 | - (id)initWithName:(NSString *)name object:(id)anObject userInfo:(NSDictionary *)aUserInfo; 7 | - (void)recycle; 8 | @end 9 | -------------------------------------------------------------------------------- /System/Foundation/src/NSStringPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | @interface NSStringPredicateOperator : NSPredicateOperator 4 | 5 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier variant:(NSUInteger)variant; 6 | - (NSComparisonPredicateOptions)flags; 7 | - (NSString *)_modifierString; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /tests/FoundationTests/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ApportableTests 4 | // 5 | // Created by George Kulakowski on 8/2/13. 6 | // Copyright (c) 2013 Apportable. All rights reserved. 7 | // 8 | 9 | #import "FoundationTests.h" 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | @autoreleasepool { 14 | runFoundationTests(); 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /System/Foundation/src/NSFastEnumerationEnumerator.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "ForFoundationOnly.h" 3 | 4 | @interface __NSFastEnumerationEnumerator : NSEnumerator { 5 | @package 6 | id _obj; 7 | id _origObj; 8 | NSUInteger _count; 9 | NSUInteger _mut; 10 | } 11 | 12 | - (id)initWithObject:(id)object; 13 | @end 14 | -------------------------------------------------------------------------------- /System/Foundation/src/NSMatchingPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSStringPredicateOperator.h" 2 | 3 | #import 4 | 5 | struct regexContext { 6 | NSString *_field1; 7 | URegularExpression *_field2; 8 | }; 9 | 10 | CF_PRIVATE 11 | @interface NSMatchingPredicateOperator : NSStringPredicateOperator 12 | 13 | - (BOOL)_shouldEscapeForLike; 14 | - (void)_clearContext; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLCredentialStorage.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLCredentialStorage.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | NSString *const NSURLCredentialStorageChangedNotification = @"NSURLCredentialStorageChangedNotification"; 11 | 12 | @implementation NSURLCredentialStorage 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLRequestInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NSURLRequest () 5 | - (id)_initWithCFURLRequest:(CFURLRequestRef)req; 6 | - (CFURLRequestRef)_CFURLRequest; 7 | @end 8 | 9 | CF_PRIVATE 10 | @interface NSURLRequestInternal : NSObject { 11 | @public 12 | CFURLRequestRef request; 13 | } 14 | 15 | - (void)dealloc; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSGenericDeallocHandler.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | void _NSSetDeallocHandler(id object, void (^block)(void)); 4 | 5 | __attribute__((visibility("hidden"), objc_root_class)) 6 | @interface __NSGenericDeallocHandler { 7 | Class isa; 8 | void (^_block)(void); 9 | } 10 | 11 | + (void)initialize; 12 | - (void)release; 13 | - (NSUInteger)retainCount; 14 | - (id)retain; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSUUID.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface NSUUID : NSObject 6 | 7 | + (id)UUID; 8 | - (id)init; 9 | - (id)initWithUUIDString:(NSString *)string; 10 | - (id)initWithUUIDBytes:(const uuid_t)bytes; 11 | - (void)getUUIDBytes:(uuid_t)uuid; 12 | - (NSString *)UUIDString; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSInvocationInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | // By grabbing at least 4 words for retSize, we can blindly copy r0-r3 4 | // into retdata when returning from an invocation. 5 | #define RET_SIZE_ARGS (4 * sizeof(int)) 6 | 7 | void __invoke__(void *send, void *retdata, marg_list args, size_t len, const char *rettype); 8 | 9 | extern void _CF_forwarding_prep_0(); 10 | extern void _CF_forwarding_prep_1(); -------------------------------------------------------------------------------- /tests/FoundationTests/update.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | promo 6 | 7 | fr 8 | 9 | en 10 | 11 | es 12 | 13 | de 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/FoundationTests/FoundationTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FoundationTests' target in the 'FoundationTests' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSThreadInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | __attribute__((visibility("hidden"))) 5 | @interface _NSThreadPerformInfo : NSObject { 6 | @public 7 | id target; 8 | SEL selector; 9 | id argument; 10 | NSMutableArray *modes; 11 | NSCondition *waiter; 12 | BOOL *signalled; 13 | CFRunLoopSourceRef source; 14 | } 15 | 16 | - (void)dealloc; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/_CFUtilities.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static char *CFStringUTF8Copy(CFStringRef cfString) { 5 | CFIndex length = CFStringGetLength(cfString); 6 | CFIndex size = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8); 7 | char *buffer = (char *)malloc(size); 8 | CFStringGetCString(cfString, buffer, size, kCFStringEncodingUTF8); 9 | return buffer; 10 | } 11 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLCacheInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface NSCachedURLResponse (Internal) 6 | - (id)_initWithCFCachedURLResponse:(CFCachedURLResponseRef)response; 7 | - (CFCachedURLResponseRef)_CFCachedURLResponse; 8 | @end 9 | 10 | @interface NSURLCache (Internal) 11 | - (id)_initWithExistingSharedCFURLCache:(CFURLCacheRef)cache; 12 | - (CFURLCacheRef)_CFURLCache; 13 | @end 14 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSMethodSignature.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSMethodSignature : NSObject 4 | 5 | + (NSMethodSignature *)signatureWithObjCTypes:(const char *)types; 6 | - (NSUInteger)numberOfArguments; 7 | - (const char *)getArgumentTypeAtIndex:(NSUInteger)idx NS_RETURNS_INNER_POINTER; 8 | - (NSUInteger)frameLength; 9 | - (BOOL)isOneway; 10 | - (const char *)methodReturnType NS_RETURNS_INNER_POINTER; 11 | - (NSUInteger)methodReturnLength; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /System/Foundation/src/NSCompoundPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | @class NSDictionary; 4 | 5 | @interface NSCompoundPredicateOperator : NSPredicateOperator 6 | 7 | + (id)notPredicateOperator; 8 | + (id)orPredicateOperator; 9 | + (id)andPredicateOperator; 10 | 11 | - (BOOL)evaluatePredicates:(NSArray *)predicates withObject:(id)object substitutionVariables:(NSDictionary *)variables; 12 | - (BOOL)evaluatePredicates:(NSArray *)predicates withObject:(id)object; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /XcodeTemplates/JNI Application.xctemplate/___PACKAGENAMEASIDENTIFIER___Activity.m: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | //___COPYRIGHT___ 7 | // 8 | 9 | #include 10 | #import 11 | #include 12 | 13 | void Java_com_apportable____PACKAGENAME_______FILEBASENAME____run( JNIEnv* env, jobject thiz ) 14 | { 15 | printf("hello from printf"); 16 | NSLog(@"hello from NSLog"); 17 | } 18 | -------------------------------------------------------------------------------- /System/Foundation/src/NSHTTPCookie+private.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSHTTPCookie+private.h 3 | // Foundation 4 | // 5 | // Created by Sergey Klimov on 4/11/14. 6 | // Copyright (c) 2014 Apportable. All rights reserved. 7 | // 8 | 9 | #ifndef Foundation_NSHTTPCookie_private_h 10 | #define Foundation_NSHTTPCookie_private_h 11 | #import 12 | @interface NSHTTPCookie(Internal) 13 | - (id)initWithCookie:(CFHTTPCookieRef)cookie; 14 | -(CFHTTPCookieRef)privateCookie; 15 | @end 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /System/Foundation/src/NSSpellCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSSpellCheckingResult : NSTextCheckingResult { 4 | NSRange _range; 5 | } 6 | 7 | - (id)initWithRange:(NSRange)range; 8 | - (id)initWithCoder:(NSCoder *)coder; 9 | - (void)encodeWithCoder:(NSCoder *)coder; 10 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 11 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 12 | - (NSRange)range; 13 | - (NSTextCheckingType)resultType; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSMessageBuilder.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | extern id _NSMessageBuilder(id proxy, NSInvocation **inv, SEL _cmd, void *arg); 5 | 6 | NS_ROOT_CLASS 7 | @interface __NSMessageBuilder 8 | { 9 | @public 10 | Class isa; 11 | id _target; 12 | id *_addr; 13 | } 14 | 15 | + (void)initialize; 16 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel; 17 | - (void)forwardInvocation:(NSInvocation *)inv; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /tests/FoundationTests/FoundationTestsActivity.java: -------------------------------------------------------------------------------- 1 | package com.apportable.FoundationTests; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import com.apportable.RuntimeService; 6 | 7 | public class FoundationTestsActivity extends Activity { 8 | @Override 9 | protected void onCreate(final Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | new RuntimeService(this).loadLibraries(); 12 | run(); 13 | } 14 | public native void run(); 15 | } -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSConstantString.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSConstantString.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSStringInternal.h" 9 | 10 | #import 11 | 12 | @implementation __NSCFConstantString 13 | 14 | SINGLETON_RR() 15 | 16 | - (id)copyWithZone:(NSZone *)zone 17 | { 18 | return self; 19 | } 20 | 21 | - (BOOL)isKindOfClass:(Class)cls 22 | { 23 | return cls == objc_lookUpClass("NSString"); 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /System/Foundation/src/NSNestedDictionary.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | CF_PRIVATE 4 | @interface _NSNestedDictionary : NSMutableDictionary { 5 | @public 6 | id _locals; 7 | id _bindings; 8 | } 9 | 10 | - (void)removeObjectForKey:(id)key; 11 | - (void)setObject:(id)object forKey:(id)key; 12 | - (NSEnumerator *)objectEnumerator; 13 | - (NSEnumerator *)keyEnumerator; 14 | - (id)objectForKey:(id)key; 15 | - (NSUInteger)count; 16 | - (id)_recursiveAllValues; 17 | - (id)_recursiveAllKeys; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /System/Foundation/src/NSEqualityPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | @interface NSEqualityPredicateOperator : NSPredicateOperator 4 | 5 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier negate:(BOOL)negate options:(NSComparisonPredicateOptions)options; 6 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier negate:(BOOL)negate; 7 | - (void)setNegation:(BOOL)negation; 8 | - (BOOL)isNegation; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /System/v/src/memtrace.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBV_MEMTRACE_H_ 2 | #define _LIBV_MEMTRACE_H_ 3 | 4 | #include 5 | 6 | LIBV_EXTERN void memory_init(); 7 | LIBV_EXTERN int __memtrace_enabled__; 8 | LIBV_EXTERN int __malloc_verify__; 9 | LIBV_EXTERN int __malloc_fence__; 10 | LIBV_EXTERN int __malloc_scribble__; 11 | LIBV_EXTERN void memtrace_alloc(void *ptr, int size); 12 | LIBV_EXTERN void memtrace_free(void *ptr); 13 | LIBV_EXTERN void memtrace_tic(int level); 14 | LIBV_EXTERN void memtrace_toc(const char *tag, int level); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /docs/tests.md: -------------------------------------------------------------------------------- 1 | Foundation Tests Tutorial 2 | ========================= 3 | 4 | Foundation Tests Tutorial describes how to run a set of unit tests for the Foundation framework. 5 | 6 | 7 | Android 8 | ------- 9 | 10 | * Be familiar with connecting to an Android device. See [Hello Tutorial](hello.md) 11 | * Open tests/FoundationTests.xcodeproj 12 | * Select FoundationTestsAndroid scheme 13 | 14 | ![My text](images/tests/android-scheme.png) 15 | 16 | * Run 17 | 18 | * Note test results in output window 19 | 20 | ![My text](images/tests/test-results.png) 21 | -------------------------------------------------------------------------------- /System/Foundation/src/NSComparisonPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSPredicateOperator.h" 2 | 3 | @interface NSComparisonPredicateOperator : NSPredicateOperator 4 | 5 | - (NSPredicateOperatorType)variant; 6 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier variant:(NSPredicateOperatorType)variant options:(NSComparisonPredicateOptions)options; 7 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier variant:(NSPredicateOperatorType)variant; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /System/Foundation/src/NSLikePredicateOperator.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLikePredicateOperator.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSLikePredicateOperator.h" 9 | 10 | @implementation NSLikePredicateOperator 11 | 12 | - (BOOL)_shouldEscapeForLike 13 | { 14 | return YES; 15 | } 16 | 17 | - (SEL)selector 18 | { 19 | return sel_registerName("like:"); 20 | } 21 | 22 | - (NSString *)symbol 23 | { 24 | return [@"LIKE" stringByAppendingString:[self _modifierString]]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /tests/src/NSNullTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNullTests.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "FoundationTests.h" 9 | 10 | @testcase(NSNull) 11 | 12 | test(NullSingleton) 13 | { 14 | testassert([NSNull null] == [NSNull null]); 15 | return YES; 16 | } 17 | 18 | test(CFNull) 19 | { 20 | testassert([NSNull null] == (id)kCFNull); 21 | return YES; 22 | } 23 | 24 | test(CFNullClass) 25 | { 26 | testassert([(id)kCFNull class] == [NSNull class]); 27 | return YES; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueComputedProperty.h: -------------------------------------------------------------------------------- 1 | #import "NSKeyValueProperty.h" 2 | 3 | @class NSString; 4 | 5 | CF_PRIVATE 6 | @interface NSKeyValueComputedProperty : NSKeyValueProperty 7 | - (NSString *)_keyPathIfAffectedByValueForMemberOfKeys:(NSSet *)keys; 8 | - (NSString *)_keyPathIfAffectedByValueForKey:(NSString *)key exactMatch:(BOOL *)exactMatch; 9 | - (Class)_isaForAutonotifying; 10 | - (void)_addDependentValueKey:(NSString *)key; 11 | - (void)_givenPropertiesBeingInitialized:(CFMutableSetRef)properties getAffectingProperties:(NSMutableArray *)affectingProperties; 12 | @end 13 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLSession.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLSession.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSURLSession.h" 9 | #import 10 | const int64_t NSURLSessionTransferSizeUnknown = -1LL; 11 | 12 | @implementation NSURLSession 13 | 14 | + (void)initialize 15 | { 16 | static dispatch_once_t once = 0L; 17 | dispatch_once(&once, ^{ 18 | Class cls = objc_lookupClass("__NSCFURLSession"); 19 | assert(cls != Nil); 20 | class_setSuperclass(self, cls); 21 | }); 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /System/Foundation/src/NSUUIDInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NSObjectInternal.h" 3 | 4 | __attribute__((visibility("hidden"))) 5 | @interface __NSConcreteUUID : NSUUID 6 | 7 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 8 | - (id)copyWithZone:(NSZone *)zone; 9 | - (Class)classForCoder; 10 | - (id)description; 11 | - (CFUUIDBytes)_cfUUIDBytes; 12 | - (void)getUUIDBytes:(uuid_t)bytes; 13 | - (BOOL)isEqual:(id)other; 14 | - (id)initWithUUIDBytes:(const uuid_t)bytes; 15 | - (id)initWithUUIDString:(NSString *)string; 16 | - (id)init; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /System/CFNetwork/src/resolv_stub.c: -------------------------------------------------------------------------------- 1 | // 2 | // resolv_stub.c 3 | // CFNetwork 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #include 9 | 10 | int32_t dns_async_handle_reply(void *msg) { 11 | return -1; 12 | } 13 | 14 | typedef void (*dns_async_callback)(int32_t status, char *buf, uint32_t len, struct sockaddr *from, int fromlen, void *context); 15 | 16 | int32_t dns_async_start(mach_port_t *p, const char *name, uint16_t dnsclass, uint16_t dnstype, uint32_t do_search, dns_async_callback callback, void *context) { 17 | return -1; 18 | } 19 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLError.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLError.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | NSString *const NSURLErrorDomain = @"NSURLErrorDomain"; 11 | NSString *const NSURLErrorFailingURLErrorKey = @"NSErrorFailingURLKey"; 12 | NSString *const NSURLErrorFailingURLStringErrorKey = @"NSErrorFailingURLStringKey"; 13 | NSString *const NSErrorFailingURLStringKey = @"NSErrorFailingURLStringKey"; 14 | NSString *const NSURLErrorFailingURLPeerTrustErrorKey = @"NSURLErrorFailingURLPeerTrustErrorKey"; 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSSubstringPredicateOperator.h: -------------------------------------------------------------------------------- 1 | #import "NSStringPredicateOperator.h" 2 | 3 | typedef NS_ENUM(NSUInteger, NSSubstringPredicateOperatorPosition) { 4 | NSSubstringBeginsWith = 0, 5 | NSSubstringEndsWith, 6 | NSSubstringContains, 7 | }; 8 | 9 | @interface NSSubstringPredicateOperator : NSStringPredicateOperator 10 | 11 | - (id)initWithOperatorType:(NSPredicateOperatorType)type modifier:(NSComparisonPredicateModifier)modifier variant:(NSUInteger)variant position:(NSSubstringPredicateOperatorPosition)position; 12 | - (NSSubstringPredicateOperatorPosition)position; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSProgress.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSProgress.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @implementation NSProgress 11 | 12 | + (id)currentProgress 13 | { 14 | return nil; 15 | } 16 | 17 | + (id)progressWithTotalUnitCount:(int64_t)unitCount 18 | { 19 | return nil; 20 | } 21 | 22 | - (BOOL)isCancelled 23 | { 24 | return NO; 25 | } 26 | 27 | - (void)setCompletedUnitCount:(int64_t)count 28 | { 29 | } 30 | 31 | - (int64_t)completedUnitCount 32 | { 33 | return 0; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /XcodeTemplates/JNI Application.xctemplate/___PACKAGENAMEASIDENTIFIER___Activity.java: -------------------------------------------------------------------------------- 1 | package ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___PACKAGENAMEASIDENTIFIER___; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import com.apportable.RuntimeService; 6 | 7 | public class ___PACKAGENAMEASIDENTIFIER___Activity extends Activity { 8 | @Override 9 | protected void onCreate(final Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | new RuntimeService(this).loadLibraries(); 12 | run(); 13 | } 14 | public native void run(); 15 | } -------------------------------------------------------------------------------- /tests/FoundationTests/FoundationTestsActivity.m: -------------------------------------------------------------------------------- 1 | // 2 | // FoundationTestsActivity.m 3 | // FoundationTests 4 | // 5 | // Created by Paul Beusterien on 10/1/14. 6 | // Copyright (c) 2014 Apportable. All rights reserved. 7 | // 8 | 9 | #include 10 | #import 11 | #include 12 | #import "FoundationTests.h" 13 | 14 | void Java_com_apportable_FoundationTests_FoundationTestsActivity_run( JNIEnv* env, jobject thiz ) 15 | { 16 | printf("hello from printf"); 17 | NSLog(@"hello from NSLog"); 18 | @autoreleasepool { 19 | runFoundationTests(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /System/Foundation/src/NSMutableStringProxyForMutableAttributedStringInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | __attribute__((visibility("hidden"))) 5 | @interface NSMutableStringProxyForMutableAttributedString : NSMutableString 6 | 7 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str; 8 | - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange; 9 | - (unichar)characterAtIndex:(NSUInteger)index; 10 | - (NSUInteger)length; 11 | - (void)dealloc; 12 | - (id)initWithMutableAttributedString:(NSMutableAttributedString *)owner; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSSpellCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSSpellCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSSpellCheckingResult.h" 9 | 10 | @implementation NSSpellCheckingResult 11 | 12 | - (id)initWithRange:(NSRange)range 13 | { 14 | self = [super init]; 15 | if (self) 16 | { 17 | _range = range; 18 | } 19 | return self; 20 | } 21 | 22 | - (NSRange)range 23 | { 24 | return _range; 25 | } 26 | 27 | - (NSTextCheckingType)resultType 28 | { 29 | return NSTextCheckingTypeSpelling; 30 | } 31 | 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /System/Foundation/src/NSLinkCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSURL; 4 | 5 | @interface NSLinkCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSURL *_url; 8 | } 9 | 10 | - (id)initWithRange:(NSRange)range URL:(NSURL *)url; 11 | - (id)initWithCoder:(NSCoder *)coder; 12 | - (void)encodeWithCoder:(NSCoder *)coder; 13 | - (void)dealloc; 14 | - (NSURL *)URL; 15 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 16 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 17 | - (NSRange)range; 18 | - (NSTextCheckingType)resultType; 19 | - (NSString *)description; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /System/Foundation/src/NSGrammarCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray; 4 | 5 | @interface NSGrammarCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSArray *_details; 8 | } 9 | 10 | - (id)initWithRange:(NSRange)range details:(NSArray *)details; 11 | - (id)initWithCoder:(NSCoder *)coder; 12 | - (void)encodeWithCoder:(NSCoder *)coder; 13 | - (void)dealloc; 14 | - (NSArray *)grammarDetails; 15 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 16 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 17 | - (NSRange)range; 18 | - (NSTextCheckingType)resultType; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /tests/src/NSAttributedStringHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedStringHelper.h 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | 9 | // Avoid including UIKit to test Foundation 10 | 11 | @interface UIColorish : NSObject 12 | +(id)yellowColor; 13 | +(id)blueColor; 14 | +(id)redColor; 15 | +(id)greenColor; 16 | +(id)orangeColor; 17 | +(id)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; 18 | @end 19 | 20 | extern NSString *const NSFontAttributeName; 21 | extern NSString *const NSBackgroundColorAttributeName; 22 | extern NSString *const NSForegroundColorAttributeName; 23 | -------------------------------------------------------------------------------- /System/CFNetwork/CFNetwork.xcodeproj/xcuserdata/paulb.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CFNetwork.xcscheme 8 | 9 | orderHint 10 | 58 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F8C6723018972D760014D61F 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /System/CFNetwork/src/Utils/CFRuntimeUtils.c: -------------------------------------------------------------------------------- 1 | // 2 | // CFRuntimeUtils.c 3 | // CFNetwork 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #include "CFRuntimeUtils.h" 9 | #include 10 | 11 | static OSSpinLock registerClassOnceLock = OS_SPINLOCK_INIT; 12 | 13 | 14 | /* API */ 15 | 16 | void _CFRuntimeRegisterClassOnce(CFTypeID* typeID, const CFRuntimeClass* cls) { 17 | OSSpinLockLock(®isterClassOnceLock); 18 | { 19 | if (*typeID == _kCFRuntimeNotATypeID) { 20 | *typeID = _CFRuntimeRegisterClass(cls); 21 | } 22 | } 23 | OSSpinLockUnlock(®isterClassOnceLock); 24 | } 25 | -------------------------------------------------------------------------------- /System/Foundation/src/NSTimeZone.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSTimeZone.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | #import "NSObjectInternal.h" 11 | 12 | @implementation NSTimeZone (NSTimeZone) 13 | 14 | OBJC_PROTOCOL_IMPL_PUSH 15 | - (id)initWithCoder:(NSCoder *)coder 16 | { 17 | NSRequestConcreteImplementation(); 18 | return nil; 19 | } 20 | 21 | - (void)encodeWithCoder:(NSCoder *)coder 22 | { 23 | NSRequestConcreteImplementation(); 24 | } 25 | OBJC_PROTOCOL_IMPL_POP 26 | 27 | - (Class)classForCoder 28 | { 29 | return [NSTimeZone self]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /System/Foundation/Foundation.xcodeproj/xcuserdata/paulb.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Foundation.xcscheme 8 | 9 | orderHint 10 | 57 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F82F8D801898396500AB6992 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /System/Foundation/src/NSFilesystemItemRemoveOperation.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | CF_PRIVATE 5 | @interface NSFilesystemItemRemoveOperation : NSOperation 6 | 7 | + (id)filesystemItemRemoveOperationWithPath:(NSString *)path; 8 | + (NSError *)_errorWithErrno:(int)err atPath:(NSString *)path; 9 | - (void)dealloc; 10 | - (void)main; 11 | - (id)initWithPath:(NSString *)path; 12 | - (BOOL)_filtersUnderbars; 13 | - (void)_setFilterUnderbars:(BOOL)filterUnderbars; 14 | - (void)_setError:(NSError *)error; 15 | - (NSError *)error; 16 | - (void)setDelegate:(NSFileManager *)delegate; 17 | - (NSFileManager *)delegate; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /System/CoreFoundation/CoreFoundation.xcodeproj/xcuserdata/paulb.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CoreFoundation.xcscheme 8 | 9 | orderHint 10 | 62 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F8C66F1818970B640014D61F 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /System/Foundation/src/NSObjectInternal.m: -------------------------------------------------------------------------------- 1 | #import "NSObjectInternal.h" 2 | #import 3 | 4 | @implementation _NSWeakRef { 5 | id _weakRef; 6 | } 7 | 8 | - (id)init 9 | { 10 | return [super init]; 11 | } 12 | 13 | - (id)initWithObject:(id)object 14 | { 15 | self = [super init]; 16 | if (self) 17 | { 18 | self.object = object; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)dealloc 24 | { 25 | self.object = nil; 26 | [super dealloc]; 27 | } 28 | 29 | - (void)setObject:(id)object 30 | { 31 | objc_storeWeak(&_weakRef, object); 32 | } 33 | 34 | - (id)object 35 | { 36 | return objc_loadWeak(&_weakRef); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /System/Foundation/src/NSUbiquitousKeyValueStoreInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @protocol _NSUbiquitousKeyValueStoreProvider 4 | 5 | - (NSUInteger)count; 6 | - (id)objectForKey:(NSString *)key; 7 | - (NSEnumerator *)keyEnumerator; 8 | 9 | - (void)setObject:(id)anObject forKey:(NSString *)key; 10 | - (void)removeObjectForKey:(NSString *)key; 11 | 12 | @optional 13 | 14 | - (BOOL)synchronize; 15 | 16 | @end 17 | 18 | @interface NSUbiquitousKeyValueStore (Internal) 19 | 20 | - (id)_initWithProvider:(id<_NSUbiquitousKeyValueStoreProvider>)provider; 21 | - (void)_setKeyValueStoreProvider:(id<_NSUbiquitousKeyValueStoreProvider>)provider; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /System/Foundation/src/NSDataDetector.m: -------------------------------------------------------------------------------- 1 | #import "NSRegularExpression.h" 2 | 3 | @implementation NSDataDetector { 4 | NSTextCheckingTypes _checkingTypes; 5 | } 6 | 7 | @synthesize checkingTypes = _checkingTypes; 8 | 9 | + (NSDataDetector *)dataDetectorWithTypes:(NSTextCheckingTypes)checkingTypes error:(NSError **)error 10 | { 11 | return [[[self alloc] initWithTypes:checkingTypes error:error] autorelease]; 12 | } 13 | 14 | - (id)initWithTypes:(NSTextCheckingTypes)checkingTypes error:(NSError **)error 15 | { 16 | self = [super initWithPattern:@".*" options:0 error:error]; 17 | 18 | if (self) 19 | { 20 | _checkingTypes = checkingTypes; 21 | } 22 | 23 | return self; 24 | } 25 | 26 | @end -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSEnumerator.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray; 4 | 5 | typedef struct { 6 | unsigned long state; 7 | id __unsafe_unretained *itemsPtr; 8 | unsigned long *mutationsPtr; 9 | unsigned long extra[5]; 10 | } NSFastEnumerationState; 11 | 12 | @protocol NSFastEnumeration 13 | 14 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len; 15 | 16 | @end 17 | 18 | @interface NSEnumerator : NSObject 19 | 20 | - (id)nextObject; 21 | 22 | @end 23 | 24 | @interface NSEnumerator (NSExtendedEnumerator) 25 | 26 | - (NSArray *)allObjects; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSProxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSMethodSignature, NSInvocation; 4 | 5 | NS_ROOT_CLASS 6 | @interface NSProxy { 7 | Class isa; 8 | } 9 | 10 | + (id)alloc; 11 | + (id)allocWithZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; 12 | + (Class)class; 13 | + (BOOL)respondsToSelector:(SEL)aSelector; 14 | - (void)forwardInvocation:(NSInvocation *)invocation; 15 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel; 16 | - (void)dealloc; 17 | - (void)finalize; 18 | - (NSString *)description; 19 | - (NSString *)debugDescription; 20 | - (BOOL)allowsWeakReference NS_UNAVAILABLE; 21 | - (BOOL)retainWeakReference NS_UNAVAILABLE; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /System/Foundation/src/NSOrthographyCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSOrthography; 4 | 5 | @interface NSOrthographyCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSOrthography *_orthography; 8 | } 9 | 10 | - (id)initWithRange:(NSRange)range orthography:(NSOrthography *)orthography; 11 | - (id)initWithCoder:(NSCoder *)coder; 12 | - (void)encodeWithCoder:(NSCoder *)coder; 13 | - (void)dealloc; 14 | - (NSOrthography *)orthography; 15 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 16 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 17 | - (NSRange)range; 18 | - (NSTextCheckingType)resultType; 19 | - (NSString *)description; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /System/Foundation/src/_NSPredicateOperatorUtilities.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "NSMatchingPredicateOperator.h" 4 | #import "_NSPredicateUtilities.h" 5 | #import 6 | 7 | @interface _NSPredicateOperatorUtilities : NSObject 8 | 9 | + (long long)copyRegexFindSafePattern:(NSString *)pattern toBuffer:(unichar *)buffer; 10 | + (BOOL)doRegexForString:(NSString *)string pattern:(NSString *)pattern likeProtect:(BOOL)protect flags:(NSComparisonPredicateOptions)flags context:(struct regexContext *)context; 11 | + (NSString *)newStringFrom:(NSString *)string usingUnicodeTransforms:(CFStringCompareFlags)transforms; 12 | + (CFLocaleRef)retainedLocale; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSCompoundPredicate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray; 4 | 5 | typedef NS_ENUM(NSUInteger, NSCompoundPredicateType) { 6 | NSNotPredicateType = 0, 7 | 8 | NSAndPredicateType, 9 | NSOrPredicateType, 10 | }; 11 | 12 | @interface NSCompoundPredicate : NSPredicate 13 | 14 | + (NSPredicate *)andPredicateWithSubpredicates:(NSArray *)subpredicates; 15 | + (NSPredicate *)orPredicateWithSubpredicates:(NSArray *)subpredicates; 16 | + (NSPredicate *)notPredicateWithSubpredicate:(NSPredicate *)predicate; 17 | - (id)initWithType:(NSCompoundPredicateType)type subpredicates:(NSArray *)subpredicates; 18 | - (NSCompoundPredicateType)compoundPredicateType; 19 | - (NSArray *)subpredicates; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSObjCRuntimeInternal.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static inline const char *stripQualifiersAndComments(const char *decl) 4 | { 5 | static const char *qualifiersAndComments = "nNoOrRV\""; 6 | 7 | // Skip type qualifiers. 8 | while (*decl != 0 && strchr(qualifiersAndComments, *decl)) { 9 | if (*decl == '"') { 10 | decl++; 11 | while (*decl++ != '"'); 12 | } 13 | else { 14 | decl++; 15 | } 16 | } 17 | 18 | return decl; 19 | } 20 | 21 | 22 | const char *__NSGetSizeAndAlignment(const char *decl, NSUInteger *size, NSUInteger *alignment, BOOL stripSizeHints); 23 | 24 | #define _C_LNG_DBL 'D' //add missing long double method signature constant character 25 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSIndexPath.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSIndexPath : NSObject 4 | 5 | + (instancetype)indexPathWithIndex:(NSUInteger)index; 6 | + (instancetype)indexPathWithIndexes:(const NSUInteger [])indexes length:(NSUInteger)length; 7 | - (instancetype)initWithIndex:(NSUInteger)index; 8 | - (instancetype)initWithIndexes:(const NSUInteger [])indexes length:(NSUInteger)length; 9 | - (NSIndexPath *)indexPathByAddingIndex:(NSUInteger)index; 10 | - (NSIndexPath *)indexPathByRemovingLastIndex; 11 | - (NSUInteger)indexAtPosition:(NSUInteger)position; 12 | - (NSUInteger)length; 13 | - (void)getIndexes:(NSUInteger *)indexes; 14 | - (NSComparisonResult)compare:(NSIndexPath *)otherObject; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSInvocation.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class NSMethodSignature; 5 | 6 | @interface NSInvocation : NSObject 7 | 8 | + (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)sig; 9 | - (NSMethodSignature *)methodSignature; 10 | - (void)retainArguments; 11 | - (BOOL)argumentsRetained; 12 | - (id)target; 13 | - (void)setTarget:(id)target; 14 | - (SEL)selector; 15 | - (void)setSelector:(SEL)selector; 16 | - (void)getReturnValue:(void *)retLoc; 17 | - (void)setReturnValue:(void *)retLoc; 18 | - (void)getArgument:(void *)argumentLocation atIndex:(NSInteger)idx; 19 | - (void)setArgument:(void *)argumentLocation atIndex:(NSInteger)idx; 20 | - (void)invoke; 21 | - (void)invokeWithTarget:(id)target; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueNestedProperty.h: -------------------------------------------------------------------------------- 1 | #import "NSKeyValueProperty.h" 2 | 3 | @class NSString; 4 | 5 | CF_PRIVATE 6 | @interface NSKeyValueNestedProperty : NSKeyValueProperty 7 | 8 | - (NSString *)_keyPathIfAffectedByValueForMemberOfKeys:(NSSet *)keys; 9 | - (NSString *)_keyPathIfAffectedByValueForKey:(NSString *)key exactMatch:(BOOL *)exactMatch; 10 | - (Class)_isaForAutonotifying; 11 | - (void)_addDependentValueKey:(NSString *)key; 12 | - (void)_givenPropertiesBeingInitialized:(CFMutableSetRef)properties getAffectingProperties:(NSMutableArray *)affectingProperties; 13 | - (instancetype)_initWithContainerClass:(NSKeyValueContainerClass *)containerClass keyPath:(NSString *)keyPath firstDotIndex:(NSUInteger)firstDotIndex propertiesBeingInitialized:(CFMutableSetRef)propertiesBeingInitialized; 14 | @end 15 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueUnnestedProperty.h: -------------------------------------------------------------------------------- 1 | #import "NSKeyValueProperty.h" 2 | 3 | @class NSArray; 4 | 5 | CF_PRIVATE 6 | @interface NSKeyValueUnnestedProperty : NSKeyValueProperty 7 | { 8 | NSArray *_affectingProperties; 9 | BOOL _cachedIsaForAutonotifyingIsValid; 10 | Class _cachedIsaForAutonotifying; 11 | } 12 | 13 | - (NSString *)_keyPathIfAffectedByValueForMemberOfKeys:(NSSet *)keys; 14 | - (NSString *)_keyPathIfAffectedByValueForKey:(NSString *)key exactMatch:(BOOL *)exactMatch; 15 | - (Class)isaForAutonotifying; 16 | - (Class)_isaForAutonotifying; 17 | - (void)_addDependentValueKey:(NSString *)key; 18 | - (void)_givenPropertiesBeingInitialized:(CFMutableSetRef)properties getAffectingProperties:(NSMutableArray *)affectingProperties; 19 | - (id)description; 20 | - (void)dealloc; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /System/Foundation/src/NSLocalizableString.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSLocalizableString : NSString { 4 | NSString *_stringsFileKey; 5 | NSString *_developmentLanguageString; 6 | } 7 | 8 | @property(readonly) NSString *developmentLanguageString; 9 | @property(readonly) NSString *stringsFileKey; 10 | 11 | + (id)localizableStringWithStringsFileKey:(NSString *)key developmentLanguageString:(NSString *)devLang; 12 | - (id)initWithStringsFileKey:(NSString *)key developmentLanguageString:(NSString *)devLang; 13 | - (void)dealloc; 14 | - (id)awakeAfterUsingCoder:(NSCoder *)coder; 15 | - (void)setDevelopmentLanguageString:(NSString *)str; 16 | - (void)setStringsFileKey:(NSString *)key; 17 | - (unichar)characterAtIndex:(NSUInteger)index; 18 | - (NSUInteger)length; 19 | 20 | @end -------------------------------------------------------------------------------- /System/Foundation/src/NSRunLoopModes.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSRunLoopModes.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | #import "NSRunLoopModesInternal.h" 12 | 13 | // Forgive me, the loader is not merging NSStrings/CFStrings correctly 14 | // This is a VERY hacky workaround. 15 | #warning https://code.google.com/p/apportable/issues/detail?id=370 16 | 17 | NSString *NSDefaultRunLoopMode = nil; 18 | NSString *NSRunLoopCommonModes = nil; 19 | 20 | static void NSRunLoopModeFix(void) __attribute__((constructor)); 21 | static void NSRunLoopModeFix(void) 22 | { 23 | NSDefaultRunLoopMode = (NSString *)kCFRunLoopDefaultMode; 24 | NSRunLoopCommonModes = (NSString *)kCFRunLoopCommonModes; 25 | } 26 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFStubs.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFStubs.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | void __CFPFactoryInitialize() { 11 | 12 | } 13 | 14 | void __CFPlugInInitialize() { 15 | 16 | } 17 | 18 | void __CFPlugInInstanceInitialize() { 19 | 20 | } 21 | 22 | void __CFMessagePortInitialize() { 23 | 24 | } 25 | 26 | Boolean _CFBundleNeedsInitPlugIn(CFBundleRef bundle) 27 | { 28 | return false; 29 | } 30 | 31 | void _CFBundleInitPlugIn(CFBundleRef bundle) 32 | { 33 | 34 | } 35 | 36 | void _CFBundlePlugInLoaded(CFBundleRef bundle) 37 | { 38 | 39 | } 40 | 41 | void _CFBundleDeallocatePlugIn(CFBundleRef bundle) 42 | { 43 | 44 | } 45 | 46 | void _CFPlugInWillUnload(CFPlugInRef plugIn) 47 | { 48 | 49 | } 50 | -------------------------------------------------------------------------------- /System/Foundation/src/NSLinkCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLinkCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSLinkCheckingResult.h" 9 | #import 10 | 11 | @implementation NSLinkCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range URL:(NSURL *)url 14 | { 15 | self = [super init]; 16 | if (self) 17 | { 18 | _range = range; 19 | _url = [url copy]; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)dealloc 25 | { 26 | [_url release]; 27 | [super dealloc]; 28 | } 29 | 30 | - (NSURL *)URL 31 | { 32 | return _url; 33 | } 34 | 35 | - (NSRange)range 36 | { 37 | return _range; 38 | } 39 | 40 | - (NSTextCheckingType)resultType 41 | { 42 | return NSTextCheckingTypeLink; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /System/Foundation/src/NSAddressCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSDictionary; 4 | 5 | @interface NSAddressCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSDictionary *_components; 8 | id _underlyingResult; 9 | } 10 | 11 | @property(readonly) void *underlyingResult; 12 | 13 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components; 14 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components underlyingResult:(void *)underlyingResult; 15 | - (id)initWithCoder:(NSCoder *)coder; 16 | - (void)encodeWithCoder:(NSCoder *)coder; 17 | - (void)dealloc; 18 | - (NSDictionary *)components; 19 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 20 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 21 | - (NSRange)range; 22 | - (NSTextCheckingType)resultType; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en_US 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.apple.CoreFoundation 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | CoreFoundation 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 6.9 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | 24 | 25 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueContainerClass.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "NSKeyValueObservingInternal.h" 4 | 5 | CF_PRIVATE 6 | @interface NSKeyValueContainerClass : NSObject 7 | { 8 | Class _originalClass; 9 | IMP _cachedObservationInfoImplementation; 10 | IMP _cachedSetObservationInfoImplementation; 11 | BOOL _cachedSetObservationInfoTakesAnObject; 12 | NSKVONotifyingInfo *_notifyingInfo; 13 | } 14 | @property (nonatomic, retain) Class originalClass; 15 | @property (nonatomic, assign) IMP cachedObservationInfoImplementation; 16 | @property (nonatomic, assign) IMP cachedSetObservationInfoImplementation; 17 | @property (nonatomic, assign) BOOL cachedSetObservationInfoTakesAnObject; 18 | @property (nonatomic, assign) NSKVONotifyingInfo *notifyingInfo; 19 | 20 | - (id)description; 21 | - (id)initWithOriginalClass:(Class)cls; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /System/Foundation/src/NSTransitInformationCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSDictionary; 4 | 5 | @interface NSTransitInformationCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSDictionary *_components; 8 | id _underlyingResult; 9 | } 10 | 11 | @property (readonly) void *underlyingResult; 12 | - (NSDictionary *)components; 13 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 14 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 15 | - (NSRange)range; 16 | - (NSTextCheckingType)resultType; 17 | - (id)initWithCoder:(NSCoder *)coder; 18 | - (void)encodeWithCoder:(NSCoder *)coder; 19 | - (void)dealloc; 20 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components; 21 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components underlyingResult:(void *)underlyingResult; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /System/Foundation/src/NSPhoneNumberCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString; 4 | 5 | @interface NSPhoneNumberCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSString *_phoneNumber; 8 | id _underlyingResult; 9 | } 10 | 11 | @property (readonly) void *underlyingResult; 12 | - (NSString *)phoneNumber; 13 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 14 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 15 | - (NSRange)range; 16 | - (NSTextCheckingType)resultType; 17 | - (id)initWithCoder:(NSCoder *)coder; 18 | - (void)encodeWithCoder:(NSCoder *)coder; 19 | - (NSString *)description; 20 | - (void)dealloc; 21 | - (id)initWithRange:(NSRange)range phoneNumber:(NSString *)phoneNumber; 22 | - (id)initWithRange:(NSRange)range phoneNumber:(NSString *)phoneNumber underlyingResult:(void *)underlyingResult; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLProtocolInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | CF_PRIVATE 7 | @interface NSURLProtocolInternal : NSObject { 8 | id client; 9 | NSURLRequest *request; 10 | NSCachedURLResponse *cachedResponse; 11 | NSLock *mutex; 12 | } 13 | 14 | - (void)dealloc; 15 | - (id)init; 16 | 17 | @end 18 | 19 | @interface NSURLProtocol (Internal) 20 | 21 | + (Class)_protocolClassForRequest:(NSURLRequest *)request; 22 | 23 | + (NSArray *)_registeredClasses; 24 | 25 | @end 26 | 27 | 28 | @interface NSURLProtocolDefaultClient : NSObject 29 | 30 | @property (nonatomic, assign) id delegate; 31 | 32 | @property (nonatomic, retain) NSURLConnection *connection; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /System/Foundation/src/NSGrammarCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSGrammarCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSGrammarCheckingResult.h" 9 | #import 10 | 11 | @implementation NSGrammarCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range details:(NSArray *)details 14 | { 15 | self = [super init]; 16 | if (self) 17 | { 18 | _range = range; 19 | _details = [details copy]; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)dealloc 25 | { 26 | [_details release]; 27 | [super dealloc]; 28 | } 29 | 30 | - (NSArray *)grammarDetails 31 | { 32 | return _details; 33 | } 34 | 35 | - (NSRange)range 36 | { 37 | return _range; 38 | } 39 | 40 | - (NSTextCheckingType)resultType 41 | { 42 | return NSTextCheckingTypeGrammar; 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSValueTransformer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray, NSString; 4 | 5 | FOUNDATION_EXPORT NSString * const NSNegateBooleanTransformerName; 6 | FOUNDATION_EXPORT NSString * const NSIsNilTransformerName; 7 | FOUNDATION_EXPORT NSString * const NSIsNotNilTransformerName; 8 | FOUNDATION_EXPORT NSString * const NSUnarchiveFromDataTransformerName; 9 | FOUNDATION_EXPORT NSString * const NSKeyedUnarchiveFromDataTransformerName; 10 | 11 | @interface NSValueTransformer : NSObject 12 | 13 | + (void)setValueTransformer:(NSValueTransformer *)transformer forName:(NSString *)name; 14 | + (NSValueTransformer *)valueTransformerForName:(NSString *)name; 15 | + (NSArray *)valueTransformerNames; 16 | + (Class)transformedValueClass; 17 | + (BOOL)allowsReverseTransformation; 18 | - (id)transformedValue:(id)value; 19 | - (id)reverseTransformedValue:(id)value; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSURLCredentialStorage.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSDictionary, NSString, NSURLCredential, NSURLProtectionSpace; 4 | 5 | FOUNDATION_EXPORT NSString *const NSURLCredentialStorageChangedNotification; 6 | 7 | @interface NSURLCredentialStorage : NSObject 8 | 9 | + (NSURLCredentialStorage *)sharedCredentialStorage; 10 | - (NSDictionary *)credentialsForProtectionSpace:(NSURLProtectionSpace *)space; 11 | - (NSDictionary *)allCredentials; 12 | - (void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; 13 | - (void)removeCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; 14 | - (NSURLCredential *)defaultCredentialForProtectionSpace:(NSURLProtectionSpace *)space; 15 | - (void)setDefaultCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSOrthography.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString, NSArray, NSDictionary; 4 | 5 | @interface NSOrthography : NSObject 6 | 7 | @property (readonly) NSString *dominantScript; 8 | @property (readonly) NSDictionary *languageMap; 9 | 10 | @end 11 | 12 | @interface NSOrthography (NSOrthographyExtended) 13 | 14 | - (NSArray *)languagesForScript:(NSString *)script; 15 | - (NSString *)dominantLanguageForScript:(NSString *)script; 16 | 17 | @property (readonly) NSString *dominantLanguage; 18 | @property (readonly) NSArray *allScripts; 19 | @property (readonly) NSArray *allLanguages; 20 | 21 | @end 22 | 23 | @interface NSOrthography (NSOrthographyCreation) 24 | 25 | + (id)orthographyWithDominantScript:(NSString *)script languageMap:(NSDictionary *)map; 26 | - (id)initWithDominantScript:(NSString *)script languageMap:(NSDictionary *)map; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /System/Foundation/src/NSOrthographyCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSOrthographyCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSOrthographyCheckingResult.h" 9 | #import 10 | 11 | @implementation NSOrthographyCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range orthography:(NSOrthography *)orthography 14 | { 15 | self = [super init]; 16 | if (self) 17 | { 18 | _orthography = [orthography copy]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)dealloc 24 | { 25 | [_orthography release]; 26 | [super dealloc]; 27 | } 28 | 29 | - (NSOrthography *)orthography 30 | { 31 | return _orthography; 32 | } 33 | 34 | - (NSRange)range 35 | { 36 | return _range; 37 | } 38 | 39 | - (NSTextCheckingType)resultType 40 | { 41 | return NSTextCheckingTypeOrthography; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSCache.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString, NSCache; 4 | 5 | @protocol NSCacheDelegate 6 | @optional 7 | - (void)cache:(NSCache *)cache willEvictObject:(id)obj; 8 | @end 9 | 10 | @interface NSCache : NSObject 11 | 12 | - (void)setName:(NSString *)n; 13 | - (NSString *)name; 14 | - (void)setDelegate:(id )delegate; 15 | - (id )delegate; 16 | - (id)objectForKey:(id)key; 17 | - (void)setObject:(id)obj forKey:(id)key; 18 | - (void)setObject:(id)obj forKey:(id)key cost:(NSUInteger)cost; 19 | - (void)removeObjectForKey:(id)key; 20 | - (void)removeAllObjects; 21 | - (void)setTotalCostLimit:(NSUInteger)limit; 22 | - (NSUInteger)totalCostLimit; 23 | - (void)setCountLimit:(NSUInteger)limit; 24 | - (NSUInteger)countLimit; 25 | - (BOOL)evictsObjectsWithDiscardedContent; 26 | - (void)setEvictsObjectsWithDiscardedContent:(BOOL)evicts; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /System/Foundation/src/NSDateInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "CFInternal.h" 3 | 4 | __attribute__((visibility("hidden"))) 5 | @interface __NSDate : NSDate 6 | 7 | + (id)allocWithZone:(NSZone *)zone; 8 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 9 | + (id)__new:(NSTimeInterval)t; 10 | - (id)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)t; 11 | - (void)dealloc; 12 | - (NSTimeInterval)timeIntervalSinceReferenceDate; 13 | 14 | @end 15 | 16 | __attribute__((visibility("hidden"))) 17 | @interface __NSPlaceholderDate : NSDate 18 | 19 | + (id)immutablePlaceholder; 20 | + (void)initialize; 21 | - (NSTimeInterval)timeIntervalSinceReferenceDate; 22 | - (void)dealloc; 23 | - (NSUInteger)retainCount; 24 | - (oneway void)release; 25 | - (id)retain; 26 | - (id)init; 27 | - (id)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)date; 28 | 29 | @end 30 | 31 | @interface NSCalendarDate : NSDate 32 | @end 33 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSNull.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNull.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "NSCFType.h" 10 | #import "NSObjectInternal.h" 11 | 12 | @implementation NSNull 13 | 14 | + (BOOL)supportsSecureCoding 15 | { 16 | return NO; 17 | } 18 | 19 | + (id)null 20 | { 21 | return (id)kCFNull; 22 | } 23 | 24 | + (id)allocWithZone:(NSZone *)zone 25 | { 26 | return (id)kCFNull; 27 | } 28 | 29 | - (void)encodeWithCoder:(NSCoder *)coder 30 | { 31 | 32 | } 33 | 34 | - (id)initWithCoder:(NSCoder *)coder 35 | { 36 | return (id)kCFNull; 37 | } 38 | 39 | - (id)description 40 | { 41 | return @""; 42 | } 43 | 44 | - (id)copyWithZone:(NSZone *)zone 45 | { 46 | return (id)kCFNull; 47 | } 48 | 49 | SINGLETON_RR() 50 | 51 | - (CFTypeID)_cfTypeID 52 | { 53 | return CFNullGetTypeID(); 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSURLResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSDictionary, NSString, NSURL, NSURLRequest; 4 | 5 | #define NSURLResponseUnknownLength ((long long)-1) 6 | 7 | @interface NSURLResponse : NSObject 8 | 9 | - (id)initWithURL:(NSURL *)URL MIMEType:(NSString *)MIMEType expectedContentLength:(NSInteger)length textEncodingName:(NSString *)name; 10 | - (NSURL *)URL; 11 | - (NSString *)MIMEType; 12 | - (long long)expectedContentLength; 13 | - (NSString *)textEncodingName; 14 | - (NSString *)suggestedFilename; 15 | 16 | @end 17 | 18 | @interface NSHTTPURLResponse : NSURLResponse 19 | 20 | + (NSString *)localizedStringForStatusCode:(NSInteger)statusCode; 21 | - (id)initWithURL:(NSURL*)URL statusCode:(NSInteger)statusCode HTTPVersion:(NSString*)HTTPVersion headerFields:(NSDictionary *)headerFields; 22 | - (NSInteger)statusCode; 23 | - (NSDictionary *)allHeaderFields; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /System/Foundation/src/NSTimerInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "CFInternal.h" 3 | 4 | @interface NSTimer (CoreFoundation) 5 | - (CFAbsoluteTime)_cffireTime; 6 | @end 7 | 8 | __attribute__((visibility("hidden"))) 9 | @interface __NSCFTimer : NSTimer 10 | 11 | + (id)allocWithZone:(NSZone *)zone; 12 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 13 | - (id)init; 14 | - (id)initWithFireDate:(NSDate *)fireDate interval:(NSTimeInterval)ti target:(id)target selector:(SEL)selector userInfo:(id)userInfo repeats:(BOOL)repeats; 15 | - (void)fire; 16 | - (id)userInfo; 17 | - (void)setFireDate:(NSDate *)date; 18 | - (NSDate *)fireDate; 19 | - (void)invalidate; 20 | - (NSTimeInterval)timeInterval; 21 | - (BOOL)isValid; 22 | - (unsigned int)retainCount; 23 | - (BOOL)_isDeallocating; 24 | - (BOOL)_tryRetain; 25 | - (oneway void)release; 26 | - (id)retain; 27 | - (NSUInteger)hash; 28 | - (BOOL)isEqual:(id)other; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSFormatter.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class NSString; 5 | @class NSAttributedString; 6 | @class NSDictionary; 7 | 8 | @interface NSFormatter : NSObject 9 | 10 | - (NSString *)stringForObjectValue:(id)obj; 11 | - (NSAttributedString *)attributedStringForObjectValue:(id)obj withDefaultAttributes:(NSDictionary *)attrs; 12 | - (NSString *)editingStringForObjectValue:(id)obj; 13 | - (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string errorDescription:(out NSString **)error; 14 | - (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error; 15 | - (BOOL)isPartialStringValid:(NSString **)partialStringPtr proposedSelectedRange:(NSRangePointer)proposedSelRangePtr originalString:(NSString *)origString originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /System/Foundation/src/NSConcreteScanner.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | CF_PRIVATE 4 | @interface NSConcreteScanner : NSScanner 5 | { 6 | NSString *scanString; 7 | NSCharacterSet *skipSet; 8 | NSCharacterSet *invertedSkipSet; 9 | id locale; 10 | unsigned int scanLocation; 11 | struct { 12 | unsigned int caseSensitive:1; 13 | unsigned int :31; 14 | } flags; 15 | } 16 | 17 | - (void)dealloc; 18 | - (BOOL)scanLongLong:(long long *)longLong; 19 | - (BOOL)scanInt:(int *)anInt; 20 | - (id)locale; 21 | - (void)setLocale:(id)locale; 22 | - (BOOL)caseSensitive; 23 | - (void)setCaseSensitive:(BOOL)caseSensitive; 24 | - (id)charactersToBeSkipped; 25 | - (void)setCharactersToBeSkipped:(NSCharacterSet *)charactersToBeSkipped; 26 | - (NSUInteger)scanLocation; 27 | - (void)setScanLocation:(NSUInteger)location; 28 | - (NSCharacterSet *)_invertedSkipSet; 29 | - (NSString *)string; 30 | - (id)initWithString:(NSString *)string; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueObservance.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class NSKeyValueSetter, NSKeyValueProperty; 5 | 6 | CF_PRIVATE 7 | @interface NSKeyValueObservance : NSObject 8 | @property (assign) NSObject *observer; 9 | @property (copy) NSString *keyPath; 10 | @property (retain) NSKeyValueProperty *property; //TODO: assign? 11 | @property (assign) NSObject *originalObservable; 12 | @property (assign) void *context; 13 | @property (retain) NSKeyValueSetter *setter; 14 | @property (assign) NSKeyValueObservingOptions options; 15 | - (instancetype)initWithObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath ofObject:(NSObject *)object withContext:(void *)context options:(NSKeyValueObservingOptions)options; 16 | - (instancetype)initWithObserver:(NSObject *)observer forProperty:(NSKeyValueProperty *)property ofObject:(NSObject *)object context:(void *)context options:(NSKeyValueObservingOptions)options; 17 | @end 18 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "CFPriv.h" 3 | #import 4 | 5 | CF_EXPORT CFURLRef _CFURLAlloc(CFAllocatorRef allocator); 6 | CF_EXPORT void _CFURLInitWithString(CFURLRef url, CFStringRef string, CFURLRef baseURL); 7 | CF_EXPORT void _CFURLInitFSPath(CFURLRef url, CFStringRef path); 8 | CF_EXPORT Boolean _CFStringIsLegalURLString(CFStringRef string); 9 | CF_EXPORT void *__CFURLReservedPtr(CFURLRef url); 10 | CF_EXPORT void __CFURLSetReservedPtr(CFURLRef url, void *ptr); 11 | CF_EXPORT CFStringEncoding _CFURLGetEncoding(CFURLRef url); 12 | CF_EXPORT Boolean _CFURLIsFileReferenceURL(CFURLRef url); 13 | CF_EXPORT Boolean _CFURLCopyComponents(CFURLRef url, CFURLComponentDecomposition decompositionType, void *components); 14 | CF_EXPORT Boolean _CFURLIsFileURL(CFURLRef url); 15 | CF_EXPORT void *__CFURLResourceInfoPtr(CFURLRef url); 16 | CF_EXPORT void __CFURLSetResourceInfoPtr(CFURLRef url, void *ptr); 17 | @interface NSURL (Internal) 18 | - (CFURLRef)_cfurl; 19 | @end 20 | -------------------------------------------------------------------------------- /System/CFNetwork/private_include/CFNetwork/CFURLAuthChallenge.h: -------------------------------------------------------------------------------- 1 | #ifndef __CFURLAUTHCHALLENGE__ 2 | #define __CFURLAUTHCHALLENGE__ 3 | 4 | #include "CFURLCredential.h" 5 | #include "CFURLProtectionSpace.h" 6 | #include "CFURLResponse.h" 7 | #include 8 | 9 | #if PRAGMA_ONCE 10 | #pragma once 11 | #endif 12 | 13 | __BEGIN_DECLS 14 | 15 | typedef const struct __CFURLAuthChallenge *CFURLAuthChallengeRef; 16 | 17 | CFURLAuthChallengeRef CFURLAuthChallengeCreateWithCFHTTPAuthentication(CFAllocatorRef allocator, CFHTTPAuthenticationRef auth); 18 | CFURLProtectionSpaceRef CFURLAuthChallengeGetProtectionSpace(CFURLAuthChallengeRef challenge); 19 | CFURLCredentialRef CFURLAuthChallengeGetCredential(CFURLAuthChallengeRef challenge); 20 | CFURLResponseRef CFURLAuthChallengeGetResponse(CFURLAuthChallengeRef challenge); 21 | CFIndex CFURLAuthChallengeGetPreviousFailureCount(CFURLAuthChallengeRef challenge); 22 | CFErrorRef CFURLAuthChallengeGetError(CFURLAuthChallengeRef challenge); 23 | 24 | __END_DECLS 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSNotificationQueue.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSNotification, NSNotificationCenter, NSArray; 4 | 5 | typedef NS_ENUM(NSUInteger, NSPostingStyle) { 6 | NSPostWhenIdle = 1, 7 | NSPostASAP = 2, 8 | NSPostNow = 3 9 | }; 10 | 11 | typedef NS_ENUM(NSUInteger, NSNotificationCoalescing) { 12 | NSNotificationNoCoalescing = 0, 13 | NSNotificationCoalescingOnName = 1, 14 | NSNotificationCoalescingOnSender = 2 15 | }; 16 | 17 | @interface NSNotificationQueue : NSObject 18 | 19 | + (id)defaultQueue; 20 | - (id)initWithNotificationCenter:(NSNotificationCenter *)notificationCenter; 21 | - (void)enqueueNotification:(NSNotification *)notification postingStyle:(NSPostingStyle)postingStyle; 22 | - (void)enqueueNotification:(NSNotification *)notification postingStyle:(NSPostingStyle)postingStyle coalesceMask:(NSUInteger)coalesceMask forModes:(NSArray *)modes; 23 | - (void)dequeueNotificationsMatching:(NSNotification *)notification coalesceMask:(NSUInteger)coalesceMask; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSJSONSerialization.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSError, NSOutputStream, NSInputStream, NSData; 4 | 5 | typedef NS_OPTIONS(NSUInteger, NSJSONReadingOptions) { 6 | NSJSONReadingMutableContainers = (1UL << 0), 7 | NSJSONReadingMutableLeaves = (1UL << 1), 8 | NSJSONReadingAllowFragments = (1UL << 2) 9 | }; 10 | 11 | typedef NS_OPTIONS(NSUInteger, NSJSONWritingOptions) { 12 | NSJSONWritingPrettyPrinted = (1UL << 0) 13 | }; 14 | 15 | @interface NSJSONSerialization : NSObject 16 | 17 | + (BOOL)isValidJSONObject:(id)obj; 18 | + (NSData *)dataWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(NSError **)error; 19 | + (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error; 20 | + (NSInteger)writeJSONObject:(id)obj toStream:(NSOutputStream *)stream options:(NSJSONWritingOptions)opt error:(NSError **)error; 21 | + (id)JSONObjectWithStream:(NSInputStream *)stream options:(NSJSONReadingOptions)opt error:(NSError **)error; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSSharedKeySet.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString; 4 | 5 | @interface NSSharedKeySet : NSObject 6 | { 7 | NSUInteger _numKey; 8 | id *_keys; 9 | NSSharedKeySet *_subSharedKeySet; 10 | } 11 | 12 | + (id)keySetWithKeys:(NSArray *)keys; 13 | - (NSUInteger)keySetCount; 14 | - (void)dealloc; 15 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len; 16 | - (id)keyAtIndex:(NSUInteger)index; 17 | - (NSUInteger)indexForKey:(id)key; 18 | - (NSArray *)allKeys; 19 | - (NSUInteger)maximumIndex; 20 | - (BOOL)isEmpty; 21 | - (NSUInteger)count; 22 | - (id)initWithCoder:(NSCoder *)coder; 23 | - (void)encodeWithCoder:(NSCoder *)coder; 24 | - (id)copyWithZone:(NSZone *)zone; 25 | - (id)init; 26 | - (id)initWithKeys:(id *)keys count:(NSUInteger)count; 27 | - (void)createSubclassCode:(NSString *)subclassName interface:(CFStringRef *)interface implementation:(CFStringRef *)implementation; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /tests/src/NSAttributedStringHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedStringHelper.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSAttributedStringHelper.h" 9 | 10 | 11 | // Avoid including UIKit to test Foundation 12 | 13 | @implementation UIColorish 14 | 15 | +(id)yellowColor 16 | { 17 | return @1; 18 | } 19 | 20 | +(id)blueColor 21 | { 22 | return @2; 23 | } 24 | 25 | +(id)redColor 26 | { 27 | return @3; 28 | } 29 | 30 | +(id)greenColor 31 | { 32 | return @4; 33 | } 34 | 35 | +(id)orangeColor 36 | { 37 | return @4; 38 | } 39 | 40 | + (id)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha 41 | { 42 | if (red == 1 && green == 0 && blue == 0 && alpha == 1) 43 | { 44 | return @3; 45 | } 46 | return @5; 47 | } 48 | 49 | @end 50 | 51 | NSString *const NSFontAttributeName = @"NSFont"; 52 | NSString *const NSBackgroundColorAttributeName = @"NSBackground"; 53 | NSString *const NSForegroundColorAttributeName = @"NSForeground"; 54 | -------------------------------------------------------------------------------- /System/Foundation/src/NSURLResponseInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | #import 6 | #import 7 | 8 | @interface NSURLResponse (Internal) 9 | + (id)_responseWithCFURLResponse:(CFURLResponseRef)resp; 10 | - (CFURLResponseRef)_CFURLResponse; 11 | @end 12 | 13 | CF_PRIVATE 14 | @interface NSURLResponseInternal : NSObject { 15 | @package 16 | CFURLResponseRef response; 17 | } 18 | 19 | - (id)initWithURLResponse:(CFURLResponseRef)resp; 20 | - (void)dealloc; 21 | 22 | @end 23 | 24 | CF_PRIVATE 25 | @interface NSHTTPURLResponseInternal : NSObject { 26 | @package 27 | SecTrustRef peerTrust; 28 | BOOL isMixedReplace; 29 | } 30 | 31 | - (id)initWithCoder:(NSCoder *)coder; 32 | - (void)encodeWithCoder:(NSCoder *)coder; 33 | - (void)dealloc; 34 | 35 | @end 36 | 37 | @interface NSHTTPURLResponse (Internal) 38 | 39 | + (BOOL)isErrorStatusCode:(NSInteger)statusCode; 40 | 41 | @end 42 | 43 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSProcessInfo.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | enum { 5 | NSWindowsNTOperatingSystem = 1, 6 | NSWindows95OperatingSystem, 7 | NSSolarisOperatingSystem, 8 | NSHPUXOperatingSystem, 9 | NSMACHOperatingSystem, 10 | NSSunOSOperatingSystem, 11 | NSOSF1OperatingSystem, 12 | NSAndroidOperatingSystem, 13 | }; 14 | 15 | @class NSArray, NSString, NSDictionary; 16 | 17 | @interface NSProcessInfo : NSObject 18 | 19 | + (NSProcessInfo *)processInfo; 20 | 21 | - (NSDictionary *)environment; 22 | - (NSArray *)arguments; 23 | - (NSString *)hostName; 24 | - (NSString *)processName; 25 | - (int)processIdentifier; 26 | - (void)setProcessName:(NSString *)newName; 27 | - (NSString *)globallyUniqueString; 28 | - (NSUInteger)operatingSystem; 29 | - (NSString *)operatingSystemName; 30 | - (NSString *)operatingSystemVersionString; 31 | - (NSUInteger)processorCount; 32 | - (NSUInteger)activeProcessorCount; 33 | - (unsigned long long)physicalMemory; 34 | - (NSTimeInterval)systemUptime; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /System/CFNetwork/src/Utils/CFHTTPUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef __CFHTTPUTILS__ 2 | #define __CFHTTPUTILS__ 3 | 4 | #include 5 | 6 | CF_EXTERN_C_BEGIN 7 | 8 | CF_EXPORT CFIndex _CFHTTPSkipUntil(const UniChar* string, CFIndex pos, const char* stopChars); 9 | CF_EXPORT CFIndex _CFHTTPSkipWhitespace(const UniChar* string, CFIndex pos, CFIndex delta); 10 | 11 | CF_EXPORT CFDictionaryRef _CFHTTPParseCacheControlField(CFStringRef string); // CFRelease() result 12 | 13 | CF_EXPORT Boolean _CFHTTPParseSeconds(CFTimeInterval* seconds, CFStringRef string); 14 | 15 | CF_EXPORT Boolean _CFHTTPParseContentTypeField(CFStringRef* textEncoding, // CFRelease() textEncoding 16 | CFStringRef* mimeType, // CFRelease() mimeType 17 | CFStringRef string); 18 | 19 | CF_EXPORT Boolean _CFHTTPParseDateField(CFAbsoluteTime* date, CFStringRef string); 20 | 21 | CF_EXPORT CFArrayRef _CFHTTPParseVaryField(CFStringRef string); // CFRelease() result 22 | 23 | CF_EXTERN_C_END 24 | 25 | #endif // __CFHTTPUTILS__ 26 | -------------------------------------------------------------------------------- /System/Foundation/src/NSSubstitutionCheckingResult.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString; 4 | 5 | @interface NSSubstitutionCheckingResult : NSTextCheckingResult { 6 | NSRange _range; 7 | NSString *_replacementString; 8 | } 9 | 10 | - (id)initWithRange:(NSRange)range replacementString:(NSString *)replacementString; 11 | - (id)initWithCoder:(NSCoder *)coder; 12 | - (void)encodeWithCoder:(NSCoder *)coder; 13 | - (void)dealloc; 14 | - (NSString *)replacementString; 15 | - (BOOL)_adjustRangesWithOffset:(NSInteger)offset; 16 | - (id)resultByAdjustingRangesWithOffset:(NSInteger)offset; 17 | - (NSRange)range; 18 | - (NSString *)description; 19 | 20 | @end 21 | 22 | 23 | @interface NSCorrectionCheckingResult : NSSubstitutionCheckingResult 24 | 25 | - (NSTextCheckingType)resultType; 26 | 27 | @end 28 | 29 | @interface NSDashCheckingResult : NSSubstitutionCheckingResult 30 | 31 | - (NSTextCheckingType)resultType; 32 | 33 | @end 34 | 35 | @interface NSQuoteCheckingResult : NSSubstitutionCheckingResult 36 | 37 | - (NSTextCheckingType)resultType; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSTimer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NSTimer : NSObject 5 | 6 | + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo; 7 | + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo; 8 | + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)sel userInfo:(id)userInfo repeats:(BOOL)yesOrNo; 9 | + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)sel userInfo:(id)userInfo repeats:(BOOL)yesOrNo; 10 | 11 | - (id)initWithFireDate:(NSDate *)date interval:(NSTimeInterval)ti target:(id)t selector:(SEL)s userInfo:(id)ui repeats:(BOOL)rep; 12 | - (void)fire; 13 | - (NSDate *)fireDate; 14 | - (void)setFireDate:(NSDate *)date; 15 | - (NSTimeInterval)timeInterval; 16 | - (void)invalidate; 17 | - (BOOL)isValid; 18 | - (id)userInfo; 19 | - (NSTimeInterval)tolerance; 20 | - (void)setTolerance:(NSTimeInterval)tolerance; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSHTTPCookieStorage.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray, NSHTTPCookie, NSURL; 4 | 5 | typedef NS_ENUM(NSUInteger, NSHTTPCookieAcceptPolicy) { 6 | NSHTTPCookieAcceptPolicyAlways, 7 | NSHTTPCookieAcceptPolicyNever, 8 | NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain 9 | }; 10 | 11 | FOUNDATION_EXPORT NSString * const NSHTTPCookieManagerAcceptPolicyChangedNotification; 12 | FOUNDATION_EXPORT NSString * const NSHTTPCookieManagerCookiesChangedNotification; 13 | 14 | @interface NSHTTPCookieStorage : NSObject 15 | 16 | + (NSHTTPCookieStorage *)sharedHTTPCookieStorage; 17 | 18 | - (NSArray *)cookies; 19 | - (void)setCookie:(NSHTTPCookie *)cookie; 20 | - (void)deleteCookie:(NSHTTPCookie *)cookie; 21 | - (NSArray *)cookiesForURL:(NSURL *)URL; 22 | - (void)setCookies:(NSArray *)cookies forURL:(NSURL *)URL mainDocumentURL:(NSURL *)mainDocumentURL; 23 | - (NSHTTPCookieAcceptPolicy)cookieAcceptPolicy; 24 | - (void)setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)cookieAcceptPolicy; 25 | - (NSArray*)sortedCookiesUsingDescriptors:(NSArray*) sortOrder; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /tests/FoundationTests/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/PropertyList.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSPointerArray.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface NSPointerArray : NSObject 6 | 7 | + (id)pointerArrayWithOptions:(NSPointerFunctionsOptions)options; 8 | + (id)pointerArrayWithPointerFunctions:(NSPointerFunctions *)functions; 9 | - (id)initWithOptions:(NSPointerFunctionsOptions)options; 10 | - (id)initWithPointerFunctions:(NSPointerFunctions *)functions; 11 | - (NSPointerFunctions *)pointerFunctions; 12 | - (void *)pointerAtIndex:(NSUInteger)index; 13 | - (void)addPointer:(void *)pointer; 14 | - (void)removePointerAtIndex:(NSUInteger)index; 15 | - (void)insertPointer:(void *)item atIndex:(NSUInteger)index; 16 | - (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item; 17 | - (void)compact; 18 | - (NSUInteger)count; 19 | - (void)setCount:(NSUInteger)count; 20 | 21 | @end 22 | 23 | @interface NSPointerArray (NSPointerArrayConveniences) 24 | 25 | + (id)strongObjectsPointerArray; 26 | + (id)weakObjectsPointerArray; 27 | - (NSArray *)allObjects; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSGenericDeallocHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSGenericDeallocHandler.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSGenericDeallocHandler.h" 9 | #import 10 | #import 11 | 12 | @implementation __NSGenericDeallocHandler 13 | 14 | void _NSSetDeallocHandler(id object, void (^block)(void)) 15 | { 16 | static void *deallocHandlerKey = &deallocHandlerKey; 17 | __NSGenericDeallocHandler *handler = class_createInstance(objc_getClass("__NSGenericDeallocHandler"), 0); 18 | handler->_block = Block_copy(block); 19 | objc_setAssociatedObject(object, &deallocHandlerKey, handler, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 20 | } 21 | 22 | + (void)initialize 23 | { 24 | 25 | } 26 | 27 | - (void)release 28 | { 29 | if (_block != nil) 30 | { 31 | _block(); 32 | Block_release(_block); 33 | object_dispose(self); 34 | } 35 | else 36 | { 37 | abort(); 38 | } 39 | } 40 | 41 | - (NSUInteger)retainCount 42 | { 43 | return 1; 44 | } 45 | 46 | - (id)retain 47 | { 48 | return self; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSSharedKeyDictionary.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NSSharedKeySet.h" 3 | 4 | @interface NSSharedKeyDictionary : NSMutableDictionary { 5 | NSSharedKeySet *_keyMap; 6 | NSUInteger _count; 7 | id *_values; 8 | NSUInteger (*_ifkIMP)(id,SEL,id); 9 | NSMutableDictionary *_sideDic; 10 | NSUInteger _mutations; 11 | } 12 | 13 | + (id)sharedKeyDictionaryWithKeySet:(NSSharedKeySet *)keySet; 14 | - (id)initWithKeySet:(NSSharedKeySet *)keySet; 15 | - (id)initWithCoder:(NSCoder *)coder; 16 | - (void)encodeWithCoder:(NSCoder *)coder; 17 | - (Class)classForCoder; 18 | - (id)mutableCopyWithZone:(NSZone *)zone; 19 | - (id)copyWithZone:(NSZone *)zone; 20 | - (void)dealloc; 21 | - (NSSharedKeySet *)keySet; 22 | - (void)removeObjectForKey:(id)key; 23 | - (void)setObject:(id)object forKey:(id)key; 24 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len; 25 | - (NSEnumerator *)keyEnumerator; 26 | - (void)getObjects:(id *)objects andKeys:(id *)keys count:(NSUInteger)count; 27 | - (id)objectForKey:(id)key; 28 | - (NSUInteger)count; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /System/Foundation/src/NSAutoreleasePool.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAutoreleasePool.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "ForFoundationOnly.h" 10 | 11 | @implementation NSAutoreleasePool { 12 | void *context; 13 | } 14 | 15 | + (id)allocWithZone:(NSZone *)zone 16 | { 17 | NSAutoreleasePool *pool = [super allocWithZone:zone]; 18 | pool->context = _CFAutoreleasePoolPush(); 19 | return pool; 20 | } 21 | 22 | + (void)addObject:(id)anObject 23 | { 24 | [anObject autorelease]; 25 | } 26 | 27 | - (void)addObject:(id)anObject 28 | { 29 | CFAutorelease((CFTypeRef)anObject); 30 | } 31 | 32 | - (id)retain 33 | { 34 | return self; // retaining an autoreleasepool makes little sense 35 | } 36 | 37 | - (id)autorelease 38 | { 39 | return self; // makes even less sense than retaining 40 | } 41 | 42 | - (void)drain 43 | { 44 | _CFAutoreleasePoolPop(context); 45 | [self dealloc]; 46 | } 47 | 48 | - (oneway void)release 49 | { 50 | [self drain]; 51 | } 52 | 53 | - (void)emptyPool 54 | { 55 | _CFAutoreleasePoolPop(context); 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /System/CFNetwork/private_include/CFNetwork/CFHTTPCookieStorage.h: -------------------------------------------------------------------------------- 1 | #ifndef CFNetwork_CFHTTPCookieStorage_h 2 | #define CFNetwork_CFHTTPCookieStorage_h 3 | 4 | #include 5 | #include "CFHTTPCookie.h" 6 | #if PRAGMA_ONCE 7 | #pragma once 8 | #endif 9 | 10 | __BEGIN_DECLS 11 | 12 | typedef struct __CFHTTPCookieStorage *CFHTTPCookieStorageRef; 13 | 14 | 15 | CFHTTPCookieStorageRef CFHTTPCookieStorageGetDefault(); 16 | void CFHTTPCookieStorageDeleteCookie(CFHTTPCookieStorageRef storage, CFHTTPCookieRef cookie); 17 | void CFHTTPCookieStorageSetCookie(CFHTTPCookieStorageRef storage, CFHTTPCookieRef cookie); 18 | void CFHTTPCookieStorageSetCookies(CFHTTPCookieStorageRef storage, CFArrayRef cookies); 19 | CFArrayRef CFHTTPCookieStorageCopyCookies(CFHTTPCookieStorageRef storage); 20 | CFArrayRef CFHTTPCookieStorageCopyCookiesForURL(CFHTTPCookieStorageRef storage, CFURLRef url); 21 | 22 | void CFHTTPCookieStorageSetCookiesWithResponseHeaderFields(CFHTTPCookieStorageRef storage, CFDictionaryRef headerFields, CFURLRef url); 23 | CFDictionaryRef CFHTTPCookieStorageCopyRequestHeaderFieldsForURL(CFHTTPCookieStorageRef storage, CFURLRef url); 24 | 25 | 26 | __END_DECLS 27 | #endif 28 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSCFType.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSCFType.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSCFType.h" 9 | #import "CFRuntime.h" 10 | #import "ForFoundationOnly.h" 11 | 12 | @implementation NSObject (NSCFType) 13 | 14 | - (NSString *)_copyDescription 15 | { 16 | return [(id)[self description] copy]; 17 | } 18 | 19 | - (CFTypeID)_cfTypeID 20 | { 21 | return CFTypeGetTypeID(); 22 | } 23 | 24 | @end 25 | 26 | @implementation __NSCFType 27 | 28 | - (NSUInteger)hash 29 | { 30 | return CFHash((CFTypeRef)self); 31 | } 32 | 33 | - (id)retain 34 | { 35 | return (id)CFRetain((CFTypeRef)self); 36 | } 37 | 38 | - (oneway void)release 39 | { 40 | CFRelease((CFTypeRef)self); 41 | } 42 | 43 | - (NSString *)description 44 | { 45 | return [(id)CFCopyDescription((CFTypeRef)self) autorelease]; 46 | } 47 | 48 | - (NSString *)descriptionWithLocale:(id)locale 49 | { 50 | return [self description]; 51 | } 52 | 53 | - (BOOL)isEqual:(id)other 54 | { 55 | if (other == nil) 56 | { 57 | return NO; 58 | } 59 | return CFEqual((CFTypeRef)self, (CFTypeRef)other); 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /System/Foundation/src/NSFileAttributes.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | CF_PRIVATE 5 | @interface NSFileAttributes : NSDictionary 6 | 7 | + (id)attributesWithStat:(struct stat *)info; 8 | + (id)_attributesAtURL:(NSURL *)url partialReturn:(BOOL)partial filterResourceFork:(BOOL)filter error:(NSError **)error; 9 | + (id)_attributesAtPath:(NSString *)path partialReturn:(BOOL)partial filterResourceFork:(BOOL)filter error:(NSError **)error; 10 | + (id)attributesAtPath:(NSString *)path traverseLink:(BOOL)yorn; 11 | 12 | - (id)initWithStat:(struct stat *)info; 13 | 14 | - (BOOL)isDirectory; 15 | - (unsigned int)fileGroupOwnerAccountNumber; 16 | - (unsigned int)fileOwnerAccountNumber; 17 | - (unsigned long long)fileSize; 18 | - (NSDate *)fileModificationDate; 19 | - (NSString *)fileType; 20 | - (NSUInteger)filePosixPermissions; 21 | - (NSString *)fileOwnerAccountName; 22 | - (NSString *)fileGroupOwnerAccountName; 23 | - (NSInteger)fileSystemNumber; 24 | - (NSUInteger)fileSystemFileNumber; 25 | - (id)keyEnumerator; 26 | - (NSUInteger)count; 27 | - (id)objectForKey:(id)key; 28 | - (BOOL)isEqual:(id)other; 29 | - (NSUInteger)hash; 30 | - (void)dealloc; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /authors.md: -------------------------------------------------------------------------------- 1 | Thanks to the Apportable Foundation Committers! 2 | ----------------------------------------------- 3 | 4 | * Philippe Hausler 5 | * Paul Beusterien 6 | * George Kulakowski 7 | * Collin Jackson 8 | * Zac Bowling 9 | * Chinmay Garde 10 | * Daniel DeCovnick 11 | * Dmitry Skiba 12 | * Steven Jeram 13 | * Ian Fischer 14 | * Marc Salem 15 | * Jeff DeCew 16 | * Mike Haney 17 | * Michael Chinen 18 | * Elliot Brodzki 19 | * Aaron Culliney 20 | * Nick Richards 21 | * Glenna Buford 22 | * Tim Lundeen 23 | * Adam Hunter 24 | * Ravi Agarwal 25 | * Breckin Loggins 26 | * Gwynne Raskind 27 | * Rhett Aultman 28 | * Ryan Prichard 29 | * Orlando Castillo 30 | * Dustin Dettmer 31 | * Adam Barth 32 | * Prateek Gaur 33 | * Rami Shomali 34 | * Tal Shiri 35 | * Sergey Klimov 36 | * Sean Xiao 37 | * Jim Terry 38 | * Christopher Lloyd 39 | * Michael Haney 40 | * Marko Novakovic 41 | * Adly Holler 42 | * Risto Vuori 43 | * Pavan Mellamputi 44 | * Jonathan Schwarz 45 | * Oleg Osin 46 | * Rob Rix 47 | * Scott Lembke 48 | * Raveesh Nayar 49 | * Dev Sanghani 50 | * Ted Williams 51 | * Sohil Habib 52 | * Manish Kumar Gupta 53 | * Kris Markel 54 | * Kevin Seghetti 55 | * Donald Hutchison 56 | * Dominic Graefen -------------------------------------------------------------------------------- /System/Foundation/src/NSAddressCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAddressCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSAddressCheckingResult.h" 9 | #import 10 | 11 | @implementation NSAddressCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components 14 | { 15 | return [self initWithRange:range components:components underlyingResult:NULL]; 16 | } 17 | 18 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components underlyingResult:(void *)underlyingResult 19 | { 20 | self = [super init]; 21 | if (self) 22 | { 23 | _range = range; 24 | _components = [components copy]; 25 | _underlyingResult = underlyingResult; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)dealloc 31 | { 32 | [_components release]; 33 | [super dealloc]; 34 | } 35 | 36 | - (NSDictionary *)components 37 | { 38 | return _components; 39 | } 40 | 41 | - (NSRange)range 42 | { 43 | return _range; 44 | } 45 | 46 | - (NSTextCheckingType)resultType 47 | { 48 | return NSTextCheckingTypeAddress; 49 | } 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /System/ApportableSystem.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ApportableSystem.xcconfig 3 | // 4 | // Created by Paul Beusterien on 1/14/14. 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | SDKROOT = apportablesdk1.0 9 | 10 | DSTROOT = $HOME/Library/ 11 | 12 | SDK_INSTALL_PATH = /Application Support/Developer/Shared/Xcode/Platforms/Android.platform/Developer/SDKs/ApportableSDK1.0.sdk/ 13 | INSTALL_PATH = $(SDK_INSTALL_PATH)/$(inherited) 14 | 15 | #include "ApportableSDKOverrides.xcconfig" 16 | 17 | GCC_PREPROCESSOR_DEFINITIONS = // Want to override -DDEBUG=1 18 | 19 | PRODUCT_NAME = $(TARGET_NAME) 20 | 21 | PRIVATE_HEADERS_FOLDER_PATH = 22 | 23 | // TODO consolidate debug.pch into globals.pch and eliminate Fixme.pch 24 | OTHER_CFLAGS = $(inherited) -include $(SRCROOT)/../global.pch -include $(SRCROOT)/../debug.pch -include $(SRCROOT)/../Fixme.pch -D__PROJECT__=\"$(TARGET_NAME)\" 25 | OTHER_CPLUSPLUSFLAGS = -include $(SRCROOT)/../global.pch -include $(SRCROOT)/../debug.pch -include $(SRCROOT)/../Fixme.pch -D__PROJECT__=\"$(TARGET_NAME)\" 26 | 27 | DEPLOYMENT_LOCATION = YES 28 | 29 | GCC_PRECOMPILE_PREFIX_HEADER = YES 30 | 31 | GCC_PREFIX_HEADER = 32 | 33 | CLANG_ENABLE_OBJC_ARC = NO 34 | 35 | 36 | -------------------------------------------------------------------------------- /XcodeTemplates/JNI Application.xctemplate/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /System/Foundation/src/NSRangeCheck.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | static inline BOOL NSRangeCheckOverflow(NSRange range) 4 | { 5 | if (NSMaxRange(range) < range.length) 6 | { 7 | [NSException raise:NSRangeException format:@"range {%d,%d} causes overflow", range.location, range.length]; 8 | return NO; 9 | } 10 | return YES; 11 | } 12 | 13 | static inline BOOL NSRangeCheckException(NSRange range, NSUInteger length) 14 | { 15 | if (!NSRangeCheckOverflow(range)) 16 | { 17 | return NO; 18 | } 19 | if (range.location > length || NSMaxRange(range) > length) 20 | { 21 | [NSException raise:NSRangeException format:@"range {%d,%d} exceeds length %d", range.location, range.length, length]; 22 | return NO; 23 | } 24 | return YES; 25 | } 26 | 27 | static inline BOOL NSRangeLengthCheckException(NSRange range, NSUInteger length) 28 | { 29 | if (!NSRangeCheckOverflow(range)) 30 | { 31 | return NO; 32 | } 33 | if (range.location > length) 34 | { 35 | [NSException raise:NSRangeException format:@"range {%d,%d} exceeds length %d", range.location, range.length, length]; 36 | return NO; 37 | } 38 | return YES; 39 | } 40 | -------------------------------------------------------------------------------- /tests/src/ConnectionDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionDelegate.h 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface ConnectionDelegate : NSObject 11 | 12 | @property (nonatomic, retain) NSMutableData *resultData; 13 | 14 | @property (nonatomic, retain) NSError *error; 15 | 16 | @property (nonatomic, assign) BOOL done; 17 | 18 | @property (nonatomic, assign) BOOL didRedirect; 19 | 20 | @end 21 | 22 | @interface FullConnectionDelegate : ConnectionDelegate 23 | @property (nonatomic, assign) NSInteger willSendRequestCount; 24 | @property (nonatomic, assign, readwrite) BOOL shouldAlterCachedResponseData; 25 | @property (nonatomic, assign, readwrite) BOOL shouldKillCachedResponse; 26 | @property (nonatomic, assign, readwrite) BOOL shouldKillRedirectRequest; 27 | @property (nonatomic, assign) BOOL didKillCachedResponse; 28 | @property (nonatomic, assign) BOOL didAlterCachedResponseData; 29 | @property (nonatomic, assign) BOOL didKillRedirectRequest; 30 | @property (nonatomic, retain) NSCachedURLResponse *cachedURLResponse; 31 | @property (nonatomic, retain) NSURLResponse *firstRedirectResponseReceived; 32 | @end 33 | 34 | -------------------------------------------------------------------------------- /System/Foundation/src/NSTransitInformationCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSTransitInformationCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSTransitInformationCheckingResult.h" 9 | #import 10 | 11 | @implementation NSTransitInformationCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components 14 | { 15 | return [self initWithRange:range components:components underlyingResult:NULL]; 16 | } 17 | 18 | - (id)initWithRange:(NSRange)range components:(NSDictionary *)components underlyingResult:(void *)underlyingResult 19 | { 20 | self = [super init]; 21 | if (self) 22 | { 23 | _range = range; 24 | _components = [components copy]; 25 | _underlyingResult = underlyingResult; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)dealloc 31 | { 32 | [_components release]; 33 | [super dealloc]; 34 | } 35 | 36 | - (NSDictionary *)components 37 | { 38 | return _components; 39 | } 40 | 41 | - (NSRange)range 42 | { 43 | return _range; 44 | } 45 | 46 | - (NSTextCheckingType)resultType 47 | { 48 | return NSTextCheckingTypeTransitInformation; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /System/Foundation/src/NSMutableStringProxyForMutableAttributedString.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableStringProxyForMutableAttributedString.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSMutableStringProxyForMutableAttributedStringInternal.h" 9 | 10 | @implementation NSMutableStringProxyForMutableAttributedString 11 | { 12 | NSMutableAttributedString *_owner; 13 | } 14 | 15 | - (id)initWithMutableAttributedString:(NSMutableAttributedString *)owner 16 | { 17 | self = [super init]; 18 | 19 | if (self) 20 | { 21 | _owner = [owner retain]; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | - (NSUInteger)length 28 | { 29 | return [_owner length]; 30 | } 31 | 32 | - (unichar)characterAtIndex:(NSUInteger)index 33 | { 34 | return [[_owner string] characterAtIndex:index]; 35 | } 36 | 37 | - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange 38 | { 39 | [[_owner string] getCharacters:buffer range:aRange]; 40 | } 41 | 42 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str 43 | { 44 | [_owner replaceCharactersInRange:range withString:str]; 45 | } 46 | 47 | - (void)dealloc 48 | { 49 | [_owner release]; 50 | [super dealloc]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /System/Foundation/src/NSPlatform.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSPlatform.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import "wrap.h" 16 | 17 | extern void __CFInitialize(); 18 | extern char ***_NSGetArgv(void); 19 | 20 | static void _enumerationMutationHandler(id object) 21 | { 22 | [NSException raise:NSGenericException format:@"Illegal mutation while fast enumerating %@", object]; 23 | } 24 | 25 | static void NSPlatformInitialize() __attribute__((constructor)); 26 | static void NSPlatformInitialize() 27 | { 28 | __CFInitialize(); 29 | @autoreleasepool { 30 | NSString* appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleExecutableKey]; 31 | __printf_tag = strdup([appName UTF8String]); 32 | char ***argv = _NSGetArgv(); 33 | snprintf((*argv)[0], PATH_MAX, "%s/%s", __virtual_prefix(virtual_bundle), __printf_tag); 34 | 35 | objc_setEnumerationMutationHandler(_enumerationMutationHandler); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /System/Foundation/src/NSPhoneNumberCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSPhoneNumberCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSPhoneNumberCheckingResult.h" 9 | #import 10 | 11 | @implementation NSPhoneNumberCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range phoneNumber:(NSString *)phoneNumber 14 | { 15 | return [self initWithRange:range phoneNumber:phoneNumber underlyingResult:nil]; 16 | } 17 | 18 | - (id)initWithRange:(NSRange)range phoneNumber:(NSString *)phoneNumber underlyingResult:(void *)underlyingResult 19 | { 20 | self = [super init]; 21 | if (self) 22 | { 23 | _range = range; 24 | _phoneNumber = [phoneNumber copy]; 25 | _underlyingResult = underlyingResult; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)dealloc 31 | { 32 | [_phoneNumber release]; 33 | [super dealloc]; 34 | } 35 | 36 | - (NSString *)phoneNumber 37 | { 38 | return _phoneNumber; 39 | } 40 | 41 | - (NSRange)range 42 | { 43 | return _range; 44 | } 45 | 46 | - (NSTextCheckingType)resultType 47 | { 48 | return NSTextCheckingTypePhoneNumber; 49 | } 50 | 51 | /* 52 | - (NSString *)description 53 | { 54 | 55 | } 56 | */ 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSRange.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class NSString; 5 | 6 | typedef struct _NSRange { 7 | NSUInteger location; 8 | NSUInteger length; 9 | } NSRange; 10 | 11 | typedef NSRange *NSRangePointer; 12 | 13 | NS_INLINE NSRange NSMakeRange(NSUInteger loc, NSUInteger len) { 14 | NSRange r; 15 | r.location = loc; 16 | r.length = len; 17 | return r; 18 | } 19 | 20 | NS_INLINE NSUInteger NSMaxRange(NSRange range) { 21 | return range.location + range.length; 22 | } 23 | 24 | NS_INLINE BOOL NSLocationInRange(NSUInteger loc, NSRange range) { 25 | return loc - range.location < range.length; 26 | } 27 | 28 | NS_INLINE BOOL NSEqualRanges(NSRange range1, NSRange range2) { 29 | return range1.location == range2.location && range1.length == range2.length; 30 | } 31 | 32 | FOUNDATION_EXPORT NSRange NSUnionRange(NSRange range1, NSRange range2); 33 | FOUNDATION_EXPORT NSRange NSIntersectionRange(NSRange range1, NSRange range2); 34 | FOUNDATION_EXPORT NSString *NSStringFromRange(NSRange range); 35 | FOUNDATION_EXPORT NSRange NSRangeFromString(NSString *aString); 36 | 37 | @interface NSValue (NSValueRangeExtensions) 38 | 39 | + (NSValue *)valueWithRange:(NSRange)range; 40 | - (NSRange)rangeValue; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /System/Foundation/src/NSLocaleInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | extern CFDictionaryRef __CFLocaleGetPrefs(CFLocaleRef locale); 5 | 6 | @interface NSLocale () 7 | - (id)_prefs; 8 | @end 9 | 10 | __attribute__((visibility("hidden"))) 11 | @interface __NSCFLocale : NSLocale 12 | 13 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 14 | - (id)_prefs; 15 | - (id)initWithLocaleIdentifier:(NSString *)identifier; 16 | - (NSString *)displayNameForKey:(id)key value:(id)value; 17 | - (id)objectForKey:(id)key; 18 | - (NSUInteger)retainCount; 19 | - (BOOL)_isDeallocating; 20 | - (BOOL)_tryRetain; 21 | - (oneway void)release; 22 | - (id)retain; 23 | - (NSUInteger)hash; 24 | - (BOOL)isEqual:(id)other; 25 | 26 | @end 27 | 28 | __attribute__((visibility("hidden"))) 29 | @interface NSAutoLocale : NSLocale { 30 | NSLocale *loc; 31 | } 32 | 33 | + (BOOL)supportsSecureCoding; 34 | - (Class)classForCoder; 35 | - (id)initWithCoder:(NSCoder *)coder; 36 | - (void)encodeWithCoder:(NSCoder *)coder; 37 | - (id)copyWithZone:(NSZone *)zone; 38 | - (id)description; 39 | - (id)_prefs; 40 | - (NSString *)displayNameForKey:(id)key value:(id)value; 41 | - (id)objectForKey:(id)key; 42 | - (void)dealloc; 43 | - (id)initWithLocaleIdentifier:(NSString *)identifier; 44 | - (id)_init; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /System/Foundation/src/NSSubstitutionCheckingResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSSubstitutionCheckingResult.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSSubstitutionCheckingResult.h" 9 | #import 10 | 11 | @implementation NSSubstitutionCheckingResult 12 | 13 | - (id)initWithRange:(NSRange)range replacementString:(NSString *)replacementString 14 | { 15 | self = [super init]; 16 | if (self) 17 | { 18 | _range = range; 19 | _replacementString = [replacementString copy]; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)dealloc 25 | { 26 | [super dealloc]; 27 | } 28 | 29 | - (NSString *)replacementString 30 | { 31 | return _replacementString; 32 | } 33 | 34 | - (NSRange)range 35 | { 36 | return _range; 37 | } 38 | 39 | @end 40 | 41 | @implementation NSCorrectionCheckingResult 42 | 43 | - (NSTextCheckingType)resultType 44 | { 45 | return NSTextCheckingTypeCorrection; 46 | } 47 | 48 | @end 49 | 50 | @implementation NSDashCheckingResult 51 | 52 | - (NSTextCheckingType)resultType 53 | { 54 | return NSTextCheckingTypeDash; 55 | } 56 | 57 | @end 58 | 59 | @implementation NSQuoteCheckingResult 60 | 61 | - (NSTextCheckingType)resultType 62 | { 63 | return NSTextCheckingTypeQuote; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSNotification.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString, NSDictionary, NSOperationQueue; 4 | 5 | @interface NSNotification : NSObject 6 | 7 | - (NSString *)name; 8 | - (id)object; 9 | - (NSDictionary *)userInfo; 10 | 11 | @end 12 | 13 | @interface NSNotification (NSNotificationCreation) 14 | 15 | + (instancetype)notificationWithName:(NSString *)aName object:(id)anObject; 16 | + (instancetype)notificationWithName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo; 17 | 18 | @end 19 | 20 | @interface NSNotificationCenter : NSObject 21 | 22 | + (id)defaultCenter; 23 | - (void)addObserver:(id)observer selector:(SEL)aSelector name:(NSString *)aName object:(id)anObject; 24 | - (void)postNotification:(NSNotification *)notification; 25 | - (void)postNotificationName:(NSString *)aName object:(id)anObject; 26 | - (void)postNotificationName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo; 27 | - (void)removeObserver:(id)observer; 28 | - (void)removeObserver:(id)observer name:(NSString *)aName object:(id)anObject; 29 | #if NS_BLOCKS_AVAILABLE 30 | - (id)addObserverForName:(NSString *)name object:(id)obj queue:(NSOperationQueue *)queue usingBlock:(void (^)(NSNotification *note))block NS_AVAILABLE(10_6, 4_0); 31 | #endif 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSLock.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSDate; 4 | 5 | @protocol NSLocking 6 | 7 | - (void)lock; 8 | - (void)unlock; 9 | 10 | @end 11 | 12 | @interface NSLock : NSObject 13 | 14 | - (BOOL)tryLock; 15 | - (BOOL)lockBeforeDate:(NSDate *)limit; 16 | - (void)setName:(NSString *)n; 17 | - (NSString *)name; 18 | 19 | @end 20 | 21 | @interface NSConditionLock : NSObject 22 | 23 | - (id)initWithCondition:(NSInteger)condition; 24 | - (NSInteger)condition; 25 | - (void)lockWhenCondition:(NSInteger)condition; 26 | - (BOOL)tryLock; 27 | - (BOOL)tryLockWhenCondition:(NSInteger)condition; 28 | - (void)unlockWithCondition:(NSInteger)condition; 29 | - (BOOL)lockBeforeDate:(NSDate *)limit; 30 | - (BOOL)lockWhenCondition:(NSInteger)condition beforeDate:(NSDate *)limit; 31 | - (void)setName:(NSString *)n; 32 | - (NSString *)name; 33 | 34 | @end 35 | 36 | @interface NSRecursiveLock : NSObject 37 | 38 | - (BOOL)tryLock; 39 | - (BOOL)lockBeforeDate:(NSDate *)limit; 40 | - (void)setName:(NSString *)n; 41 | - (NSString *)name; 42 | 43 | @end 44 | 45 | @interface NSCondition : NSObject 46 | 47 | - (void)wait; 48 | - (BOOL)waitUntilDate:(NSDate *)limit; 49 | - (void)signal; 50 | - (void)broadcast; 51 | - (void)setName:(NSString *)n; 52 | - (NSString *)name; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /System/Foundation/src/NSCharacterSetInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NSCFType.h" 3 | 4 | __attribute__((visibility("hidden"))) 5 | @interface __NSCFCharacterSet : __NSCFType 6 | 7 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 8 | - (void)encodeWithCoder:(NSCoder *)coder; 9 | - (Class)classForKeyedArchiver; 10 | - (void)makeCharacterSetFast; 11 | - (void)makeCharacterSetCompact; 12 | - (void)invert; 13 | - (void)formIntersectionWithCharacterSet:(NSCharacterSet *)other; 14 | - (void)formUnionWithCharacterSet:(NSCharacterSet *)other; 15 | - (void)removeCharactersInString:(NSString *)string; 16 | - (void)addCharactersInString:(NSString *)string; 17 | - (void)removeCharactersInRange:(NSRange)range; 18 | - (void)addCharactersInRange:(NSRange)range; 19 | - (NSCharacterSet *)invertedSet; 20 | - (NSData *)bitmapRepresentation; 21 | - (BOOL)hasMemberInPlane:(uint8_t)plane; 22 | - (BOOL)isSupersetOfSet:(NSCharacterSet *)other; 23 | - (BOOL)longCharacterIsMember:(UTF32Char)character; 24 | - (BOOL)characterIsMember:(unichar)character; 25 | - (id)mutableCopyWithZone:(NSZone *)zone; 26 | - (id)copyWithZone:(NSZone *)zone; 27 | - (NSUInteger)retainCount; 28 | - (BOOL)_isDeallocating; 29 | - (BOOL)_tryRetain; 30 | - (oneway void)release; 31 | - (id)retain; 32 | - (NSUInteger)hash; 33 | - (BOOL)isEqual:(id)other; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /tests/src/NSBlockTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBlockTests.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "FoundationTests.h" 9 | 10 | @testcase(NSBlock) 11 | 12 | test(GlobalBlock) 13 | { 14 | NSString *desc = [^{ 15 | 16 | } description]; 17 | testassert(desc != nil); 18 | 19 | return YES; 20 | } 21 | 22 | test(BlockCopy) 23 | { 24 | id block = [^{ 25 | 26 | } copy]; 27 | testassert(block != nil); 28 | 29 | return YES; 30 | } 31 | 32 | test(BlockRelease) 33 | { 34 | void (^block)() = Block_copy(^{ 35 | 36 | }); 37 | [block release]; 38 | 39 | return YES; 40 | } 41 | 42 | test(BlockInvoke) 43 | { 44 | __block BOOL invoked = NO; 45 | [^{ 46 | invoked = YES; 47 | } invoke]; 48 | testassert(invoked); 49 | 50 | return YES; 51 | } 52 | 53 | test(BlockNSInvocation) 54 | { 55 | __block BOOL invoked = NO; 56 | void (^block)(char ch) = ^(char c){ 57 | invoked = c == 'B'; 58 | }; 59 | char t = 'B'; 60 | NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[(id)block methodSignatureForSelector:@selector(invoke)]]; 61 | [inv setTarget:block]; 62 | [inv setSelector:@selector(invoke)]; 63 | [inv setArgument:&t atIndex:1]; 64 | [inv invoke]; 65 | testassert(invoked); 66 | return YES; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/NSEnumerator.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSEnumerator.m 3 | // CoreFoundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | #import "NSObjectInternal.h" 11 | 12 | @implementation NSEnumerator 13 | 14 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len 15 | { 16 | if (state->state == -1) { 17 | return 0; 18 | } 19 | state->itemsPtr = buffer; 20 | state->mutationsPtr = &state->extra[0]; 21 | // should this adjust mutations? 22 | buffer[0] = [self nextObject]; 23 | if (buffer[0] == nil) { 24 | state->state = -1; 25 | return 0; 26 | } 27 | else { 28 | ++state->state; 29 | return 1; 30 | } 31 | } 32 | 33 | - (id)nextObject 34 | { 35 | NSRequestConcreteImplementation(); 36 | return nil; 37 | } 38 | 39 | @end 40 | 41 | @implementation NSEnumerator (NSExtendedEnumerator) 42 | 43 | - (NSArray *)allObjects 44 | { 45 | NSMutableArray *objects = [[NSMutableArray alloc] init]; 46 | 47 | for (id object in self) 48 | { 49 | [objects addObject:object]; 50 | } 51 | 52 | NSArray *array = [objects copy]; 53 | [objects release]; 54 | return [array autorelease]; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueChangeDictionary.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import 4 | 5 | @class NSObject, NSIndexSet; 6 | 7 | typedef struct 8 | { 9 | NSKeyValueChange kind; 10 | NSObject *oldValue; 11 | NSObject *newValue; 12 | NSIndexSet *indexes; 13 | id extraData; 14 | } NSKeyValueChangeDetails; 15 | 16 | extern NSString * const NSKeyValueChangeKindKey; 17 | extern NSString * const NSKeyValueChangeNewKey; 18 | extern NSString * const NSKeyValueChangeOldKey; 19 | extern NSString * const NSKeyValueChangeIndexesKey; 20 | extern NSString * const NSKeyValueChangeOriginalObservableKey; 21 | extern NSString * const NSKeyValueChangeNotificationIsPriorKey; 22 | 23 | 24 | CF_PRIVATE 25 | @interface NSKeyValueChangeDictionary : NSDictionary 26 | { 27 | NSKeyValueChangeDetails _details; 28 | NSObject *_originalObservable; 29 | BOOL _isPriorNotification; 30 | BOOL _isRetainingObjects; 31 | } 32 | 33 | - (id)keyEnumerator; 34 | - (id)objectForKey:(id)key; 35 | - (NSUInteger)count; 36 | - (void)dealloc; 37 | - (void)retainObjects; 38 | - (void)setOriginalObservable:(id)observable; 39 | - (void)setDetailsNoCopy:(NSKeyValueChangeDetails)details originalObservable:(id)observable; 40 | - (id)initWithDetailsNoCopy:(NSKeyValueChangeDetails)details originalObservable:(id)observable isPriorNotification:(BOOL)yn; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueObservationInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSKeyValueObservationInfo.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSKeyValueObservationInfo.h" 9 | #import 10 | #import 11 | #import "NSKeyValueObservance.h" 12 | 13 | @implementation NSKeyValueObservationInfo 14 | { 15 | NSMutableArray *_observances; 16 | } 17 | - (instancetype)init 18 | { 19 | self = [super init]; 20 | if (self) 21 | { 22 | _observances = [[NSMutableArray alloc] init]; 23 | } 24 | return self; 25 | } 26 | - (void)dealloc 27 | { 28 | [_observances release]; 29 | [super dealloc]; 30 | } 31 | 32 | - (void)addObservance:(NSKeyValueObservance *)observance 33 | { 34 | [_observances addObject:observance]; 35 | } 36 | - (void)removeObservance:(NSKeyValueObservance *)observance 37 | { 38 | [_observances removeObject:observance]; 39 | } 40 | - (NSArray *)observances 41 | { 42 | return _observances; 43 | } 44 | - (NSString *)description 45 | { 46 | NSMutableString *desc = [[super description] mutableCopy]; 47 | [desc appendString:@" (\n"]; 48 | for (NSKeyValueObservance *observance in _observances) 49 | { 50 | [desc appendString:[observance description]]; 51 | } 52 | [desc appendString:@")"]; 53 | return [desc autorelease]; 54 | } 55 | @end 56 | -------------------------------------------------------------------------------- /tests/src/NSThreadTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSThreadTests.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "FoundationTests.h" 9 | 10 | @testcase(NSThread, { 11 | BOOL _thread1Passed; 12 | BOOL _thread2Passed; 13 | }) 14 | 15 | test(ThreadCreation) 16 | { 17 | NSThread *thread = [[NSThread alloc] init]; 18 | testassert(thread != nil); 19 | [thread release]; 20 | 21 | return YES; 22 | } 23 | 24 | - (BOOL)thread1 25 | { 26 | _thread1Passed = YES; 27 | 28 | return YES; 29 | } 30 | 31 | test(ThreadSpawning1) 32 | { 33 | _thread1Passed = NO; 34 | NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(thread1) object:nil]; 35 | [thread start]; 36 | sleep(1); 37 | testassert(_thread1Passed); 38 | [thread release]; 39 | 40 | return YES; 41 | } 42 | 43 | - (BOOL)thread2:(NSObject *)obj 44 | { 45 | _thread2Passed = [obj retain] != NULL; 46 | 47 | return YES; 48 | } 49 | 50 | test(ThreadSpawning2) 51 | { 52 | _thread2Passed = NO; 53 | NSObject *obj = [[NSObject alloc] init]; 54 | NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(thread2:) object:obj]; 55 | [obj release]; 56 | [thread start]; 57 | sleep(1); 58 | testassert(_thread2Passed); 59 | [thread release]; 60 | 61 | return YES; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFVersion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFVersion.c 25 | Copyright 2009-2011, Apple Inc. All rights reserved. 26 | Responsibility: CFLite Team 27 | */ 28 | const unsigned char kCFCoreFoundationVersionString[] = "@(#)PROGRAM:CoreFoundation PROJECT:CoreFoundation-855.11 SYSTEM:Darwin DEVELOPER:unknown BUILT:" __DATE__ " " __TIME__ "\n"; 29 | double kCFCoreFoundationVersionNumber = (double)855.11; 30 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSSortDescriptor.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NSSortDescriptor : NSObject 5 | 6 | + (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending; 7 | + (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending selector:(SEL)selector; 8 | #if NS_BLOCKS_AVAILABLE 9 | + (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending comparator:(NSComparator)comparator; 10 | #endif 11 | - (id)initWithKey:(NSString *)key ascending:(BOOL)ascending; 12 | - (id)initWithKey:(NSString *)key ascending:(BOOL)ascending selector:(SEL)selector; 13 | - (NSString *)key; 14 | - (BOOL)ascending; 15 | - (SEL)selector; 16 | #if NS_BLOCKS_AVAILABLE 17 | - (id)initWithKey:(NSString *)key ascending:(BOOL)ascending comparator:(NSComparator)comparator; 18 | - (NSComparator)comparator; 19 | #endif 20 | - (NSComparisonResult)compareObject:(id)obj1 toObject:(id)obj2; 21 | - (id)reversedSortDescriptor; 22 | 23 | @end 24 | 25 | @interface NSSet (NSSortDescriptorSorting) 26 | 27 | - (NSArray *)sortedArrayUsingDescriptors:(NSArray *)sortDescriptors; 28 | 29 | @end 30 | 31 | @interface NSArray (NSSortDescriptorSorting) 32 | 33 | - (NSArray *)sortedArrayUsingDescriptors:(NSArray *)sortDescriptors; 34 | 35 | @end 36 | 37 | @interface NSMutableArray (NSSortDescriptorSorting) 38 | 39 | - (void)sortUsingDescriptors:(NSArray *)sortDescriptors; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /System/Foundation/src/NSOrderedSetInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #import "CFBasicHash.h" 8 | 9 | @interface __NSPlaceholderOrderedSet : NSMutableOrderedSet 10 | + (id)mutablePlaceholder; 11 | + (id)immutablePlaceholder; 12 | @end 13 | 14 | @interface __NSOrderedSetI : NSOrderedSet 15 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 16 | + (id)__new:(const id *)addr :(NSUInteger)count :(BOOL)tbd; 17 | @end 18 | 19 | @interface __NSOrderedSetM : NSMutableOrderedSet 20 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 21 | + (id)__new:(const id *)addr :(NSUInteger)count :(BOOL)tbd; 22 | - (void)_mutate; 23 | @end 24 | 25 | @interface __NSOrderedSetArrayProxy : NSArray 26 | - (id)initWithOrderedSet:(NSOrderedSet *)orderedSet; 27 | @end 28 | 29 | @interface __NSOrderedSetSetProxy : NSSet 30 | - (id)initWithOrderedSet:(NSOrderedSet *)orderedSet; 31 | @end 32 | 33 | @interface __NSOrderedSetReversed : NSOrderedSet 34 | @end 35 | 36 | @interface __NSOrderedSetReverseEnumerator : NSEnumerator 37 | - (id)initWithObject:(id)object; 38 | @end 39 | 40 | @interface NSOrderedSet (NSKeyValueInternalCoding) 41 | 42 | - (id)_minForKeyPath:(id)keyPath; 43 | - (id)_maxForKeyPath:(id)keyPath; 44 | - (id)_avgForKeyPath:(id)keyPath; 45 | - (id)_sumForKeyPath:(id)keyPath; 46 | - (id)_countForKeyPath:(id)keyPath; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSScanner.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSString, NSCharacterSet, NSDictionary; 4 | 5 | @interface NSScanner : NSObject 6 | 7 | - (NSString *)string; 8 | - (NSUInteger)scanLocation; 9 | - (void)setScanLocation:(NSUInteger)pos; 10 | - (void)setCharactersToBeSkipped:(NSCharacterSet *)set; 11 | - (void)setCaseSensitive:(BOOL)flag; 12 | - (void)setLocale:(id)locale; 13 | 14 | @end 15 | 16 | @interface NSScanner (NSExtendedScanner) 17 | 18 | + (id)scannerWithString:(NSString *)string; 19 | + (id)localizedScannerWithString:(NSString *)string; 20 | - (NSCharacterSet *)charactersToBeSkipped; 21 | - (BOOL)caseSensitive; 22 | - (id)locale; 23 | - (BOOL)scanInt:(int *)value; 24 | - (BOOL)scanInteger:(NSInteger *)value; 25 | - (BOOL)scanHexLongLong:(unsigned long long *)result; 26 | - (BOOL)scanHexFloat:(float *)result; 27 | - (BOOL)scanHexDouble:(double *)result; 28 | - (BOOL)scanHexInt:(unsigned *)value; 29 | - (BOOL)scanLongLong:(long long *)value; 30 | - (BOOL)scanFloat:(float *)value; 31 | - (BOOL)scanDouble:(double *)value; 32 | - (BOOL)scanString:(NSString *)string intoString:(NSString **)value; 33 | - (BOOL)scanCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value; 34 | - (BOOL)scanUpToString:(NSString *)string intoString:(NSString **)value; 35 | - (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value; 36 | - (BOOL)isAtEnd; 37 | - (id)initWithString:(NSString *)string; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /System/Foundation/src/NSPointerArrayInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NSPointerFunctionsInternal.h" 3 | 4 | __attribute__((visibility("hidden"))) 5 | @interface NSConcretePointerArray : NSPointerArray { 6 | struct NSSlice slice; 7 | NSUInteger count; 8 | NSUInteger capacity; 9 | NSUInteger options; 10 | NSUInteger mutations; 11 | BOOL needsCompaction; 12 | } 13 | - (id)init; 14 | - (id)initWithOptions:(NSPointerFunctionsOptions)options; 15 | - (id)initWithPointerFunctions:(NSPointerFunctions *)pointerFunctions; 16 | - (id)initWithCoder:(NSCoder *)coder; 17 | - (void)dealloc; 18 | - (void)encodeWithCoder:(NSCoder *)coder; 19 | - (BOOL)isEqual:(id)other; 20 | - (NSUInteger)hash; 21 | - (id)copyWithZone:(NSZone *)zone; 22 | - (void)removePointer:(void *)ptr; 23 | - (NSUInteger)indexOfPointer:(void *)ptr; 24 | - (void)setCount:(NSUInteger)count; 25 | - (NSUInteger)count; 26 | - (void)compact; 27 | - (void)_markNeedsCompaction; 28 | - (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)ptr; 29 | - (void)insertPointer:(void *)ptr atIndex:(NSUInteger)index; 30 | - (void)removePointerAtIndex:(NSUInteger)index; 31 | - (void)addPointer:(void *)ptr; 32 | - (void *)pointerAtIndex:(NSUInteger)index; 33 | - (void)arrayGrow:(NSUInteger)count; 34 | - (NSPointerFunctions *)pointerFunctions; 35 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len; 36 | - (Class)classForCoder; 37 | - (void)_initBlock; 38 | @end 39 | -------------------------------------------------------------------------------- /docs/hello.md: -------------------------------------------------------------------------------- 1 | Hello World Tutorial 2 | ==================== 3 | 4 | Hello World shows how to build a minimal JNI hello world program that uses Foundation and builds and runs on an Android device. 5 | 6 | 7 | Steps 8 | ----- 9 | 10 | * Start Xcode (Android plug-in must have been installed) 11 | * Select New->Project 12 | * Choose JNI Application 13 | 14 | ![My text](images/hello/new-jni-project.png) 15 | 16 | * Name project 17 | * Choose "com.apportable" for Organization Identifier 18 | * Optionally choose another identifier 19 | * If you do, after project creation, edit HelloAndroidActivity.m to match 20 | 21 | ![My text](images/hello/name-project.png) 22 | 23 | * Continue to create project 24 | 25 | ![My text](images/hello/create-project.png) 26 | 27 | * Connect Android device via USB to Mac 28 | * Make sure the device is in developer mode. 29 | 30 | * If your Mac recognizes the device, the Xcode scheme will transition from a generic Android target 31 | 32 | ![My text](images/hello/pre-connect.png) 33 | 34 | * To showing the specific device 35 | 36 | ![My text](images/hello/post-connect.png) 37 | 38 | * Open HelloAndroid.m 39 | 40 | * Double click line 16 to set a breakpoint 41 | 42 | ![My text](images/hello/breakpoint.png) 43 | 44 | * Click the Build and Run button in the upper left corner 45 | 46 | * Note "hello from printf" in the Output log 47 | 48 | ![My text](images/hello/printf.png) 49 | 50 | * Click the Step Over icon 51 | 52 | * Note "hello from NSLog" in the Output log 53 | 54 | ![My text](images/hello/nslog.png) 55 | -------------------------------------------------------------------------------- /System/Foundation/src/NSDate.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | #import "NSExternals.h" 11 | #import "NSObjectInternal.h" 12 | 13 | #import 14 | 15 | @implementation NSDate (NSDate) 16 | 17 | - (Class)classForCoder 18 | { 19 | return [NSDate self]; 20 | } 21 | 22 | OBJC_PROTOCOL_IMPL_PUSH 23 | - (id)initWithCoder:(NSCoder *)aDecoder 24 | { 25 | NSTimeInterval timeInterval = 0.0; 26 | if ([aDecoder allowsKeyedCoding]) 27 | { 28 | timeInterval = [aDecoder decodeDoubleForKey:NS_time]; 29 | } 30 | else 31 | { 32 | [aDecoder decodeValueOfObjCType:@encode(NSTimeInterval) at:&timeInterval]; 33 | } 34 | return [self initWithTimeIntervalSinceReferenceDate:timeInterval]; 35 | } 36 | 37 | - (void)encodeWithCoder:(NSCoder *)aCoder 38 | { 39 | NSTimeInterval timeInterval = [self timeIntervalSinceReferenceDate]; 40 | if ([aCoder allowsKeyedCoding]) 41 | { 42 | [aCoder encodeDouble:timeInterval forKey:NS_time]; 43 | } 44 | else 45 | { 46 | [aCoder encodeValueOfObjCType:@encode(NSTimeInterval) at:&timeInterval]; 47 | } 48 | } 49 | OBJC_PROTOCOL_IMPL_POP 50 | 51 | @end 52 | 53 | @interface NSCalendarDate : NSDate 54 | @end 55 | 56 | @implementation NSCalendarDate 57 | 58 | - (id)allocWithZone:(NSZone *)zone 59 | { 60 | #warning TODO implement NSCalendarDate 61 | DEBUG_BREAK(); 62 | return nil; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSURLCredential.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class NSString, NSArray; 5 | 6 | typedef NS_ENUM(NSUInteger, NSURLCredentialPersistence) { 7 | NSURLCredentialPersistenceNone, 8 | NSURLCredentialPersistenceForSession, 9 | NSURLCredentialPersistencePermanent 10 | }; 11 | 12 | @interface NSURLCredential : NSObject 13 | 14 | - (NSURLCredentialPersistence)persistence; 15 | 16 | @end 17 | 18 | @interface NSURLCredential (NSInternetPassword) 19 | 20 | + (NSURLCredential *)credentialWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence; 21 | - (id)initWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence; 22 | - (NSString *)user; 23 | - (NSString *)password; 24 | - (BOOL)hasPassword; 25 | 26 | @end 27 | 28 | @interface NSURLCredential (NSClientCertificate) 29 | 30 | + (NSURLCredential *)credentialWithIdentity:(SecIdentityRef)identity certificates:(NSArray *)certArray persistence:(NSURLCredentialPersistence)persistence NS_AVAILABLE(10_6, 3_0); 31 | - (id)initWithIdentity:(SecIdentityRef)identity certificates:(NSArray *)certArray persistence:(NSURLCredentialPersistence) persistence NS_AVAILABLE(10_6, 3_0); 32 | - (SecIdentityRef)identity; 33 | - (NSArray *)certificates; 34 | 35 | @end 36 | 37 | @interface NSURLCredential(NSServerTrust) 38 | 39 | + (NSURLCredential *)credentialForTrust:(SecTrustRef)trust; 40 | - (id)initWithTrust:(SecTrustRef)trust; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /tests/src/NSPointerFunctionsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSPointerFunctionsTests.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "FoundationTests.h" 9 | 10 | @testcase(NSPointerFunctions) 11 | 12 | static NSUInteger constTen(const void *str) 13 | { 14 | return 10; 15 | } 16 | 17 | test(CStringHash) 18 | { 19 | NSPointerFunctions *functions = [[[NSPointerFunctions alloc] initWithOptions:NSPointerFunctionsCStringPersonality] autorelease]; 20 | NSUInteger (*hashFunction)(const void *item, NSUInteger (*size)(const void *item)) = [functions hashFunction]; 21 | 22 | testassert(hashFunction != NULL); 23 | 24 | NSUInteger emptyHash = hashFunction("", &strlen); 25 | testassert(emptyHash == 0); 26 | 27 | const char nuls[10] = {0}; 28 | NSUInteger tenNulsHash = hashFunction(nuls, &constTen); 29 | #if __LP64__ 30 | testassert(tenNulsHash == 7832317117341010954ull); 31 | #else 32 | testassert(tenNulsHash == 3142749194); 33 | #endif 34 | 35 | char chars[2] = {0}; 36 | for (int i = 0; i < 256; i++) 37 | { 38 | chars[0] = i; 39 | NSUInteger hash = hashFunction(chars, &strlen); 40 | testassert(hash == (i ? 771 + 3 * i : 0)); 41 | } 42 | 43 | const char *alphabet = "abcdefghijklmnopqrstuvwxyz"; 44 | NSUInteger alphabetHash = hashFunction(alphabet, &strlen); 45 | #if __LP64__ 46 | testassert(alphabetHash == 3027273625588202553ull); 47 | #else 48 | testassert(alphabetHash == 3273129017); 49 | #endif 50 | 51 | return YES; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSURLAuthenticationChallenge.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSURLAuthenticationChallenge, NSURLCredential, NSURLProtectionSpace, NSURLResponse, NSError; 4 | 5 | @protocol NSURLAuthenticationChallengeSender 6 | @required 7 | 8 | - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; 9 | - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; 10 | - (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; 11 | 12 | @optional 13 | 14 | - (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; 15 | - (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge; 16 | 17 | @end 18 | 19 | @interface NSURLAuthenticationChallenge : NSObject 20 | 21 | - (id)initWithProtectionSpace:(NSURLProtectionSpace *)space proposedCredential:(NSURLCredential *)credential previousFailureCount:(NSInteger)previousFailureCount failureResponse:(NSURLResponse *)response error:(NSError *)error sender:(id)sender; 22 | - (id)initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge sender:(id)sender; 23 | - (NSURLProtectionSpace *)protectionSpace; 24 | - (NSURLCredential *)proposedCredential; 25 | - (NSInteger)previousFailureCount; 26 | - (NSURLResponse *)failureResponse; 27 | - (NSError *)error; 28 | - (id)sender; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSURLCache.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | typedef NS_ENUM(NSUInteger, NSURLCacheStoragePolicy) { 4 | NSURLCacheStorageAllowed, 5 | NSURLCacheStorageAllowedInMemoryOnly, 6 | NSURLCacheStorageNotAllowed, 7 | }; 8 | 9 | @class NSData, NSDictionary, NSURLRequest, NSURLResponse; 10 | 11 | @interface NSCachedURLResponse : NSObject 12 | 13 | - (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data; 14 | - (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data userInfo:(NSDictionary *)userInfo storagePolicy:(NSURLCacheStoragePolicy)storagePolicy; 15 | - (NSURLResponse *)response; 16 | - (NSData *)data; 17 | - (NSDictionary *)userInfo; 18 | - (NSURLCacheStoragePolicy)storagePolicy; 19 | 20 | @end 21 | 22 | @interface NSURLCache : NSObject 23 | 24 | + (NSURLCache *)sharedURLCache; 25 | + (void)setSharedURLCache:(NSURLCache *)cache; 26 | - (id)initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity diskPath:(NSString *)path; 27 | - (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request; 28 | - (void)storeCachedResponse:(NSCachedURLResponse *)cachedResponse forRequest:(NSURLRequest *)request; 29 | - (void)removeCachedResponseForRequest:(NSURLRequest *)request; 30 | - (void)removeAllCachedResponses; 31 | - (NSUInteger)memoryCapacity; 32 | - (NSUInteger)diskCapacity; 33 | - (void)setMemoryCapacity:(NSUInteger)memoryCapacity; 34 | - (void)setDiskCapacity:(NSUInteger)diskCapacity; 35 | - (NSUInteger)currentMemoryUsage; 36 | - (NSUInteger)currentDiskUsage; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /tests/src/NSLocaleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLocaleTests.m 3 | // FoundationTests 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "FoundationTests.h" 9 | 10 | @testcase(NSLocale) 11 | 12 | test(Allocate) 13 | { 14 | NSLocale *l1 = [NSLocale alloc]; 15 | NSLocale *l2 = [NSLocale alloc]; 16 | 17 | testassert(l1 == l2); 18 | 19 | return YES; 20 | } 21 | 22 | test(PreferredLanguages) 23 | { 24 | NSArray *langs = [NSLocale preferredLanguages]; 25 | testassert([langs count] >= 1); 26 | NSString *myLanguage = [langs objectAtIndex:0]; 27 | testassert([myLanguage isEqualToString:@"en"]); // Will fail on non English speaking devices 28 | return YES; 29 | } 30 | 31 | test(AutoupdatingCurrentLocale) 32 | { 33 | NSLocale *autoCurrentLocale = [NSLocale autoupdatingCurrentLocale]; 34 | NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; 35 | testassert([autoCurrentLocale isKindOfClass:[NSLocale class]]); 36 | testassert([currentLocale isKindOfClass:[NSLocale class]]); 37 | testassert([[autoCurrentLocale localeIdentifier] isEqualToString:[currentLocale localeIdentifier]]); 38 | return YES; 39 | } 40 | 41 | test(displayNameForKeyValue) 42 | { 43 | NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; 44 | NSString *displayName = [currentLocale displayNameForKey:NSLocaleIdentifier value:@"en_US"]; 45 | testassert(displayName != nil); 46 | testassert([displayName isEqualToString:@"English (United States)"]); 47 | return YES; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSHTTPCookie.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray, NSDate, NSDictionary, NSString, NSURL; 4 | 5 | FOUNDATION_EXPORT NSString * const NSHTTPCookieName; 6 | FOUNDATION_EXPORT NSString * const NSHTTPCookieValue; 7 | FOUNDATION_EXPORT NSString * const NSHTTPCookieOriginURL; 8 | FOUNDATION_EXPORT NSString * const NSHTTPCookieVersion; 9 | FOUNDATION_EXPORT NSString * const NSHTTPCookieDomain; 10 | FOUNDATION_EXPORT NSString * const NSHTTPCookiePath; 11 | FOUNDATION_EXPORT NSString * const NSHTTPCookieSecure; 12 | FOUNDATION_EXPORT NSString * const NSHTTPCookieExpires; 13 | FOUNDATION_EXPORT NSString * const NSHTTPCookieComment; 14 | FOUNDATION_EXPORT NSString * const NSHTTPCookieCommentURL; 15 | FOUNDATION_EXPORT NSString * const NSHTTPCookieDiscard; 16 | FOUNDATION_EXPORT NSString * const NSHTTPCookieMaximumAge; 17 | FOUNDATION_EXPORT NSString * const NSHTTPCookiePort; 18 | 19 | @interface NSHTTPCookie : NSObject 20 | 21 | + (id)cookieWithProperties:(NSDictionary *)properties; 22 | + (NSDictionary *)requestHeaderFieldsWithCookies:(NSArray *)cookies; 23 | + (NSArray *)cookiesWithResponseHeaderFields:(NSDictionary *)headerFields forURL:(NSURL *)URL; 24 | - (id)initWithProperties:(NSDictionary *)properties; 25 | - (NSDictionary *)properties; 26 | - (NSUInteger)version; 27 | - (NSString *)name; 28 | - (NSString *)value; 29 | - (NSDate *)expiresDate; 30 | - (BOOL)isSessionOnly; 31 | - (NSString *)domain; 32 | - (NSString *)path; 33 | - (BOOL)isSecure; 34 | - (BOOL)isHTTPOnly; 35 | - (NSString *)comment; 36 | - (NSURL *)commentURL; 37 | - (NSArray *)portList; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /System/CFNetwork/CFNetwork/CFNetwork-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.apportable.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | APBL 23 | CFBundleVersion 24 | 1 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | 00000000-0000-0000-0000-000000000000 32 | MyFactoryFunction 33 | 34 | CFPlugInTypes 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 00000000-0000-0000-0000-000000000000 39 | 40 | 41 | CFPlugInUnloadFunction 42 | 43 | NSHumanReadableCopyright 44 | Copyright © 2014 Apportable Inc. All rights reserved. 45 | 46 | 47 | -------------------------------------------------------------------------------- /System/Foundation/Foundation/Foundation-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.apportable.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | APBL 23 | CFBundleVersion 24 | 1 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | 00000000-0000-0000-0000-000000000000 32 | MyFactoryFunction 33 | 34 | CFPlugInTypes 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 00000000-0000-0000-0000-000000000000 39 | 40 | 41 | CFPlugInUnloadFunction 42 | 43 | NSHumanReadableCopyright 44 | Copyright © 2014 Apportable Inc. All rights reserved. 45 | 46 | 47 | -------------------------------------------------------------------------------- /System/CoreFoundation/CoreFoundation/CoreFoundation-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.apportable.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | APBL 23 | CFBundleVersion 24 | 1 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | 00000000-0000-0000-0000-000000000000 32 | MyFactoryFunction 33 | 34 | CFPlugInTypes 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 00000000-0000-0000-0000-000000000000 39 | 40 | 41 | CFPlugInUnloadFunction 42 | 43 | NSHumanReadableCopyright 44 | Copyright © 2014 Apportable Inc. All rights reserved. 45 | 46 | 47 | -------------------------------------------------------------------------------- /System/CFNetwork/private_include/CFNetwork/CFHTTPCookie.h: -------------------------------------------------------------------------------- 1 | #ifndef CFNetwork_CFHTTPCookie_h 2 | #define CFNetwork_CFHTTPCookie_h 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #if PRAGMA_ONCE 12 | #pragma once 13 | #endif 14 | 15 | __BEGIN_DECLS 16 | 17 | typedef struct __CFHTTPCookie *CFHTTPCookieRef; 18 | 19 | CFHTTPCookieRef CFHTTPCookieCreateWithProperties(CFDictionaryRef properties); 20 | CFNumberRef CFHTTPCookieGetVersion(CFHTTPCookieRef cookie); 21 | CFStringRef CFHTTPCookieGetValue(CFHTTPCookieRef cookie); 22 | CFStringRef CFHTTPCookieGetName(CFHTTPCookieRef cookie); 23 | CFStringRef CFHTTPCookieGetDomain(CFHTTPCookieRef cookie); 24 | CFDateRef CFHTTPCookieGetExpirationDate(CFHTTPCookieRef cookie); 25 | CFStringRef CFHTTPCookieGetPath(CFHTTPCookieRef cookie); 26 | CFStringRef CFHTTPCookieGetComment(CFHTTPCookieRef cookie); 27 | CFURLRef CFHTTPCookieGetCommentURL(CFHTTPCookieRef cookie); 28 | CFStringRef CFHTTPCookieGetPath(CFHTTPCookieRef cookie); 29 | CFArrayRef CFHTTPCookieGetPortArray(CFHTTPCookieRef cookie); 30 | Boolean CFHTTPCookieIsHTTPOnly(CFHTTPCookieRef cookie); 31 | Boolean CFHTTPCookieIsSecure(CFHTTPCookieRef cookie); 32 | Boolean CFHTTPCookieIsSessionOnly(CFHTTPCookieRef cookie); 33 | CFDictionaryRef CFHTTPCookieCopyProperties(CFHTTPCookieRef cookie); 34 | CFDictionaryRef CFHTTPCookieCopyRequestHeaderFields(CFArrayRef cookies); 35 | CFArrayRef CFHTTPCookieCreateWithResponseHeaderFields(CFDictionaryRef headerFields, CFURLRef url); 36 | 37 | __END_DECLS 38 | #endif 39 | -------------------------------------------------------------------------------- /System/CoreFoundation/src/CFUtilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* CFUtilities.h 25 | Copyright (c) 2005-2013, Apple Inc. All rights reserved. 26 | */ 27 | 28 | #if !defined(__COREFOUNDATION_CFUTILITIES__) 29 | #define __COREFOUNDATION_CFUTILITIES__ 1 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | CF_IMPLICIT_BRIDGING_ENABLED 36 | CF_EXTERN_C_BEGIN 37 | 38 | CF_EXPORT 39 | CFURLRef CFCopyHomeDirectoryURL(void) CF_AVAILABLE_IOS(5_0); 40 | 41 | CF_EXTERN_C_END 42 | CF_IMPLICIT_BRIDGING_DISABLED 43 | 44 | #endif /* ! __COREFOUNDATION_CFUTILITIES__ */ 45 | 46 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSByteCountFormatter.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | typedef NS_OPTIONS(NSUInteger, NSByteCountFormatterUnits) { 4 | NSByteCountFormatterUseDefault = 0, 5 | NSByteCountFormatterUseBytes = 1UL << 0, 6 | NSByteCountFormatterUseKB = 1UL << 1, 7 | NSByteCountFormatterUseMB = 1UL << 2, 8 | NSByteCountFormatterUseGB = 1UL << 3, 9 | NSByteCountFormatterUseTB = 1UL << 4, 10 | NSByteCountFormatterUsePB = 1UL << 5, 11 | NSByteCountFormatterUseEB = 1UL << 6, 12 | NSByteCountFormatterUseZB = 1UL << 7, 13 | NSByteCountFormatterUseYBOrHigher = 0x0FFUL << 8, 14 | NSByteCountFormatterUseAll = 0x0FFFFUL 15 | 16 | }; 17 | 18 | typedef NS_ENUM(NSInteger, NSByteCountFormatterCountStyle) { 19 | NSByteCountFormatterCountStyleFile = 0, 20 | NSByteCountFormatterCountStyleMemory = 1, 21 | NSByteCountFormatterCountStyleDecimal = 2, 22 | NSByteCountFormatterCountStyleBinary = 3 23 | }; 24 | 25 | @interface NSByteCountFormatter : NSFormatter 26 | 27 | @property NSByteCountFormatterUnits allowedUnits; 28 | @property NSByteCountFormatterCountStyle countStyle; 29 | @property BOOL allowsNonnumericFormatting; 30 | @property BOOL includesUnit; 31 | @property BOOL includesCount; 32 | @property BOOL includesActualByteCount; 33 | @property (getter=isAdaptive) BOOL adaptive; 34 | @property BOOL zeroPadsFractionDigits; 35 | 36 | + (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)style; 37 | - (NSString *)stringFromByteCount:(long long)byteCount; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /tests/FoundationTests/ATestPlist.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apportable.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /System/Foundation/src/NSJSONSerializationInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | #import 6 | 7 | @interface _NSJSONReader : NSObject { 8 | id input; 9 | NSJSONReadingOptions kind; 10 | NSError *error; 11 | } 12 | 13 | + (BOOL)validForJSON:(id)obj depth:(NSUInteger)depth allowFragments:(BOOL)frags; 14 | - (id)init; 15 | - (void)dealloc; 16 | - (id)parseStream:(NSInputStream *)stream options:(NSJSONReadingOptions)opts; 17 | - (id)parseData:(NSData *)data options:(NSJSONReadingOptions)opts; 18 | - (NSStringEncoding)findEncodingFromData:(NSData *)data withBOMSkipLength:(NSUInteger *)bomLength; 19 | - (id)parseUTF8JSONData:(NSData *)data skipBytes:(NSUInteger)skip options:(NSJSONReadingOptions)opts; 20 | - (void)setError:(NSError *)error; 21 | - (NSError *)error; 22 | 23 | @end 24 | 25 | @interface _NSJSONWriter : NSObject { 26 | NSOutputStream *outputStream; 27 | NSJSONWritingOptions kind; 28 | char *dataBuffer; 29 | NSUInteger dataBufferLen; 30 | NSUInteger dataLen; 31 | BOOL freeDataBuffer; 32 | char *tempBuffer; 33 | NSUInteger tempBufferLen; 34 | NSInteger totalDataWritten; 35 | } 36 | 37 | - (id)init; 38 | - (void)dealloc; 39 | - (int)appendString:(NSString *)string range:(NSRange)range; 40 | - (void)resizeTemporaryBuffer:(size_t)size; 41 | - (int)writeRootObject:(id)object toStream:(NSOutputStream *)stream options:(NSJSONWritingOptions)opts error:(NSError **)error; 42 | - (NSData *)dataWithRootObject:(id)object options:(NSJSONWritingOptions)options error:(NSError **)error; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /System/Foundation/src/NSKeyValueContainerClass.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSKeyValueContainerClass.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSKeyValueContainerClass.h" 9 | #import 10 | #import 11 | 12 | @implementation NSKeyValueContainerClass 13 | 14 | - (instancetype)initWithOriginalClass:(Class)cls 15 | { 16 | self = [super init]; 17 | if (self != nil) 18 | { 19 | self.originalClass = cls; 20 | self.cachedObservationInfoImplementation = class_getMethodImplementation(self.originalClass, @selector(observationInfo)); 21 | Method setObservationInfoMethod = class_getInstanceMethod(self.originalClass, @selector(setObservationInfo:)); 22 | self.cachedSetObservationInfoImplementation = method_getImplementation(setObservationInfoMethod); 23 | char buf = 0; 24 | method_getArgumentType(setObservationInfoMethod, 2, &buf, 1); 25 | if (buf == '@') 26 | { 27 | self.cachedSetObservationInfoTakesAnObject = YES; 28 | } 29 | } 30 | return self; 31 | } 32 | 33 | - (NSString *)description 34 | { 35 | return [NSString stringWithFormat:@"%@ containing: %@, cached observationInfo IMP: %p, cached setObservationInfo: IMP: %p, cached setObservationInfo: does %@take an object>", 36 | [super description], 37 | self.originalClass, 38 | self.cachedObservationInfoImplementation, 39 | self.cachedSetObservationInfoImplementation, 40 | self.cachedSetObservationInfoTakesAnObject ? @"" : @"NOT "]; 41 | } 42 | @end 43 | -------------------------------------------------------------------------------- /tests/FoundationTests/FoundationTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apportable.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSFileVersion.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSArray, NSDate, NSDictionary, NSError, NSString, NSURL; 4 | 5 | typedef NS_OPTIONS(NSUInteger, NSFileVersionAddingOptions) { 6 | NSFileVersionAddingByMoving = 1 << 0 7 | }; 8 | 9 | typedef NS_OPTIONS(NSUInteger, NSFileVersionReplacingOptions) { 10 | NSFileVersionReplacingByMoving = 1 << 0 11 | }; 12 | 13 | @interface NSFileVersion : NSObject 14 | 15 | @property (readonly) NSURL *URL; 16 | @property (readonly) NSString *localizedName; 17 | @property (readonly) NSString *localizedNameOfSavingComputer; 18 | @property (readonly) NSDate *modificationDate; 19 | @property (readonly) id persistentIdentifier; 20 | @property (readonly, getter=isConflict) BOOL conflict; 21 | @property (getter=isResolved) BOOL resolved; 22 | @property (getter=isDiscardable) BOOL discardable; 23 | 24 | + (NSFileVersion *)currentVersionOfItemAtURL:(NSURL *)url; 25 | + (NSArray *)otherVersionsOfItemAtURL:(NSURL *)url; 26 | + (NSArray *)unresolvedConflictVersionsOfItemAtURL:(NSURL *)url; 27 | + (NSFileVersion *)versionOfItemAtURL:(NSURL *)url forPersistentIdentifier:(id)persistentIdentifier; 28 | + (NSFileVersion *)addVersionOfItemAtURL:(NSURL *)url withContentsOfURL:(NSURL *)contentsURL options:(NSFileVersionAddingOptions)options error:(NSError **)outError; 29 | + (NSURL *)temporaryDirectoryURLForNewVersionOfItemAtURL:(NSURL *)url; 30 | + (BOOL)removeOtherVersionsOfItemAtURL:(NSURL *)url error:(NSError **)outError; 31 | 32 | - (NSURL *)replaceItemAtURL:(NSURL *)url options:(NSFileVersionReplacingOptions)options error:(NSError **)error; 33 | - (BOOL)removeAndReturnError:(NSError **)outError; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /tests/FoundationTests/FoundationTestsAndroid-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apportable.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSPredicate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | @interface NSPredicate : NSObject 7 | 8 | + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat argumentArray:(NSArray *)arguments; 9 | + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat, ...; 10 | + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat arguments:(va_list)args; 11 | + (NSPredicate *)predicateWithValue:(BOOL)value; 12 | #if NS_BLOCKS_AVAILABLE 13 | + (NSPredicate*)predicateWithBlock:(BOOL (^)(id evaluatedObject, NSDictionary *bindings))block; 14 | #endif 15 | 16 | - (NSString *)predicateFormat; 17 | - (NSPredicate *)predicateWithSubstitutionVariables:(NSDictionary *)variables; 18 | - (BOOL)evaluateWithObject:(id)object; 19 | - (BOOL)evaluateWithObject:(id)object substitutionVariables:(NSDictionary *)bindings; 20 | 21 | @end 22 | 23 | @interface NSArray (NSPredicateSupport) 24 | 25 | - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate; 26 | 27 | @end 28 | 29 | @interface NSMutableArray (NSPredicateSupport) 30 | 31 | - (void)filterUsingPredicate:(NSPredicate *)predicate; 32 | 33 | @end 34 | 35 | @interface NSSet (NSPredicateSupport) 36 | 37 | - (NSSet *)filteredSetUsingPredicate:(NSPredicate *)predicate; 38 | 39 | @end 40 | 41 | @interface NSOrderedSet (NSPredicateSupport) 42 | 43 | - (NSOrderedSet *)filteredOrderedSetUsingPredicate:(NSPredicate *)predicate; 44 | 45 | @end 46 | 47 | @interface NSMutableSet (NSPredicateSupport) 48 | 49 | - (void)filterUsingPredicate:(NSPredicate *)predicate; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSFilePresenter.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class NSError, NSFileVersion, NSOperationQueue, NSURL; 4 | 5 | @protocol NSFilePresenter 6 | @required 7 | 8 | @property (readonly) NSURL *presentedItemURL; 9 | @property (readonly) NSOperationQueue *presentedItemOperationQueue; 10 | 11 | @optional 12 | 13 | #if NS_BLOCKS_AVAILABLE 14 | - (void)relinquishPresentedItemToReader:(void (^)(void (^reacquirer)(void)))reader; 15 | - (void)relinquishPresentedItemToWriter:(void (^)(void (^reacquirer)(void)))writer; 16 | - (void)savePresentedItemChangesWithCompletionHandler:(void (^)(NSError *errorOrNil))completionHandler; 17 | - (void)accommodatePresentedItemDeletionWithCompletionHandler:(void (^)(NSError *errorOrNil))completionHandler; 18 | #endif 19 | - (void)presentedItemDidMoveToURL:(NSURL *)newURL; 20 | - (void)presentedItemDidChange; 21 | - (void)presentedItemDidGainVersion:(NSFileVersion *)version; 22 | - (void)presentedItemDidLoseVersion:(NSFileVersion *)version; 23 | - (void)presentedItemDidResolveConflictVersion:(NSFileVersion *)version; 24 | #if NS_BLOCKS_AVAILABLE 25 | - (void)accommodatePresentedSubitemDeletionAtURL:(NSURL *)url completionHandler:(void (^)(NSError *errorOrNil))completionHandler; 26 | #endif 27 | - (void)presentedSubitemDidAppearAtURL:(NSURL *)url; 28 | - (void)presentedSubitemAtURL:(NSURL *)oldURL didMoveToURL:(NSURL *)newURL; 29 | - (void)presentedSubitemDidChangeAtURL:(NSURL *)url; 30 | - (void)presentedSubitemAtURL:(NSURL *)url didGainVersion:(NSFileVersion *)version; 31 | - (void)presentedSubitemAtURL:(NSURL *)url didLoseVersion:(NSFileVersion *)version; 32 | - (void)presentedSubitemAtURL:(NSURL *)url didResolveConflictVersion:(NSFileVersion *)version; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /System/Foundation/src/NSTimeZoneInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "CFInternal.h" 3 | 4 | CF_PRIVATE 5 | @interface __NSPlaceholderTimeZone : NSTimeZone 6 | 7 | + (id)immutablePlaceholder; 8 | + (void)initialize; 9 | - (NSDate *)nextDaylightSavingTimeTransitionAfterDate:(NSDate *)aDate; 10 | - (NSTimeInterval)daylightSavingTimeOffsetForDate:(NSDate *)aDate; 11 | - (BOOL)isDaylightSavingTimeForDate:(NSDate *)aDate; 12 | - (NSString *)abbreviationForDate:(NSDate *)aDate; 13 | - (NSInteger)secondsFromGMTForDate:(NSDate *)aDate; 14 | - (NSData *)data; 15 | - (NSString *)name; 16 | - (void)dealloc; 17 | - (NSUInteger)retainCount; 18 | - (oneway void)release; 19 | - (id)retain; 20 | - (id)init; 21 | - (id)initWithName:(NSString *)name; 22 | - (id)__initWithName:(NSString *)name cache:(BOOL)shouldCache; 23 | - (id)initWithName:(NSString *)name data:(NSData *)data; 24 | - (id)__initWithName:(NSString *)name data:(NSData *)data cache:(BOOL)shouldCache; 25 | 26 | @end 27 | 28 | CF_PRIVATE 29 | @interface __NSTimeZone : NSTimeZone 30 | 31 | + (id)allocWithZone:(NSZone *)zone; 32 | + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 33 | + (id)__new:(CFStringRef)name cache:(BOOL)shouldCache; 34 | + (id)__new:(CFStringRef)name data:(CFDataRef)data; 35 | - (void)dealloc; 36 | - (NSString *)localizedName:(NSTimeZoneNameStyle)style locale:(NSLocale *)locale; 37 | - (NSDate *)nextDaylightSavingTimeTransitionAfterDate:(NSDate *)aDate; 38 | - (NSTimeInterval)daylightSavingTimeOffsetForDate:(NSDate *)aDate; 39 | - (BOOL)isDaylightSavingTimeForDate:(NSDate *)aDate; 40 | - (NSString *)abbreviationForDate:(NSDate *)aDate; 41 | - (NSInteger)secondsFromGMTForDate:(NSDate *)aDate; 42 | - (NSData *)data; 43 | - (NSString *)name; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /System/Foundation/src/NSBOMEncoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBOMEncoding.m 3 | // Foundation 4 | // 5 | // Copyright (c) 2014 Apportable. All rights reserved. 6 | // 7 | 8 | #import "NSBOMEncoding.h" 9 | 10 | #import 11 | 12 | struct BOMEncoding { 13 | uint32_t BOM; 14 | uint32_t mask; 15 | uint8_t length; 16 | NSStringEncoding encoding; 17 | }; 18 | 19 | static struct BOMEncoding BOMEncodings[] = { 20 | { 21 | 0xEFBBBF00, 22 | 0xFFFFFF00, 23 | 3, 24 | NSUTF8StringEncoding 25 | }, 26 | { 27 | 0xFEFF0000, 28 | 0xFFFF0000, 29 | 2, 30 | NSUTF16BigEndianStringEncoding 31 | }, 32 | { 33 | 0xFFFE0000, 34 | 0xFFFF0000, 35 | 2, 36 | NSUTF16LittleEndianStringEncoding 37 | }, 38 | { 39 | 0x0000FEFF, 40 | 0xFFFFFFFF, 41 | 4, 42 | NSUTF32BigEndianStringEncoding 43 | }, 44 | { 45 | 0xFFFE0000, 46 | 0xFFFFFFFF, 47 | 4, 48 | NSUTF32LittleEndianStringEncoding 49 | }, 50 | #warning TODO https://code.google.com/p/apportable/issues/detail?id=271 51 | }; 52 | 53 | void _NSDetectEncodingFromBOM(uint32_t BOM, NSStringEncoding *encoding, NSUInteger *length) 54 | { 55 | for (NSUInteger idx = 0; idx < sizeof(BOMEncodings)/sizeof(struct BOMEncoding); idx++) 56 | { 57 | if ((BOM & BOMEncodings[idx].mask) == BOMEncodings[idx].BOM) 58 | { 59 | if (length != NULL) 60 | { 61 | *length = BOMEncodings[idx].length; 62 | } 63 | if (encoding != NULL) 64 | { 65 | *encoding = BOMEncodings[idx].encoding; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /System/Foundation/src/NSValueTransformerInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSValueTransformer (Internal) 4 | 5 | + (NSMutableDictionary *)_transformerRegistry; 6 | 7 | @end 8 | 9 | @interface _NSSharedValueTransformer : NSValueTransformer 10 | 11 | - (BOOL)_isBooleanTransformer; 12 | - (id)copyWithZone:(NSZone *)zone; 13 | - (id)copy; 14 | - (BOOL)_tryRetain; 15 | - (BOOL)_isDeallocating; 16 | - (oneway void)release; 17 | - (id)autorelease; 18 | - (id)retain; 19 | 20 | @end 21 | 22 | __attribute__((visibility("hidden"))) 23 | @interface _NSNegateBooleanTransformer : _NSSharedValueTransformer 24 | 25 | + (Class)transformedValueClass; 26 | - (BOOL)_isBooleanTransformer; 27 | - (id)description; 28 | - (id)transformedValue:(id)value; 29 | 30 | @end 31 | 32 | __attribute__((visibility("hidden"))) 33 | @interface _NSIsNilTransformer : _NSNegateBooleanTransformer 34 | 35 | + (BOOL)supportsReverseTransformation; 36 | - (id)description; 37 | - (id)transformedValue:(id)value; 38 | 39 | @end 40 | 41 | __attribute__((visibility("hidden"))) 42 | @interface _NSIsNotNilTransformer : _NSNegateBooleanTransformer 43 | 44 | + (BOOL)supportsReverseTransformation; 45 | - (id)description; 46 | - (id)transformedValue:(id)value; 47 | 48 | @end 49 | 50 | __attribute__((visibility("hidden"))) 51 | @interface _NSKeyedUnarchiveFromDataTransformer : _NSSharedValueTransformer 52 | 53 | - (id)description; 54 | - (id)reverseTransformedValue:(id)value; 55 | - (id)transformedValue:(id)value; 56 | 57 | @end 58 | 59 | __attribute__((visibility("hidden"))) 60 | @interface _NSUnarchiveFromDataTransformer : _NSSharedValueTransformer 61 | 62 | - (id)description; 63 | - (id)reverseTransformedValue:(id)value; 64 | - (id)transformedValue:(id)value; 65 | 66 | @end 67 | 68 | -------------------------------------------------------------------------------- /System/Foundation/include/Foundation/NSMapTable.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | #if !defined(__FOUNDATION_NSMAPTABLE__) 6 | #define __FOUNDATION_NSMAPTABLE__ 1 7 | 8 | @class NSArray, NSDictionary, NSMapTable; 9 | 10 | typedef NS_ENUM(NSUInteger, NSMapTableOptions) { 11 | NSMapTableStrongMemory = 0, 12 | NSMapTableCopyIn = NSPointerFunctionsCopyIn, 13 | NSMapTableObjectPointerPersonality = NSPointerFunctionsObjectPointerPersonality, 14 | NSMapTableWeakMemory = NSPointerFunctionsWeakMemory 15 | }; 16 | 17 | @interface NSMapTable : NSObject 18 | 19 | + (id)mapTableWithKeyOptions:(NSPointerFunctionsOptions)keyOptions valueOptions:(NSPointerFunctionsOptions)valueOptions; 20 | + (id)strongToStrongObjectsMapTable; 21 | + (id)weakToStrongObjectsMapTable; 22 | + (id)strongToWeakObjectsMapTable; 23 | + (id)weakToWeakObjectsMapTable; 24 | - (id)initWithKeyOptions:(NSPointerFunctionsOptions)keyOptions valueOptions:(NSPointerFunctionsOptions)valueOptions capacity:(NSUInteger)initialCapacity; 25 | - (id)initWithKeyPointerFunctions:(NSPointerFunctions *)keyFunctions valuePointerFunctions:(NSPointerFunctions *)valueFunctions capacity:(NSUInteger)initialCapacity; 26 | - (NSPointerFunctions *)keyPointerFunctions; 27 | - (NSPointerFunctions *)valuePointerFunctions; 28 | - (id)objectForKey:(id)aKey; 29 | - (void)removeObjectForKey:(id)aKey; 30 | - (void)setObject:(id)anObject forKey:(id)aKey; 31 | - (NSUInteger)count; 32 | - (NSEnumerator *)keyEnumerator; 33 | - (NSEnumerator *)objectEnumerator; 34 | - (void)removeAllObjects; 35 | - (NSDictionary *)dictionaryRepresentation; 36 | 37 | @end 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /System/Foundation/src/NSDirectoryEnumerator.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NSFileAttributes.h" 3 | #import 4 | #import 5 | 6 | CF_PRIVATE 7 | @interface NSAllDescendantPathsEnumerator : NSDirectoryEnumerator { 8 | NSString *path; 9 | NSArray *contents; 10 | NSUInteger idx; 11 | NSString *prepend; 12 | NSAllDescendantPathsEnumerator *under; 13 | NSFileAttributes *directoryAttributes; 14 | NSString *pathToLastReportedItem; 15 | NSUInteger depth; 16 | BOOL cross; 17 | char _padding[3]; 18 | } 19 | 20 | + (id)newWithPath:(NSString *)path prepend:(NSString *)prefix attributes:(NSArray *)properties cross:(BOOL)cross depth:(NSUInteger)depth; 21 | - (void)dealloc; 22 | - (void)skipDescendants; 23 | - (void)skipDescendents; 24 | - (NSAllDescendantPathsEnumerator *)_under; 25 | - (NSUInteger)level; 26 | - (id)currentSubdirectoryAttributes; 27 | - (NSDictionary *)directoryAttributes; 28 | - (NSDictionary *)fileAttributes; 29 | - (id)nextObject; 30 | 31 | @end 32 | 33 | CF_PRIVATE 34 | @interface NSURLDirectoryEnumerator : NSDirectoryEnumerator { 35 | CFURLEnumeratorRef _enumerator; 36 | BOOL (^_errorHandler)(NSURL *url, NSError *error); 37 | BOOL shouldContinue; 38 | } 39 | 40 | @property (copy) BOOL (^errorHandler)(NSURL *url, NSError *error); 41 | 42 | - (id)initWithURL:(NSURL *)url includingPropertiesForKeys:(NSArray *)properties options:(NSDirectoryEnumerationOptions)options errorHandler:(BOOL (^)(NSURL *url, NSError *error))handler; 43 | - (void)dealloc; 44 | - (NSDictionary *)directoryAttributes; 45 | - (NSDictionary *)fileAttributes; 46 | - (NSUInteger)level; 47 | - (void)skipDescendants; 48 | - (void)skipDescendents; 49 | - (id)nextObject; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /System/Foundation/src/CFInternal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | CF_EXPORT void _CFRuntimeBridgeClasses(CFTypeID type, const char *name); 5 | CF_EXPORT CFTypeRef _CFTryRetain(CFTypeRef cf); 6 | CF_EXPORT Boolean _CFIsDeallocating(CFTypeRef cf); 7 | CF_EXPORT CFHashCode CFHashBytes(UInt8 *bytes, CFIndex length); 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wunused-function" 11 | 12 | static const void * _NSCFCopy(CFAllocatorRef allocator, const void *value) 13 | { 14 | return [(NSObject *)value copy]; 15 | } 16 | 17 | static const void * _NSCFRetain2(CFAllocatorRef allocator, const void *value) 18 | { 19 | return [(NSObject *)value retain]; 20 | } 21 | 22 | static void _NSCFRelease2(CFAllocatorRef allocator, const void *value) 23 | { 24 | [(NSObject *)value release]; 25 | } 26 | 27 | static const void * _NSCFRetain(const void *info) 28 | { 29 | return (void *)[(NSObject *)info retain]; 30 | } 31 | 32 | static void _NSCFRelease(const void *info) 33 | { 34 | [(NSObject *)info release]; 35 | } 36 | 37 | static CFStringRef _NSCFCopyDescription(const void *value) 38 | { 39 | return (CFStringRef)[[(NSObject *)value description] copy]; 40 | } 41 | 42 | static CFStringRef _NSCFCopyDescription2(void *value, const void *formatOpts) 43 | { 44 | return (CFStringRef)[[(NSObject *)value description] copy]; 45 | } 46 | 47 | static Boolean _NSCFEqual(const void *value1, const void *value2) 48 | { 49 | if (value1 == value2) { 50 | return true; 51 | } 52 | return [(NSObject *)value1 isEqual:(NSObject *)value2]; 53 | } 54 | 55 | static CFHashCode _NSCFHash(const void *value) 56 | { 57 | return [(NSObject *)value hash]; 58 | } 59 | 60 | #pragma clang diagnostic pop 61 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contribute to ApportableFoundation 2 | ================================== 3 | 4 | The ApportableFoundation project relies upon vibrant user and contributor community. Here's how you can participate as a contributor. 5 | 6 | 7 | Guidelines 8 | ---------- 9 | 10 | - **Apple proprietary Foundation implementation**: If you've looked at Apple's proprietary Foundation, you cannot contribute to ApportableFoundation. 11 | - **No Reverse Engineering**: Do not use reverse engineering tools to examine Apple proprietary code. If you do so, you cannot contribute to ApportableFoundation. 12 | - **Contributed Code Ownership**: Make sure you have full access to any code contributed. Do not contribute code that other's have copyrighted. 13 | - **Reference Docs**: Refer to published documentation when implementing any classes. If you would like to discuss approaches, post to the [forum](http://forum.opensource.apportable.com). 14 | - **Reference Code**: Refer to [Apple Open Source](https://www.apple.com/opensource/) code or Apportable Foundation. 15 | - **Coding Style**: Contributions should maintain the coding style of their files and modules. 16 | - **Submit [Pull Requests](https://github.com/apportable/Foundation/pulls) under [MIT license](http://opensource.org/licenses/MIT)** 17 | - Your commit messages should include the line 18 | - **This change is released under the MIT license.** 19 | 20 | Work Areas 21 | ---------- 22 | 23 | Find something that excites you! 24 | 25 | Some ways to get rolling: 26 | 27 | - **Fix a test failure** - After running the [tests](docs/tests.md), fix one of the failures 28 | - **Fix an issue** - See [issues list](https://github.com/apportable/Foundation/issues) 29 | - **Implement Foundation functionality** - Code and add tests for a missing Foundation capability 30 | 31 | --------------------------------------------------------------------------------