From 8a72262d0c30ed2a0a66770094e25dcb70916666 Mon Sep 17 00:00:00 2001 From: Christopher Lloyd Date: Mon, 15 Mar 2010 18:51:01 +0000 Subject: [PATCH] - Common mode behavior added to NSRunLoop - NSRunLoop modified to fire only one timer each time through run loop - NSRunLoop -cancelPerformSelectorsWithTarget: implemented - NSObject +cancelPreviousPerformRequestsWithTarget: implemented - KVO fixes and optimizations - pthread functions added to Foundation project for Windows target - CFHost added to Foundation project - CFStream, CFRunLoop work - NSCollectionViewItem subclass now NSViewController per 10.6 change - NSColor catalog color cleanup - NSTrackingArea made public header - NSStream fixes, CFStream additions - NSUserDefaults improved boolForKey: --- AppKit/AppKit.xcodeproj/project.pbxproj | 10 +- .../NSCollectionView/NSCollectionViewItem.h | 6 +- AppKit/NSColor.subproj/NSColor.m | 20 +- AppKit/NSColor.subproj/NSColor_catalog.h | 2 + AppKit/NSColor.subproj/NSColor_catalog.m | 48 +- AppKit/NSDisplay.m | 8 + CFNetwork/CFHost.m | 2 +- CFNetwork/CFNetServices.h | 3 + CFNetwork/CFNetServices.m | 0 CFNetwork/CFNetwork.h | 3 + CFNetwork/CFNetwork.xcodeproj/project.pbxproj | 147 ++- CoreFoundation/CFRunLoop.h | 2 +- CoreFoundation/CFRunLoop.m | 203 +++++ CoreFoundation/CFStream.h | 7 +- CoreFoundation/CFStream.m | 198 ++++ .../CoreFoundation.xcodeproj/project.pbxproj | 16 + CoreFoundation/pthread/pthread.m | 2 +- .../Foundation.xcodeproj/project.pbxproj | 373 +++++++- .../NSKeyValueCoding/NSKVOInfoPerObject.h | 18 + .../NSKeyValueCoding/NSKVOInfoPerObject.m | 36 + .../NSKeyValueCoding/NSKeyValueCoding.h | 2 +- .../NSKeyValueObserving-Private.h | 19 - .../NSKeyValueCoding/NSKeyValueObserving.h | 10 +- .../NSKeyValueCoding/NSKeyValueObserving.m | 851 +++++++++--------- .../NSKeyValueCoding/NSObservationInfo.h | 34 + .../NSKeyValueCoding/NSObservationInfo.m | 59 ++ .../NSKeyValueCoding/NSString+KVCAdditions.h | 3 +- .../NSKeyValueCoding/NSString+KVCAdditions.m | 11 +- Foundation/NSRunLoop/NSRunLoop.h | 7 +- Foundation/NSRunLoop/NSRunLoop.m | 94 +- Foundation/NSRunLoop/NSRunLoopState.h | 2 +- Foundation/NSRunLoop/NSRunLoopState.m | 57 +- Foundation/NSStream/CFSSLHandler_openssl.m | 8 +- Foundation/NSStream/NSInputStream_socket.h | 7 +- Foundation/NSStream/NSInputStream_socket.m | 106 ++- Foundation/NSStream/NSOutputStream_socket.h | 6 + Foundation/NSStream/NSOutputStream_socket.m | 123 ++- Foundation/NSStream/NSSocket.h | 6 +- Foundation/NSStream/NSSocket.m | 10 + Foundation/NSStream/NSStream.h | 12 +- Foundation/NSStream/NSStream.m | 7 +- Foundation/NSUserDefaults/NSUserDefaults.m | 13 +- Foundation/platform_linux/NSPlatform_linux.m | 10 +- 43 files changed, 1911 insertions(+), 650 deletions(-) create mode 100644 CFNetwork/CFNetServices.h create mode 100644 CFNetwork/CFNetServices.m create mode 100644 Foundation/NSKeyValueCoding/NSKVOInfoPerObject.h create mode 100644 Foundation/NSKeyValueCoding/NSKVOInfoPerObject.m create mode 100644 Foundation/NSKeyValueCoding/NSObservationInfo.h create mode 100644 Foundation/NSKeyValueCoding/NSObservationInfo.m diff --git a/AppKit/AppKit.xcodeproj/project.pbxproj b/AppKit/AppKit.xcodeproj/project.pbxproj index 46853482..1f0af3b3 100644 --- a/AppKit/AppKit.xcodeproj/project.pbxproj +++ b/AppKit/AppKit.xcodeproj/project.pbxproj @@ -133,7 +133,7 @@ C88974800EA0BF3100D0A0A2 /* NSTextAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B60976075300DA0954 /* NSTextAttachment.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C88974810EA0BF3100D0A0A2 /* NSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B80976075300DA0954 /* NSTextField.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C88974820EA0BF3100D0A0A2 /* NSTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BA0976075300DA0954 /* NSTextFieldCell.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; - C88974830EA0BF3100D0A0A2 /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C88974830EA0BF3100D0A0A2 /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; C88974840EA0BF3100D0A0A2 /* NSView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BE0976075300DA0954 /* NSView.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C88974850EA0BF3100D0A0A2 /* NSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C00976075300DA0954 /* NSWindow.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C88974860EA0BF3100D0A0A2 /* NSWindow-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C20976075300DA0954 /* NSWindow-Private.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; @@ -795,7 +795,7 @@ C8A2E3010F07EA1F0054397C /* NSTextAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B60976075300DA0954 /* NSTextAttachment.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C8A2E3020F07EA1F0054397C /* NSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B80976075300DA0954 /* NSTextField.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C8A2E3030F07EA1F0054397C /* NSTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BA0976075300DA0954 /* NSTextFieldCell.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; - C8A2E3040F07EA1F0054397C /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C8A2E3040F07EA1F0054397C /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; C8A2E3050F07EA1F0054397C /* NSView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BE0976075300DA0954 /* NSView.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C8A2E3060F07EA1F0054397C /* NSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C00976075300DA0954 /* NSWindow.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; C8A2E3070F07EA1F0054397C /* NSWindow-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C20976075300DA0954 /* NSWindow-Private.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; @@ -1489,7 +1489,7 @@ FE01A8670C5D9BCB00AEA51A /* NSTextAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B60976075300DA0954 /* NSTextAttachment.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE01A8680C5D9BCB00AEA51A /* NSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B80976075300DA0954 /* NSTextField.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE01A8690C5D9BCB00AEA51A /* NSTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BA0976075300DA0954 /* NSTextFieldCell.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; - FE01A86A0C5D9BCB00AEA51A /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE01A86A0C5D9BCB00AEA51A /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE01A86B0C5D9BCB00AEA51A /* NSView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BE0976075300DA0954 /* NSView.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE01A86C0C5D9BCB00AEA51A /* NSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C00976075300DA0954 /* NSWindow.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE01A86D0C5D9BCB00AEA51A /* NSWindow-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C20976075300DA0954 /* NSWindow-Private.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; @@ -2269,7 +2269,7 @@ FE5A893710C6F50E005E348A /* NSTextAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B60976075300DA0954 /* NSTextAttachment.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE5A893810C6F50E005E348A /* NSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B80976075300DA0954 /* NSTextField.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE5A893910C6F50E005E348A /* NSTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BA0976075300DA0954 /* NSTextFieldCell.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; - FE5A893A10C6F50E005E348A /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE5A893A10C6F50E005E348A /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE5A893B10C6F50E005E348A /* NSView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BE0976075300DA0954 /* NSView.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE5A893C10C6F50E005E348A /* NSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C00976075300DA0954 /* NSWindow.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FE5A893D10C6F50E005E348A /* NSWindow-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C20976075300DA0954 /* NSWindow-Private.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; @@ -3115,7 +3115,7 @@ FEA313D50FD5667D00F480D4 /* NSTextAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B60976075300DA0954 /* NSTextAttachment.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FEA313D60FD5667D00F480D4 /* NSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54B80976075300DA0954 /* NSTextField.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FEA313D70FD5667D00F480D4 /* NSTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BA0976075300DA0954 /* NSTextFieldCell.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; - FEA313D80FD5667D00F480D4 /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FEA313D80FD5667D00F480D4 /* NSTrackingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BC0976075300DA0954 /* NSTrackingArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; FEA313D90FD5667D00F480D4 /* NSView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54BE0976075300DA0954 /* NSView.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FEA313DA0FD5667D00F480D4 /* NSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C00976075300DA0954 /* NSWindow.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; FEA313DB0FD5667D00F480D4 /* NSWindow-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2B54C20976075300DA0954 /* NSWindow-Private.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; diff --git a/AppKit/NSCollectionView/NSCollectionViewItem.h b/AppKit/NSCollectionView/NSCollectionViewItem.h index 8fd2b5e2..8d3839cb 100644 --- a/AppKit/NSCollectionView/NSCollectionViewItem.h +++ b/AppKit/NSCollectionView/NSCollectionViewItem.h @@ -5,11 +5,11 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#import +#import -@class NSCollectionView,NSView; +@class NSCollectionView; -@interface NSCollectionViewItem : NSObject { +@interface NSCollectionViewItem : NSViewController { NSCollectionView *_collectionView; id _representedObject; NSView *_view; diff --git a/AppKit/NSColor.subproj/NSColor.m b/AppKit/NSColor.subproj/NSColor.m index d408d45b..70c834ed 100755 --- a/AppKit/NSColor.subproj/NSColor.m +++ b/AppKit/NSColor.subproj/NSColor.m @@ -18,12 +18,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import -#import - -@interface NSDisplay(revelation) --(void) _addSystemColor: (NSColor *) color forName: (NSString *) name; -@end - @interface NSColor(private) -(NSString *)catalogName; -(NSString *)colorName; @@ -187,19 +181,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI NSString *colorName=[keyed decodeObjectForKey:@"NSColorName"]; NSColor *color=[keyed decodeObjectForKey:@"NSColor"]; - if([catalogName isEqualToString: @"System"]) { - NSDisplay *display = [NSDisplay currentDisplay]; - result = [display colorWithName: colorName]; - if(!result) { - result = color; - [display _addSystemColor: result forName: colorName]; - } - } else { - result = [NSColor colorWithCatalogName: catalogName colorName: colorName]; - if(!result) { - result=color; - } - } + result=[NSColor_catalog colorWithCatalogName: catalogName colorName: colorName color:color]; } break; diff --git a/AppKit/NSColor.subproj/NSColor_catalog.h b/AppKit/NSColor.subproj/NSColor_catalog.h index 592416e6..afbe7f4a 100755 --- a/AppKit/NSColor.subproj/NSColor_catalog.h +++ b/AppKit/NSColor.subproj/NSColor_catalog.h @@ -11,8 +11,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI @interface NSColor_catalog : NSColor { NSString *_catalogName; NSString *_colorName; + NSColor *_color; } +(NSColor *)colorWithCatalogName:(NSString *)catalogName colorName:(NSString *)colorName; ++(NSColor *)colorWithCatalogName:(NSString *)catalogName colorName:(NSString *)colorName color:(NSColor *)color; @end diff --git a/AppKit/NSColor.subproj/NSColor_catalog.m b/AppKit/NSColor.subproj/NSColor_catalog.m index 3f89a505..2a406a81 100755 --- a/AppKit/NSColor.subproj/NSColor_catalog.m +++ b/AppKit/NSColor.subproj/NSColor_catalog.m @@ -8,23 +8,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import -#import @interface NSColor(NSAppKitPrivate) -(CGColorRef)CGColorRef; @end +void NSColorSetCatalogColor(NSString *catalogName,NSString *colorName,NSColor *color); +NSColor *NSColorGetCatalogColor(NSString *catalogName,NSString *colorName); + @implementation NSColor_catalog --initWithCatalogName:(NSString *)catalogName colorName:(NSString *)colorName { +-initWithCatalogName:(NSString *)catalogName colorName:(NSString *)colorName color:(NSColor *)color { _catalogName=[catalogName copy]; _colorName=[colorName copy]; + _color=[color copy]; return self; } -(void)dealloc { [_colorName release]; [_catalogName release]; + [_color release]; NSDeallocateObject(self); return; [super dealloc]; @@ -49,14 +53,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI return NO; } -- (NSString *)description -{ +-(NSString *)description { return [NSString stringWithFormat:@"<%@ catalogName: %@ colorName: %@>", [[self class] description], _catalogName, _colorName]; } +(NSColor *)colorWithCatalogName:(NSString *)catalogName colorName:(NSString *)colorName { - return [[[self alloc] initWithCatalogName:catalogName colorName:colorName] autorelease]; + return [[[self alloc] initWithCatalogName:catalogName colorName:colorName color:nil] autorelease]; +} + ++(NSColor *)colorWithCatalogName:(NSString *)catalogName colorName:(NSString *)colorName color:(NSColor *)color { + if(NSColorGetCatalogColor(catalogName,colorName)==nil) + NSColorSetCatalogColor(catalogName,colorName,color); + + return [[[self alloc] initWithCatalogName:catalogName colorName:colorName color:color] autorelease]; } -(NSString *)colorSpaceName { @@ -72,37 +82,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI } -(NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace device:(NSDictionary *)device { - NSColor *result; + NSColor *result; - if ([colorSpace isEqualToString:[self colorSpaceName]]) - return self; + if ([colorSpace isEqualToString:[self colorSpaceName]]) + return self; - result=[[[NSDisplay currentDisplay] colorWithName:_colorName] colorUsingColorSpaceName:colorSpace device:device]; + result=[NSColorGetCatalogColor(_catalogName,_colorName) colorUsingColorSpaceName:colorSpace device:device]; + if(result==nil) NSLog(@"result ==nil %@ %@",_colorName,colorSpace); + return result; } -(CGColorRef)CGColorRef { - return [[[NSDisplay currentDisplay] colorWithName:_colorName] CGColorRef]; + return [NSColorGetCatalogColor(_catalogName,_colorName) CGColorRef]; } -(void)setFill { - NSColor *color=[[NSDisplay currentDisplay] colorWithName:_colorName]; + NSColor *color=NSColorGetCatalogColor(_catalogName,_colorName); - if(color==nil) - [NSException raise:@"NSUnknownColor" format:@"Unknown color %@ in catalog %@",_colorName,_catalogName]; + if(color==nil) + [NSException raise:@"NSUnknownColor" format:@"Unknown color %@ in catalog %@",_colorName,_catalogName]; - [color setFill]; + [color setFill]; } -(void)setStroke { - NSColor *color=[[NSDisplay currentDisplay] colorWithName:_colorName]; + NSColor *color=NSColorGetCatalogColor(_catalogName,_colorName); - if(color==nil) - [NSException raise:@"NSUnknownColor" format:@"Unknown color %@ in catalog %@",_colorName,_catalogName]; + if(color==nil) + [NSException raise:@"NSUnknownColor" format:@"Unknown color %@ in catalog %@",_colorName,_catalogName]; - [color setStroke]; + [color setStroke]; } @end diff --git a/AppKit/NSDisplay.m b/AppKit/NSDisplay.m index f807ddf8..e4d26f1d 100755 --- a/AppKit/NSDisplay.m +++ b/AppKit/NSDisplay.m @@ -219,3 +219,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI } @end + +void NSColorSetCatalogColor(NSString *catalogName,NSString *colorName,NSColor *color){ + [[NSDisplay currentDisplay] _addSystemColor:color forName: colorName]; +} + +NSColor *NSColorGetCatalogColor(NSString *catalogName,NSString *colorName){ + return [[NSDisplay currentDisplay] colorWithName:colorName]; +} diff --git a/CFNetwork/CFHost.m b/CFNetwork/CFHost.m index 86b713fb..b3687723 100644 --- a/CFNetwork/CFHost.m +++ b/CFNetwork/CFHost.m @@ -1,9 +1,9 @@ #import #import #import -#import #import #ifdef WINDOWS +#import #undef WINVER #define WINVER 0x501 #import diff --git a/CFNetwork/CFNetServices.h b/CFNetwork/CFNetServices.h new file mode 100644 index 00000000..d064838c --- /dev/null +++ b/CFNetwork/CFNetServices.h @@ -0,0 +1,3 @@ +#import + +typedef struct __CFNetService *CFNetServiceRef; diff --git a/CFNetwork/CFNetServices.m b/CFNetwork/CFNetServices.m new file mode 100644 index 00000000..e69de29b diff --git a/CFNetwork/CFNetwork.h b/CFNetwork/CFNetwork.h index e69de29b..07624c91 100644 --- a/CFNetwork/CFNetwork.h +++ b/CFNetwork/CFNetwork.h @@ -0,0 +1,3 @@ +#import +#import +#import diff --git a/CFNetwork/CFNetwork.xcodeproj/project.pbxproj b/CFNetwork/CFNetwork.xcodeproj/project.pbxproj index d7e4ce28..436f27e9 100644 --- a/CFNetwork/CFNetwork.xcodeproj/project.pbxproj +++ b/CFNetwork/CFNetwork.xcodeproj/project.pbxproj @@ -7,9 +7,16 @@ objects = { /* Begin PBXBuildFile section */ - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; - FE74335C10A8968B004CDF00 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; FE74338610A89A9D004CDF00 /* CFNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = FE74338510A89A9D004CDF00 /* CFNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEA752EA114EB30B00AF634E /* CFNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = FE74338510A89A9D004CDF00 /* CFNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEA752EB114EB30B00AF634E /* CFSocketStream.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC121A810EFC6C000FD1B47 /* CFSocketStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEA752EC114EB30B00AF634E /* CFNetServices.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC121CC10EFC89500FD1B47 /* CFNetServices.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEA752ED114EB30B00AF634E /* CFHost.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC121D610EFC92800FD1B47 /* CFHost.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEA752EE114EB30B00AF634E /* CFNetworkExport.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC1221810EFCB9A00FD1B47 /* CFNetworkExport.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEC121A910EFC6C000FD1B47 /* CFSocketStream.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC121A810EFC6C000FD1B47 /* CFSocketStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEC121CD10EFC89500FD1B47 /* CFNetServices.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC121CC10EFC89500FD1B47 /* CFNetServices.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEC121D710EFC92800FD1B47 /* CFHost.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC121D610EFC92800FD1B47 /* CFHost.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEC1221910EFCB9A00FD1B47 /* CFNetworkExport.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC1221810EFCB9A00FD1B47 /* CFNetworkExport.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ @@ -21,6 +28,14 @@ outputFiles = ( ); }; + FEA752EF114EB30B00AF634E /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = org.cocotron.1.0.windows.i386.gcc.default; + fileType = sourcecode.c; + isEditable = 1; + outputFiles = ( + ); + }; /* End PBXBuildRule section */ /* Begin PBXFileReference section */ @@ -29,24 +44,20 @@ 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* CFNetwork.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CFNetwork.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FE74338510A89A9D004CDF00 /* CFNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetwork.h; sourceTree = ""; }; + FEA752F3114EB30B00AF634E /* CFNetwork.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CFNetwork.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FEA752F4114EB30B00AF634E /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info copy.plist"; sourceTree = ""; }; + FEC121A810EFC6C000FD1B47 /* CFSocketStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSocketStream.h; sourceTree = ""; }; + FEC121CC10EFC89500FD1B47 /* CFNetServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetServices.h; sourceTree = ""; }; + FEC121D610EFC92800FD1B47 /* CFHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFHost.h; sourceTree = ""; }; + FEC1221810EFCB9A00FD1B47 /* CFNetworkExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetworkExport.h; sourceTree = ""; }; /* End PBXFileReference section */ -/* Begin PBXFrameworksBuildPhase section */ - 8DC2EF560486A6940098B216 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FE74335C10A8968B004CDF00 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* CFNetwork.framework */, + FEA752F3114EB30B00AF634E /* CFNetwork.framework */, ); name = Products; sourceTree = ""; @@ -54,7 +65,11 @@ 0867D691FE84028FC02AAC07 /* CFNetwork */ = { isa = PBXGroup; children = ( + FEC1221810EFCB9A00FD1B47 /* CFNetworkExport.h */, + FEC121D610EFC92800FD1B47 /* CFHost.h */, + FEC121A810EFC6C000FD1B47 /* CFSocketStream.h */, FE74338510A89A9D004CDF00 /* CFNetwork.h */, + FEC121CC10EFC89500FD1B47 /* CFNetServices.h */, 32C88DFF0371C24200C91783 /* Other Sources */, 089C1665FE841158C02AAC07 /* Resources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, @@ -77,6 +92,7 @@ children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + FEA752F4114EB30B00AF634E /* Info copy.plist */, ); name = Resources; sourceTree = ""; @@ -111,6 +127,22 @@ buildActionMask = 2147483647; files = ( FE74338610A89A9D004CDF00 /* CFNetwork.h in Headers */, + FEC121A910EFC6C000FD1B47 /* CFSocketStream.h in Headers */, + FEC121CD10EFC89500FD1B47 /* CFNetServices.h in Headers */, + FEC121D710EFC92800FD1B47 /* CFHost.h in Headers */, + FEC1221910EFCB9A00FD1B47 /* CFNetworkExport.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FEA752E9114EB30B00AF634E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + FEA752EA114EB30B00AF634E /* CFNetwork.h in Headers */, + FEA752EB114EB30B00AF634E /* CFSocketStream.h in Headers */, + FEA752EC114EB30B00AF634E /* CFNetServices.h in Headers */, + FEA752ED114EB30B00AF634E /* CFHost.h in Headers */, + FEA752EE114EB30B00AF634E /* CFNetworkExport.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -122,9 +154,6 @@ buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CFNetwork-Windows-i386" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, - 8DC2EF520486A6940098B216 /* Resources */, - 8DC2EF540486A6940098B216 /* Sources */, - 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( FE74338110A899DC004CDF00 /* PBXBuildRule */, @@ -137,6 +166,23 @@ productReference = 8DC2EF5B0486A6940098B216 /* CFNetwork.framework */; productType = "com.apple.product-type.framework"; }; + FEA752E8114EB30B00AF634E /* CFNetwork-Linux-i386 */ = { + isa = PBXNativeTarget; + buildConfigurationList = FEA752F0114EB30B00AF634E /* Build configuration list for PBXNativeTarget "CFNetwork-Linux-i386" */; + buildPhases = ( + FEA752E9114EB30B00AF634E /* Headers */, + ); + buildRules = ( + FEA752EF114EB30B00AF634E /* PBXBuildRule */, + ); + dependencies = ( + ); + name = "CFNetwork-Linux-i386"; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = CFNetwork; + productReference = FEA752F3114EB30B00AF634E /* CFNetwork.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -151,31 +197,11 @@ projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* CFNetwork-Windows-i386 */, + FEA752E8114EB30B00AF634E /* CFNetwork-Linux-i386 */, ); }; /* End PBXProject section */ -/* Begin PBXResourcesBuildPhase section */ - 8DC2EF520486A6940098B216 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8DC2EF540486A6940098B216 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - /* Begin PBXVariantGroup section */ 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; @@ -254,6 +280,44 @@ }; name = Release; }; + FEA752F1114EB30B00AF634E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = i386; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = /; + INFOPLIST_FILE = Info.plist; + INSTALL_MODE_FLAG = "og-w,a+rX"; + INSTALL_PATH = /Developer/Cocotron/1.0/Linux/i386/Frameworks; + OTHER_CFLAGS = "-DCFNETWORK_INSIDE_BUILD"; + PRODUCT_NAME = CFNetwork; + SDKROOT = ""; + STRIP_INSTALLED_PRODUCT = YES; + SYMROOT = /Developer/Cocotron/1.0/build/CFNetwork/Linux/i386; + }; + name = Debug; + }; + FEA752F2114EB30B00AF634E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = i386; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = /; + INFOPLIST_FILE = Info.plist; + INSTALL_MODE_FLAG = "og-w,a+rX"; + INSTALL_PATH = /Developer/Cocotron/1.0/Linux/i386/Frameworks; + OTHER_CFLAGS = "-DCFNETWORK_INSIDE_BUILD"; + PRODUCT_NAME = CFNetwork; + SDKROOT = ""; + STRIP_INSTALLED_PRODUCT = YES; + SYMROOT = /Developer/Cocotron/1.0/build/CFNetwork/Linux/i386; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -275,6 +339,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FEA752F0114EB30B00AF634E /* Build configuration list for PBXNativeTarget "CFNetwork-Linux-i386" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FEA752F1114EB30B00AF634E /* Debug */, + FEA752F2114EB30B00AF634E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; diff --git a/CoreFoundation/CFRunLoop.h b/CoreFoundation/CFRunLoop.h index 1881f191..c2edd32b 100644 --- a/CoreFoundation/CFRunLoop.h +++ b/CoreFoundation/CFRunLoop.h @@ -8,7 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED #import #import -typedef struct __NSRunLoop *CFRunLoopRef; +typedef struct __CFRunLoop *CFRunLoopRef; typedef struct __NSTimer *CFRunLoopTimerRef; typedef struct __NSInputSource *CFRunLoopSourceRef; typedef struct CFRunLoopObserver *CFRunLoopObserverRef; diff --git a/CoreFoundation/CFRunLoop.m b/CoreFoundation/CFRunLoop.m index 8b9c72db..764d7c8b 100644 --- a/CoreFoundation/CFRunLoop.m +++ b/CoreFoundation/CFRunLoop.m @@ -1 +1,204 @@ #import +#import +#import +#import +#import +#import + +/* For now CFRunLoop is NSRunLoop, the real organization should be NSRunLoop owns a CFRunLoop + */ + +@interface __CFRunLoop : NSRunLoop +@end + +const CFStringRef kCFRunLoopCommonModes=(CFStringRef)@"kCFRunLoopCommonModes"; +const CFStringRef kCFRunLoopDefaultMode=(CFStringRef)@"kCFRunLoopDefaultMode"; + +@implementation __CFRunLoop + +CFTypeID CFRunLoopGetTypeID(void) { + NSUnimplementedFunction(); + return 0; +} + +CFRunLoopRef CFRunLoopGetCurrent(void) { + return (CFRunLoopRef)[NSRunLoop currentRunLoop]; +} + +CFRunLoopRef CFRunLoopGetMain(void) { + return (CFRunLoopRef)[NSRunLoop mainRunLoop]; +} + +void CFRunLoopRun(void) { + CFRunLoopRunInMode(kCFRunLoopDefaultMode,1000.0*365.0*24.0*60.0*60.0,NO); +} + +void CFRunLoopAddCommonMode(CFRunLoopRef self,CFStringRef mode) { + NSUnimplementedFunction(); +} + +void CFRunLoopAddObserver(CFRunLoopRef self,CFRunLoopObserverRef observer,CFStringRef mode) { + NSUnimplementedFunction(); +} + +void CFRunLoopRemoveObserver(CFRunLoopRef self,CFRunLoopObserverRef observer,CFStringRef mode) { + NSUnimplementedFunction(); +} + +Boolean CFRunLoopContainsObserver(CFRunLoopRef self,CFRunLoopObserverRef observer,CFStringRef mode) { + NSUnimplementedFunction(); + return 0; +} + +void CFRunLoopAddSource(CFRunLoopRef self,CFRunLoopSourceRef source,CFStringRef mode) { + NSUnimplementedFunction(); +} + +void CFRunLoopRemoveSource(CFRunLoopRef self,CFRunLoopSourceRef source,CFStringRef mode) { + NSUnimplementedFunction(); +} + +Boolean CFRunLoopContainsSource(CFRunLoopRef self,CFRunLoopSourceRef source,CFStringRef mode) { + NSUnimplementedFunction(); + return 0; +} + +void CFRunLoopAddTimer(CFRunLoopRef self,CFRunLoopTimerRef timer,CFStringRef mode) { + NSUnimplementedFunction(); +} + +void CFRunLoopRemoveTimer(CFRunLoopRef self,CFRunLoopTimerRef timer,CFStringRef mode) { + NSUnimplementedFunction(); +} + +Boolean CFRunLoopContainsTimer(CFRunLoopRef self,CFRunLoopTimerRef timer,CFStringRef mode) { + NSUnimplementedFunction(); + return 0; +} + +CFStringRef CFRunLoopCopyCurrentMode(CFRunLoopRef self) { + NSUnimplementedFunction(); + return 0; +} +CFArrayRef CFRunLoopCopyAllModes(CFRunLoopRef self) { + NSUnimplementedFunction(); + return 0; +} + +Boolean CFRunLoopIsWaiting(CFRunLoopRef self) { + NSUnimplementedFunction(); + return 0; +} + +CFAbsoluteTime CFRunLoopGetNextTimerFireDate(CFRunLoopRef self,CFStringRef mode) { + NSUnimplementedFunction(); + return 0; +} + +CFInteger CFRunLoopRunInMode(CFStringRef mode,CFTimeInterval seconds,Boolean returnAfterSourceHandled) { + CFRunLoopRef runLoop=CFRunLoopGetCurrent(); + NSDate *before=[NSDate dateWithTimeIntervalSinceNow:seconds]; + + [runLoop->_continue addObject:[NSNumber numberWithBool:YES]]; + + if(returnAfterSourceHandled){ + + if(seconds==0) + before=[NSDate distantFuture]; + + [runLoop runMode:(NSString *)mode beforeDate:before]; + } + else { + while([runLoop runMode:(NSString *)mode beforeDate:before] && [[runLoop->_continue lastObject] boolValue]) + if([before timeIntervalSinceNow]<0) + break; + } + + [runLoop->_continue removeLastObject]; + + return 0; +} + +void CFRunLoopStop(CFRunLoopRef self) { + [self->_continue removeLastObject]; + [self->_continue addObject:[NSNumber numberWithBool:NO]]; +} + +void CFRunLoopWakeUp(CFRunLoopRef self) { + NSUnimplementedFunction(); +} + +// sources + +CFTypeID CFRunLoopSourceGetTypeID(void) { + NSUnimplementedFunction(); + return 0; +} + +CFRunLoopSourceRef CFRunLoopSourceCreate(CFAllocatorRef allocator,CFIndex order,CFRunLoopSourceContext *context) { + NSUnimplementedFunction(); + return 0; +} + +CFIndex CFRunLoopSourceGetOrder(CFRunLoopSourceRef self) { + NSUnimplementedFunction(); + return 0; +} + +void CFRunLoopSourceGetContext(CFRunLoopSourceRef self,CFRunLoopSourceContext *context) { + NSUnimplementedFunction(); +} + +void CFRunLoopSourceInvalidate(CFRunLoopSourceRef self) { + NSUnimplementedFunction(); +} + +Boolean CFRunLoopSourceIsValid(CFRunLoopSourceRef self) { + NSUnimplementedFunction(); + return 0; +} + +void CFRunLoopSourceSignal(CFRunLoopSourceRef self) { + NSUnimplementedFunction(); +} + +// observers + +CFTypeID CFRunLoopObserverGetTypeID(void) { + NSUnimplementedFunction(); + return 0; +} + +CFRunLoopObserverRef CFRunLoopObserverCreate(CFAllocatorRef allocator,CFOptionFlags activities,Boolean repeats,CFIndex order,CFRunLoopObserverCallBack callback,CFRunLoopObserverContext *context) { + NSUnimplementedFunction(); + return 0; +} + +CFOptionFlags CFRunLoopObserverGetActivities(CFRunLoopObserverRef self) { + NSUnimplementedFunction(); + return 0; +} + +Boolean CFRunLoopObserverDoesRepeat(CFRunLoopObserverRef self) { + NSUnimplementedFunction(); + return 0; +} + +CFIndex CFRunLoopObserverGetOrder(CFRunLoopObserverRef self) { + NSUnimplementedFunction(); + return 0; +} + +void CFRunLoopObserverGetContext(CFRunLoopObserverRef self,CFRunLoopObserverContext *context) { + NSUnimplementedFunction(); +} + +void CFRunLoopObserverInvalidate(CFRunLoopObserverRef self) { + NSUnimplementedFunction(); +} +Boolean CFRunLoopObserverIsValid(CFRunLoopObserverRef self) { + NSUnimplementedFunction(); + return 0; +} +@end + diff --git a/CoreFoundation/CFStream.h b/CoreFoundation/CFStream.h index b3a59a45..b4aef558 100644 --- a/CoreFoundation/CFStream.h +++ b/CoreFoundation/CFStream.h @@ -6,9 +6,9 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -typedef struct __NSStream *CFStreamRef; -typedef struct __NSInputStream *CFReadStreamRef; -typedef struct __NSOutputStream *CFWriteStreamRef; +typedef struct __CFStream *CFStreamRef; +typedef struct __CFReadStream *CFReadStreamRef; +typedef struct __CFWriteStream *CFWriteStreamRef; #import #import @@ -16,6 +16,7 @@ typedef struct __NSOutputStream *CFWriteStreamRef; #import #import +// These values must match NSStream typedef enum { kCFStreamEventNone =0, kCFStreamEventOpenCompleted =(1<<0), diff --git a/CoreFoundation/CFStream.m b/CoreFoundation/CFStream.m index a24b6611..202f0c93 100644 --- a/CoreFoundation/CFStream.m +++ b/CoreFoundation/CFStream.m @@ -1 +1,199 @@ #import +#import +#import +#import +#import +#import +#import + +@interface __CFStream : NSStream +@end +@interface __CFReadStream : NSInputStream +@end +@interface __CFWriteStream : NSOutputStream +@end + +const CFStringRef kCFStreamPropertyFileCurrentOffset=(CFStringRef)@"kCFStreamPropertyFileCurrentOffset"; +const CFStringRef kCFStreamPropertyAppendToFile=(CFStringRef)@"kCFStreamPropertyAppendToFile"; +const CFStringRef kCFStreamPropertyDataWritten=(CFStringRef)@"kCFStreamPropertyDataWritten"; +const CFStringRef kCFStreamPropertySocketNativeHandle=(CFStringRef)@"kCFStreamPropertySocketNativeHandle"; +const CFStringRef kCFStreamPropertySocketRemoteHostName=(CFStringRef)@"kCFStreamPropertySocketRemoteHostName"; +const CFStringRef kCFStreamPropertySocketRemotePortNumber=(CFStringRef)@"kCFStreamPropertySocketRemotePortNumber"; + +void CFStreamCreateBoundPair(CFAllocatorRef allocator,CFReadStreamRef *readStream,CFWriteStreamRef *writeStream,CFIndex bufferSize) { + NSUnimplementedFunction(); +} + +void CFStreamCreatePairWithPeerSocketSignature(CFAllocatorRef allocator,const CFSocketSignature *signature,CFReadStreamRef *readStream,CFWriteStreamRef *writeStream) { + NSUnimplementedFunction(); +} + +void CFStreamCreatePairWithSocket(CFAllocatorRef allocator,CFSocketNativeHandle sock,CFReadStreamRef *readStream,CFWriteStreamRef *writeStream) { + NSUnimplementedFunction(); +} + +void CFStreamCreatePairWithSocketToHost(CFAllocatorRef allocator,CFStringRef hostName,CFUInteger port,CFReadStreamRef *readStream,CFWriteStreamRef *writeStream) { + NSHost *host=[NSHost hostWithName:(NSString *)hostName]; + [NSStream getStreamsToHost:host port:port inputStream:readStream outputStream:writeStream]; + if(readStream!=NULL) + [*readStream retain]; + if(writeStream!=NULL) + [*writeStream retain]; +} + +CFTypeID CFReadStreamGetTypeID(void) { + NSUnimplementedFunction(); + return 0; +} + +CFReadStreamRef CFReadStreamCreateWithBytesNoCopy(CFAllocatorRef allocator,const uint8_t *bytes,CFIndex length,CFAllocatorRef bytesDeallocator) { + NSUnimplementedFunction(); + return 0; +} +CFReadStreamRef CFReadStreamCreateWithFile(CFAllocatorRef allocator,CFURLRef url) { + NSUnimplementedFunction(); + return 0; +} + +Boolean CFReadStreamSetClient(CFReadStreamRef self,CFOptionFlags events,CFReadStreamClientCallBack callback,CFStreamClientContext *context) { + if([self isKindOfClass:[NSInputStream_socket class]]){ + [(NSInputStream_socket *)self setClientEvents:events callBack:callback context:context]; + return TRUE; + } + else { + NSUnimplementedFunction(); + return 0; + } +} + +CFTypeRef CFReadStreamCopyProperty(CFReadStreamRef self,CFStringRef key) { + return [[self propertyForKey:(NSString *)key] copy]; +} + +Boolean CFReadStreamSetProperty(CFReadStreamRef self,CFStringRef key,CFTypeRef value) { + return [self setProperty:(id)value forKey:(NSString *)key]; +} + +const uint8_t * CFReadStreamGetBuffer(CFReadStreamRef self,CFIndex limit,CFIndex *available) { + NSUnimplementedFunction(); + return 0; +} + +Boolean CFReadStreamOpen(CFReadStreamRef self) { + [self open]; + return TRUE; +} + +void CFReadStreamClose(CFReadStreamRef self) { + [self close]; +} + +Boolean CFReadStreamHasBytesAvailable(CFReadStreamRef self) { + return [self hasBytesAvailable]; +} + +CFIndex CFReadStreamRead(CFReadStreamRef self,uint8_t *bytes,CFIndex length) { + return [self read:bytes maxLength:length]; +} + +CFErrorRef CFReadStreamCopyError(CFReadStreamRef self) { + NSUnimplementedFunction(); + return 0; +} + +CFStreamError CFReadStreamGetError(CFReadStreamRef self) { + CFStreamError error={0,0}; + NSUnimplementedFunction(); + return error; +} + +CFStreamStatus CFReadStreamGetStatus(CFReadStreamRef self) { + NSUnimplementedFunction(); + return 0; +} + +void CFReadStreamScheduleWithRunLoop(CFReadStreamRef self,CFRunLoopRef runLoop,CFStringRef mode) { + [self scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode]; +} + +void CFReadStreamUnscheduleFromRunLoop(CFReadStreamRef self,CFRunLoopRef runLoop,CFStringRef mode) { + [self removeFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode]; +} + +CFTypeID CFWriteStreamGetTypeID(void) { + NSUnimplementedFunction(); + return 0; +} + +CFWriteStreamRef CFWriteStreamCreateWithAllocatedBuffers(CFAllocatorRef allocator,CFAllocatorRef bufferAllocator) { + NSUnimplementedFunction(); + return 0; +} +CFWriteStreamRef CFWriteStreamCreateWithBuffer(CFAllocatorRef allocator,uint8_t *bytes,CFIndex capacity) { + NSUnimplementedFunction(); + return 0; +} +CFWriteStreamRef CFWriteStreamCreateWithFile(CFAllocatorRef allocator,CFURLRef url) { + NSUnimplementedFunction(); + return 0; +} + +Boolean CFWriteStreamSetClient(CFWriteStreamRef self,CFOptionFlags events,CFWriteStreamClientCallBack callback,CFStreamClientContext *context) { + if([self isKindOfClass:[NSOutputStream_socket class]]){ + [(NSOutputStream_socket *)self setClientEvents:events callBack:callback context:context]; + return TRUE; + } + else { + NSUnimplementedFunction(); + return 0; + } +} + +CFTypeRef CFWriteStreamCopyProperty(CFWriteStreamRef self,CFStringRef key) { + return [[self propertyForKey:(NSString *)key] copy]; +} + +Boolean CFWriteStreamSetProperty(CFWriteStreamRef self,CFStringRef key,CFTypeRef value) { + return [self setProperty:(id)value forKey:(NSString *)key]; +} + +Boolean CFWriteStreamOpen(CFWriteStreamRef self) { + [self open]; + return TRUE; +} + +void CFWriteStreamClose(CFWriteStreamRef self) { + [self close]; +} + +Boolean CFWriteStreamCanAcceptBytes(CFWriteStreamRef self) { + return [self hasSpaceAvailable]; +} + +CFIndex CFWriteStreamWrite(CFWriteStreamRef self,const uint8_t *bytes,CFIndex length) { + return [self write:bytes maxLength:length]; +} + +CFErrorRef CFWriteStreamCopyError(CFReadStreamRef self) { + NSUnimplementedFunction(); + return 0; +} + +CFStreamError CFWriteStreamGetError(CFWriteStreamRef self) { + CFStreamError error={0,0}; + NSUnimplementedFunction(); + return error; +} + +CFStreamStatus CFWriteStreamGetStatus(CFWriteStreamRef self) { + NSUnimplementedFunction(); + return 0; +} + +void CFWriteStreamScheduleWithRunLoop(CFWriteStreamRef self,CFRunLoopRef runLoop,CFStringRef mode) { + [self scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode]; +} + +void CFWriteStreamUnscheduleFromRunLoop(CFWriteStreamRef self,CFRunLoopRef runLoop,CFStringRef mode) { + [self removeFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode]; +} diff --git a/CoreFoundation/CoreFoundation.xcodeproj/project.pbxproj b/CoreFoundation/CoreFoundation.xcodeproj/project.pbxproj index 95f61510..96343291 100644 --- a/CoreFoundation/CoreFoundation.xcodeproj/project.pbxproj +++ b/CoreFoundation/CoreFoundation.xcodeproj/project.pbxproj @@ -48,6 +48,8 @@ FE5A86BE10C6EE28005E348A /* CFXMLNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FEED22730EFB669D004E378B /* CFXMLNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE5A86BF10C6EE28005E348A /* CFXMLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = FEED22740EFB669D004E378B /* CFXMLParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE5A86C110C6EE28005E348A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + FEA7525E114EA57300AF634E /* pthread.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828EEA110DE9080008AFA2 /* pthread.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FEA7525F114EA57A00AF634E /* sched.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828EEC110DE9080008AFA2 /* sched.h */; settings = {ATTRIBUTES = (Public, ); }; }; FEA828B5109B754A00C7A732 /* CFBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE0F9C60DC962D600598037 /* CFBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; FEA828B6109B754A00C7A732 /* CFLocale.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE0F9C70DC962D600598037 /* CFLocale.h */; settings = {ATTRIBUTES = (Public, ); }; }; FEA828B7109B754A00C7A732 /* CFNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE0F9C90DC962D600598037 /* CFNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -305,6 +307,8 @@ 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* CoreFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FE5A86C810C6EE28005E348A /* CoreFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FE828EEA110DE9080008AFA2 /* pthread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pthread.h; sourceTree = ""; }; + FE828EEC110DE9080008AFA2 /* sched.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sched.h; sourceTree = ""; }; FEA828E4109B754A00C7A732 /* CoreFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FEA82956109B75D600C7A732 /* CoreFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FEA82990109B773300C7A732 /* CoreFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -412,6 +416,7 @@ 0867D691FE84028FC02AAC07 /* CoreFoundation */ = { isa = PBXGroup; children = ( + FE828EE8110DE8BA0008AFA2 /* pthread */, FEED22530EFB669D004E378B /* CFArray.h */, FEED22540EFB669D004E378B /* CFAttributedString.h */, FEED22550EFB669D004E378B /* CFBag.h */, @@ -498,6 +503,15 @@ name = "Other Sources"; sourceTree = ""; }; + FE828EE8110DE8BA0008AFA2 /* pthread */ = { + isa = PBXGroup; + children = ( + FE828EEA110DE9080008AFA2 /* pthread.h */, + FE828EEC110DE9080008AFA2 /* sched.h */, + ); + path = pthread; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -544,6 +558,8 @@ FEED22940EFB669D004E378B /* CFUUID.h in Headers */, FEED22950EFB669D004E378B /* CFXMLNode.h in Headers */, FEED22960EFB669D004E378B /* CFXMLParser.h in Headers */, + FEA7525E114EA57300AF634E /* pthread.h in Headers */, + FEA7525F114EA57A00AF634E /* sched.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/CoreFoundation/pthread/pthread.m b/CoreFoundation/pthread/pthread.m index 520ced81..c22448d1 100644 --- a/CoreFoundation/pthread/pthread.m +++ b/CoreFoundation/pthread/pthread.m @@ -62,7 +62,7 @@ int pthread_setspecific(pthread_key_t key, const void *value) { } int pthread_key_create(pthread_key_t *key,void (*destructor)(void*)) { -#warning implement destructor +// FIXME: implement destructor if((*key=TlsAlloc())==TLS_OUT_OF_INDEXES) return EAGAIN; diff --git a/Foundation/Foundation.xcodeproj/project.pbxproj b/Foundation/Foundation.xcodeproj/project.pbxproj index a6ce2e23..97f362ca 100644 --- a/Foundation/Foundation.xcodeproj/project.pbxproj +++ b/Foundation/Foundation.xcodeproj/project.pbxproj @@ -2854,6 +2854,34 @@ FE1CF95B10233D94001414D4 /* illegalCharacterSet.bitmap in Resources */ = {isa = PBXBuildFile; fileRef = FE1CF95610233D94001414D4 /* illegalCharacterSet.bitmap */; }; FE1CF95C10233D94001414D4 /* illegalCharacterSet.bitmap in Resources */ = {isa = PBXBuildFile; fileRef = FE1CF95610233D94001414D4 /* illegalCharacterSet.bitmap */; }; FE1CF95D10233D94001414D4 /* illegalCharacterSet.bitmap in Resources */ = {isa = PBXBuildFile; fileRef = FE1CF95610233D94001414D4 /* illegalCharacterSet.bitmap */; }; + FE2569E910F2F9C7005CE23E /* CFHost.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E610F2F9C7005CE23E /* CFHost.m */; }; + FE2569EA10F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569EB10F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569ED10F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569EE10F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569F010F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569F110F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569F310F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569F410F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569F610F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569F710F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569F910F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569FA10F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569FC10F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE2569FD10F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE2569FF10F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE256A0010F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE256A0210F2F9C7005CE23E /* CFNetServices.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E710F2F9C7005CE23E /* CFNetServices.m */; }; + FE256A0310F2F9C7005CE23E /* CFSocketStream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2569E810F2F9C7005CE23E /* CFSocketStream.m */; }; + FE256A8310F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8410F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8510F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8610F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8710F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8810F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8910F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8A10F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; + FE256A8B10F387DA005CE23E /* CFDate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE256A8210F387DA005CE23E /* CFDate.m */; }; FE2705C60C5EF3D60004AB37 /* OBJCInitializeProcess_Darwin.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2705C50C5EF3D60004AB37 /* OBJCInitializeProcess_Darwin.m */; }; FE2705C70C5EF3D60004AB37 /* OBJCInitializeProcess_Darwin.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2705C50C5EF3D60004AB37 /* OBJCInitializeProcess_Darwin.m */; }; FE30A05510C6ED6F00A1BF7F /* NSArray_concrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E280311097478CC00EC542B /* NSArray_concrete.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -3551,6 +3579,24 @@ FE35D66F0B52AFBC00FE7AB3 /* NSSocket_bsd.m in Sources */ = {isa = PBXBuildFile; fileRef = FE35D66D0B52AFBC00FE7AB3 /* NSSocket_bsd.m */; }; FE35D6700B52AFBC00FE7AB3 /* NSSocket_bsd.h in Headers */ = {isa = PBXBuildFile; fileRef = FE35D66C0B52AFBC00FE7AB3 /* NSSocket_bsd.h */; }; FE35D6710B52AFBC00FE7AB3 /* NSSocket_bsd.m in Sources */ = {isa = PBXBuildFile; fileRef = FE35D66D0B52AFBC00FE7AB3 /* NSSocket_bsd.m */; }; + FE3C473E112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C473F112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C4740112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C4741112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C4742112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C4743112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C4744112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C4745112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C4746112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C4747112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C4748112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C4749112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C474A112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C474B112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C474C112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C474D112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; + FE3C474E112AF7FC0099DAB8 /* CFUID.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3C473C112AF7FC0099DAB8 /* CFUID.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE3C474F112AF7FC0099DAB8 /* CFUID.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3C473D112AF7FC0099DAB8 /* CFUID.m */; }; FE3F7D9C0BE63BBE007E9363 /* NSDateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3F7D980BE63BBD007E9363 /* NSDateComponents.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE3F7D9D0BE63BBE007E9363 /* NSDateComponents.m in Sources */ = {isa = PBXBuildFile; fileRef = FE3F7D990BE63BBD007E9363 /* NSDateComponents.m */; }; FE3F7D9E0BE63BBE007E9363 /* NSDateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3F7D980BE63BBD007E9363 /* NSDateComponents.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -3694,6 +3740,15 @@ FE53BE7C0BA9ED490050277F /* NSXMLNode.m in Sources */ = {isa = PBXBuildFile; fileRef = FE53BE520BA9ED490050277F /* NSXMLNode.m */; }; FE53BE7F0BA9ED490050277F /* NSXMLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = FE53BE550BA9ED490050277F /* NSXMLParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE53BE800BA9ED490050277F /* NSXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = FE53BE560BA9ED490050277F /* NSXMLParser.m */; }; + FE55AD1A1119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD1B1119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD1C1119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD1D1119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD1E1119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD1F1119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD201119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD211119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; + FE55AD221119D86900A777AB /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE55AD191119D86900A777AB /* CFByteOrder.m */; }; FE5A86DA10C6EF41005E348A /* NSMemoryFunctions_bsd.m in Sources */ = {isa = PBXBuildFile; fileRef = FE5EA8010FA3896500536850 /* NSMemoryFunctions_bsd.m */; }; FE5A86DB10C6EF41005E348A /* NSPlatform_bsd.h in Headers */ = {isa = PBXBuildFile; fileRef = FE5EA8020FA3896500536850 /* NSPlatform_bsd.h */; settings = {ATTRIBUTES = (Private, ); }; }; FE5A86DC10C6EF42005E348A /* NSPlatform_bsd.m in Sources */ = {isa = PBXBuildFile; fileRef = FE5EA8030FA3896500536850 /* NSPlatform_bsd.m */; }; @@ -4326,6 +4381,24 @@ FE651A820FBC844C00464BFD /* NSTimeZoneRegions.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6E2806B309747EA400EC542B /* NSTimeZoneRegions.plist */; }; FE651A830FBC844C00464BFD /* NSUserDefaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6E280B2B09747F4900EC542B /* NSUserDefaults.plist */; }; FE651BB00FBC92F700464BFD /* objc_msgSend-darwin-i386.s in Sources */ = {isa = PBXBuildFile; fileRef = FED70C8E0C3BFFBE000CBE5B /* objc_msgSend-darwin-i386.s */; }; + FE65B3001107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B3011107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B3021107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B3031107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B3041107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B3051107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B3061107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B3071107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B3081107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B3091107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B30A1107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B30B1107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B30C1107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B30D1107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B30E1107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B30F1107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; + FE65B3101107690500439F46 /* NSObservationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE65B2FE1107690500439F46 /* NSObservationInfo.h */; }; + FE65B3111107690500439F46 /* NSObservationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FE65B2FF1107690500439F46 /* NSObservationInfo.m */; }; FE6DC2590BA902710082AC66 /* NSAffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6DC2550BA902710082AC66 /* NSAffineTransform.h */; settings = {ATTRIBUTES = (Public, ); }; }; FE6DC25A0BA902710082AC66 /* NSAffineTransform.m in Sources */ = {isa = PBXBuildFile; fileRef = FE6DC2560BA902710082AC66 /* NSAffineTransform.m */; }; FE6DC25B0BA902710082AC66 /* NSAffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6DC2550BA902710082AC66 /* NSAffineTransform.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -4394,6 +4467,25 @@ FE7FE5C80D7CF08B006CCA28 /* NSFileHandle_stream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7FE5C00D7CF08B006CCA28 /* NSFileHandle_stream.m */; }; FE7FE5C90D7CF08B006CCA28 /* NSFileHandle_stream.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7FE5BF0D7CF08B006CCA28 /* NSFileHandle_stream.h */; }; FE7FE5CA0D7CF08B006CCA28 /* NSFileHandle_stream.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7FE5C00D7CF08B006CCA28 /* NSFileHandle_stream.m */; }; + FE828F0B110DEB540008AFA2 /* pthread.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F0A110DEB540008AFA2 /* pthread.m */; }; + FE828F39110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F3A110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F3B110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F3C110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F3D110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F3E110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F3F110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F40110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F41110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F42110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F43110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F44110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F45110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F46110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F47110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F48110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; + FE828F49110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */; }; + FE828F4A110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */; }; FE8693F60FE0108E00F89733 /* CFArray.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8693D20FE0108E00F89733 /* CFArray.m */; }; FE8693F70FE0108E00F89733 /* CFAttributedString.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8693D30FE0108E00F89733 /* CFAttributedString.m */; }; FE8693F80FE0108E00F89733 /* CFBag.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8693D40FE0108E00F89733 /* CFBag.m */; }; @@ -4648,6 +4740,42 @@ FE8C914B0FFD1E430027C889 /* NSString_win1252.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8C913F0FFD1E430027C889 /* NSString_win1252.m */; }; FE8C914C0FFD1E430027C889 /* NSString_win1252.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8C913E0FFD1E430027C889 /* NSString_win1252.h */; settings = {ATTRIBUTES = (Private, ); }; }; FE8C914D0FFD1E430027C889 /* NSString_win1252.m in Sources */ = {isa = PBXBuildFile; fileRef = FE8C913F0FFD1E430027C889 /* NSString_win1252.m */; }; + FE9C1B8C1125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1B8D1125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1B8E1125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1B8F1125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1B901125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1B911125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1B921125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1B931125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1B941125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1B951125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1B961125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1B971125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1B981125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1B991125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1B9A1125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1B9B1125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1B9C1125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1B9D1125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1B9E1125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1B9F1125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1BA01125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1BA11125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1BA21125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1BA31125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1BA41125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1BA51125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1BA61125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1BA71125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1BA81125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1BA91125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1BAA1125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1BAB1125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; + FE9C1BAC1125A649002DA20B /* CFSSLHandler_openssl.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */; }; + FE9C1BAD1125A649002DA20B /* CFSSLHandler_openssl.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */; }; + FE9C1BAE1125A649002DA20B /* CFSSLHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FE9C1BAF1125A649002DA20B /* CFSSLHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */; }; FE9D95440C0387D5006DB214 /* NSValueTransformer_IsNil.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9D95340C0387D5006DB214 /* NSValueTransformer_IsNil.h */; }; FE9D95450C0387D5006DB214 /* NSValueTransformer_IsNil.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9D95350C0387D5006DB214 /* NSValueTransformer_IsNil.m */; }; FE9D95460C0387D5006DB214 /* NSValueTransformer_IsNotNil.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9D95360C0387D5006DB214 /* NSValueTransformer_IsNotNil.h */; }; @@ -4878,15 +5006,6 @@ FEC1CFE20F7AAB7900619DD5 /* FoundationErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC1CFDF0F7AAB7900619DD5 /* FoundationErrors.h */; settings = {ATTRIBUTES = (Public, ); }; }; FEC1CFE30F7AAB7900619DD5 /* FoundationErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC1CFDF0F7AAB7900619DD5 /* FoundationErrors.h */; settings = {ATTRIBUTES = (Public, ); }; }; FEC1CFE40F7AAB7900619DD5 /* FoundationErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC1CFDF0F7AAB7900619DD5 /* FoundationErrors.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FEC79E3C1146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E3D1146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E3E1146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E3F1146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E401146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E411146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E421146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E431146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; - FEC79E441146C47D0070B596 /* CFByteOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC79E3B1146C47D0070B596 /* CFByteOrder.m */; }; FEC9F6AE0E2F98EA0034932A /* NSURLProtocol_http.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC9F6AC0E2F98EA0034932A /* NSURLProtocol_http.h */; }; FEC9F6AF0E2F98EA0034932A /* NSURLProtocol_http.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC9F6AD0E2F98EA0034932A /* NSURLProtocol_http.m */; }; FEC9F6B00E2F98EA0034932A /* NSURLProtocol_http.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC9F6AC0E2F98EA0034932A /* NSURLProtocol_http.h */; }; @@ -6331,6 +6450,13 @@ remoteGlobalIDString = FE01A57F0C5D9B3100AEA51A; remoteInfo = "objc-Windows-i386"; }; + FE2569DF10F2F91C005CE23E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FE2569DB10F2F91C005CE23E /* CFNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8DC2EF5B0486A6940098B216; + remoteInfo = "CFNetwork-Windows-i386"; + }; FE50C5D90D85891000CD1896 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -6380,6 +6506,13 @@ remoteGlobalIDString = FE651A9D0FBC84DD00464BFD; remoteInfo = "objc-Darwin-i386 copy"; }; + FEA752F6114EB30B00AF634E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FE2569DB10F2F91C005CE23E /* CFNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FEA752F3114EB30B00AF634E; + remoteInfo = "CFNetwork-Windows-i386 copy"; + }; FEA828AA109B74B200C7A732 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FEA828A3109B74B200C7A732 /* CoreFoundation.xcodeproj */; @@ -6994,6 +7127,11 @@ FE1A0D1F0F8BADBA00FC4CC7 /* forwarding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = forwarding.h; sourceTree = ""; }; FE1A0D200F8BADBA00FC4CC7 /* forwarding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = forwarding.m; sourceTree = ""; }; FE1CF95610233D94001414D4 /* illegalCharacterSet.bitmap */ = {isa = PBXFileReference; lastKnownFileType = file; name = illegalCharacterSet.bitmap; path = NSCharacterSet/illegalCharacterSet.bitmap; sourceTree = ""; }; + FE2569DB10F2F91C005CE23E /* CFNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CFNetwork.xcodeproj; path = ../CFNetwork/CFNetwork.xcodeproj; sourceTree = SOURCE_ROOT; }; + FE2569E610F2F9C7005CE23E /* CFHost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFHost.m; sourceTree = ""; }; + FE2569E710F2F9C7005CE23E /* CFNetServices.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFNetServices.m; sourceTree = ""; }; + FE2569E810F2F9C7005CE23E /* CFSocketStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSocketStream.m; sourceTree = ""; }; + FE256A8210F387DA005CE23E /* CFDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFDate.m; sourceTree = ""; }; FE2705C50C5EF3D60004AB37 /* OBJCInitializeProcess_Darwin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = OBJCInitializeProcess_Darwin.m; sourceTree = ""; }; FE30A2FF10C6ED6F00A1BF7F /* Foundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Foundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FE35CAEC0B4AB85800FE7AB3 /* objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = objc.m; sourceTree = ""; }; @@ -7013,6 +7151,8 @@ FE35D6480B52A3E400FE7AB3 /* NSSelectSet_bsd.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSSelectSet_bsd.m; path = platform_posix/NSSelectSet_bsd.m; sourceTree = ""; }; FE35D66C0B52AFBC00FE7AB3 /* NSSocket_bsd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NSSocket_bsd.h; path = platform_posix/NSSocket_bsd.h; sourceTree = ""; }; FE35D66D0B52AFBC00FE7AB3 /* NSSocket_bsd.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSSocket_bsd.m; path = platform_posix/NSSocket_bsd.m; sourceTree = ""; }; + FE3C473C112AF7FC0099DAB8 /* CFUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFUID.h; sourceTree = ""; }; + FE3C473D112AF7FC0099DAB8 /* CFUID.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFUID.m; sourceTree = ""; }; FE3F7D980BE63BBD007E9363 /* NSDateComponents.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NSDateComponents.h; path = NSDate/NSDateComponents.h; sourceTree = ""; }; FE3F7D990BE63BBD007E9363 /* NSDateComponents.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSDateComponents.m; path = NSDate/NSDateComponents.m; sourceTree = ""; }; FE405A6A0B4450FD001B183D /* NSHTTPURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSHTTPURLResponse.h; sourceTree = ""; }; @@ -7052,6 +7192,7 @@ FE53BE520BA9ED490050277F /* NSXMLNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSXMLNode.m; sourceTree = ""; }; FE53BE550BA9ED490050277F /* NSXMLParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSXMLParser.h; sourceTree = ""; }; FE53BE560BA9ED490050277F /* NSXMLParser.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSXMLParser.m; sourceTree = ""; }; + FE55AD191119D86900A777AB /* CFByteOrder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFByteOrder.m; sourceTree = ""; }; FE5EA8010FA3896500536850 /* NSMemoryFunctions_bsd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSMemoryFunctions_bsd.m; sourceTree = ""; }; FE5EA8020FA3896500536850 /* NSPlatform_bsd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSPlatform_bsd.h; sourceTree = ""; }; FE5EA8030FA3896500536850 /* NSPlatform_bsd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSPlatform_bsd.m; sourceTree = ""; }; @@ -7062,6 +7203,8 @@ FE6014291042FD6B008A7357 /* NSString_defaultEncoding_windows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSString_defaultEncoding_windows.m; sourceTree = ""; }; FE60143A1042FDD2008A7357 /* NSString_defaultEncoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSString_defaultEncoding.h; sourceTree = ""; }; FE651A870FBC844C00464BFD /* Foundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Foundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FE65B2FE1107690500439F46 /* NSObservationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSObservationInfo.h; sourceTree = ""; }; + FE65B2FF1107690500439F46 /* NSObservationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSObservationInfo.m; sourceTree = ""; }; FE6DC2550BA902710082AC66 /* NSAffineTransform.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSAffineTransform.h; sourceTree = ""; }; FE6DC2560BA902710082AC66 /* NSAffineTransform.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSAffineTransform.m; sourceTree = ""; }; FE74776D0BAC4E9000829F4F /* NSDecimal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSDecimal.h; sourceTree = ""; }; @@ -7088,6 +7231,9 @@ FE75E2E710F6442F000419C4 /* bonjour.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = bonjour.m; sourceTree = ""; }; FE7FE5BF0D7CF08B006CCA28 /* NSFileHandle_stream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSFileHandle_stream.h; sourceTree = ""; }; FE7FE5C00D7CF08B006CCA28 /* NSFileHandle_stream.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSFileHandle_stream.m; sourceTree = ""; }; + FE828F0A110DEB540008AFA2 /* pthread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = pthread.m; path = pthread/pthread.m; sourceTree = ""; }; + FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKVOInfoPerObject.h; sourceTree = ""; }; + FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSKVOInfoPerObject.m; sourceTree = ""; }; FE8693D20FE0108E00F89733 /* CFArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFArray.m; sourceTree = ""; }; FE8693D30FE0108E00F89733 /* CFAttributedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFAttributedString.m; sourceTree = ""; }; FE8693D40FE0108E00F89733 /* CFBag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFBag.m; sourceTree = ""; }; @@ -7130,6 +7276,10 @@ FE88A4D50F8A9DE00081CFC1 /* Object.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Object.m; sourceTree = ""; }; FE8C913E0FFD1E430027C889 /* NSString_win1252.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSString_win1252.h; sourceTree = ""; }; FE8C913F0FFD1E430027C889 /* NSString_win1252.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSString_win1252.m; sourceTree = ""; }; + FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSSLHandler_openssl.h; sourceTree = ""; }; + FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSSLHandler_openssl.m; sourceTree = ""; }; + FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSSLHandler.h; sourceTree = ""; }; + FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSSLHandler.m; sourceTree = ""; }; FE9D95340C0387D5006DB214 /* NSValueTransformer_IsNil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSValueTransformer_IsNil.h; sourceTree = ""; }; FE9D95350C0387D5006DB214 /* NSValueTransformer_IsNil.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSValueTransformer_IsNil.m; sourceTree = ""; }; FE9D95360C0387D5006DB214 /* NSValueTransformer_IsNotNil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSValueTransformer_IsNotNil.h; sourceTree = ""; }; @@ -7236,7 +7386,6 @@ FEBF53670F926025005DC684 /* objc_protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = objc_protocol.h; sourceTree = ""; }; FEBF545A0F93AE8A005DC684 /* objc_property.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = objc_property.m; sourceTree = ""; }; FEC1CFDF0F7AAB7900619DD5 /* FoundationErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoundationErrors.h; sourceTree = ""; }; - FEC79E3B1146C47D0070B596 /* CFByteOrder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFByteOrder.m; sourceTree = ""; }; FEC9F6AC0E2F98EA0034932A /* NSURLProtocol_http.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSURLProtocol_http.h; sourceTree = ""; }; FEC9F6AD0E2F98EA0034932A /* NSURLProtocol_http.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSURLProtocol_http.m; sourceTree = ""; }; FEC9F6BB0E2F9BEA0034932A /* NSURLConnectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSURLConnectionState.h; sourceTree = ""; }; @@ -7380,6 +7529,8 @@ 0867D691FE84028FC02AAC07 /* Foundation */ = { isa = PBXGroup; children = ( + FE2569E410F2F936005CE23E /* CFNetwork */, + FE2569DB10F2F91C005CE23E /* CFNetwork.xcodeproj */, FEA828A3109B74B200C7A732 /* CoreFoundation.xcodeproj */, 151B5D1A105EA94F009092D5 /* NSAtomicCompareAndSwap.h */, FE463E54102CD5C700B265D6 /* NSPointerArray.h */, @@ -7396,8 +7547,8 @@ FEC1CFDF0F7AAB7900619DD5 /* FoundationErrors.h */, FE6DC2550BA902710082AC66 /* NSAffineTransform.h */, FE6DC2560BA902710082AC66 /* NSAffineTransform.m */, - 6E28030D0974787200EC542B /* NSArchiver.h */, 6E28030E0974787200EC542B /* NSArchiver.m */, + 6E28030D0974787200EC542B /* NSArchiver.h */, 6E280310097478A700EC542B /* NSArray */, FE1935150B5D449E00FB74CC /* NSAssertionHandler.h */, FE1935160B5D449E00FB74CC /* NSAssertionHandler.m */, @@ -7777,6 +7928,8 @@ 6E2803390974795700EC542B /* NSPropertyList */ = { isa = PBXGroup; children = ( + FE3C473C112AF7FC0099DAB8 /* CFUID.h */, + FE3C473D112AF7FC0099DAB8 /* CFUID.m */, FEA9D0880D16C55E00123D51 /* NSPropertyListReader_binary1.h */, FEA9D0890D16C55E00123D51 /* NSPropertyListReader_binary1.m */, FE53BE170BA9EBBE0050277F /* NSOldXMLAttribute.h */, @@ -7860,6 +8013,10 @@ 6E28033D0974797500EC542B /* NSStream */ = { isa = PBXGroup; children = ( + FE9C1B881125A649002DA20B /* CFSSLHandler_openssl.h */, + FE9C1B891125A649002DA20B /* CFSSLHandler_openssl.m */, + FE9C1B8A1125A649002DA20B /* CFSSLHandler.h */, + FE9C1B8B1125A649002DA20B /* CFSSLHandler.m */, FE7FE5BF0D7CF08B006CCA28 /* NSFileHandle_stream.h */, FE7FE5C00D7CF08B006CCA28 /* NSFileHandle_stream.m */, 6E2805FF09747D5800EC542B /* NSFileHandle.h */, @@ -8324,6 +8481,26 @@ path = platform_darwin; sourceTree = ""; }; + FE2569DC10F2F91C005CE23E /* Products */ = { + isa = PBXGroup; + children = ( + FE2569E010F2F91C005CE23E /* CFNetwork.framework */, + FEA752F7114EB30B00AF634E /* CFNetwork.framework */, + ); + name = Products; + sourceTree = ""; + }; + FE2569E410F2F936005CE23E /* CFNetwork */ = { + isa = PBXGroup; + children = ( + FE2569E610F2F9C7005CE23E /* CFHost.m */, + FE2569E710F2F9C7005CE23E /* CFNetServices.m */, + FE2569E810F2F9C7005CE23E /* CFSocketStream.m */, + ); + name = CFNetwork; + path = ../CFNetwork; + sourceTree = ""; + }; FE3B5D350FF3A6CF005E7605 /* platform_solaris */ = { isa = PBXGroup; children = ( @@ -8351,7 +8528,9 @@ FE4BDD2A0BCD65EB00E19685 /* CoreFoundation */ = { isa = PBXGroup; children = ( - FEC79E3B1146C47D0070B596 /* CFByteOrder.m */, + FE55AD191119D86900A777AB /* CFByteOrder.m */, + FE828F0A110DEB540008AFA2 /* pthread.m */, + FE256A8210F387DA005CE23E /* CFDate.m */, 1A8A694E1091EF0200DC5A01 /* NSCFTypeID.h */, FE8693D20FE0108E00F89733 /* CFArray.m */, FE8693D30FE0108E00F89733 /* CFAttributedString.m */, @@ -8503,6 +8682,10 @@ FEB6CC800B4A1C7A004FADF2 /* NSKeyValueCoding */ = { isa = PBXGroup; children = ( + FE828F37110DFA1C0008AFA2 /* NSKVOInfoPerObject.h */, + FE828F38110DFA1C0008AFA2 /* NSKVOInfoPerObject.m */, + FE65B2FE1107690500439F46 /* NSObservationInfo.h */, + FE65B2FF1107690500439F46 /* NSObservationInfo.m */, FEF5B4C60BBEFDBA00A8FF26 /* NSArray+KVC.m */, FEF5B4C70BBEFDBA00A8FF26 /* NSDictionary+KVC.m */, FEF5B4C80BBEFDBA00A8FF26 /* NSKeyValueObserving-Private.h */, @@ -8987,6 +9170,11 @@ 1A27BFFE1090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFFF1090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69561091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B30E1107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F47110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1BA81125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1BAA1125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C474C112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9309,6 +9497,11 @@ 1A27C0001090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27C0011090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69551091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B30C1107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F45110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1BA41125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1BA61125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C474A112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9631,6 +9824,11 @@ 1A27BFF81090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFF91090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69521091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B3041107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F3D110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1B941125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1B961125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C4742112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9953,6 +10151,11 @@ 1A27BFFA1090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFFB1090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69531091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B3021107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F3B110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1B901125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1B921125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C4740112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -10279,6 +10482,11 @@ 1A27BFFC1090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFFD1090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69541091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B3001107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F39110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1B8C1125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1B8E1125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C473E112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -10601,6 +10809,11 @@ FE30A18F10C6ED6F00A1BF7F /* NSCFTypeID.h in Headers */, FE5A86DB10C6EF41005E348A /* NSPlatform_bsd.h in Headers */, FE5A86DD10C6EF43005E348A /* NSTask_bsd.h in Headers */, + FE65B3101107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F49110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1BAC1125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1BAE1125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C474E112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -10924,6 +11137,11 @@ 1A27BFF61090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFF71090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69511091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B30A1107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F43110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1BA01125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1BA21125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C4748112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11247,6 +11465,11 @@ 1A27BFF21090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFF31090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A694F1091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B3061107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F3F110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1B981125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1B9A1125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C4744112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11570,6 +11793,11 @@ 1A27BFF41090CBCD00C44FD7 /* NSNumber_BOOL_const_impl.h in Headers */, 1A27BFF51090CBCD00C44FD7 /* NSNumber_double_const_impl.h in Headers */, 1A8A69501091EF0200DC5A01 /* NSCFTypeID.h in Headers */, + FE65B3081107690500439F46 /* NSObservationInfo.h in Headers */, + FE828F41110DFA1C0008AFA2 /* NSKVOInfoPerObject.h in Headers */, + FE9C1B9C1125A649002DA20B /* CFSSLHandler_openssl.h in Headers */, + FE9C1B9E1125A649002DA20B /* CFSSLHandler.h in Headers */, + FE3C4746112AF7FC0099DAB8 /* CFUID.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11789,6 +12017,10 @@ productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectReferences = ( + { + ProductGroup = FE2569DC10F2F91C005CE23E /* Products */; + ProjectRef = FE2569DB10F2F91C005CE23E /* CFNetwork.xcodeproj */; + }, { ProductGroup = FEA828A4109B74B200C7A732 /* Products */; ProjectRef = FEA828A3109B74B200C7A732 /* CoreFoundation.xcodeproj */; @@ -11829,6 +12061,13 @@ remoteRef = 28D485000FE04DDD00DC03EF /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + FE2569E010F2F91C005CE23E /* CFNetwork.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CFNetwork.framework; + remoteRef = FE2569DF10F2F91C005CE23E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FE5A868E10C6EDDC005E348A /* objc.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -11850,6 +12089,13 @@ remoteRef = FE651AA00FBC84DD00464BFD /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + FEA752F7114EB30B00AF634E /* CFNetwork.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CFNetwork.framework; + remoteRef = FEA752F6114EB30B00AF634E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FEA828AB109B74B200C7A732 /* CoreFoundation.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -12448,8 +12694,16 @@ 15D921AC105E918000171406 /* NSPointerFunctions.m in Sources */, 15D921AD105E918000171406 /* NSString_defaultEncoding_posix.m in Sources */, 151B5CC4105EA25E009092D5 /* objc_msg_sendv-Disabled.m in Sources */, + FE2569FF10F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE256A0010F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8A10F387DA005CE23E /* CFDate.m in Sources */, FE75E2EF10F6442F000419C4 /* bonjour.m in Sources */, - FEC79E431146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B30F1107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F48110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD211119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1BA91125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1BAB1125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C474D112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -12803,8 +13057,16 @@ FE463E53102CD5B800B265D6 /* NSGarbageCollector.m in Sources */, FE463E71102CD5C700B265D6 /* NSPointerArray.m in Sources */, FE463E73102CD5C700B265D6 /* NSPointerFunctions.m in Sources */, + FE2569FC10F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569FD10F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8910F387DA005CE23E /* CFDate.m in Sources */, FE75E2EE10F6442F000419C4 /* bonjour.m in Sources */, - FEC79E421146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B30D1107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F46110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD201119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1BA51125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1BA71125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C474B112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -13159,8 +13421,16 @@ FE463E61102CD5C700B265D6 /* NSPointerArray.m in Sources */, FE463E63102CD5C700B265D6 /* NSPointerFunctions.m in Sources */, FE6014231042FD49008A7357 /* NSString_defaultEncoding_posix.m in Sources */, + FE2569F010F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569F110F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8510F387DA005CE23E /* CFDate.m in Sources */, FE75E2EA10F6442F000419C4 /* bonjour.m in Sources */, - FEC79E3E1146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B3051107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F3E110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD1C1119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1B951125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1B971125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C4743112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -13516,8 +13786,16 @@ FE463E5D102CD5C700B265D6 /* NSPointerArray.m in Sources */, FE463E5F102CD5C700B265D6 /* NSPointerFunctions.m in Sources */, FE6014241042FD49008A7357 /* NSString_defaultEncoding_posix.m in Sources */, + FE2569ED10F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569EE10F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8410F387DA005CE23E /* CFDate.m in Sources */, FE75E2E910F6442F000419C4 /* bonjour.m in Sources */, - FEC79E3D1146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B3031107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F3C110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD1B1119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1B911125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1B931125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C4741112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -13877,8 +14155,18 @@ FE463E59102CD5C700B265D6 /* NSPointerArray.m in Sources */, FE463E5B102CD5C700B265D6 /* NSPointerFunctions.m in Sources */, FE60142A1042FD6B008A7357 /* NSString_defaultEncoding_windows.m in Sources */, + FE2569E910F2F9C7005CE23E /* CFHost.m in Sources */, + FE2569EA10F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569EB10F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8310F387DA005CE23E /* CFDate.m in Sources */, FE75E2E810F6442F000419C4 /* bonjour.m in Sources */, - FEC79E3C1146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B3011107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F0B110DEB540008AFA2 /* pthread.m in Sources */, + FE828F3A110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD1A1119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1B8D1125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1B8F1125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C473F112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -14234,8 +14522,16 @@ FE5A86DA10C6EF41005E348A /* NSMemoryFunctions_bsd.m in Sources */, FE5A86DC10C6EF42005E348A /* NSPlatform_bsd.m in Sources */, FE5A86DE10C6EF43005E348A /* NSTask_bsd.m in Sources */, + FE256A0210F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE256A0310F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8B10F387DA005CE23E /* CFDate.m in Sources */, FE75E2F010F6442F000419C4 /* bonjour.m in Sources */, - FEC79E441146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B3111107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F4A110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD221119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1BAD1125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1BAF1125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C474F112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -14594,8 +14890,16 @@ FE6014281042FD5A008A7357 /* NSString_defaultEncoding_darwin.m in Sources */, 1A27C0051090CC0500C44FD7 /* NSNumber_double_const.m in Sources */, 1A27C0631090D1BE00C44FD7 /* NSNumber_BOOL_const.m in Sources */, + FE2569F910F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569FA10F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8810F387DA005CE23E /* CFDate.m in Sources */, FE75E2ED10F6442F000419C4 /* bonjour.m in Sources */, - FEC79E411146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B30B1107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F44110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD1F1119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1BA11125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1BA31125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C4749112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -14955,8 +15259,16 @@ FE6014261042FD5A008A7357 /* NSString_defaultEncoding_darwin.m in Sources */, 1A27C0031090CC0500C44FD7 /* NSNumber_double_const.m in Sources */, 1A27C0611090D1BE00C44FD7 /* NSNumber_BOOL_const.m in Sources */, + FE2569F310F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569F410F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8610F387DA005CE23E /* CFDate.m in Sources */, FE75E2EB10F6442F000419C4 /* bonjour.m in Sources */, - FEC79E3F1146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B3071107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F40110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD1D1119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1B991125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1B9B1125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C4745112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -15316,8 +15628,16 @@ FE6014271042FD5A008A7357 /* NSString_defaultEncoding_darwin.m in Sources */, 1A27C0041090CC0500C44FD7 /* NSNumber_double_const.m in Sources */, 1A27C0621090D1BE00C44FD7 /* NSNumber_BOOL_const.m in Sources */, + FE2569F610F2F9C7005CE23E /* CFNetServices.m in Sources */, + FE2569F710F2F9C7005CE23E /* CFSocketStream.m in Sources */, + FE256A8710F387DA005CE23E /* CFDate.m in Sources */, FE75E2EC10F6442F000419C4 /* bonjour.m in Sources */, - FEC79E401146C47D0070B596 /* CFByteOrder.m in Sources */, + FE65B3091107690500439F46 /* NSObservationInfo.m in Sources */, + FE828F42110DFA1C0008AFA2 /* NSKVOInfoPerObject.m in Sources */, + FE55AD1E1119D86900A777AB /* CFByteOrder.m in Sources */, + FE9C1B9D1125A649002DA20B /* CFSSLHandler_openssl.m in Sources */, + FE9C1B9F1125A649002DA20B /* CFSSLHandler.m in Sources */, + FE3C4747112AF7FC0099DAB8 /* CFUID.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -15591,7 +15911,10 @@ 6E2801BB09746B8900EC542B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - OTHER_CFLAGS = "-DCOREFOUNDATION_INSIDE_BUILD=1"; + OTHER_CFLAGS = ( + "-DCFNETWORK_INSIDE_BUILD=1", + "-DCOREFOUNDATION_INSIDE_BUILD=1", + ); }; name = Release; }; @@ -15850,7 +16173,10 @@ 7E891F1C0D4964FF008150D3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - OTHER_CFLAGS = "-DCOREFOUNDATION_INSIDE_BUILD=1"; + OTHER_CFLAGS = ( + "-DCFNETWORK_INSIDE_BUILD=1", + "-DCOREFOUNDATION_INSIDE_BUILD=1", + ); }; name = Debug; }; @@ -15871,6 +16197,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_UNROLL_LOOPS = NO; + HEADER_SEARCH_PATHS = /Developer/Cocotron/1.0/Windows/i386/Frameworks/CoreFoundation.framework/Headers; INFOPLIST_FILE = Info.plist; INSTALL_MODE_FLAG = "og-w,a+rX"; INSTALL_PATH = /Developer/Cocotron/1.0/Windows/i386/Frameworks; diff --git a/Foundation/NSKeyValueCoding/NSKVOInfoPerObject.h b/Foundation/NSKeyValueCoding/NSKVOInfoPerObject.h new file mode 100644 index 00000000..2d112b65 --- /dev/null +++ b/Foundation/NSKeyValueCoding/NSKVOInfoPerObject.h @@ -0,0 +1,18 @@ +#import +#import + +@class NSMutableDictionary,NSMutableArray; + +@interface NSKVOInfoPerObject : NSObject { + pthread_mutex_t _lock; + NSMutableDictionary *_dictionary; +} + +-init; +-objectForKey:key; +-(void)setObject:value forKey:key; +-(void)removeObjectForKey:key; +-(NSUInteger)count; +-(NSMutableArray *)observersForKey:(NSString *)key; + +@end diff --git a/Foundation/NSKeyValueCoding/NSKVOInfoPerObject.m b/Foundation/NSKeyValueCoding/NSKVOInfoPerObject.m new file mode 100644 index 00000000..6cdc6f71 --- /dev/null +++ b/Foundation/NSKeyValueCoding/NSKVOInfoPerObject.m @@ -0,0 +1,36 @@ +#import "NSKVOInfoPerObject.h" + +@implementation NSKVOInfoPerObject + +-init { + _lock=(pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; + _dictionary=[[NSMutableDictionary allocWithZone:NULL] init]; + return self; +} + +-(void)dealloc { + [_dictionary release]; + [super dealloc]; +} + +-objectForKey:key { + return [_dictionary objectForKey:key]; +} + +-(void)setObject:value forKey:key { + [_dictionary setObject:value forKey:key]; +} + +-(void)removeObjectForKey:key { + [_dictionary removeObjectForKey:key]; +} + +-(NSUInteger)count { + return [_dictionary count]; +} + +-(NSMutableArray *)observersForKey:(NSString *)key { + return [_dictionary objectForKey:key]; +} + +@end diff --git a/Foundation/NSKeyValueCoding/NSKeyValueCoding.h b/Foundation/NSKeyValueCoding/NSKeyValueCoding.h index ea30b24a..c862b7dd 100644 --- a/Foundation/NSKeyValueCoding/NSKeyValueCoding.h +++ b/Foundation/NSKeyValueCoding/NSKeyValueCoding.h @@ -9,7 +9,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI @class NSDictionary, NSArray, NSError; -FOUNDATION_EXPORT NSString *const NSUndefinedKeyException; +FOUNDATION_EXPORT NSString * const NSUndefinedKeyException; @interface NSObject (KeyValueCoding) +(BOOL)accessInstanceVariablesDirectly; diff --git a/Foundation/NSKeyValueCoding/NSKeyValueObserving-Private.h b/Foundation/NSKeyValueCoding/NSKeyValueObserving-Private.h index aca4b91e..20a40c4e 100644 --- a/Foundation/NSKeyValueCoding/NSKeyValueObserving-Private.h +++ b/Foundation/NSKeyValueCoding/NSKeyValueObserving-Private.h @@ -7,25 +7,6 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import -@interface _NSObservationInfo : NSObject -{ - @public - id observer; - NSKeyValueObservingOptions options; - void* context; - id changeDictionary; - NSUInteger willChangeCount; - NSString* keyPath; - id object; -} --(id)observer; -- (id)changeDictionary; -- (void)setChangeDictionary:(id)value; -- (NSString *)keyPath; -- (void)setKeyPath:(NSString *)value; - -@end - @interface NSObject (KVOSwizzeling) -(void)_KVO_swizzle; -(Class)_KVO_swizzledClass; diff --git a/Foundation/NSKeyValueCoding/NSKeyValueObserving.h b/Foundation/NSKeyValueCoding/NSKeyValueObserving.h index e07285bf..a3ea409d 100644 --- a/Foundation/NSKeyValueCoding/NSKeyValueObserving.h +++ b/Foundation/NSKeyValueCoding/NSKeyValueObserving.h @@ -10,11 +10,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import @class NSDictionary,NSSet; -FOUNDATION_EXPORT NSString *const NSKeyValueChangeKindKey; -FOUNDATION_EXPORT NSString *const NSKeyValueChangeNewKey; -FOUNDATION_EXPORT NSString *const NSKeyValueChangeOldKey; -FOUNDATION_EXPORT NSString *const NSKeyValueChangeIndexesKey; -FOUNDATION_EXPORT NSString *const NSKeyValueChangeNotificationIsPriorKey; +FOUNDATION_EXPORT NSString * const NSKeyValueChangeKindKey; +FOUNDATION_EXPORT NSString * const NSKeyValueChangeNewKey; +FOUNDATION_EXPORT NSString * const NSKeyValueChangeOldKey; +FOUNDATION_EXPORT NSString * const NSKeyValueChangeIndexesKey; +FOUNDATION_EXPORT NSString * const NSKeyValueChangeNotificationIsPriorKey; enum { diff --git a/Foundation/NSKeyValueCoding/NSKeyValueObserving.m b/Foundation/NSKeyValueCoding/NSKeyValueObserving.m index 0bc40b29..35516c0d 100644 --- a/Foundation/NSKeyValueCoding/NSKeyValueObserving.m +++ b/Foundation/NSKeyValueCoding/NSKeyValueObserving.m @@ -5,7 +5,6 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #import #import #import @@ -17,15 +16,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import #import +#import #import +#import #import #import #import #import +#import #import "NSString+KVCAdditions.h" #import "NSKeyValueObserving-Private.h" +#import "NSKVOInfoPerObject.h" +#import "NSObservationInfo.h" NSString *const NSKeyValueChangeKindKey=@"NSKeyValueChangeKindKey"; NSString *const NSKeyValueChangeNewKey=@"NSKeyValueChangeNewKey"; @@ -36,80 +40,109 @@ NSString *const NSKeyValueChangeNotificationIsPriorKey=@"NSKeyValueChangeNotific NSString *const _KVO_DependentKeysTriggeringChangeNotification=@"_KVO_DependentKeysTriggeringChangeNotification"; NSString *const _KVO_KeyPathsForValuesAffectingValueForKey=@"_KVO_KeyPathsForValuesAffectingValueForKey"; -#pragma mark - -#pragma mark KVO implementation - -static NSMutableDictionary *observationInfos=nil; -static NSLock *kvoLock=nil; +static pthread_mutex_t kvoLock=PTHREAD_MUTEX_INITIALIZER; @interface NSObject (KVOSettersForwardReferencs) -+(void)_KVO_buildDependencyUnion; ++(NSDictionary *)_KVO_buildDependencyUnion; @end @interface NSObject (KVCPrivateMethod) -(void)_demangleTypeEncoding:(const char*)type to:(char*)cleanType; @end + @implementation NSObject (KeyValueObserving) --(void*)observationInfo -{ - return [[observationInfos objectForKey:[NSValue valueWithPointer:self]] pointerValue]; +static pthread_mutex_t masterObservationLock=PTHREAD_MUTEX_INITIALIZER; + +static inline NSMapTable *masterObservationInfo(){ + static NSMapTable *observationInfos=NULL; + + if(observationInfos==NULL) + observationInfos=NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,NSNonOwnedPointerMapValueCallBacks,0); + + return observationInfos; } --(void)setObservationInfo:(void*)info -{ - if(!observationInfos) - observationInfos=[NSMutableDictionary new]; - [observationInfos setObject:[NSValue valueWithPointer:info] forKey:[NSValue valueWithPointer:self]]; +-(void *)observationInfo { + void *result; + + pthread_mutex_lock(&masterObservationLock); + + result=NSMapGet(masterObservationInfo(),self); + + pthread_mutex_unlock(&masterObservationLock); + + return result; } -+(void*)observationInfo -{ - return [[observationInfos objectForKey:[NSValue valueWithPointer:self]] pointerValue]; +-(void)setObservationInfo:(void *)info { + pthread_mutex_lock(&masterObservationLock); + + if(info==NULL) + NSMapRemove(masterObservationInfo(),self); + else + NSMapInsert(masterObservationInfo(),self,info); + + pthread_mutex_unlock(&masterObservationLock); } -+(void)setObservationInfo:(void*)info -{ - if(!observationInfos) - observationInfos=[NSMutableDictionary new]; - [observationInfos setObject:[NSValue valueWithPointer:info] forKey:[NSValue valueWithPointer:self]]; ++(void *)observationInfo { + void *result; + + pthread_mutex_lock(&masterObservationLock); + + result=NSMapGet(masterObservationInfo(),self); + + pthread_mutex_unlock(&masterObservationLock); + + return result; } --(void)addObserver:(id)observer forKeyPath:(NSString*)keyPath options:(NSKeyValueObservingOptions)options context:(void*)context; -{ ++(void)setObservationInfo:(void *)info { + pthread_mutex_lock(&masterObservationLock); + + if(info==NULL) + NSMapRemove(masterObservationInfo(),self); + else + NSMapInsert(masterObservationInfo(),self,info); + + pthread_mutex_unlock(&masterObservationLock); +} + +static NSObservationInfo *observerInfoForObject(id object,id observer,NSString *key,NSString *keyPath){ + NSKVOInfoPerObject *observationInfo=[object observationInfo]; + NSMutableArray *observers=[observationInfo objectForKey:key]; + NSInteger i,count=[observers count]; + id objects[count]; + + [observers getObjects:objects]; + + for(i=0;iobserver==observer && [check->keyPath isEqualToString:keyPath]) { + return check; + } + } + return nil; +} + +-(void)addObserver:(id)observer forKeyPath:(NSString*)keyPath options:(NSKeyValueObservingOptions)options context:(void*)context { [self _KVO_swizzle]; - NSString* remainingKeyPath; - NSString* key; + + NSString *key; + NSString *remainingKeyPath; [keyPath _KVC_partBeforeDot:&key afterDot:&remainingKeyPath]; if([keyPath hasPrefix:@"@"]) { - // the key path is an operator: don't evaluate - key=keyPath; - remainingKeyPath=nil; + // the key path is an operator: don't evaluate + key=keyPath; + remainingKeyPath=nil; } - // get observation info dictionary - NSMutableDictionary* observationInfo=[self observationInfo]; - // get all observers for current key - NSMutableArray *observers=[observationInfo objectForKey:key]; - - // find if already observing - _NSObservationInfo *oldInfo=nil; - for(_NSObservationInfo *current in observers) { - if(current->observer==observer && - [[current keyPath] isEqualToString:keyPath]) { - oldInfo=current; - break; - } - } - - // create new info - _NSObservationInfo *info=nil; - if(oldInfo) - info=oldInfo; - else - info=[[_NSObservationInfo new] autorelease]; + NSObservationInfo *oldInfo=observerInfoForObject(self,observer,key,keyPath); + NSObservationInfo *info=(oldInfo!=nil)?[[oldInfo retain] autorelease]:[[[NSObservationInfo allocWithZone:NULL] init] autorelease]; // We now add the observer to the rest of the path, then to the dependents. // Any of the following may fail if a key path doesn't exist. @@ -119,23 +152,20 @@ static NSLock *kvoLock=nil; @try { // if observing a key path, also observe all deeper levels // info object acts as a proxy replacing remainingKeyPath with keyPath - if([remainingKeyPath length]) - { - lastPathTried=remainingKeyPath; - [[self valueForKey:key] addObserver:info - forKeyPath:remainingKeyPath - options:options - context:context]; + if([remainingKeyPath length]) { + lastPathTried=remainingKeyPath; + id value=[self valueForKey:key]; + + if(value!=nil){ + [value addObserver:info forKeyPath:remainingKeyPath options:options context:context]; + } } // now try all dependent key paths - for(NSString *path in dependentPathsForKey) - { - lastPathTried=path; - [self addObserver:info - forKeyPath:path - options:options - context:context]; + for(NSString *path in dependentPathsForKey) { + lastPathTried=path; + + [self addObserver:info forKeyPath:path options:options context:context]; } } @catch(id ex) { @@ -149,11 +179,11 @@ static NSLock *kvoLock=nil; [[self valueForKey:key] removeObserver:info forKeyPath:remainingKeyPath]; } - for(NSString *path in dependentPathsForKey) - { + for(NSString *path in dependentPathsForKey) { if(path==lastPathTried) break; // this is the one that failed - [self removeObserver:info forKeyPath:path]; + + [self removeObserver:info forKeyPath:path]; } } @@ -170,25 +200,27 @@ static NSLock *kvoLock=nil; } [ex raise]; } - - + // we were able to observe the full length of our key path, and the dependents. // now make the changes to our own observers array // create observation info dictionary if it's not there // (we have to re-check: it may have been created while observing our dependents - if(!observationInfo && !(observationInfo = [self observationInfo])) - { - [self setObservationInfo:[NSMutableDictionary new]]; - observationInfo=[self observationInfo]; - observers = [observationInfo objectForKey:key]; + NSKVOInfoPerObject *observationInfo; + NSMutableArray *observers; + + if((observationInfo = [self observationInfo])==nil) { + observationInfo=[[NSKVOInfoPerObject allocWithZone:NULL] init]; + [self setObservationInfo:observationInfo]; } + observers = [observationInfo objectForKey:key]; + // get all observers for current key - if(!observers) - { - observers = [NSMutableArray array]; - [observationInfo setObject:observers forKey:key]; + if(!observers) { + observers=[[NSMutableArray allocWithZone:NULL] init]; + [observationInfo setObject:observers forKey:key]; + [observers release]; } // set info options @@ -197,23 +229,38 @@ static NSLock *kvoLock=nil; info->context=context; info->object=self; [info setKeyPath:keyPath]; + [info setChangeDictionary:nil]; if(!oldInfo) { [observers addObject:info]; } - - if(options & NSKeyValueObservingOptionInitial) - { + if(options & NSKeyValueObservingOptionInitial) { [self willChangeValueForKey:keyPath]; [self didChangeValueForKey:keyPath]; } } +static void removeObserverInfoForObject(id object,NSObservationInfo *info,NSString *key){ + NSKVOInfoPerObject *observationInfo=[object observationInfo]; + NSMutableArray *observers=[observationInfo objectForKey:key]; + + [info invalidate]; + [observers removeObjectIdenticalTo:info]; + + if([observers count]==0) + [observationInfo removeObjectForKey:key]; + + if([observationInfo count]==0){ + [object setObservationInfo:nil]; + [observationInfo release]; + } +} --(void)removeObserver:(id)observer forKeyPath:(NSString*)keyPath; -{ - NSString* key, *remainingKeyPath; +-(void)removeObserver:observer forKeyPath:(NSString*)keyPath { + NSString *key; + NSString *remainingKeyPath; + [keyPath _KVC_partBeforeDot:&key afterDot:&remainingKeyPath]; if([keyPath hasPrefix:@"@"]) { @@ -222,225 +269,223 @@ static NSLock *kvoLock=nil; remainingKeyPath=nil; } - // now remove own observer - NSMutableDictionary* observationInfo=[self observationInfo]; - NSMutableArray *observers=[observationInfo objectForKey:key]; - - for(_NSObservationInfo *info in [[observers copy] autorelease]) - { - if(info->observer==observer && - [[info keyPath] isEqualToString:keyPath]) - { - [[info retain] autorelease]; - [observers removeObject:info]; - if(![observers count]) - { - [observationInfo removeObjectForKey:key]; - } - if(![observationInfo count]) - { - [self setObservationInfo:nil]; - [observationInfo release]; - } - - if([remainingKeyPath length]) - [[self valueForKey:key] removeObserver:info forKeyPath:remainingKeyPath]; - - NSSet* keysPathsForKey=[isa keyPathsForValuesAffectingValueForKey:key]; - for(NSString *path in keysPathsForKey) - { - [self removeObserver:info - forKeyPath:path]; - } - - return; - } + NSObservationInfo *info=observerInfoForObject(self,observer,key,keyPath); + + if(info!=nil){ + info=[[info retain] autorelease]; + + NSSet *keysPathsForKey=[isa keyPathsForValuesAffectingValueForKey:key]; + for(NSString *path in keysPathsForKey){ + [self removeObserver:info forKeyPath:path]; + } + + if([remainingKeyPath length]){ + id value=[self valueForKey:key]; + [value removeObserver:info forKeyPath:remainingKeyPath]; + } + + removeObserverInfoForObject(self,info,key); + return; } - // 10.4 Apple implementation will crash at this point... - [NSException raise:@"NSKVOException" format:@"trying to remove observer %@ for unobserved key path %@", observer, keyPath]; + + if(NSDebugEnabled){ + // 10.4 Apple implementation will crash at this point... + + /* FIXME: While observing key paths it is possible for an NSObservationInfo to be watching nothing due to a nil value down the path + Until that is fixed this shouldn't raise an exception + + [NSException raise:@"NSKVOException" format:@"trying to remove observer %@ for unobserved key path %@", observer, keyPath]; + */ + } + } --(void)willChangeValueForKey:(NSString*)key -{ - NSMutableDictionary *dict=[NSMutableDictionary new]; - [dict setObject:[NSNumber numberWithInt:NSKeyValueChangeSetting] - forKey:NSKeyValueChangeKindKey]; +-(void)willChangeValueForKey:(NSString *)key { + NSMutableDictionary *dict=[[NSMutableDictionary allocWithZone:NULL] init]; + [dict setObject:[NSNumber numberWithInt:NSKeyValueChangeSetting] forKey:NSKeyValueChangeKindKey]; [self _willChangeValueForKey:key changeOptions:dict]; [dict release]; } --(void)didChangeValueForKey:(NSString*)key -{ +-(void)didChangeValueForKey:(NSString*)key { [self _didChangeValueForKey:key changeOptions:nil]; } -- (void)willChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key -{ - NSMutableDictionary *dict=[NSMutableDictionary new]; - [dict setObject:[NSNumber numberWithUnsignedInteger:change] - forKey:NSKeyValueChangeKindKey]; - [dict setObject:indexes - forKey:NSKeyValueChangeIndexesKey]; +-(void)willChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key { + NSMutableDictionary *dict=[[NSMutableDictionary allocWithZone:NULL] init]; + [dict setObject:[NSNumber numberWithUnsignedInteger:change] forKey:NSKeyValueChangeKindKey]; + [dict setObject:indexes forKey:NSKeyValueChangeIndexesKey]; [self _willChangeValueForKey:key changeOptions:dict]; [dict release]; } -- (void)didChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key -{ +-(void)didChange:(NSKeyValueChange)change valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key { [self _didChangeValueForKey:key changeOptions:nil]; } - -#pragma mark Observer notification - --(void)_willChangeValueForKey:(NSString*)key changeOptions:(NSDictionary*)changeOptions -{ - NSMutableDictionary* observationInfo=[self observationInfo]; +-(void)_willChangeValueForKey:(NSString*)key changeOptions:(NSDictionary*)changeOptions { + NSKVOInfoPerObject *observationInfo=[self observationInfo]; - if(!observationInfo) + if(observationInfo==nil){ return; + } - NSMutableArray *observers=[observationInfo objectForKey:key]; - - for(_NSObservationInfo *info in [[observers copy] autorelease]) - { + NSMutableArray *observers=[observationInfo objectForKey:key]; + NSInteger i,count=[observers count]; + id objects[count]; + + [observers getObjects:objects]; + + for(i=0;iwillChangeCount++; - if(info->willChangeCount>1) + check->willChangeCount++; + if(check->willChangeCount>1){ continue; - NSString* keyPath=info->keyPath; + } + NSString* keyPath=check->keyPath; - if(![info changeDictionary]) - { + if(check->changeDictionary==nil){ id cd=[changeOptions mutableCopy]; - [info setChangeDictionary:cd]; + [check setChangeDictionary:cd]; [cd release]; } // store old value if applicable - if(info->options & NSKeyValueObservingOptionOld) - { - id idxs=[info->changeDictionary objectForKey:NSKeyValueChangeIndexesKey]; + if(check->options & NSKeyValueObservingOptionOld){ + id idxs=[check->changeDictionary objectForKey:NSKeyValueChangeIndexesKey]; - if(idxs) - { - int type=[[info->changeDictionary objectForKey:NSKeyValueChangeKindKey] intValue]; + if(idxs) { + int type=[[check->changeDictionary objectForKey:NSKeyValueChangeKindKey] intValue]; // for to-many relationships, oldvalue is only sensible for replace and remove - if(type == NSKeyValueChangeReplacement || - type == NSKeyValueChangeRemoval) - [info->changeDictionary setValue:[[self mutableArrayValueForKeyPath:keyPath] objectsAtIndexes:idxs] forKey:NSKeyValueChangeOldKey]; + if(type == NSKeyValueChangeReplacement || type == NSKeyValueChangeRemoval) + [check->changeDictionary setValue:[[self mutableArrayValueForKeyPath:keyPath] objectsAtIndexes:idxs] forKey:NSKeyValueChangeOldKey]; } - else - { - [info->changeDictionary setValue:[self valueForKeyPath:keyPath] forKey:NSKeyValueChangeOldKey]; + else { + [check->changeDictionary setValue:[self valueForKeyPath:keyPath] forKey:NSKeyValueChangeOldKey]; } } + check=[[check retain] autorelease]; + // inform observer of change - if(info->options & NSKeyValueObservingOptionPrior) - { - [info->changeDictionary setObject:[NSNumber numberWithBool:YES] - forKey:NSKeyValueChangeNotificationIsPriorKey]; - [info->observer observeValueForKeyPath:info->keyPath - ofObject:self - change:info->changeDictionary - context:info->context]; - [info->changeDictionary removeObjectForKey:NSKeyValueChangeNotificationIsPriorKey]; + if(check->options & NSKeyValueObservingOptionPrior) { + [check->changeDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSKeyValueChangeNotificationIsPriorKey]; + + [check->observer observeValueForKeyPath:check->keyPath ofObject:self change:check->changeDictionary context:check->context]; + + [check->changeDictionary removeObjectForKey:NSKeyValueChangeNotificationIsPriorKey]; } - NSString* firstPart, *rest; - [keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest]; + if(NSDebugEnabled && check->_isInvalid) + NSLog(@"NSDebugEnabled check became invalid during will change"); if([keyPath hasPrefix:@"@"]) { // the key path is an operator: don't evaluate - key=keyPath; - rest=nil; } + else { + NSString* firstPart, *rest; + [keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest]; // remove deeper levels (those items will change) - if(rest) - [[self valueForKey:firstPart] removeObserver:info forKeyPath:rest]; + if(rest) { + if(!check->_isInvalid){ + id value=[self valueForKey:firstPart]; + + [value removeObserver:check forKeyPath:rest]; + } + } + } } } --(void)_didChangeValueForKey:(NSString*)key changeOptions:(NSDictionary*)ignored -{ - NSMutableDictionary* observationInfo=[self observationInfo]; +-(void)_didChangeValueForKey:(NSString*)key changeOptions:(NSDictionary*)ignored { + NSKVOInfoPerObject *observationInfo=[self observationInfo]; - if(!observationInfo) - return; + if(observationInfo==nil) + return; - NSMutableArray *observers=[[observationInfo objectForKey:key] copy]; + NSArray *observers=[observationInfo objectForKey:key]; + NSInteger i,count=[observers count]; + id objects[count]; + + [observers getObjects:objects]; + + for(i=0;iwillChangeCount--; - if(info->willChangeCount>0) - continue; - NSString* keyPath=info->keyPath; + check->willChangeCount--; + if(check->willChangeCount>0){ + objects[i]=nil; + continue; + } + [[check retain] autorelease]; + + NSString* keyPath=check->keyPath; - // store new value if applicable - if(info->options & NSKeyValueObservingOptionNew) - { - id idxs=[info->changeDictionary objectForKey:NSKeyValueChangeIndexesKey]; - if(idxs) - { - int type=[[info->changeDictionary objectForKey:NSKeyValueChangeKindKey] intValue]; + // store new value if applicable + if(check->options & NSKeyValueObservingOptionNew){ + id idxs=[check->changeDictionary objectForKey:NSKeyValueChangeIndexesKey]; + + if(idxs){ + int type=[[check->changeDictionary objectForKey:NSKeyValueChangeKindKey] intValue]; // for to-many relationships, newvalue is only sensible for replace and insert - if(type == NSKeyValueChangeReplacement || - type == NSKeyValueChangeInsertion) - [info->changeDictionary setValue:[[self mutableArrayValueForKeyPath:keyPath] objectsAtIndexes:idxs] forKey:NSKeyValueChangeNewKey]; - } - else - { - [info->changeDictionary setValue:[self valueForKeyPath:keyPath] forKey:NSKeyValueChangeNewKey]; - } - } + if(type == NSKeyValueChangeReplacement || type == NSKeyValueChangeInsertion) + [check->changeDictionary setValue:[[self mutableArrayValueForKeyPath:keyPath] objectsAtIndexes:idxs] forKey:NSKeyValueChangeNewKey]; + } + else { + [check->changeDictionary setValue:[self valueForKeyPath:keyPath] forKey:NSKeyValueChangeNewKey]; + } + } - // restore deeper observers if applicable - NSString* firstPart, *rest; - [keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest]; + } + + for(i=0;i_isInvalid){ + continue; + } + + // restore deeper observers if applicable + NSString *firstPart, *rest; + [check->keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest]; - if([keyPath hasPrefix:@"@"]) { - // the key path is an operator: don't evaluate - key=keyPath; - rest=nil; - } + if([check->keyPath hasPrefix:@"@"]) { + // the key path is an operator: don't evaluate + key=check->keyPath; + rest=nil; + } +// FIXME: +// adding an observer with the same options here means the initial option is used, which we don't want during will/did - if(rest) - { - [[self valueForKey:firstPart] - addObserver:info - forKeyPath:rest - options:info->options - context:info->context]; - } - - // inform observer of change - [info->observer observeValueForKeyPath:info->keyPath - ofObject:self - change:info->changeDictionary - context:info->context]; + if(rest){ + [[self valueForKey:firstPart] addObserver:check forKeyPath:rest options:check->options context:check->context]; + } + + // inform observer of change + [check->observer observeValueForKeyPath:check->keyPath ofObject:self change:check->changeDictionary context:check->context]; - [info setChangeDictionary:nil]; - } - [observers release]; + [check setChangeDictionary:nil]; + } } -+(void)setKeys:(NSArray *)keys triggerChangeNotificationsForDependentKey:(NSString *)dependentKey -{ - NSMutableDictionary* observationInfo=[self observationInfo]; - if(!observationInfo) - { - observationInfo=[NSMutableDictionary new]; - [self setObservationInfo:observationInfo]; - } ++(void)setKeys:(NSArray *)keys triggerChangeNotificationsForDependentKey:(NSString *)dependentKey { + NSKVOInfoPerObject* observationInfo=[self observationInfo]; + + if(!observationInfo) { + observationInfo=[[NSKVOInfoPerObject allocWithZone:NULL] init]; + [self setObservationInfo:observationInfo]; + } NSMutableDictionary *dependencies=[observationInfo objectForKey:_KVO_DependentKeysTriggeringChangeNotification]; - if(!dependencies) - { + if(!dependencies){ dependencies=[NSMutableDictionary dictionary]; [observationInfo setObject:dependencies forKey:_KVO_DependentKeysTriggeringChangeNotification]; @@ -448,8 +493,7 @@ static NSLock *kvoLock=nil; id key; id en=[keys objectEnumerator]; - while((key = [en nextObject])) - { + while((key = [en nextObject])){ NSMutableSet* allDependencies=[dependencies objectForKey:key]; if(!allDependencies) { @@ -462,30 +506,43 @@ static NSLock *kvoLock=nil; } } -+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key -{ - NSString *methodName=[[NSString alloc] initWithFormat:@"keyPathsForValuesAffecting%@", [key capitalizedString]]; - NSSet* ret=nil; - SEL sel=NSSelectorFromString(methodName); - if([self respondsToSelector:sel]) - { - ret=[self performSelector:sel]; - } - else - { - [self _KVO_buildDependencyUnion]; - NSMutableDictionary* observationInfo=[self observationInfo]; - NSMutableDictionary *keyPathsByKey=[observationInfo objectForKey:_KVO_KeyPathsForValuesAffectingValueForKey]; - ret=[keyPathsByKey objectForKey:key]; - } - [methodName release]; - return ret; +static SEL selectorForKeyPathsForValuesAffecting(NSString *key){ + const char *prefix="keyPathsForValuesAffecting"; + char keyCString[[key length]+1]; + char buffer[strlen(prefix)+strlen(keyCString)+1]; + + [key getCString:keyCString]; + keyCString[0]=toupper(keyCString[0]); + strcpy(buffer,prefix); + strcat(buffer,keyCString); + + SEL result=sel_getUid(buffer); + + return result; +} + ++(NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + SEL sel=selectorForKeyPathsForValuesAffecting(key); + NSSet *result=nil; + + if([self respondsToSelector:sel]) + result=[self performSelector:sel]; + else { + NSKVOInfoPerObject *observationInfo=[self observationInfo]; + NSDictionary *keyPathsByKey=[observationInfo objectForKey:_KVO_KeyPathsForValuesAffectingValueForKey]; + + if(keyPathsByKey==nil){ + keyPathsByKey=[self _KVO_buildDependencyUnion]; + } + + result=[keyPathsByKey objectForKey:key]; + } + + return result; } @end -#pragma mark - -#pragma mark KVO-notifying setters and swizzeling code /* The following functions define suitable setters and getters which call willChangeValueForKey: and didChangeValueForKey: on their superclass _KVO_swizzle changes the class of its object to a subclass which overrides @@ -515,7 +572,7 @@ static NSLock *kvoLock=nil; else \ sel+=3; \ sel[0]=tolower(sel[0]); \ - NSString *key=[[NSString alloc] initWithCString:sel]; \ + NSString *key=[[NSString allocWithZone:NULL] initWithCString:sel]; \ [self willChangeValueForKey:key]; \ typedef id (*sender)(id obj, SEL selector, type value); \ sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; \ @@ -553,8 +610,7 @@ CHANGE_DECLARATION(char) CHANGE_DECLARATION(long) CHANGE_DECLARATION(SEL) --(void)KVO_notifying_change_setObject:(id)object forKey:(NSString*)key -{ +-(void)KVO_notifying_change_setObject:(id)object forKey:(NSString*)key { [self willChangeValueForKey:key]; typedef id (*sender)(id obj, SEL selector, id object, id key); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -562,8 +618,7 @@ CHANGE_DECLARATION(SEL) [self didChangeValueForKey:key]; } --(void)KVO_notifying_change_removeObjectForKey:(NSString*)key -{ +-(void)KVO_notifying_change_removeObjectForKey:(NSString*)key { [self willChangeValueForKey:key]; typedef id (*sender)(id obj, SEL selector, id key); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -572,8 +627,7 @@ CHANGE_DECLARATION(SEL) } --(void)KVO_notifying_change_insertObject:(id)object inKeyAtIndex:(NSInteger)index -{ +-(void)KVO_notifying_change_insertObject:(id)object inKeyAtIndex:(NSInteger)index { const char* origName = sel_getName(_cmd); size_t selLen=strlen(origName); @@ -584,8 +638,8 @@ CHANGE_DECLARATION(SEL) sel[strlen(sel)-strlen("AtIndex:")+1]='\0'; sel[0]=tolower(sel[0]); + NSString *key=[[NSString allocWithZone:NULL] initWithCString:sel]; - NSString *key=[[NSString alloc] initWithCString:sel]; [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:key]; typedef id (*sender)(id obj, SEL selector, id value, NSInteger index); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -594,8 +648,7 @@ CHANGE_DECLARATION(SEL) [key release]; } --(void)KVO_notifying_change_addKeyObject:(id)object -{ +-(void)KVO_notifying_change_addKeyObject:(id)object { const char* origName = sel_getName(_cmd); size_t selLen=strlen(origName); @@ -613,7 +666,7 @@ CHANGE_DECLARATION(SEL) sel[0]=tolower(sel[0]); - NSString *key=[[NSString alloc] initWithCString:sel]; + NSString *key=[[NSString allocWithZone:NULL] initWithCString:sel]; [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:idx] forKey:key]; typedef id (*sender)(id obj, SEL selector, id value); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -622,8 +675,7 @@ CHANGE_DECLARATION(SEL) [key release]; } --(void)KVO_notifying_change_removeKeyObject:(id)object -{ +-(void)KVO_notifying_change_removeKeyObject:(id)object { const char* origName = sel_getName(_cmd); size_t selLen=strlen(origName); @@ -641,7 +693,7 @@ CHANGE_DECLARATION(SEL) sel[0]=tolower(sel[0]); - NSString *key=[[NSString alloc] initWithCString:sel]; + NSString *key=[[NSString allocWithZone:NULL] initWithCString:sel]; [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:idx] forKey:key]; typedef id (*sender)(id obj, SEL selector, id value); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -650,8 +702,7 @@ CHANGE_DECLARATION(SEL) [key release]; } --(void)KVO_notifying_change_removeObjectFromKeyAtIndex:(int)index -{ +-(void)KVO_notifying_change_removeObjectFromKeyAtIndex:(int)index { const char* origName = sel_getName(_cmd); size_t selLen=strlen(origName); char *sel=__builtin_alloca(selLen+1); @@ -661,7 +712,7 @@ CHANGE_DECLARATION(SEL) sel[strlen(sel)-strlen("AtIndex:")+1]='\0'; sel[0]=tolower(sel[0]); - NSString *key=[[NSString alloc] initWithCString:sel]; + NSString *key=[[NSString allocWithZone:NULL] initWithCString:sel]; [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:key]; typedef id (*sender)(id obj, SEL selector, int index); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -670,8 +721,7 @@ CHANGE_DECLARATION(SEL) [key release]; } --(void)KVO_notifying_change_replaceObjectInKeyAtIndex:(int)index withObject:(id)object -{ +-(void)KVO_notifying_change_replaceObjectInKeyAtIndex:(int)index withObject:(id)object { const char* origName = sel_getName(_cmd); size_t selLen=strlen(origName); char *sel=__builtin_alloca(selLen+1); @@ -681,7 +731,7 @@ CHANGE_DECLARATION(SEL) sel[strlen(sel)-strlen("AtIndex:WithObject:")+1]='\0'; sel[0]=tolower(sel[0]); - NSString *key=[[NSString alloc] initWithCString:sel]; + NSString *key=[[NSString allocWithZone:NULL] initWithCString:sel]; [self willChange:NSKeyValueChangeReplacement valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:key]; typedef id (*sender)(id obj, SEL selector, int index, id object); sender implementation=(sender)[[self superclass] instanceMethodForSelector:_cmd]; @@ -691,48 +741,40 @@ CHANGE_DECLARATION(SEL) } --(id)_KVO_className -{ +-(id)_KVO_className { return [NSString stringWithCString:isa->name+strlen("KVONotifying_")]; } --(Class)_KVO_class -{ +-(Class)_KVO_class { return isa->super_class; } --(Class)_KVO_classForCoder -{ +-(Class)_KVO_classForCoder { return isa->super_class; } -+(void)_KVO_buildDependencyUnion -{ ++(NSDictionary *)_KVO_buildDependencyUnion { /* This method gathers dependent keys from all superclasses and merges them together */ - NSMutableDictionary* observationInfo=[self observationInfo]; - if(!observationInfo) - { - [self setObservationInfo:[NSMutableDictionary new]]; - observationInfo=[self observationInfo]; - } + NSKVOInfoPerObject *observationInfo=[self observationInfo]; + + if(!observationInfo) { + observationInfo=[[NSKVOInfoPerObject allocWithZone:NULL] init]; + [self setObservationInfo:observationInfo]; + } - NSMutableDictionary *keyPathsByKey=[NSMutableDictionary dictionary]; + NSMutableDictionary *keyPathsByKey=[[NSMutableDictionary alloc] init]; id class=self; - while(class != [NSObject class]) - { + while(class != [NSObject class]){ NSDictionary* classDependents=[(NSDictionary*)[class observationInfo] objectForKey:_KVO_DependentKeysTriggeringChangeNotification]; - for(id key in [classDependents allKeys]) - { - for(id value in [classDependents objectForKey:key]) - { + for(id key in [classDependents allKeys]) { + for(id value in [classDependents objectForKey:key]) { NSMutableSet *pathSet=[keyPathsByKey objectForKey:value]; - if(!pathSet) - { + if(!pathSet) { pathSet=[NSMutableSet set]; [keyPathsByKey setObject:pathSet forKey:value]; } @@ -742,8 +784,10 @@ CHANGE_DECLARATION(SEL) class=[class superclass]; } - [observationInfo setObject:keyPathsByKey - forKey:_KVO_KeyPathsForValuesAffectingValueForKey]; + [observationInfo setObject:keyPathsByKey forKey:_KVO_KeyPathsForValuesAffectingValueForKey]; + [keyPathsByKey release]; + + return keyPathsByKey; } @@ -753,11 +797,80 @@ CHANGE_DECLARATION(SEL) NSString* className=[self className]; if([className hasPrefix:@"KVONotifying_"]) return; // this class is already swizzled - [kvoLock lock]; + pthread_mutex_lock(&kvoLock); isa=[self _KVO_swizzledClass]; - [kvoLock unlock]; + pthread_mutex_unlock(&kvoLock); } +static BOOL methodIsAutoNotifyingSetter(Class class,const char *methodCString){ + size_t cStringLength=strlen(methodCString),keyCStringLength=0; + char keyCString[cStringLength+1]; + enum { + STATE_START, + STATE_UNDERSCORE, + STATE_S, + STATE_E, + STATE_T, + STATE_UNTILCOLON, + } state=STATE_START; + + for(;*methodCString!='\0';methodCString++){ + + switch(state){ + + case STATE_START: + if(*methodCString=='s') + state=STATE_S; + else if(*methodCString=='_') + state=STATE_UNDERSCORE; + else + return NO; + break; + + case STATE_UNDERSCORE: + if(*methodCString=='s') + state=STATE_S; + else + return NO; + break; + + case STATE_S: + if(*methodCString=='e') + state=STATE_E; + else + return NO; + break; + + case STATE_E: + if(*methodCString=='t') + state=STATE_T; + else + return NO; + break; + + case STATE_T: + if(*methodCString==':') + return NO; + keyCString[keyCStringLength++]=tolower(*methodCString); + state=STATE_UNTILCOLON; + break; + + case STATE_UNTILCOLON: + if(*methodCString!=':') + keyCString[keyCStringLength++]=*methodCString; + break; + } + } + if(keyCStringLength==0) + return NO; + + NSString *keyName=[[NSString alloc] initWithCString:keyCString length:keyCStringLength]; + + BOOL result=[class automaticallyNotifiesObserversForKey:keyName]; + [keyName release]; + + return result; +} -(Class)_KVO_swizzledClass { @@ -804,20 +917,21 @@ CHANGE_DECLARATION(SEL) struct objc_method_list* list = class_nextMethodList(currentClass, &iterator); while(list) { + NSAutoreleasePool *pool=[NSAutoreleasePool new]; int i; for(i=0; imethod_count; i++) { struct objc_method *method=&list->method_list[i]; - NSString* methodName = NSStringFromSelector(method->method_name); + const char *methodCString=sel_getName(method->method_name); + NSUInteger numberOfArguments=method_getNumberOfArguments(method); SEL kvoSelector=0; // current method is a setter? - if(([methodName hasPrefix:@"set"] || [methodName hasPrefix:@"_set"]) && - [[self methodSignatureForSelector:method->method_name] numberOfArguments]==3 && - [[self class] automaticallyNotifiesObserversForKey:[methodName _KVC_setterKeyNameFromSelectorName]]) + if(numberOfArguments==3 && methodIsAutoNotifyingSetter([self class],methodCString)) { - const char* firstParameterType=[[self methodSignatureForSelector:method->method_name] getArgumentTypeAtIndex:2]; - const char* returnType=[[self methodSignatureForSelector:method->method_name] methodReturnType]; + NSMethodSignature *signature=[self methodSignatureForSelector:method->method_name]; + const char* firstParameterType=[signature getArgumentTypeAtIndex:2]; + const char* returnType=[signature methodReturnType]; char *cleanFirstParameterType=__builtin_alloca(strlen(firstParameterType)+1); [self _demangleTypeEncoding:firstParameterType to:cleanFirstParameterType]; @@ -850,12 +964,10 @@ CHANGE_DECLARATION(SEL) if(kvoSelector==0 && NSDebugEnabled) { - NSLog(@"type %s not defined in %s:%i (selector %s on class %@)", cleanFirstParameterType, __FILE__, __LINE__, sel_getName(method->method_name), [self className]); + NSLog(@"NSDebugEnabled type %s not defined in %s:%i (selector %s on class %@)", cleanFirstParameterType, __FILE__, __LINE__, sel_getName(method->method_name), [self className]); } if(returnType[0]!=_C_VOID) { - if(NSDebugEnabled) - NSLog(@"selector %s on class %@ has return type %s and will not be modified for automatic KVO notification", sel_getName(method->method_name), [self className], returnType); kvoSelector=0; } @@ -867,46 +979,35 @@ CHANGE_DECLARATION(SEL) // long selectors if(kvoSelector==0) { - id ret=nil; - - if([methodName _KVC_setterKeyName:&ret forSelectorNameStartingWith:@"insertObject:in" endingWith:@"AtIndex:"] && - ret && - [[self methodSignatureForSelector:method->method_name] numberOfArguments] == 4) + NSString * methodName = NSStringFromSelector(method->method_name); + if(numberOfArguments == 4 && [methodName _KVC_isSetterForSelectorNameStartingWith:@"insertObject:in" endingWith:@"AtIndex:"]) { kvoSelector = @selector(KVO_notifying_change_insertObject:inKeyAtIndex:); } - else if([methodName _KVC_setterKeyName:&ret forSelectorNameStartingWith:@"removeObjectFrom" endingWith:@"AtIndex:"] && - ret && - [[self methodSignatureForSelector:method->method_name] numberOfArguments] == 3) + else if(numberOfArguments == 3 && [methodName _KVC_isSetterForSelectorNameStartingWith:@"removeObjectFrom" endingWith:@"AtIndex:"]) { kvoSelector = @selector(KVO_notifying_change_removeObjectFromKeyAtIndex:); } - else if([methodName _KVC_setterKeyName:&ret forSelectorNameStartingWith:@"replaceObjectIn" endingWith:@"AtIndex:withObject:"] && - ret && - [[self methodSignatureForSelector:method->method_name] numberOfArguments] == 4) + else if(numberOfArguments == 4 && [methodName _KVC_isSetterForSelectorNameStartingWith:@"replaceObjectIn" endingWith:@"AtIndex:withObject:"]) { kvoSelector = @selector(KVO_notifying_change_replaceObjectInKeyAtIndex:withObject:); } - else if([methodName _KVC_setterKeyName:&ret forSelectorNameStartingWith:@"remove" endingWith:@"Object:"] && - ret && - [[self methodSignatureForSelector:method->method_name] numberOfArguments] == 3) + else if(numberOfArguments == 3 && [methodName _KVC_isSetterForSelectorNameStartingWith:@"remove" endingWith:@"Object:"]) { kvoSelector = @selector(KVO_notifying_change_removeKeyObject:); } - else if([methodName _KVC_setterKeyName:&ret forSelectorNameStartingWith:@"add" endingWith:@"Object:"] && - ret && - [[self methodSignatureForSelector:method->method_name] numberOfArguments] == 3) + else if(numberOfArguments == 3 && [methodName _KVC_isSetterForSelectorNameStartingWith:@"add" endingWith:@"Object:"]) { kvoSelector = @selector(KVO_notifying_change_addKeyObject:); } } - + // these are swizzled so e.g. subclasses of NSMutableDictionary get change notifications in setObject:forKey: - if([methodName isEqualToString:@"setObject:forKey:"]) + if(strcmp(methodCString,"setObject:forKey:")==0) { kvoSelector = @selector(KVO_notifying_change_setObject:forKey:); } - if([methodName isEqualToString:@"removeObjectForKey:"]) + else if(strcmp(methodCString,"removeObjectForKey:")==0) { kvoSelector = @selector(KVO_notifying_change_removeObjectForKey:forKey:); } @@ -932,7 +1033,7 @@ CHANGE_DECLARATION(SEL) currentMethod++; - //NSLog(@"replaced method %@ by %@ in class %@", methodName, NSStringFromSelector(newMethod->method_name), [self className]); + //NSLog(@"replaced method %s by %@ in class %@", methodNameCString, NSStringFromSelector(newMethod->method_name), [self className]); } } list=class_nextMethodList(currentClass, &iterator); @@ -943,6 +1044,7 @@ CHANGE_DECLARATION(SEL) if(currentClass && currentClass->super_class!=currentClass) list=class_nextMethodList(currentClass, &iterator); } + [pool release]; } #undef CHECK_AND_ASSIGN @@ -962,71 +1064,12 @@ CHANGE_DECLARATION(SEL) return swizzledClass; } -+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; -{ ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; { if([key isEqualToString:@"observationInfo"]) { - return NO; + return NO; } - return YES; -} -@end - -#pragma mark - -#pragma mark Observation info structure - - -@implementation _NSObservationInfo -- (NSString*)keyPath { - return [[keyPath retain] autorelease]; -} - -- (void)setKeyPath:(NSString*)value { - if (keyPath != value) { - [keyPath release]; - keyPath = [value copy]; - } -} - - - -- (id)changeDictionary -{ - return [[changeDictionary retain] autorelease]; -} - -- (void)setChangeDictionary:(id)value -{ - if (changeDictionary != value) - { - [changeDictionary release]; - changeDictionary = [value retain]; - } -} - --(id)observer -{ - return observer; -} - --(void)dealloc -{ - [keyPath release]; - [changeDictionary release]; - [super dealloc]; -} - --(void)observeValueForKeyPath:(NSString*)subKeyPath ofObject:(id)subObject change:(NSDictionary*)changeDict context:(void*)subContext; -{ - [observer observeValueForKeyPath:keyPath - ofObject:object - change:changeDict - context:context]; -} - --(NSString *)description -{ - return [NSString stringWithFormat:@"<%@ %p (%@ -> %@)>", [self className], self, keyPath, observer]; + return YES; } @end diff --git a/Foundation/NSKeyValueCoding/NSObservationInfo.h b/Foundation/NSKeyValueCoding/NSObservationInfo.h new file mode 100644 index 00000000..1e71da25 --- /dev/null +++ b/Foundation/NSKeyValueCoding/NSObservationInfo.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2007 Johannes Fortmann + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#import +#import + +@class NSMutableDictionary; + +@interface NSObservationInfo : NSObject { +@public + id observer; + NSKeyValueObservingOptions options; + void* context; + NSMutableDictionary *changeDictionary; + NSUInteger willChangeCount; + NSString* keyPath; + id object; + id emptyValue; + BOOL _isInvalid; +} + +-(void)invalidate; + +-(id)observer; +- (NSMutableDictionary *)changeDictionary; +- (void)setChangeDictionary:(NSMutableDictionary *)value; +- (NSString *)keyPath; +- (void)setKeyPath:(NSString *)value; + +@end diff --git a/Foundation/NSKeyValueCoding/NSObservationInfo.m b/Foundation/NSKeyValueCoding/NSObservationInfo.m new file mode 100644 index 00000000..c7cb3ec7 --- /dev/null +++ b/Foundation/NSKeyValueCoding/NSObservationInfo.m @@ -0,0 +1,59 @@ +/* Copyright (c) 2007-2008 Johannes Fortmann + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#import "NSObservationInfo.h" +#import + +@implementation NSObservationInfo + +-(void)invalidate { + _isInvalid=YES; +} + +-(NSString *)keyPath { + return keyPath; +} + +-(void)setKeyPath:(NSString *)value { + if (keyPath != value) { + [keyPath release]; + keyPath = [value copy]; + } +} + +-(NSMutableDictionary *)changeDictionary { + return changeDictionary; +} + +-(void)setChangeDictionary:(NSMutableDictionary *)value { + if (changeDictionary != value) { + [changeDictionary release]; + changeDictionary = [value retain]; + } +} + +-observer { + return observer; +} + +-(void)dealloc { + [keyPath release]; + [changeDictionary release]; + [emptyValue release]; + [super dealloc]; +} + +-(void)observeValueForKeyPath:(NSString *)subKeyPath ofObject:(id)subObject change:(NSDictionary*)changeDict context:(void*)subContext { + [observer observeValueForKeyPath:keyPath ofObject:object change:changeDict context:context]; +} + +-(NSString *)description { + return [NSString stringWithFormat:@"<%@ %p (%@ -> %@)>", isa, self, keyPath, observer]; +} + +@end + diff --git a/Foundation/NSKeyValueCoding/NSString+KVCAdditions.h b/Foundation/NSKeyValueCoding/NSString+KVCAdditions.h index e1298b8e..5c40e1be 100644 --- a/Foundation/NSKeyValueCoding/NSString+KVCAdditions.h +++ b/Foundation/NSKeyValueCoding/NSString+KVCAdditions.h @@ -10,6 +10,5 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI @interface NSString (KVCAdditions) -(void)_KVC_partBeforeDot:(NSString**)before afterDot:(NSString**)after; --(id)_KVC_setterKeyNameFromSelectorName; --(BOOL)_KVC_setterKeyName:(NSString**)keyName forSelectorNameStartingWith:(id)start endingWith:(id)end; +-(BOOL)_KVC_isSetterForSelectorNameStartingWith:(NSString *)start endingWith:(NSString *)end; @end diff --git a/Foundation/NSKeyValueCoding/NSString+KVCAdditions.m b/Foundation/NSKeyValueCoding/NSString+KVCAdditions.m index 34e855f2..f9e7fbca 100644 --- a/Foundation/NSKeyValueCoding/NSString+KVCAdditions.m +++ b/Foundation/NSKeyValueCoding/NSString+KVCAdditions.m @@ -8,23 +8,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import "NSString+KVCAdditions.h" - @implementation NSString (KVCPrivateAdditions) --(id)_KVC_setterKeyNameFromSelectorName -{ - NSString* keyName=[self substringWithRange:NSMakeRange(3, [self length]-4)]; - return [NSString stringWithFormat:@"%@%@", [[keyName substringToIndex:1] lowercaseString], [keyName substringFromIndex:1]]; -} --(BOOL)_KVC_setterKeyName:(NSString**)ret forSelectorNameStartingWith:(id)start endingWith:(id)end; +-(BOOL)_KVC_isSetterForSelectorNameStartingWith:(NSString *)start endingWith:(NSString *)end; { - *ret=nil; if([self hasPrefix:start] && [self hasSuffix:end]) { NSString* keyName=[self substringWithRange:NSMakeRange([start length], [self length]-[end length]-[start length])]; if(![keyName length]) return NO; - *ret = [NSString stringWithFormat:@"%@%@", [[keyName substringToIndex:1] lowercaseString], [keyName substringFromIndex:1]]; + return YES; } return NO; diff --git a/Foundation/NSRunLoop/NSRunLoop.h b/Foundation/NSRunLoop/NSRunLoop.h index bb189d5c..70f487a7 100755 --- a/Foundation/NSRunLoop/NSRunLoop.h +++ b/Foundation/NSRunLoop/NSRunLoop.h @@ -16,7 +16,9 @@ FOUNDATION_EXPORT NSString * const NSRunLoopCommonModes; @interface NSRunLoop : NSObject { NSMapTable *_modes; + NSMutableArray *_commonModes; NSString *_currentMode; + NSMutableArray *_continue; NSMutableArray *_orderedPerforms; } @@ -42,6 +44,7 @@ FOUNDATION_EXPORT NSString * const NSRunLoopCommonModes; -(void)performSelector:(SEL)selector target:target argument:argument order:(NSUInteger)order modes:(NSArray *)modes; -(void)cancelPerformSelector:(SEL)selector target:target argument:argument; +-(void)cancelPerformSelectorsWithTarget:target; @end @@ -50,8 +53,8 @@ FOUNDATION_EXPORT NSString * const NSRunLoopCommonModes; -(void)performSelector:(SEL)selector withObject:object afterDelay:(NSTimeInterval)delay; -+(void)cancelPreviousPerformRequestsWithTarget:target selector:(SEL)selector - object:object; ++(void)cancelPreviousPerformRequestsWithTarget:target selector:(SEL)selector object:object; ++(void)cancelPreviousPerformRequestsWithTarget:target; @end diff --git a/Foundation/NSRunLoop/NSRunLoop.m b/Foundation/NSRunLoop/NSRunLoop.m index 4652d397..03d5a20b 100755 --- a/Foundation/NSRunLoop/NSRunLoop.m +++ b/Foundation/NSRunLoop/NSRunLoop.m @@ -20,8 +20,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import -NSString * const NSDefaultRunLoopMode=@"NSDefaultRunLoopMode"; -NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; +NSString * const NSDefaultRunLoopMode=@"kCFRunLoopDefaultMode"; +NSString * const NSRunLoopCommonModes=@"kCFRunLoopCommonModes"; @implementation NSRunLoop @@ -37,7 +37,10 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; NSInputSource *parentDeath; _modes=NSCreateMapTableWithZone(NSObjectMapKeyCallBacks,NSObjectMapValueCallBacks,0,[self zone]); + _commonModes=[[NSMutableArray alloc] init]; + [_commonModes addObject:NSDefaultRunLoopMode]; _currentMode=NSDefaultRunLoopMode; + _continue=[[NSMutableArray alloc] init]; _orderedPerforms=[NSMutableArray new]; if((parentDeath=[[NSPlatform currentPlatform] parentDeathInputSource])!=nil) @@ -49,6 +52,8 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; -(void)dealloc { NSFreeMapTable(_modes); [_currentMode release]; + [_commonModes release]; + [_continue release]; [_orderedPerforms release]; [super dealloc]; } @@ -57,16 +62,32 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; NSRunLoopState *state=NSMapGet(_modes,mode); if(state==nil){ - state=[[NSRunLoopState new] autorelease]; - NSMapInsert(_modes,mode,state); + state=[[NSRunLoopState new] autorelease]; + NSMapInsert(_modes,mode,state); } return state; } +-(NSArray *)statesForMode:(NSString *)mode { + NSMutableArray *result=[NSMutableArray array]; + + if([mode isEqualToString:NSRunLoopCommonModes]){ + for(NSString *common in _commonModes) + [result addObject:[self stateForMode:common]]; + } + else { + [result addObject:[self stateForMode:mode]]; + } + + return result; +} + + -(BOOL)_orderedPerforms { BOOL didPerform=NO; id performs=nil; + @synchronized(_orderedPerforms) { performs=[_orderedPerforms copy]; @@ -92,7 +113,7 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; // be careful the lock on _orderedPerforms is not held while we fire the perform // TODO: right now, all modes are common modes - if([check fireInMode:_currentMode] || [check fireInMode:NSRunLoopCommonModes]){ + if([check fireInMode:_currentMode]){ didPerform=YES; } else{ @@ -127,7 +148,7 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; if([self _orderedPerforms]) [self _wakeUp]; - if([state fireTimers]) + if([state fireFirstTimer]) [self _wakeUp]; [[NSNotificationQueue defaultQueue] asapProcessMode:mode]; @@ -160,8 +181,8 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; -(BOOL)runMode:(NSString *)mode beforeDate:(NSDate *)date { NSAutoreleasePool *pool=[NSAutoreleasePool new]; NSDate *limitDate=[self limitDateForMode:mode]; - - if(limitDate!=nil){ + + if(limitDate!=nil){ limitDate=[limitDate earlierDate:date]; [self acceptInputForMode:mode beforeDate:limitDate]; } @@ -173,7 +194,7 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; -(void)runUntilDate:(NSDate *)date { while([self runMode:NSDefaultRunLoopMode beforeDate:date]) - if([date timeIntervalSinceNow]<0) + if([date timeIntervalSinceNow]<=0) break; } @@ -198,19 +219,41 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; } -(void)addInputSource:(NSInputSource *)source forMode:(NSString *)mode { - [[self stateForMode:mode] addInputSource:source]; + NSArray *modeStates=[self statesForMode:mode]; + + for(NSRunLoopState *state in modeStates) + [state addInputSource:source]; + } -(void)removeInputSource:(NSInputSource *)source forMode:(NSString *)mode { - [[self stateForMode:mode] removeInputSource:source]; + NSArray *modeStates=[self statesForMode:mode]; + + for(NSRunLoopState *state in modeStates) + [state removeInputSource:source]; } -(void)addTimer:(NSTimer *)timer forMode:(NSString *)mode { - [[self stateForMode:mode] addTimer:timer]; + NSArray *modeStates=[self statesForMode:mode]; + + for(NSRunLoopState *state in modeStates) + [state addTimer:timer]; +} + +-(NSArray *)resolveCommonModes:(NSArray *)modes { + NSMutableArray *result=[NSMutableArray array]; + + for(NSString *check in modes) + if([check isEqualToString:NSRunLoopCommonModes]) + [result addObjectsFromArray:_commonModes]; + else + [result addObject:check]; + + return result; } -(void)performSelector:(SEL)selector target:target argument:argument order:(NSUInteger)order modes:(NSArray *)modes { - NSOrderedPerform *perform=[NSOrderedPerform orderedPerformWithSelector:selector target:target argument:argument order:order modes:modes]; + NSOrderedPerform *perform=[NSOrderedPerform orderedPerformWithSelector:selector target:target argument:argument order:order modes:[self resolveCommonModes:modes]]; @synchronized(_orderedPerforms) { NSInteger count=[_orderedPerforms count]; @@ -241,6 +284,19 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; } } +-(void)cancelPerformSelectorsWithTarget:target { + @synchronized(_orderedPerforms) + { + NSInteger count=[_orderedPerforms count]; + + while(--count>=0){ + NSOrderedPerform *check=[_orderedPerforms objectAtIndex:count]; + + if([check target]==target) + [_orderedPerforms removeObjectAtIndex:count]; + } + } +} @end @@ -249,8 +305,13 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; +(void)cancelPreviousPerformRequestsWithTarget:target selector:(SEL)selector object:argument { - NSDelayedPerform *delayed=[NSDelayedPerform delayedPerformWithObject:target selector:selector - argument:argument]; + NSDelayedPerform *delayed=[NSDelayedPerform delayedPerformWithObject:target selector:selector argument:argument]; + + [[NSRunLoop currentRunLoop] invalidateTimerWithDelayedPerform:delayed]; +} + ++(void)cancelPreviousPerformRequestsWithTarget:target { + NSDelayedPerform *delayed=[NSDelayedPerform delayedPerformWithObject:target selector:NULL argument:nil]; [[NSRunLoop currentRunLoop] invalidateTimerWithDelayedPerform:delayed]; } @@ -278,8 +339,5 @@ NSString * const NSRunLoopCommonModes=@"NSRunLoopCommonModes"; afterDelay:delay]; } - - - @end diff --git a/Foundation/NSRunLoop/NSRunLoopState.h b/Foundation/NSRunLoop/NSRunLoopState.h index ba534237..4bad6f4b 100755 --- a/Foundation/NSRunLoop/NSRunLoopState.h +++ b/Foundation/NSRunLoop/NSRunLoopState.h @@ -22,7 +22,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -(void)changingIntoMode:(NSString *)mode; --(BOOL)fireTimers; +-(BOOL)fireFirstTimer; -(NSDate *)limitDateForMode:(NSString *)mode; -(void)addInputSource:(NSInputSource *)source; diff --git a/Foundation/NSRunLoop/NSRunLoopState.m b/Foundation/NSRunLoop/NSRunLoopState.m index e18f8c27..9eafdf9e 100755 --- a/Foundation/NSRunLoop/NSRunLoopState.m +++ b/Foundation/NSRunLoop/NSRunLoopState.m @@ -56,25 +56,33 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI [[_asyncInputSourceSets objectAtIndex:i] changingIntoMode:mode]; } --(BOOL)fireTimers { - NSMutableArray *fire=[NSMutableArray array]; - NSDate *now=[NSDate date]; - NSInteger count=[_timers count]; - BOOL didFireTimer=NO; - - while(--count>=0){ - NSTimer *timer=[_timers objectAtIndex:count]; - - if(![timer isValid]) - [_timers removeObjectAtIndex:count]; - else if([now compare:[timer fireDate]]!=NSOrderedAscending) { - [fire addObject:timer]; - didFireTimer=YES; +-(BOOL)fireFirstTimer { + NSDate *now=[NSDate date]; + NSInteger i,count=[_timers count]; + NSTimer *fireTimer=nil; + + for(i=0;i=0) + if(![[_timers objectAtIndex:count] isValid]) + [_timers removeObjectAtIndex:count]; + + return (fireTimer!=nil)?YES:NO; } -(NSDate *)limitDateForMode:(NSString *)mode { @@ -87,10 +95,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI if(![timer isValid]) [_timers removeObjectAtIndex:count]; - else if(limit==nil) - limit=[timer fireDate]; - else - limit=[limit earlierDate:[timer fireDate]]; + else { + if(limit==nil){ + limit=[timer fireDate]; + } + else{ + limit=[limit earlierDate:[timer fireDate]]; + } + } } if(limit==nil){ @@ -132,9 +144,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI NSTimer *timer=[_timers objectAtIndex:count]; NSDelayedPerform *check=[timer userInfo]; - if([check isKindOfClass:[NSDelayedPerform class]]) + if([check isKindOfClass:[NSDelayedPerform class]]){ if([check isEqualToPerform:delayed]) [timer invalidate]; + } } } diff --git a/Foundation/NSStream/CFSSLHandler_openssl.m b/Foundation/NSStream/CFSSLHandler_openssl.m index 295a1bfa..061cd511 100644 --- a/Foundation/NSStream/CFSSLHandler_openssl.m +++ b/Foundation/NSStream/CFSSLHandler_openssl.m @@ -2,9 +2,9 @@ #import #import #import -#import #ifdef OPENSSL_ENABLED +#import #import @implementation CFSSLHandler(openssl) @@ -15,11 +15,8 @@ @end -#endif - @implementation CFSSLHandler_openssl -#ifdef OPENSSL_ENABLED static pthread_mutex_t initLock=PTHREAD_MUTEX_INITIALIZER; @@ -310,6 +307,7 @@ static threadid_func(CRYPTO_THREADID *id){ } } -#endif @end + +#endif diff --git a/Foundation/NSStream/NSInputStream_socket.h b/Foundation/NSStream/NSInputStream_socket.h index d9d0d13b..13056598 100644 --- a/Foundation/NSStream/NSInputStream_socket.h +++ b/Foundation/NSStream/NSInputStream_socket.h @@ -9,20 +9,25 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import #import +#import @class NSSocket,NSSelectInputSource; @interface NSInputStream_socket : NSInputStream { + CFOptionFlags _events; + CFReadStreamClientCallBack _callBack; + CFStreamClientContext _context; id _delegate; NSError *_error; NSStreamStatus _status; NSSocket *_socket; NSSelectInputSource *_inputSource; - } -initWithSocket:(NSSocket *)socket streamStatus:(NSStreamStatus)status; -(NSSocket *)socket; +-(void)setClientEvents:(CFOptionFlags)events callBack:(CFReadStreamClientCallBack)callBack context:(CFStreamClientContext *)context; + @end diff --git a/Foundation/NSStream/NSInputStream_socket.m b/Foundation/NSStream/NSInputStream_socket.m index fe4bb59c..3174d4ac 100644 --- a/Foundation/NSStream/NSInputStream_socket.m +++ b/Foundation/NSStream/NSInputStream_socket.m @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2007 Christopher J. W. Lloyd +/* Copyright (c) 2006-2007 Christopher J. W. Lloyd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -6,16 +6,21 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -// Original - Christopher Lloyd #import #import #import #import +#import #import +#import +#import +#import @implementation NSInputStream_socket -initWithSocket:(NSSocket *)socket streamStatus:(NSStreamStatus)status { + _events=0; + _callBack=NULL; _delegate=self; _error=nil; _status=status; @@ -27,7 +32,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -(void)dealloc { [_error release]; [_socket release]; - [_inputSource setDelegate:nil]; [_inputSource release]; [super dealloc]; } @@ -44,12 +48,49 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI return _delegate; } +-(void)setClientEvents:(CFOptionFlags)events callBack:(CFReadStreamClientCallBack)callBack context:(CFStreamClientContext *)context { + _events=events; + _callBack=callBack; + + if(context!=NULL && context->info!=NULL && context->retain!=NULL) + context->retain(context->info); + + _context.version=0; + if(_context.info!=NULL && _context.release!=NULL) + _context.release(_context.info); + _context.info=NULL; + _context.retain=NULL; + _context.release=NULL; + + if(context!=NULL) + _context=*context; +} + -(void)setDelegate:delegate { _delegate=delegate; if(_delegate==nil) _delegate=self; } +-propertyForKey:(NSString *)key { + if([key isEqualToString:(NSString *)kCFStreamPropertySocketNativeHandle]){ + CFSocketNativeHandle value=(_socket==nil)?-1:[_socket fileDescriptor]; + + return [NSData dataWithBytes:&value length:sizeof(value)]; + } + + NSUnimplementedMethod(); + return nil; +} + +-(BOOL)setProperty:property forKey:(NSString *)key { + if([key isEqualToString:(NSString *)kCFStreamPropertySSLSettings]) + return [_socket setSSLProperties:(CFDictionaryRef)property]; + + NSUnimplementedMethod(); + return NO; +} + -(void)open { if(_status==NSStreamStatusNotOpen){ _status=NSStreamStatusOpening; @@ -80,6 +121,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI } -(void)close { + [_inputSource setSelectEventMask:0]; + [_inputSource invalidate]; [_socket close]; } @@ -90,10 +133,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI } -(BOOL)hasBytesAvailable { - if(_status==NSStreamStatusOpen) - return [_socket hasBytesAvailable]; - - return NO; + BOOL result=NO; + + if(_status==NSStreamStatusOpen){ + CFSSLHandler *sslHandler=[_socket sslHandler]; + + if(sslHandler==nil) + result=[_socket hasBytesAvailable]; + else { + if([_socket hasBytesAvailable]) + [sslHandler transferOneBufferFromSocketToSSL:_socket]; + + result=([sslHandler readBytesAvailable]>0)?YES:NO; + } + } + + return result; } -(NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)maxLength { @@ -104,9 +159,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI if(_status!=NSStreamStatusOpen && _status!=NSStreamStatusOpening) return -1; + + CFSSLHandler *sslHandler=[_socket sslHandler]; - result=[_socket read:buffer maxLength:maxLength]; - + if(sslHandler==nil) + result=[_socket read:buffer maxLength:maxLength]; + else { + [sslHandler runWithSocket:_socket]; + + result=[sslHandler readPlaintext:buffer maxLength:maxLength]; + + [sslHandler runWithSocket:_socket]; + } + if(result==0) _status=NSStreamStatusAtEnd; if(result==-1) @@ -125,8 +190,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI event=NSStreamEventOpenCompleted; break; - case NSStreamStatusOpen: - event=NSStreamEventHasBytesAvailable; + case NSStreamStatusOpen:; + if([self hasBytesAvailable]) + event=NSStreamEventHasBytesAvailable; + else + event=NSStreamEventNone; break; case NSStreamStatusAtEnd: @@ -137,9 +205,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI event=NSStreamEventNone; break; } - - if(event!=NSStreamEventNone && [_delegate respondsToSelector:@selector(stream:handleEvent:)]) - [_delegate stream:self handleEvent:event]; + + if(event!=NSStreamEventNone){ + if(_callBack!=NULL){ + if(_events&event){ + _callBack((CFReadStreamRef)self,event,_context.info); + } + } + else { + if([_delegate respondsToSelector:@selector(stream:handleEvent:)]){ + [_delegate stream:self handleEvent:event]; + } + } + } } @end diff --git a/Foundation/NSStream/NSOutputStream_socket.h b/Foundation/NSStream/NSOutputStream_socket.h index 45272965..7340ea9c 100644 --- a/Foundation/NSStream/NSOutputStream_socket.h +++ b/Foundation/NSStream/NSOutputStream_socket.h @@ -7,10 +7,14 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import +#import @class NSSocket, NSSelectInputSource; @interface NSOutputStream_socket : NSOutputStream { + CFOptionFlags _events; + CFWriteStreamClientCallBack _callBack; + CFStreamClientContext _context; id _delegate; NSError *_error; NSStreamStatus _status; @@ -20,4 +24,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -initWithSocket:(NSSocket *)socket streamStatus:(NSStreamStatus)status; +-(void)setClientEvents:(CFOptionFlags)events callBack:(CFWriteStreamClientCallBack)callBack context:(CFStreamClientContext *)context; + @end diff --git a/Foundation/NSStream/NSOutputStream_socket.m b/Foundation/NSStream/NSOutputStream_socket.m index f410b53d..3fe589ee 100644 --- a/Foundation/NSStream/NSOutputStream_socket.m +++ b/Foundation/NSStream/NSOutputStream_socket.m @@ -1,18 +1,21 @@ -/* Copyright (c) 2006-2007 Christopher J. W. Lloyd +/* Copyright (c) 2006-2007 Christopher J. W. Lloyd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -// Original - Christopher Lloyd #import #import #import #import #import #import +#import +#import +#import +#import +#import @implementation NSOutputStream_socket @@ -28,7 +31,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -(void)dealloc { [_error release]; [_socket release]; - [_inputSource setDelegate:nil]; [_inputSource release]; [super dealloc]; } @@ -41,12 +43,49 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI return _delegate; } +-(void)setClientEvents:(CFOptionFlags)events callBack:(CFWriteStreamClientCallBack)callBack context:(CFStreamClientContext *)context { + _events=events; + _callBack=callBack; + + if(context!=NULL && context->info!=NULL && context->retain!=NULL) + context->retain(context->info); + + _context.version=0; + if(_context.info!=NULL && _context.release!=NULL) + _context.release(_context.info); + _context.info=NULL; + _context.retain=NULL; + _context.release=NULL; + + if(context!=NULL) + _context=*context; +} + -(void)setDelegate:delegate { _delegate=delegate; if(_delegate==nil) _delegate=self; } +-propertyForKey:(NSString *)key { + if([key isEqualToString:(NSString *)kCFStreamPropertySocketNativeHandle]){ + CFSocketNativeHandle value=(_socket==nil)?-1:[_socket fileDescriptor]; + + return [NSData dataWithBytes:&value length:sizeof(value)]; + } + + NSUnimplementedMethod(); + return nil; +} + +-(BOOL)setProperty:property forKey:(NSString *)key { + if([key isEqualToString:(NSString *)kCFStreamPropertySSLSettings]) + return [_socket setSSLProperties:(CFDictionaryRef)property]; + + NSUnimplementedMethod(); + return NO; +} + -(void)open { if(_status==NSStreamStatusNotOpen){ _status=NSStreamStatusOpening; @@ -77,26 +116,66 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI } -(void)close { + [_inputSource setSelectEventMask:0]; + [_inputSource invalidate]; [_socket close]; } +static BOOL socketHasSpaceAvailable(NSSocket *socket){ + NSSelectSet *selectSet=[[[NSSelectSet alloc] init] autorelease]; + NSSelectSet *outputSet; + + [selectSet addObjectForWrite:socket]; + if([selectSet waitForSelectWithOutputSet:&outputSet beforeDate:[NSDate date]]==nil) + return [outputSet containsObjectForWrite:socket]; + + return NO; +} + -(BOOL)hasSpaceAvailable { if(_status==NSStreamStatusOpen){ - NSSelectSet *selectSet=[[[NSSelectSet alloc] init] autorelease]; - NSSelectSet *outputSet; + + CFSSLHandler *sslHandler=[_socket sslHandler]; - [selectSet addObjectForWrite:_socket]; - if([selectSet waitForSelectWithOutputSet:&outputSet beforeDate:[NSDate date]]!=nil) - return [outputSet containsObjectForWrite:_socket]; + if(sslHandler==nil) + return socketHasSpaceAvailable(_socket); + else { + if([sslHandler writeBytesAvailable]==0) + return YES; + else if(socketHasSpaceAvailable(_socket)){ + [sslHandler transferOneBufferFromSSLToSocket:_socket]; + } + } } + return NO; } -(NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length { + if(_status!=NSStreamStatusOpen && _status!=NSStreamStatusOpening) return -1; - return [_socket write:buffer maxLength:length]; + CFSSLHandler *sslHandler=[_socket sslHandler]; + + if(sslHandler==nil){ + [_inputSource setSelectEventMask:[_inputSource selectEventMask]|NSSelectWriteEvent]; + return [_socket write:buffer maxLength:length]; + } + else { + + [sslHandler runHandshakeIfNeeded:_socket]; + + NSInteger check=[sslHandler writePlaintext:buffer maxLength:length]; + + if(check!=length) + NSCLog("failure writePlaintext:%d=%d",length,check); + + [sslHandler runWithSocket:_socket]; + [_inputSource setSelectEventMask:[_inputSource selectEventMask]|NSSelectWriteEvent]; + + return check; + } } -(void)selectInputSource:(NSSelectInputSource *)inputSource selectEvent:(NSUInteger)selectEvent { @@ -109,8 +188,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI event=NSStreamEventOpenCompleted; break; - case NSStreamStatusOpen: - event=NSStreamEventHasSpaceAvailable; + case NSStreamStatusOpen:; + if(![self hasSpaceAvailable]) + event=NSStreamEventNone; + else { + event=NSStreamEventHasSpaceAvailable; + /* Streams only signal when space is available once, then it reactivates on a write, so we turn it off before notifying */ + [_inputSource setSelectEventMask:[_inputSource selectEventMask]&~NSSelectWriteEvent]; + } break; case NSStreamStatusAtEnd: @@ -122,7 +207,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI break; } - if(event!=NSStreamEventNone && [_delegate respondsToSelector:@selector(stream:handleEvent:)]) - [_delegate stream:self handleEvent:event]; + if(event!=NSStreamEventNone){ + if(_callBack!=NULL){ + if(_events&event){ + _callBack((CFWriteStreamRef)self,event,_context.info); + } + } + else { + if([_delegate respondsToSelector:@selector(stream:handleEvent:)]){ + [_delegate stream:self handleEvent:event]; + } + } + } } @end diff --git a/Foundation/NSStream/NSSocket.h b/Foundation/NSStream/NSSocket.h index f6500102..fffa4b46 100644 --- a/Foundation/NSStream/NSSocket.h +++ b/Foundation/NSStream/NSSocket.h @@ -6,8 +6,9 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import +#import -@class NSError,NSHost,NSData; +@class NSError,NSHost,NSData,CFSSLHandler; @interface NSSocket : NSObject @@ -31,6 +32,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -(NSSocket *)acceptWithError:(NSError **)errorp; +-(CFSSLHandler *)sslHandler; +-(BOOL)setSSLProperties:(CFDictionaryRef)sslProperties; + @end NSData *NSSocketAddressDataForNetworkOrderAddressBytesAndPort(const void *address,NSUInteger length,uint16_t port,uint32_t interface); diff --git a/Foundation/NSStream/NSSocket.m b/Foundation/NSStream/NSSocket.m index 5f3de0ed..bf72d2ad 100644 --- a/Foundation/NSStream/NSSocket.m +++ b/Foundation/NSStream/NSSocket.m @@ -61,4 +61,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI return nil; } +-(CFSSLHandler *)sslHandler { + NSInvalidAbstractInvocation(); + return nil; +} + +-(BOOL)setSSLProperties:(CFDictionaryRef )sslProperties { + NSInvalidAbstractInvocation(); + return NO; +} + @end diff --git a/Foundation/NSStream/NSStream.h b/Foundation/NSStream/NSStream.h index 0293d463..1d0e13c8 100755 --- a/Foundation/NSStream/NSStream.h +++ b/Foundation/NSStream/NSStream.h @@ -7,6 +7,7 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import +#import @class NSError,NSHost,NSRunLoop, NSInputStream, NSOutputStream; @@ -21,13 +22,14 @@ typedef enum { NSStreamStatusError } NSStreamStatus; +// These values must match CFStream typedef enum { NSStreamEventNone, - NSStreamEventOpenCompleted=0x01, - NSStreamEventHasBytesAvailable=0x02, - NSStreamEventHasSpaceAvailable=0x04, - NSStreamEventErrorOccurred=0x08, - NSStreamEventEndEncountered=0x10, + NSStreamEventOpenCompleted=kCFStreamEventOpenCompleted, + NSStreamEventHasBytesAvailable=kCFStreamEventHasBytesAvailable, + NSStreamEventHasSpaceAvailable=kCFStreamEventCanAcceptBytes, + NSStreamEventErrorOccurred=kCFStreamEventErrorOccurred, + NSStreamEventEndEncountered=kCFStreamEventEndEncountered, } NSStreamEvent; FOUNDATION_EXPORT NSString * const NSStreamDataWrittenToMemoryStreamKey; diff --git a/Foundation/NSStream/NSStream.m b/Foundation/NSStream/NSStream.m index 0aa25034..c7868869 100755 --- a/Foundation/NSStream/NSStream.m +++ b/Foundation/NSStream/NSStream.m @@ -8,11 +8,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import #import +#import #import "NSInputStream_socket.h" #import "NSOutputStream_socket.h" -NSString * const NSStreamDataWrittenToMemoryStreamKey=@"NSStreamDataWrittenToMemoryStreamKey"; -NSString * const NSStreamFileCurrentOffsetKey=@"NSStreamFileCurrentOffsetKey"; +NSString * const NSStreamDataWrittenToMemoryStreamKey=@"kCFStreamPropertyDataWritten"; +NSString * const NSStreamFileCurrentOffsetKey=@"kCFStreamPropertyFileCurrentOffset"; @implementation NSStream @@ -23,7 +24,7 @@ NSString * const NSStreamFileCurrentOffsetKey=@"NSStreamFileCurrentOffsetKey"; NSStreamStatus status; NSInputStream_socket *input; NSOutputStream_socket *output; - + if((error=[socket connectToHost:host port:port immediate:&immediate])!=nil){ *inputStreamp=nil; *outputStreamp=nil; diff --git a/Foundation/NSUserDefaults/NSUserDefaults.m b/Foundation/NSUserDefaults/NSUserDefaults.m index ae20d2ba..53e0b40c 100755 --- a/Foundation/NSUserDefaults/NSUserDefaults.m +++ b/Foundation/NSUserDefaults/NSUserDefaults.m @@ -301,15 +301,12 @@ NSString * const NSUserDefaultsDidChangeNotification=@"NSUserDefaultsDidChangeNo -(BOOL)boolForKey:(NSString *)defaultName { - NSString *string=[self objectForKey:defaultName]; + id object=[self objectForKey:defaultName]; - if(![string isKindOfClass:objc_lookUpClass("NSString")]) - return NO; - - if([string caseInsensitiveCompare:@"YES"]==NSOrderedSame) - return YES; - - return [string intValue]; + if([object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[NSString class]]) + return [object boolValue]; + + return NO; } -(NSInteger)integerForKey:(NSString *)defaultName { diff --git a/Foundation/platform_linux/NSPlatform_linux.m b/Foundation/platform_linux/NSPlatform_linux.m index 76dda351..d284ed2a 100755 --- a/Foundation/platform_linux/NSPlatform_linux.m +++ b/Foundation/platform_linux/NSPlatform_linux.m @@ -90,12 +90,12 @@ void NSPlatformSleepThreadForTimeInterval(NSTimeInterval interval) { return [self hostName]; } -NSString *NSPlatformExecutableDirectory=@"Linux"; -NSString *NSPlatformResourceNameSuffix=@"linux"; +NSString * const NSPlatformExecutableDirectory=@"Linux"; +NSString * const NSPlatformResourceNameSuffix=@"linux"; -NSString *NSPlatformExecutableFileExtension=@""; -NSString *NSPlatformLoadableObjectFileExtension=@"so"; -NSString *NSPlatformLoadableObjectFilePrefix=@"lib"; +NSString * const NSPlatformExecutableFileExtension=@""; +NSString * const NSPlatformLoadableObjectFileExtension=@"so"; +NSString * const NSPlatformLoadableObjectFilePrefix=@"lib"; -(Class)taskClass { return [NSTask_linux class];