Ivar underscore prefixes added and some tidying done.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4902 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-09-16 07:21:34 +00:00
parent 6a01c2a85d
commit a2737c2cf5
69 changed files with 2340 additions and 2203 deletions

View file

@ -1,3 +1,76 @@
Thu Sep 16 8:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Changes to minimise naming conflicts by making sure that all ivars
of public classes are prefixed with a underscore.
* Headers/Foundation/NSArchiver.h: prefix ivars with underscore and tidy
* Headers/Foundation/NSArray.h: ditto
* Headers/Foundation/NSAttributedString.h: ditto
* Headers/Foundation/NSAutoreleasePool.h: ditto
* Headers/Foundation/NSBitmapCharSet.h: ditto
* Headers/Foundation/NSBundle.h: ditto
* Headers/Foundation/NSCharacterSet.h: ditto
* Headers/Foundation/NSCoder.h: ditto
* Headers/Foundation/NSData.h: ditto
* Headers/Foundation/NSDate.h: ditto
* Headers/Foundation/NSDateFormatter.h: ditto
* Headers/Foundation/NSDictionary.h: ditto
* Headers/Foundation/NSDistantObject.h: ditto
* Headers/Foundation/NSDistributedLock.h: ditto
* Headers/Foundation/NSDistributedNotificationCenter.h: ditto
* Headers/Foundation/NSException.h: ditto
* Headers/Foundation/NSFileHandle.h: ditto
* Headers/Foundation/NSFileManager.h: ditto
* Headers/Foundation/NSGAttributedString.h: ditto
* Headers/Foundation/NSHost.h: ditto
* Headers/Foundation/NSInvocation.h: ditto
* Headers/Foundation/NSLock.h: ditto
* Headers/Foundation/NSMethodSignature.h: ditto
* Headers/Foundation/NSNotification.h: ditto
* Headers/Foundation/NSNotificationQueue.h: ditto
* Headers/Foundation/NSPort.h: ditto
* Headers/Foundation/NSPortMessage.h: ditto
* Headers/Foundation/NSPortNameServer.h: ditto
* Headers/Foundation/NSProtocolChecker.h: ditto
* Headers/Foundation/NSScanner.h: ditto
* Headers/Foundation/NSSet.h: ditto
* Headers/Foundation/NSTask.h: ditto
* Headers/Foundation/NSURL.h: ditto
* Headers/Foundation/NSURLHandle.h: ditto
* Headers/Foundation/NSUndoManager.h: ditto
* Headers/Foundation/NSUserDefaults.h: ditto
* Source/NSArchiver.m: ditto
* Source/NSAutoreleasePool.m: ditto
* Source/NSBitmapCharSet.m: ditto
* Source/NSCalendarDate.m: ditto
* Source/NSDate.m: ditto
* Source/NSDateFormatter.m: ditto
* Source/NSDistantObject.m: ditto
* Source/NSDistributedLock.m: ditto
* Source/NSDistributedNotificationCenter.m: ditto
* Source/NSException.m: ditto
* Source/NSFileManager.m: ditto
* Source/NSGAttributedString.m: ditto
* Source/NSGSet.m: ditto
* Source/NSHost.m: ditto
* Source/NSInvocation.m: ditto
* Source/NSLock.m: ditto
* Source/NSMethodSignature.m: ditto
* Source/NSNotificationCenter.m: ditto
* Source/NSNotificationQueue.m: ditto
* Source/NSPort.m: ditto
* Source/NSPortMessage.m: ditto
* Source/NSPortNameServer.m: ditto
* Source/NSProtocolChecker.m: ditto
* Source/NSScanner.m: ditto
* Source/NSTask.m: ditto
* Source/NSURL.m: ditto
* Source/NSURLHandle.m: ditto
* Source/NSUndoManager.m: ditto
* Source/NSUserDefaults.m: ditto
* Source/Port.m: ditto
* Source/TcpPort.m: ditto
* Source/UdpPort.m: ditto
Tue Sep 14 20:44:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSArray.m: Huge amounts of optimisation.

View file

@ -30,31 +30,31 @@
@interface NSArchiver : NSCoder
{
NSMutableData *data; /* Data to write into. */
id dst; /* Serialization destination. */
IMP serImp; /* Method to serialize with. */
IMP tagImp; /* Serialize a type tag. */
IMP xRefImp; /* Serialize a crossref. */
IMP eObjImp; /* Method to encode an id. */
IMP eValImp; /* Method to encode others. */
NSMutableData *_data; /* Data to write into. */
id _dst; /* Serialization destination. */
IMP _serImp; /* Method to serialize with. */
IMP _tagImp; /* Serialize a type tag. */
IMP _xRefImp; /* Serialize a crossref. */
IMP _eObjImp; /* Method to encode an id. */
IMP _eValImp; /* Method to encode others. */
#ifndef _IN_NSARCHIVER_M
#define GSIMapTable void*
#endif
GSIMapTable clsMap; /* Class cross references. */
GSIMapTable cIdMap; /* Conditionally coded. */
GSIMapTable uIdMap; /* Unconditionally coded. */
GSIMapTable ptrMap; /* Constant pointers. */
GSIMapTable namMap; /* Mappings for class names. */
GSIMapTable repMap; /* Mappings for objects. */
GSIMapTable _clsMap; /* Class cross references. */
GSIMapTable _cIdMap; /* Conditionally coded. */
GSIMapTable _uIdMap; /* Unconditionally coded. */
GSIMapTable _ptrMap; /* Constant pointers. */
GSIMapTable _namMap; /* Mappings for class names. */
GSIMapTable _repMap; /* Mappings for objects. */
#ifndef _IN_NSARCHIVER_M
#undef GSIMapTable
#endif
unsigned xRefC; /* Counter for cross-reference. */
unsigned xRefO; /* Counter for cross-reference. */
unsigned xRefP; /* Counter for cross-reference. */
unsigned startPos; /* Where in data we started. */
BOOL isEncodingRootObject;
BOOL isInPreparatoryPass;
unsigned _xRefC; /* Counter for cross-reference. */
unsigned _xRefO; /* Counter for cross-reference. */
unsigned _xRefP; /* Counter for cross-reference. */
unsigned _startPos; /* Where in data we started. */
BOOL _encodingRoot;
BOOL _initialPass;
}
/* Initializing an archiver */

View file

@ -31,46 +31,46 @@
@class NSString;
@interface NSArray : NSObject <NSCoding, NSCopying, NSMutableCopying>
- initWithObjects: (id*) objects count: (unsigned) count;
- (id) initWithObjects: (id*) objects count: (unsigned) count;
- (unsigned) count;
- objectAtIndex: (unsigned)index;
- (id) objectAtIndex: (unsigned)index;
@end
@interface NSArray (NonCore)
+ array;
+ arrayWithArray: (NSArray*)array;
+ arrayWithContentsOfFile: (NSString*)file;
+ arrayWithObject: anObject;
+ arrayWithObjects: firstObj, ...;
+ arrayWithObjects: (id*)objects count: (unsigned)count;
- (NSArray*) arrayByAddingObject: anObject;
+ (id) array;
+ (id) arrayWithArray: (NSArray*)array;
+ (id) arrayWithContentsOfFile: (NSString*)file;
+ (id) arrayWithObject: (id)anObject;
+ (id) arrayWithObjects: (id)firstObj, ...;
+ (id) arrayWithObjects: (id*)objects count: (unsigned)count;
- (NSArray*) arrayByAddingObject: (id)anObject;
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray;
- initWithArray: (NSArray*)array;
- initWithContentsOfFile: (NSString*)file;
- initWithObjects: firstObj, ...;
- inttWithObjects: (id*)objects count: (unsigned)count;
- (id) initWithArray: (NSArray*)array;
- (id) initWithContentsOfFile: (NSString*)file;
- (id) initWithObjects: firstObj, ...;
- (id) initWithObjects: (id*)objects count: (unsigned)count;
- (BOOL) containsObject: anObject;
- (void) getObjects: (id*)objs;
- (void) getObjects: (id*)objs range: (NSRange)aRange;
- (unsigned) indexOfObject: anObject;
- (unsigned) indexOfObject: anObject inRange: (NSRange)aRange;
- (unsigned) indexOfObjectIdenticalTo: anObject;
- (unsigned) indexOfObjectIdenticalTo: anObject inRange: (NSRange)aRange;
- lastObject;
- (unsigned) indexOfObject: (id)anObject;
- (unsigned) indexOfObject: (id)anObject inRange: (NSRange)aRange;
- (unsigned) indexOfObjectIdenticalTo: (id)anObject;
- (unsigned) indexOfObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange;
- (id) lastObject;
- firstObjectCommonWithArray: (NSArray*) otherArray;
- (id) firstObjectCommonWithArray: (NSArray*)otherArray;
- (BOOL) isEqualToArray: (NSArray*)otherArray;
#ifndef STRICT_MACOS_X
- (void) makeObjectsPerform: (SEL) aSelector;
- (void) makeObjectsPerform: (SEL)aSelector withObject: argument;
- (void) makeObjectsPerform: (SEL)aSelector;
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument;
#endif
#ifndef STRICT_OPENSTEP
- (void) makeObjectsPerformSelector: (SEL) aSelector;
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: argument;
- (void) makeObjectsPerformSelector: (SEL)aSelector;
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)argument;
#endif
- (NSData*) sortedArrayHint;
@ -85,7 +85,7 @@
- (NSString*) componentsJoinedByString: (NSString*)separator;
- (NSArray*) pathsMatchingExtensions: (NSArray*)extensions;
- (NSEnumerator*) objectEnumerator;
- (NSEnumerator*) objectEnumerator;
- (NSEnumerator*) reverseObjectEnumerator;
- (NSString*) description;
@ -100,16 +100,16 @@
@interface NSMutableArray : NSArray
- (id) initWithCapacity: (unsigned)numItems;
- (void) addObject: anObject;
- (void) replaceObjectAtIndex: (unsigned)index withObject: anObject;
- (void) insertObject: anObject atIndex: (unsigned)index;
- (void) addObject: (id)anObject;
- (void) replaceObjectAtIndex: (unsigned)index withObject: (id)anObject;
- (void) insertObject: (id)anObject atIndex: (unsigned)index;
- (void) removeObjectAtIndex: (unsigned)index;
@end
@interface NSMutableArray (NonCore)
+ arrayWithCapacity: (unsigned)numItems;
+ initWithCapacity: (unsigned)numItems;
+ (id) arrayWithCapacity: (unsigned)numItems;
+ (id) initWithCapacity: (unsigned)numItems;
- (void) addObjectsFromArray: (NSArray*)otherArray;
- (void) replaceObjectsInRange: (NSRange)aRange
@ -121,10 +121,10 @@
- (void) removeAllObjects;
- (void) removeLastObject;
- (void) removeObject: anObject;
- (void) removeObject: anObject inRange: (NSRange)aRange;
- (void) removeObjectIdenticalTo: anObject;
- (void) removeObjectIdenticalTo: anObject inRange: (NSRange)aRange;
- (void) removeObject: (id)anObject;
- (void) removeObject: (id)anObject inRange: (NSRange)aRange;
- (void) removeObjectIdenticalTo: (id)anObject;
- (void) removeObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange;
- (void) removeObjectsInArray: (NSArray*)otherArray;
- (void) removeObjectsInRange: (NSRange)aRange;
- (void) removeObjectsFromIndices: (unsigned*)indices

View file

@ -3,7 +3,7 @@
String class with attributes
Copyright (C) 1997,1997 Free Software Foundation, Inc.
Copyright (C) 1997,1999 Free Software Foundation, Inc.
Written by: ANOQ of the sun <anoq@vip.cybercity.dk>
Date: November 1997
@ -55,29 +55,34 @@
@interface NSAttributedString : NSObject <NSCoding, NSCopying, NSMutableCopying>
{
}
//Creating an NSAttributedString
- (id)initWithString:(NSString *)aString;
- (id)initWithAttributedString:(NSAttributedString *)attributedString;
- (id)initWithString:(NSString *)aString attributes:(NSDictionary *)attributes;
- (id) initWithString: (NSString*)aString;
- (id) initWithAttributedString: (NSAttributedString*)attributedString;
- (id) initWithString: (NSString*)aString attributes: (NSDictionary*)attributes;
//Retrieving character information
- (unsigned int)length;
- (NSString *)string;//Primitive method!
- (unsigned) length;
- (NSString*) string; //Primitive method!
//Retrieving attribute information
- (NSDictionary *)attributesAtIndex:(unsigned int)index effectiveRange:(NSRange *)aRange;//Primitive method!
- (NSDictionary *)attributesAtIndex:(unsigned int)index longestEffectiveRange:(NSRange *)aRange inRange:(NSRange)rangeLimit;
- (id)attribute:(NSString *)attributeName atIndex:(unsigned int)index effectiveRange:(NSRange *)aRange;
- (id)attribute:(NSString *)attributeName atIndex:(unsigned int)index longestEffectiveRange:(NSRange *)aRange inRange:(NSRange)rangeLimit;
- (NSDictionary*) attributesAtIndex: (unsigned)index
effectiveRange: (NSRange*)aRange; //Primitive method!
- (NSDictionary*) attributesAtIndex: (unsigned)index
longestEffectiveRange: (NSRange*)aRange
inRange: (NSRange)rangeLimit;
- (id) attribute: (NSString*)attributeName
atIndex: (unsigned)index
effectiveRange: (NSRange*)aRange;
- (id) attribute: (NSString*)attributeName atIndex: (unsigned)index
longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit;
//Comparing attributed strings
- (BOOL)isEqualToAttributedString:(NSAttributedString *)otherString;
- (BOOL) isEqualToAttributedString: (NSAttributedString*)otherString;
//Extracting a substring
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)aRange;
- (NSAttributedString*) attributedSubstringFromRange: (NSRange)aRange;
@end //NSAttributedString
@ -87,27 +92,31 @@
}
//Retrieving character information
- (NSMutableString *)mutableString;
- (NSMutableString*) mutableString;
//Changing characters
- (void)deleteCharactersInRange:(NSRange)aRange;
- (void) deleteCharactersInRange: (NSRange)aRange;
//Changing attributes
- (void)setAttributes:(NSDictionary *)attributes range:(NSRange)aRange;//Primitive method!
- (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)aRange;
- (void)addAttributes:(NSDictionary *)attributes range:(NSRange)aRange;
- (void)removeAttribute:(NSString *)name range:(NSRange)aRange;
- (void) setAttributes: (NSDictionary*)attributes
range: (NSRange)aRange; //Primitive method!
- (void) addAttribute: (NSString*)name value: (id)value range: (NSRange)aRange;
- (void) addAttributes: (NSDictionary*)attributes range: (NSRange)aRange;
- (void) removeAttribute: (NSString*)name range: (NSRange)aRange;
//Changing characters and attributes
- (void)appendAttributedString:(NSAttributedString *)attributedString;
- (void)insertAttributedString:(NSAttributedString *)attributedString atIndex:(unsigned int)index;
- (void)replaceCharactersInRange:(NSRange)aRange withAttributedString:(NSAttributedString *)attributedString;
- (void)replaceCharactersInRange:(NSRange)aRange withString:(NSString *)aString;//Primitive method!
- (void)setAttributedString:(NSAttributedString *)attributedString;
- (void) appendAttributedString: (NSAttributedString*)attributedString;
- (void) insertAttributedString: (NSAttributedString*)attributedString
atIndex: (unsigned)index;
- (void) replaceCharactersInRange: (NSRange)aRange
withAttributedString: (NSAttributedString*)attributedString;
- (void) replaceCharactersInRange: (NSRange)aRange
withString: (NSString*)aString; //Primitive method!
- (void) setAttributedString: (NSAttributedString*)attributedString;
//Grouping changes
- (void)beginEditing;
- (void)endEditing;
- (void) beginEditing;
- (void) endEditing;
@end //NSMutableAttributedString

View file

@ -82,16 +82,16 @@ struct autorelease_array_list
/* The total number of objects autoreleased in this pool. */
unsigned _released_count;
/* The method to add an object to this pool */
void (*addImp)(id, SEL, id);
void (*_addImp)(id, SEL, id);
}
+ (void)addObject: anObject;
- (void)addObject: anObject;
+ (void) addObject: (id)anObject;
- (void) addObject: (id)anObject;
#ifndef NO_GNUSTEP
+ (void) enableRelease: (BOOL)enable;
+ (void) setPoolCountThreshhold: (unsigned)c;
+ (unsigned) autoreleaseCountForObject: anObject;
+ (unsigned) autoreleaseCountForObject: (id)anObject;
+ (void) _endThread; /* Don't call this directly - NSThread uses it. */
/*
* The next two methods have no effect unless you define COUNT_ALL to be

View file

@ -38,19 +38,19 @@
@interface NSBitmapCharSet : NSCharacterSet
{
char data[BITMAP_SIZE];
char _data[BITMAP_SIZE];
}
- initWithBitmap:(NSData *)bitmap;
- (id) initWithBitmap: (NSData*)bitmap;
@end
@interface NSMutableBitmapCharSet : NSMutableCharacterSet
{
char data[BITMAP_SIZE];
char _data[BITMAP_SIZE];
}
- initWithBitmap:(NSData *)bitmap;
- (id) initWithBitmap: (NSData*)bitmap;
@end

View file

@ -19,7 +19,7 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
*/
#ifndef __NSBundle_h_GNUSTEP_BASE_INCLUDE
#define __NSBundle_h_GNUSTEP_BASE_INCLUDE
@ -47,40 +47,40 @@ extern NSString* NSLoadedClasses;
unsigned _version;
}
+ (NSArray *) allBundles;
+ (NSArray *) allFrameworks;
+ (NSBundle *) mainBundle;
+ (NSBundle *) bundleForClass: (Class)aClass;
+ (NSBundle *) bundleWithPath: (NSString *)path;
+ (NSString *) pathForResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath;
+ (NSString *) pathForResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath
withVersion: (int)version;
- initWithPath: (NSString *)path;
- (NSString *) bundlePath;
- (Class) classNamed: (NSString *)className;
+ (NSArray*) allBundles;
+ (NSArray*) allFrameworks;
+ (NSBundle*) mainBundle;
+ (NSBundle*) bundleForClass: (Class)aClass;
+ (NSBundle*) bundleWithPath: (NSString*)path;
+ (NSString*) pathForResource: (NSString*)name
ofType: (NSString*)ext
inDirectory: (NSString*)bundlePath;
+ (NSString*) pathForResource: (NSString*)name
ofType: (NSString*)ext
inDirectory: (NSString*)bundlePath
withVersion: (int)version;
- (id) initWithPath: (NSString*)path;
- (NSString*) bundlePath;
- (Class) classNamed: (NSString*)className;
- (Class) principalClass;
- (NSArray *) pathsForResourcesOfType: (NSString *)extension
inDirectory: (NSString *)bundlePath;
- (NSString *) pathForResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath;
- (NSString *) pathForResource: (NSString *)name
ofType: (NSString *)ext;
- (NSString *) localizedStringForKey: (NSString *)key
value: (NSString *)value
table: (NSString *)tableName;
- (NSString *) resourcePath;
- (NSArray*) pathsForResourcesOfType: (NSString*)extension
inDirectory: (NSString*)bundlePath;
- (NSString*) pathForResource: (NSString*)name
ofType: (NSString*)ext
inDirectory: (NSString*)bundlePath;
- (NSString*) pathForResource: (NSString*)name
ofType: (NSString*)ext;
- (NSString*) localizedStringForKey: (NSString*)key
value: (NSString*)value
table: (NSString*)tableName;
- (NSString*) resourcePath;
- (unsigned) bundleVersion;
- (void) setBundleVersion: (unsigned)version;
#ifndef STRICT_OPENSTEP
- (NSDictionary *) infoDictionary;
- (NSDictionary*) infoDictionary;
- (BOOL) load;
#endif
@ -94,9 +94,9 @@ extern NSString* NSLoadedClasses;
+ (NSString*) _gnustep_target_os;
+ (NSString*) _library_combo;
+ (NSBundle*) gnustepBundle;
+ (NSString *) pathForGNUstepResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath;
+ (NSString*) pathForGNUstepResource: (NSString*)name
ofType: (NSString*)ext
inDirectory: (NSString*)bundlePath;
@end
#define GSLocalizedString(key, comment) \

View file

@ -19,7 +19,7 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
*/
#ifndef __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE
#define __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE
@ -31,28 +31,28 @@
@interface NSCharacterSet : NSObject <NSCoding, NSCopying, NSMutableCopying>
// Creating standard character sets
+ (NSCharacterSet *)alphanumericCharacterSet;
+ (NSCharacterSet *)controlCharacterSet;
+ (NSCharacterSet *)decimalDigitCharacterSet;
+ (NSCharacterSet *)decomposableCharacterSet;
+ (NSCharacterSet *)illegalCharacterSet;
+ (NSCharacterSet *)letterCharacterSet;
+ (NSCharacterSet *)lowercaseLetterCharacterSet;
+ (NSCharacterSet *)nonBaseCharacterSet;
+ (NSCharacterSet *)punctuationCharacterSet;
+ (NSCharacterSet *)symbolAndOperatorCharacterSet;
+ (NSCharacterSet *)uppercaseLetterCharacterSet;
+ (NSCharacterSet *)whitespaceAndNewlineCharacterSet;
+ (NSCharacterSet *)whitespaceCharacterSet;
+ (NSCharacterSet*) alphanumericCharacterSet;
+ (NSCharacterSet*) controlCharacterSet;
+ (NSCharacterSet*) decimalDigitCharacterSet;
+ (NSCharacterSet*) decomposableCharacterSet;
+ (NSCharacterSet*) illegalCharacterSet;
+ (NSCharacterSet*) letterCharacterSet;
+ (NSCharacterSet*) lowercaseLetterCharacterSet;
+ (NSCharacterSet*) nonBaseCharacterSet;
+ (NSCharacterSet*) punctuationCharacterSet;
+ (NSCharacterSet*) symbolAndOperatorCharacterSet;
+ (NSCharacterSet*) uppercaseLetterCharacterSet;
+ (NSCharacterSet*) whitespaceAndNewlineCharacterSet;
+ (NSCharacterSet*) whitespaceCharacterSet;
// Creating custom character sets
+ (NSCharacterSet *)characterSetWithBitmapRepresentation:(NSData *)data;
+ (NSCharacterSet *)characterSetWithCharactersInString:(NSString *)aString;
+ (NSCharacterSet *)characterSetWithRange:(NSRange)aRange;
+ (NSCharacterSet*) characterSetWithBitmapRepresentation: (NSData*)data;
+ (NSCharacterSet*) characterSetWithCharactersInString: (NSString*)aString;
+ (NSCharacterSet*) characterSetWithRange: (NSRange)aRange;
- (NSData *)bitmapRepresentation;
- (BOOL)characterIsMember:(unichar)aCharacter;
- (NSCharacterSet *)invertedSet;
- (NSData*) bitmapRepresentation;
- (BOOL) characterIsMember: (unichar)aCharacter;
- (NSCharacterSet*) invertedSet;
#ifndef STRICT_MACOS_X
+ (NSCharacterSet*) characterSetWithContentsOfFile: (NSString*)file;
@ -61,14 +61,14 @@
@interface NSMutableCharacterSet : NSCharacterSet
- (void)addCharactersInRange:(NSRange)aRange;
- (void)addCharactersInString:(NSString *)aString;
- (void)formUnionWithCharacterSet:(NSCharacterSet *)otherSet;
- (void)formIntersectionWithCharacterSet:(NSCharacterSet *)otherSet;
- (void)removeCharactersInRange:(NSRange)aRange;
- (void)removeCharactersInString:(NSString *)aString;
- (void)invert;
- (void) addCharactersInRange: (NSRange)aRange;
- (void) addCharactersInString: (NSString*)aString;
- (void) formUnionWithCharacterSet: (NSCharacterSet*)otherSet;
- (void) formIntersectionWithCharacterSet: (NSCharacterSet*)otherSet;
- (void) removeCharactersInRange: (NSRange)aRange;
- (void) removeCharactersInString: (NSString*)aString;
- (void) invert;
@end
#endif /* __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE */
#endif /* __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE*/

View file

@ -41,8 +41,8 @@
// Encoding Data
- (void) encodeArrayOfObjCType: (const char*)type
count: (unsigned)count
at: (const void*)array;
count: (unsigned)count
at: (const void*)array;
- (void) encodeBycopyObject: (id)anObject;
- (void) encodeByrefObject: (id)anObject;
- (void) encodeBytes: (void*)addr length: (unsigned)l;
@ -55,7 +55,7 @@
- (void) encodeRootObject: (id)rootObject;
- (void) encodeSize: (NSSize)size;
- (void) encodeValueOfObjCType: (const char*)type
at: (const void*)address;
at: (const void*)address;
- (void) encodeValuesOfObjCTypes: (const char*)types,...;
// Decoding Data
@ -71,7 +71,7 @@
- (NSRect) decodeRect;
- (NSSize) decodeSize;
- (void) decodeValueOfObjCType: (const char*)type
at: (void*)address;
at: (void*)address;
- (void) decodeValuesOfObjCTypes: (const char*)types,...;
// Managing Zones

View file

@ -32,61 +32,61 @@
// Allocating and Initializing a Data Object
+ (id)data;
+ (id)dataWithBytes: (const void*)bytes
length: (unsigned int)length;
+ (id)dataWithBytesNoCopy: (void*)bytes
length: (unsigned int)length;
+ (id)dataWithContentsOfFile: (NSString*)path;
+ (id)dataWithContentsOfMappedFile: (NSString*)path;
+ (id)dataWithData: (NSData*)data;
- (id)initWithBytes: (const void*)bytes
length: (unsigned int)length;
- (id)initWithBytesNoCopy: (void*)bytes
length: (unsigned int)length;
- (id)initWithContentsOfFile: (NSString*)path;
- (id)initWithContentsOfMappedFile: (NSString*)path;
- (id)initWithData: (NSData*)data;
+ (id) data;
+ (id) dataWithBytes: (const void*)bytes
length: (unsigned int)length;
+ (id) dataWithBytesNoCopy: (void*)bytes
length: (unsigned int)length;
+ (id) dataWithContentsOfFile: (NSString*)path;
+ (id) dataWithContentsOfMappedFile: (NSString*)path;
+ (id) dataWithData: (NSData*)data;
- (id) initWithBytes: (const void*)bytes
length: (unsigned int)length;
- (id) initWithBytesNoCopy: (void*)bytes
length: (unsigned int)length;
- (id) initWithContentsOfFile: (NSString*)path;
- (id) initWithContentsOfMappedFile: (NSString*)path;
- (id) initWithData: (NSData*)data;
// Accessing Data
- (const void*)bytes;
- (NSString*)description;
- (void)getBytes: (void*)buffer;
- (void)getBytes: (void*)buffer
length: (unsigned int)length;
- (void)getBytes: (void*)buffer
range: (NSRange)aRange;
- (NSData*)subdataWithRange: (NSRange)aRange;
- (const void*) bytes;
- (NSString*) description;
- (void) getBytes: (void*)buffer;
- (void) getBytes: (void*)buffer
length: (unsigned int)length;
- (void) getBytes: (void*)buffer
range: (NSRange)aRange;
- (NSData*) subdataWithRange: (NSRange)aRange;
// Querying a Data Object
- (BOOL)isEqualToData: (NSData*)other;
- (unsigned int)length;
- (BOOL) isEqualToData: (NSData*)other;
- (unsigned int) length;
// Storing Data
- (BOOL)writeToFile: (NSString*)path
atomically: (BOOL)useAuxiliaryFile;
- (BOOL) writeToFile: (NSString*)path
atomically: (BOOL)useAuxiliaryFile;
// Deserializing Data
- (unsigned int)deserializeAlignedBytesLengthAtCursor: (unsigned int*)cursor;
- (void)deserializeBytes: (void*)buffer
length: (unsigned int)bytes
atCursor: (unsigned int*)cursor;
- (void)deserializeDataAt: (void*)data
ofObjCType: (const char*)type
atCursor: (unsigned int*)cursor
context: (id <NSObjCTypeSerializationCallBack>)callback;
- (int)deserializeIntAtCursor: (unsigned int*)cursor;
- (int)deserializeIntAtIndex: (unsigned int)location;
- (void)deserializeInts: (int*)intBuffer
count: (unsigned int)numInts
atCursor: (unsigned int*)cursor;
- (void)deserializeInts: (int*)intBuffer
count: (unsigned int)numInts
atIndex: (unsigned int)index;
- (unsigned int) deserializeAlignedBytesLengthAtCursor: (unsigned int*)cursor;
- (void) deserializeBytes: (void*)buffer
length: (unsigned int)bytes
atCursor: (unsigned int*)cursor;
- (void) deserializeDataAt: (void*)data
ofObjCType: (const char*)type
atCursor: (unsigned int*)cursor
context: (id <NSObjCTypeSerializationCallBack>)callback;
- (int) deserializeIntAtCursor: (unsigned int*)cursor;
- (int) deserializeIntAtIndex: (unsigned int)location;
- (void) deserializeInts: (int*)intBuffer
count: (unsigned int)numInts
atCursor: (unsigned int*)cursor;
- (void) deserializeInts: (int*)intBuffer
count: (unsigned int)numInts
atIndex: (unsigned int)index;
@end

View file

@ -1,5 +1,5 @@
/* Interface for NSDate for GNUStep
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
Copyright (C) 1994, 1996, 1999 Free Software Foundation, Inc.
This file is part of the GNUstep Base Library.
@ -16,12 +16,12 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
*/
#ifndef __NSDate_h_GNUSTEP_BASE_INCLUDE
#define __NSDate_h_GNUSTEP_BASE_INCLUDE
/* Time interval difference between two dates, in seconds. */
/* Time interval difference between two dates, in seconds.*/
typedef double NSTimeInterval;
#include <Foundation/NSObject.h>
@ -59,16 +59,16 @@ typedef double NSTimeInterval;
// Converting to NSCalendar
- (NSCalendarDate *) dateWithCalendarFormat: (NSString*)formatString
timeZone: (NSTimeZone*)timeZone;
- (NSCalendarDate*) dateWithCalendarFormat: (NSString*)formatString
timeZone: (NSTimeZone*)timeZone;
// Representing dates
- (NSString*) description;
- (NSString*) descriptionWithCalendarFormat: (NSString*)format
timeZone: (NSTimeZone*)aTimeZone
locale: (NSDictionary *)localeDictionary;
- (NSString *) descriptionWithLocale: (NSDictionary *)locale;
locale: (NSDictionary*)localeDictionary;
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
// Adding and getting intervals
@ -87,9 +87,9 @@ typedef double NSTimeInterval;
- (NSDate*) laterDate: (NSDate*)otherDate;
#ifndef STRICT_OPENSTEP
+ (id) dateWithNaturalLanguageString: (NSString *)string;
+ (id) dateWithNaturalLanguageString: (NSString *)string
locale: (NSDictionary *)localeDictionary;
+ (id) dateWithNaturalLanguageString: (NSString*)string;
+ (id) dateWithNaturalLanguageString: (NSString*)string
locale: (NSDictionary*)localeDictionary;
- (id) initWithTimeIntervalSince1970: (NSTimeInterval)seconds;
#endif
@ -97,16 +97,16 @@ typedef double NSTimeInterval;
#ifndef NO_GNUSTEP
/*
* Our concrete base class - NSCalendar date must share the ivar layout.
*/
* Our concrete base class - NSCalendar date must share the ivar layout.
*/
@interface NSGDate : NSDate
{
@public
NSTimeInterval seconds_since_ref;
NSTimeInterval _seconds_since_ref;
}
@end
NSTimeInterval GSTimeNow(); /* Get time since reference date */
NSTimeInterval GSTimeNow(); /* Get time since reference date*/
#endif
@ -114,28 +114,28 @@ NSTimeInterval GSTimeNow(); /* Get time since reference date */
@interface NSTimeZone : NSObject
//Creating and Initializing an NSTimeZone
+ (NSTimeZoneDetail *)defaultTimeZone;
+ (NSTimeZone *)localTimeZone;
+ (NSTimeZone *)timeZoneForSecondsFromGMT:(int)seconds;
+ (NSTimeZoneDetail *)timeZoneWithAbbreviation:(NSString *)abbreviation;
+ (NSTimeZone *)timeZoneWithName:(NSString *)aTimeZoneName;
- (NSTimeZoneDetail *)timeZoneDetailForDate:(NSDate *)date;
+ (NSTimeZoneDetail*) defaultTimeZone;
+ (NSTimeZone*) localTimeZone;
+ (NSTimeZone*) timeZoneForSecondsFromGMT: (int)seconds;
+ (NSTimeZoneDetail*) timeZoneWithAbbreviation: (NSString*)abbreviation;
+ (NSTimeZone*) timeZoneWithName: (NSString*)aTimeZoneName;
- (NSTimeZoneDetail*) timeZoneDetailForDate: (NSDate*)date;
//Managing Time Zones
+ (void)setDefaultTimeZone:(NSTimeZone *)aTimeZone;
+ (void) setDefaultTimeZone: (NSTimeZone*)aTimeZone;
// Getting Time Zone Information
+ (NSDictionary *)abbreviationDictionary;
- (NSString *)timeZoneName;
+ (NSDictionary*) abbreviationDictionary;
- (NSString*) timeZoneName;
//Getting Arrays of Time Zones
+ (NSArray *)timeZoneArray;
- (NSArray *)timeZoneDetailArray;
+ (NSArray*) timeZoneArray;
- (NSArray*) timeZoneDetailArray;
#ifndef NO_GNUSTEP
/* Returns an dictionary that maps abbreviations to the array
containing all the time zone names that use the abbreviation. */
+ (NSDictionary *)abbreviationMap;
containing all the time zone names that use the abbreviation. */
+ (NSDictionary*) abbreviationMap;
#endif
@end
@ -144,9 +144,9 @@ NSTimeInterval GSTimeNow(); /* Get time since reference date */
@interface NSTimeZoneDetail : NSTimeZone
//Querying an NSTimeZoneDetail
- (BOOL)isDaylightSavingTimeZone;
- (NSString *)timeZoneAbbreviation;
- (int)timeZoneSecondsFromGMT;
- (BOOL) isDaylightSavingTimeZone;
- (NSString*) timeZoneAbbreviation;
- (int) timeZoneSecondsFromGMT;
@end
@ -154,97 +154,97 @@ NSTimeInterval GSTimeNow(); /* Get time since reference date */
@interface NSCalendarDate : NSDate
{
NSTimeInterval seconds_since_ref;
NSString *calendar_format;
NSTimeZoneDetail *time_zone;
NSTimeInterval _seconds_since_ref;
NSString *_calendar_format;
NSTimeZoneDetail *_time_zone;
}
// Getting an NSCalendar Date
+ (id)calendarDate;
+ (id)dateWithString:(NSString *)description
calendarFormat:(NSString *)format;
+ (id)dateWithString:(NSString *)description
calendarFormat:(NSString *)format
locale:(NSDictionary *)dictionary;
+ (id)dateWithYear:(int)year
month:(unsigned int)month
day:(unsigned int)day
hour:(unsigned int)hour
minute:(unsigned int)minute
second:(unsigned int)second
timeZone:(NSTimeZone *)aTimeZone;
+ (id) calendarDate;
+ (id) dateWithString: (NSString*)description
calendarFormat: (NSString*)format;
+ (id) dateWithString: (NSString*)description
calendarFormat: (NSString*)format
locale: (NSDictionary*)dictionary;
+ (id) dateWithYear: (int)year
month: (unsigned int)month
day: (unsigned int)day
hour: (unsigned int)hour
minute: (unsigned int)minute
second: (unsigned int)second
timeZone: (NSTimeZone*)aTimeZone;
// Initializing an NSCalendar Date
- (id)initWithString:(NSString *)description;
- (id)initWithString:(NSString *)description
calendarFormat:(NSString *)format;
- (id)initWithString:(NSString *)description
calendarFormat:(NSString *)format
locale:(NSDictionary *)dictionary;
- (id)initWithYear:(int)year
month:(unsigned int)month
day:(unsigned int)day
hour:(unsigned int)hour
minute:(unsigned int)minute
second:(unsigned int)second
timeZone:(NSTimeZone *)aTimeZone;
- (id) initWithString: (NSString*)description;
- (id) initWithString: (NSString*)description
calendarFormat: (NSString*)format;
- (id) initWithString: (NSString*)description
calendarFormat: (NSString*)format
locale: (NSDictionary*)dictionary;
- (id) initWithYear: (int)year
month: (unsigned int)month
day: (unsigned int)day
hour: (unsigned int)hour
minute: (unsigned int)minute
second: (unsigned int)second
timeZone: (NSTimeZone*)aTimeZone;
// Retreiving Date Elements
- (int)dayOfCommonEra;
- (int)dayOfMonth;
- (int)dayOfWeek;
- (int)dayOfYear;
- (int)hourOfDay;
- (int)minuteOfHour;
- (int)monthOfYear;
- (int)secondOfMinute;
- (int)yearOfCommonEra;
- (int) dayOfCommonEra;
- (int) dayOfMonth;
- (int) dayOfWeek;
- (int) dayOfYear;
- (int) hourOfDay;
- (int) minuteOfHour;
- (int) monthOfYear;
- (int) secondOfMinute;
- (int) yearOfCommonEra;
// Providing Adjusted Dates
- (NSCalendarDate *)addYear:(int)year
month:(unsigned int)month
day:(unsigned int)day
hour:(unsigned int)hour
minute:(unsigned int)minute
second:(unsigned int)second;
- (NSCalendarDate*) addYear: (int)year
month: (unsigned int)month
day: (unsigned int)day
hour: (unsigned int)hour
minute: (unsigned int)minute
second: (unsigned int)second;
// Getting String Descriptions of Dates
- (NSString *)description;
- (NSString *)descriptionWithCalendarFormat:(NSString *)format;
- (NSString *)descriptionWithCalendarFormat:(NSString *)format
locale:(NSDictionary *)locale;
- (NSString *)descriptionWithLocale:(NSDictionary *)locale;
- (NSString*) description;
- (NSString*) descriptionWithCalendarFormat: (NSString*)format;
- (NSString*) descriptionWithCalendarFormat: (NSString*)format
locale: (NSDictionary*)locale;
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
// Getting and Setting Calendar Formats
- (NSString *)calendarFormat;
- (void)setCalendarFormat:(NSString *)format;
- (NSString*) calendarFormat;
- (void) setCalendarFormat: (NSString*)format;
// Getting and Setting Time Zones
- (void)setTimeZone:(NSTimeZone *)aTimeZone;
- (NSTimeZoneDetail *)timeZoneDetail;
- (void) setTimeZone: (NSTimeZone*)aTimeZone;
- (NSTimeZoneDetail*) timeZoneDetail;
@end
@interface NSCalendarDate (GregorianDate)
- (int)lastDayOfGregorianMonth:(int)month year:(int)year;
- (int)absoluteGregorianDay:(int)day month:(int)month year:(int)year;
- (void)gregorianDateFromAbsolute:(int)d
day:(int *)day
month:(int *)month
year:(int *)year;
- (int) lastDayOfGregorianMonth: (int)month year: (int)year;
- (int) absoluteGregorianDay: (int)day month: (int)month year: (int)year;
- (void) gregorianDateFromAbsolute: (int)d
day: (int*)day
month: (int*)month
year: (int*)year;
@end
@interface NSCalendarDate (OPENSTEP)
- (NSCalendarDate *)dateByAddingYears:(int)years
months:(int)months
days:(int)days
hours:(int)hours
minutes:(int)minutes
seconds:(int)seconds;
- (NSCalendarDate*) dateByAddingYears: (int)years
months: (int)months
days: (int)days
hours: (int)hours
minutes: (int)minutes
seconds: (int)seconds;
- (void) years: (int*)years
months: (int*)months
@ -255,4 +255,4 @@ NSTimeInterval GSTimeNow(); /* Get time since reference date */
sinceDate: (NSDate*)date;
@end
#endif /* __NSDate_h_GNUSTEP_BASE_INCLUDE */
#endif /* __NSDate_h_GNUSTEP_BASE_INCLUDE*/

View file

@ -31,8 +31,8 @@
@interface NSDateFormatter : NSFormatter <NSCoding, NSCopying>
{
NSString *dateFormat;
BOOL allowsNaturalLanguage;
NSString *_dateFormat;
BOOL _allowsNaturalLanguage;
}
/* Initializing an NSDateFormatter */

View file

@ -1,5 +1,5 @@
/* Interface for NSDictionary for GNUStep
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Date: 1995
@ -19,7 +19,7 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
*/
#ifndef _NSDictionary_h_GNUSTEP_BASE_INCLUDE
#define _NSDictionary_h_GNUSTEP_BASE_INCLUDE
@ -29,40 +29,41 @@
@class NSArray, NSString, NSEnumerator;
@interface NSDictionary : NSObject <NSCoding, NSCopying, NSMutableCopying>
- initWithObjects: (id*)objects
forKeys: (id*)keys
count: (unsigned)count;
- (id) initWithObjects: (id*)objects
forKeys: (id*)keys
count: (unsigned)count;
- (unsigned) count;
- objectForKey: (id)aKey;
- (id) objectForKey: (id)aKey;
- (NSEnumerator*) keyEnumerator;
- (NSEnumerator*) objectEnumerator;
@end
@interface NSDictionary (NonCore)
+ allocWithZone: (NSZone*)zone;
+ dictionary;
+ dictionaryWithContentsOfFile:(NSString *)path;
+ dictionaryWithDictionary: (NSDictionary*)aDict;
+ dictionaryWithObject: (id)object forKey: (id)key;
+ dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
+ dictionaryWithObjects: (id*)objects forKeys: (id*)keys
count: (unsigned)count;
+ dictionaryWithObjectsAndKeys: (id)object, ...;
- initWithContentsOfFile: (NSString*)path;
- initWithDictionary: (NSDictionary*)otherDictionary;
- initWithDictionary: (NSDictionary*)otherDictionary
copyItems: (BOOL)shouldCopy;
- initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
- initWithObjectsAndKeys: (id)object, ...;
+ (id) allocWithZone: (NSZone*)zone;
+ (id) dictionary;
+ (id) dictionaryWithContentsOfFile: (NSString*)path;
+ (id) dictionaryWithDictionary: (NSDictionary*)aDict;
+ (id) dictionaryWithObject: (id)object forKey: (id)key;
+ (id) dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
+ (id) dictionaryWithObjects: (id*)objects
forKeys: (id*)keys
count: (unsigned)count;
+ (id) dictionaryWithObjectsAndKeys: (id)object, ...;
- (id) initWithContentsOfFile: (NSString*)path;
- (id) initWithDictionary: (NSDictionary*)otherDictionary;
- (id) initWithDictionary: (NSDictionary*)otherDictionary
copyItems: (BOOL)shouldCopy;
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
- (id) initWithObjectsAndKeys: (id)object, ...;
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
- (NSArray*) allKeys;
- (NSArray*) allKeysForObject: anObject;
- (NSArray*) allKeysForObject: (id)anObject;
- (NSArray*) allValues;
- (NSArray*) keysSortedByValueUsingSelector: (SEL)comp;
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)abObject;
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)anObject;
- (NSString*) description;
- (NSString*) descriptionInStringsFileFormat;
@ -72,20 +73,20 @@
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile;
/* Accessing file attributes is a catagory declared in NSFileManager.h */
/* Accessing file attributes is a catagory declared in NSFileManager.h*/
@end
@interface NSMutableDictionary: NSDictionary
- initWithCapacity: (unsigned)numItems;
- (void) setObject:anObject forKey:(id)aKey;
- (void) removeObjectForKey:(id)aKey;
- (id) initWithCapacity: (unsigned)numItems;
- (void) setObject: (id)anObject forKey: (id)aKey;
- (void) removeObjectForKey: (id)aKey;
@end
@interface NSMutableDictionary (NonCore)
+ allocWithZone: (NSZone*)zone;
+ dictionaryWithCapacity: (unsigned)numItems;
+ (id) allocWithZone: (NSZone*)zone;
+ (id) dictionaryWithCapacity: (unsigned)numItems;
- (void) removeAllObjects;
- (void) removeObjectsForKeys: (NSArray*)keyArray;
@ -99,17 +100,17 @@
#include <base/KeyedCollecting.h>
#include <Foundation/NSDictionary.h>
/* Eventually we'll make a Constant version of this protocol. */
/* Eventually we'll make a Constant version of this protocol.*/
@interface NSDictionary (GNU) <KeyedCollecting>
@end
@interface NSMutableDictionary (GNU)
+ (unsigned) defaultCapacity;
- initWithType: (const char *)contentEncoding
keyType: (const char *)keyEncoding
capacity: (unsigned)aCapacity;
- (id) initWithType: (const char*)contentEncoding
keyType: (const char*)keyEncoding
capacity: (unsigned)aCapacity;
@end
#endif /* NO_GNUSTEP */
#endif /* NO_GNUSTEP*/
#endif

View file

@ -32,10 +32,10 @@
@interface NSDistantObject : NSProxy <NSCoding>
{
@private
NSConnection *_connection;
id _object;
unsigned _handle;
Protocol *_protocol;
NSConnection *_connection;
id _object;
unsigned _handle;
Protocol *_protocol;
}
+ (NSDistantObject*) proxyWithLocal: (id)anObject
@ -49,8 +49,10 @@
connection: (NSConnection*)aConnection;
- (NSConnection*) connectionForProxy;
- (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
- (id) initWithTarget: (unsigned)anObject connection: (NSConnection*)aConnection;
- (id) initWithLocal: (id)anObject
connection: (NSConnection*)aConnection;
- (id) initWithTarget: (unsigned)anObject
connection: (NSConnection*)aConnection;
- (void) setProtocolForProxy: (Protocol*)aProtocol;
@end

View file

@ -30,17 +30,17 @@
@interface NSDistributedLock : NSObject
{
NSString *lockPath;
NSDate *lockTime;
NSString *_lockPath;
NSDate *_lockTime;
}
+ (NSDistributedLock*)lockWithPath: (NSString*)aPath;
- (NSDistributedLock*)initWithPath: (NSString*)aPath;
+ (NSDistributedLock*) lockWithPath: (NSString*)aPath;
- (NSDistributedLock*) initWithPath: (NSString*)aPath;
- (void)breakLock;
- (NSDate*)lockDate;
- (BOOL)tryLock;
- (void)unlock;
- (void) breakLock;
- (NSDate*) lockDate;
- (BOOL) tryLock;
- (void) unlock;
@end

View file

@ -43,9 +43,9 @@ extern NSString *NSLocalNotificationCenterType;
@interface NSDistributedNotificationCenter : NSObject
{
NSRecursiveLock *centerLock; /* For thread safety. */
id remote; /* Proxy for center. */
BOOL suspended; /* Is delivery suspended? */
NSRecursiveLock *_centerLock; /* For thread safety. */
id _remote; /* Proxy for center. */
BOOL _suspended; /* Is delivery suspended? */
}
+ (id) defaultCenter;
+ (id) notificationCenterForType: (NSString*)type;

View file

@ -32,9 +32,9 @@
@interface NSException : NSObject <NSCoding, NSCopying>
{
NSString *e_name;
NSString *e_reason;
NSDictionary *e_info;
NSString *_e_name;
NSString *_e_reason;
NSDictionary *_e_info;
}
+ (NSException *)exceptionWithName:(NSString *)name

View file

@ -32,53 +32,53 @@
// Allocating and Initializing a FileHandle Object
+ (id)fileHandleForReadingAtPath:(NSString*)path;
+ (id)fileHandleForWritingAtPath:(NSString*)path;
+ (id)fileHandleForUpdatingAtPath:(NSString*)path;
+ (id)fileHandleWithStandardError;
+ (id)fileHandleWithStandardInput;
+ (id)fileHandleWithStandardOutput;
+ (id)fileHandleWithNullDevice;
+ (id) fileHandleForReadingAtPath: (NSString*)path;
+ (id) fileHandleForWritingAtPath: (NSString*)path;
+ (id) fileHandleForUpdatingAtPath: (NSString*)path;
+ (id) fileHandleWithStandardError;
+ (id) fileHandleWithStandardInput;
+ (id) fileHandleWithStandardOutput;
+ (id) fileHandleWithNullDevice;
- (id)initWithFileDescriptor:(int)desc;
- (id)initWithFileDescriptor:(int)desc closeOnDealloc:(BOOL)flag;
- (id)initWithNativeHandle:(void*)hdl;
- (id)initWithNativeHandle:(void*)hdl closeOnDealloc:(BOOL)flag;
- (id) initWithFileDescriptor: (int)desc;
- (id) initWithFileDescriptor: (int)desc closeOnDealloc: (BOOL)flag;
- (id) initWithNativeHandle: (void*)hdl;
- (id) initWithNativeHandle: (void*)hdl closeOnDealloc: (BOOL)flag;
// Returning file handles
- (int)fileDescriptor;
- (void*)nativeHandle;
- (int) fileDescriptor;
- (void*) nativeHandle;
// Synchronous I/O operations
- (NSData*)availableData;
- (NSData*)readDataToEndOfFile;
- (NSData*)readDataOfLength:(unsigned int)len;
- (void)writeData:(NSData*)item;
- (NSData*) availableData;
- (NSData*) readDataToEndOfFile;
- (NSData*) readDataOfLength: (unsigned int)len;
- (void) writeData: (NSData*)item;
// Asynchronous I/O operations
- (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray*)modes;
- (void)acceptConnectionInBackgroundAndNotify;
- (void)readInBackgroundAndNotifyForModes:(NSArray*)modes;
- (void)readInBackgroundAndNotify;
- (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray*)modes;
- (void)readToEndOfFileInBackgroundAndNotify;
- (void)waitForDataInBackgroundAndNotifyForModes:(NSArray*)modes;
- (void)waitForDataInBackgroundAndNotify;
- (void) acceptConnectionInBackgroundAndNotifyForModes: (NSArray*)modes;
- (void) acceptConnectionInBackgroundAndNotify;
- (void) readInBackgroundAndNotifyForModes: (NSArray*)modes;
- (void) readInBackgroundAndNotify;
- (void) readToEndOfFileInBackgroundAndNotifyForModes: (NSArray*)modes;
- (void) readToEndOfFileInBackgroundAndNotify;
- (void) waitForDataInBackgroundAndNotifyForModes: (NSArray*)modes;
- (void) waitForDataInBackgroundAndNotify;
// Seeking within a file
- (unsigned long long)offsetInFile;
- (unsigned long long)seekToEndOfFile;
- (void)seekToFileOffset:(unsigned long long)pos;
- (unsigned long long) offsetInFile;
- (unsigned long long) seekToEndOfFile;
- (void) seekToFileOffset: (unsigned long long)pos;
// Operations on file
- (void)closeFile;
- (void)synchronizeFile;
- (void)truncateFileAtOffset:(unsigned long long)pos;
- (void) closeFile;
- (void) synchronizeFile;
- (void) truncateFileAtOffset: (unsigned long long)pos;
@end
@ -104,35 +104,35 @@ extern NSString* NSFileHandleOperationException;
NSFileHandle* readHandle;
NSFileHandle* writeHandle;
}
+ (id)pipe;
- (NSFileHandle*)fileHandleForReading;
- (NSFileHandle*)fileHandleForWriting;
+ (id) pipe;
- (NSFileHandle*) fileHandleForReading;
- (NSFileHandle*) fileHandleForWriting;
@end
// GNUstep class extensions
@interface NSFileHandle (GNUstepExtensions)
+ (id)fileHandleAsServerAtAddress:(NSString*)address
service:(NSString*)service
protocol:(NSString*)protocol;
+ (id)fileHandleAsClientAtAddress:(NSString*)address
service:(NSString*)service
protocol:(NSString*)protocol;
+ (id)fileHandleAsClientInBackgroundAtAddress:(NSString*)address
service:(NSString*)service
protocol:(NSString*)protocol;
+ (id)fileHandleAsClientInBackgroundAtAddress:(NSString*)address
service:(NSString*)service
protocol:(NSString*)protocol
forModes:(NSArray*)modes;
- (BOOL)readInProgress;
- (NSString*)socketAddress;
- (NSString*)socketService;
- (NSString*)socketProtocol;
- (void)writeInBackgroundAndNotify:(NSData*)item forModes:(NSArray*)modes;
- (void)writeInBackgroundAndNotify:(NSData*)item;
- (BOOL)writeInProgress;
+ (id) fileHandleAsServerAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol;
+ (id) fileHandleAsClientAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol;
+ (id) fileHandleAsClientInBackgroundAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol;
+ (id) fileHandleAsClientInBackgroundAtAddress: (NSString*)address
service: (NSString*)service
protocol: (NSString*)protocol
forModes: (NSArray*)modes;
- (BOOL) readInProgress;
- (NSString*) socketAddress;
- (NSString*) socketService;
- (NSString*) socketProtocol;
- (void) writeInBackgroundAndNotify: (NSData*)item forModes: (NSArray*)modes;
- (void) writeInBackgroundAndNotify: (NSData*)item;
- (BOOL) writeInProgress;
@end
// GNUstep Notification names.

View file

@ -44,7 +44,7 @@
@interface NSFileManager : NSObject
{
NSString *lastError;
NSString *_lastError;
}
// Getting the default manager
@ -120,17 +120,17 @@
@interface NSDirectoryEnumerator : NSEnumerator
{
NSMutableArray *enumStack;
NSMutableArray *pathStack;
NSString *currentFileName;
NSString *currentFilePath;
NSString *topPath;
NSDictionary *directoryAttributes;
NSDictionary *fileAttributes;
NSMutableArray *_enumStack;
NSMutableArray *_pathStack;
NSString *_currentFileName;
NSString *_currentFilePath;
NSString *_topPath;
NSDictionary *_directoryAttributes;
NSDictionary *_fileAttributes;
struct {
BOOL isRecursive: 1;
BOOL isFollowing: 1;
} flags;
} _flags;
}
// Initializing

View file

@ -52,8 +52,8 @@
@interface NSGAttributedString : NSAttributedString
{
NSString *textChars;
NSMutableArray *infoArray;
NSString *_textChars;
NSMutableArray *_infoArray;
}
- (id) initWithString: (NSString*)aString
@ -66,8 +66,8 @@
@interface NSGMutableAttributedString : NSMutableAttributedString
{
NSMutableString *textChars;
NSMutableArray *infoArray;
NSMutableString *_textChars;
NSMutableArray *_infoArray;
}
- (id) initWithString: (NSString*)aString

View file

@ -30,9 +30,8 @@
@interface NSHost : NSObject
{
@private
NSMutableArray *names;
NSMutableArray *addresses;
void *reserved;
NSMutableArray *_names;
NSMutableArray *_addresses;
}
/*

View file

@ -30,15 +30,15 @@
@interface NSInvocation : NSObject
{
NSMethodSignature *sig;
arglist_t argframe;
void *retval;
id target;
SEL selector;
int numArgs;
NSArgumentInfo *info;
BOOL argsRetained;
BOOL validReturn;
NSMethodSignature *_sig;
arglist_t _argframe;
void *_retval;
id _target;
SEL _selector;
int _numArgs;
NSArgumentInfo *_info;
BOOL _argsRetained;
BOOL _validReturn;
}
/*
@ -85,7 +85,7 @@
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
- (id) initWithSelector: (SEL)aSelector;
- (id) initWithTarget: target selector: (SEL)aSelector, ...;
- (void*)returnFrame: (arglist_t)argFrame;
- (void*) returnFrame: (arglist_t)argFrame;
@end
#endif

View file

@ -34,90 +34,96 @@
#include <Foundation/NSObject.h>
#include <objc/thr.h>
//
// NSLocking protocol
//
/*
* NSLocking protocol
*/
@protocol NSLocking
- (void)lock;
- (void)unlock;
- (void) lock;
- (void) unlock;
@end
//
// NSLock class
// Simplest lock for protecting critical sections of code
//
/*
* NSLock class
* Simplest lock for protecting critical sections of code
*/
@interface NSLock : NSObject <NSLocking>
{
@private
objc_mutex_t mutex;
objc_mutex_t _mutex;
}
- (BOOL)tryLock;
- (BOOL)lockBeforeDate:(NSDate *)limit;
- (BOOL) tryLock;
- (BOOL) lockBeforeDate: (NSDate*)limit;
// NSLocking protocol
- (void)lock;
- (void)unlock;
- (void) lock;
- (void) unlock;
@end
//
// NSConditionLock
// Allows locking and unlocking to be based upon a condition
//
/*
* NSConditionLock
* Allows locking and unlocking to be based upon a condition
*/
@interface NSConditionLock : NSObject <NSLocking>
{
@private
objc_condition_t condition;
objc_mutex_t mutex;
int condition_value;
objc_condition_t _condition;
objc_mutex_t _mutex;
int _condition_value;
}
// Initialize lock with condition
- (id)initWithCondition:(int)value;
/*
* Initialize lock with condition
*/
- (id) initWithCondition: (int)value;
// Return the current condition of the lock
- (int)condition;
/*
* Return the current condition of the lock
*/
- (int) condition;
// Acquiring and release the lock
- (void)lockWhenCondition:(int)value;
- (void)unlockWithCondition:(int)value;
- (BOOL)tryLock;
- (BOOL)tryLockWhenCondition:(int)value;
// Acquiring the lock with a date condition
- (BOOL)lockBeforeDate:(NSDate *)limit;
- (BOOL)lockWhenCondition:(int)condition
beforeDate:(NSDate *)limit;
/*
* Acquiring and release the lock
*/
- (void) lockWhenCondition: (int)value;
- (void) unlockWithCondition: (int)value;
- (BOOL) tryLock;
- (BOOL) tryLockWhenCondition: (int)value;
// NSLocking protocol
- (void)lock;
- (void)unlock;
/*
* Acquiring the lock with a date condition
*/
- (BOOL) lockBeforeDate: (NSDate*)limit;
- (BOOL) lockWhenCondition: (int)condition
beforeDate: (NSDate*)limit;
- (void) lock;
- (void) unlock;
@end
//
// NSRecursiveLock
// Allows the lock to be recursively acquired by the same thread
//
// If the same thread locks the mutex (n) times then that same
// thread must also unlock it (n) times before another thread
// can acquire the lock.
//
/*
* NSRecursiveLock
* Allows the lock to be recursively acquired by the same thread
*
* If the same thread locks the mutex (n) times then that same
* thread must also unlock it (n) times before another thread
* can acquire the lock.
*/
@interface NSRecursiveLock : NSObject <NSLocking>
{
@private
objc_mutex_t mutex;
objc_mutex_t _mutex;
}
- (BOOL)tryLock;
- (BOOL)lockBeforeDate:(NSDate *)limit;
- (BOOL) tryLock;
- (BOOL) lockBeforeDate: (NSDate*)limit;
// NSLocking protocol
- (void)lock;
- (void)unlock;
- (void) lock;
- (void) unlock;
@end
#endif /* _GNUstep_H_NSLock */
#endif /* _GNUstep_H_NSLock*/

View file

@ -50,13 +50,13 @@ typedef struct {
@interface NSMethodSignature : NSObject
{
const char *methodTypes;
unsigned argFrameLength;
unsigned numArgs;
const char *_methodTypes;
unsigned _argFrameLength;
unsigned _numArgs;
#ifdef STRICT_MACOS_X
void *dummy;
void *_dummy;
#else
NSArgumentInfo *info;
NSArgumentInfo *_info;
#endif
}

View file

@ -58,7 +58,7 @@
@interface NSNotificationCenter : NSObject <GCFinalization>
{
void *table;
void *_table;
}
+ (NSNotificationCenter*) defaultCenter;

View file

@ -74,10 +74,10 @@ struct _NSNotificationQueueList;
@interface NSNotificationQueue : NSObject
{
NSNotificationCenter *center;
struct _NSNotificationQueueList *asapQueue;
struct _NSNotificationQueueList *idleQueue;
NSZone *zone;
NSNotificationCenter *_center;
struct _NSNotificationQueueList *_asapQueue;
struct _NSNotificationQueueList *_idleQueue;
NSZone *_zone;
}
/* Creating Notification Queues */
@ -87,16 +87,16 @@ struct _NSNotificationQueueList;
/* Inserting and Removing Notifications From a Queue */
- (void) dequeueNotificationsMatching:(NSNotification*)notification
coalesceMask:(unsigned int)coalesceMask;
- (void) dequeueNotificationsMatching: (NSNotification*)notification
coalesceMask: (unsigned int)coalesceMask;
- (void) enqueueNotification:(NSNotification*)notification
postingStyle:(NSPostingStyle)postingStyle;
- (void) enqueueNotification: (NSNotification*)notification
postingStyle: (NSPostingStyle)postingStyle;
- (void) enqueueNotification:(NSNotification*)notification
postingStyle:(NSPostingStyle)postingStyle
coalesceMask:(unsigned int)coalesceMask
forModes:(NSArray*)modes;
- (void) enqueueNotification: (NSNotification*)notification
postingStyle: (NSPostingStyle)postingStyle
coalesceMask: (unsigned int)coalesceMask
forModes: (NSArray*)modes;
@end

View file

@ -36,8 +36,8 @@ extern NSString *NSPortTimeoutException; /* OPENSTEP */
@interface NSPort : NSObject <NSCoding, NSCopying>
{
BOOL is_valid;
id delegate;
BOOL _is_valid;
id _delegate;
}
+ (NSPort*) port;

View file

@ -29,8 +29,8 @@
@interface NSPortMessage : NSObject
{
unsigned msgid;
NSMutableArray *components;
unsigned _msgid;
NSMutableArray *_components;
}
- (id) initWithMachMessage: (void*)buffer;
- (id) initWithSendPort: (NSPort*)aPort

View file

@ -30,11 +30,11 @@
@interface NSPortNameServer : NSObject
{
NSFileHandle *handle; /* File handle to talk to gdomap. */
NSMutableData *data; /* Where to accumulated incoming data. */
unsigned expecting; /* Length of data we want. */
NSMapTable *portMap; /* Registered ports information. */
NSMapTable *nameMap; /* Registered names information. */
NSFileHandle *_handle; /* File handle to talk to gdomap. */
NSMutableData *_data; /* Where to accumulated incoming data. */
unsigned _expecting; /* Length of data we want. */
NSMapTable *_portMap; /* Registered ports information. */
NSMapTable *_nameMap; /* Registered names information. */
}
+ (id) defaultPortNameServer;
- (NSPort*) portForName: (NSString*)name;

View file

@ -30,8 +30,8 @@
@interface NSProtocolChecker : NSObject
{
Protocol *myProtocol;
NSObject *myTarget;
Protocol *_myProtocol;
NSObject *_myTarget;
}
// Creating a checker

View file

@ -35,14 +35,14 @@
@interface NSScanner : NSObject <NSCopying>
{
@private
NSString *string;
NSCharacterSet *charactersToBeSkipped;
BOOL (*skipImp)(NSCharacterSet*, SEL, unichar);
NSDictionary *locale;
unsigned int scanLocation;
unichar decimal;
BOOL caseSensitive;
BOOL isUnicode;
NSString *_string;
NSCharacterSet *_charactersToBeSkipped;
BOOL (*_skipImp)(NSCharacterSet*, SEL, unichar);
NSDictionary *_locale;
unsigned int _scanLocation;
unichar _decimal;
BOOL _caseSensitive;
BOOL _isUnicode;
}
/*

View file

@ -30,11 +30,11 @@
@interface NSSet : NSObject <NSCoding, NSCopying, NSMutableCopying>
+ set;
+ setWithArray: (NSArray*)array;
+ setWithObject: anObject;
+ setWithObjects: anObject, ...;
+ setWithSet: (NSSet*)aSet;
+ (id) set;
+ (id) setWithArray: (NSArray*)array;
+ (id) setWithObject: (id)anObject;
+ (id) setWithObjects: (id)anObject, ...;
+ (id) setWithSet: (NSSet*)aSet;
- (id) initWithObjects: (id*)objects
count: (unsigned)count;
@ -46,16 +46,16 @@
@interface NSSet (NonCore)
- initWithArray: (NSArray*)array;
- initWithObjects: (id)objects, ...;
- initWithSet: (NSSet*)otherSet;
- initWithSet: (NSSet*)otherSet copyItems: (BOOL)flags;
- (id) initWithArray: (NSArray*)array;
- (id) initWithObjects: (id)objects, ...;
- (id) initWithSet: (NSSet*)otherSet;
- (id) initWithSet: (NSSet*)otherSet copyItems: (BOOL)flags;
- (NSArray*) allObjects;
- anyObject;
- (BOOL) containsObject: anObject;
- (id) anyObject;
- (BOOL) containsObject: (id)anObject;
- (void) makeObjectsPerform: (SEL)aSelector;
- (void) makeObjectsPerform: (SEL)aSelector withObject:argument;
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument;
- (BOOL) intersectsSet: (NSSet*)other;
@ -68,9 +68,9 @@
@interface NSMutableSet: NSSet
+ setWithCapacity: (unsigned)numItems;
+ (id) setWithCapacity: (unsigned)numItems;
- initWithCapacity: (unsigned)numItems;
- (id) initWithCapacity: (unsigned)numItems;
- (void) addObject: (id)anObject;
- (void) removeObject: (id)anObject;

View file

@ -33,19 +33,19 @@
@interface NSTask : NSObject <GCFinalization>
{
NSString *currentDirectoryPath;
NSString *launchPath;
NSArray *arguments;
NSDictionary *environment;
id standardError;
id standardInput;
id standardOutput;
int taskId;
int terminationStatus;
BOOL hasLaunched;
BOOL hasTerminated;
BOOL hasCollected;
BOOL hasNotified;
NSString *_currentDirectoryPath;
NSString *_launchPath;
NSArray *_arguments;
NSDictionary *_environment;
id _standardError;
id _standardInput;
id _standardOutput;
int _taskId;
int _terminationStatus;
BOOL _hasLaunched;
BOOL _hasTerminated;
BOOL _hasCollected;
BOOL _hasNotified;
}
+ (NSTask*) launchedTaskWithLaunchPath: (NSString*)path

View file

@ -34,9 +34,9 @@ extern NSString* NSURLFileScheme; //file
//============================================================================
@interface NSURL: NSObject <NSCoding, NSCopying, NSURLHandleClient>
{
NSString *urlString;
NSURL *baseURL;
void *clients;
NSString *_urlString;
NSURL *_baseURL;
void *_clients;
}
+ (id) fileURLWithPath: (NSString*)path;
@ -44,18 +44,18 @@ extern NSString* NSURLFileScheme; //file
+ (id) URLWithString: (NSString*)URLString
relativeToURL: (NSURL*)baseURL;
- (id) initWithScheme: (NSString*)_scheme
host: (NSString*)_host
path: (NSString*)_path;
- (id) initWithScheme: (NSString*)scheme
host: (NSString*)host
path: (NSString*)path;
//Non Standard Function
- (id) initWithScheme: (NSString*)_scheme
host: (NSString*)_host
port: (NSNumber*)_port
path: (NSString*)_path;
- (id) initWithScheme: (NSString*)scheme
host: (NSString*)host
port: (NSNumber*)port
path: (NSString*)path;
//Do a initWithScheme: NSFileScheme host: nil path: _path
- (id) initFileURLWithPath: (NSString*)_path;
//Do a initWithScheme: NSFileScheme host: nil path: path
- (id) initFileURLWithPath: (NSString*)path;
// urlString is escaped
- (id) initWithString: (NSString*)URLString;
@ -91,7 +91,7 @@ extern NSString* NSURLFileScheme; //file
//FIXME: delete these fn when NSURL will be validated
+ (void) test;
+ (void) testPrint: (NSURL*)_url;
+ (void) testPrint: (NSURL*)url;
@end

View file

@ -57,22 +57,22 @@ typedef enum
//=============================================================================
@interface NSURLHandle: NSObject
{
NSMutableArray *clients;
id data;
NSURLHandleStatus status;
NSMutableArray *_clients;
id _data;
NSURLHandleStatus _status;
}
+ (void) registerURLHandleClass: (Class)_urlHandleSubclass;
+ (Class) URLHandleClassForURL: (NSURL*)_url;
+ (void) registerURLHandleClass: (Class)urlHandleSubclass;
+ (Class) URLHandleClassForURL: (NSURL*)url;
- (id) initWithURL: (NSURL*)_url
cached: (BOOL)_cached;
- (id) initWithURL: (NSURL*)url
cached: (BOOL)cached;
- (NSURLHandleStatus) status;
- (NSString*) failureReason;
- (void) addClient: (id <NSURLHandleClient>)_client;
- (void) removeClient: (id <NSURLHandleClient>)_client;
- (void) addClient: (id <NSURLHandleClient>)client;
- (void) removeClient: (id <NSURLHandleClient>)client;
- (void) loadInBackground;
- (void) cancelLoadInBackground;
@ -84,11 +84,11 @@ typedef enum
- (void) backgroundLoadDidFailWithReason: (NSString*)reason;
- (void) didLoadBytes: (NSData*)newData
loadComplete: (BOOL)_loadComplete;
loadComplete: (BOOL)loadComplete;
+ (BOOL) canInitWithURL: (NSURL*)_url;
+ (NSURLHandle*) cachedHandleForURL: (NSURL*)_url;
+ (BOOL) canInitWithURL: (NSURL*)url;
+ (NSURLHandle*) cachedHandleForURL: (NSURL*)url;
- (id) propertyForKey: (NSString*)propertyKey;
- (id) propertyForKeyIfAvailable: (NSString*)propertyKey;

View file

@ -42,18 +42,18 @@ extern NSString *NSUndoManagerWillUndoChangeNotification;
@interface NSUndoManager: NSObject
{
@private
NSMutableArray *redoStack;
NSMutableArray *undoStack;
NSString *actionName;
id group;
id nextTarget;
NSArray *modes;
BOOL isRedoing;
BOOL isUndoing;
BOOL groupsByEvent;
BOOL registeredUndo;
unsigned disableCount;
unsigned levelsOfUndo;
NSMutableArray *_redoStack;
NSMutableArray *_undoStack;
NSString *_actionName;
id _group;
id _nextTarget;
NSArray *_modes;
BOOL _isRedoing;
BOOL _isUndoing;
BOOL _groupsByEvent;
BOOL _registeredUndo;
unsigned _disableCount;
unsigned _levelsOfUndo;
}
- (void) beginUndoGrouping;

View file

@ -110,17 +110,17 @@ extern NSString* const NSDateTimeOrdering;
@interface NSUserDefaults: NSObject
{
@private
NSMutableArray *searchList; // Current search list;
NSMutableDictionary *persDomains; // Contains persistent defaults info;
NSMutableDictionary *tempDomains; // Contains volatile defaults info;
NSMutableArray *changedDomains; /* ..after first time that persistent
NSMutableArray *_searchList; // Current search list;
NSMutableDictionary *_persDomains; // Contains persistent defaults info;
NSMutableDictionary *_tempDomains; // Contains volatile defaults info;
NSMutableArray *_changedDomains; /* ..after first time that persistent
user defaults are changed */
NSDictionary *dictionaryRep; // Cached dictionary representation
NSMutableString *defaultsDatabase;
NSMutableString *defaultsDatabaseLockName;
NSDistributedLock *defaultsDatabaseLock;
NSDate *lastSync;
NSTimer *tickingTimer; // for synchronization
NSDictionary *_dictionaryRep; // Cached dictionary representation
NSMutableString *_defaultsDatabase;
NSMutableString *_defaultsDatabaseLockName;
NSDistributedLock *_defaultsDatabaseLock;
NSDate *_lastSync;
NSTimer *_tickingTimer; // for synchronization
}
/* Getting the Shared Instance */

View file

@ -77,69 +77,69 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
NSZone *zone = [self zone];
data = RETAIN(anObject);
_data = RETAIN(anObject);
if ([self directDataAccess] == YES)
{
dst = data;
_dst = _data;
}
else
{
dst = self;
_dst = self;
}
serImp = [dst methodForSelector: serSel];
tagImp = [dst methodForSelector: tagSel];
xRefImp = [dst methodForSelector: xRefSel];
eObjImp = [self methodForSelector: eObjSel];
eValImp = [self methodForSelector: eValSel];
_serImp = [_dst methodForSelector: serSel];
_tagImp = [_dst methodForSelector: tagSel];
_xRefImp = [_dst methodForSelector: xRefSel];
_eObjImp = [self methodForSelector: eObjSel];
_eValImp = [self methodForSelector: eValSel];
[self resetArchiver];
/*
* Set up map tables.
*/
clsMap = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t)*6);
cIdMap = &clsMap[1];
uIdMap = &clsMap[2];
ptrMap = &clsMap[3];
namMap = &clsMap[4];
repMap = &clsMap[5];
GSIMapInitWithZoneAndCapacity(clsMap, zone, 100);
GSIMapInitWithZoneAndCapacity(cIdMap, zone, 10);
GSIMapInitWithZoneAndCapacity(uIdMap, zone, 200);
GSIMapInitWithZoneAndCapacity(ptrMap, zone, 100);
GSIMapInitWithZoneAndCapacity(namMap, zone, 1);
GSIMapInitWithZoneAndCapacity(repMap, zone, 1);
_clsMap = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t)*6);
_cIdMap = &_clsMap[1];
_uIdMap = &_clsMap[2];
_ptrMap = &_clsMap[3];
_namMap = &_clsMap[4];
_repMap = &_clsMap[5];
GSIMapInitWithZoneAndCapacity(_clsMap, zone, 100);
GSIMapInitWithZoneAndCapacity(_cIdMap, zone, 10);
GSIMapInitWithZoneAndCapacity(_uIdMap, zone, 200);
GSIMapInitWithZoneAndCapacity(_ptrMap, zone, 100);
GSIMapInitWithZoneAndCapacity(_namMap, zone, 1);
GSIMapInitWithZoneAndCapacity(_repMap, zone, 1);
}
return self;
}
- (void) dealloc
{
RELEASE(data);
if (clsMap)
RELEASE(_data);
if (_clsMap)
{
GSIMapEmptyMap(clsMap);
if (cIdMap)
GSIMapEmptyMap(_clsMap);
if (_cIdMap)
{
GSIMapEmptyMap(cIdMap);
GSIMapEmptyMap(_cIdMap);
}
if (uIdMap)
if (_uIdMap)
{
GSIMapEmptyMap(uIdMap);
GSIMapEmptyMap(_uIdMap);
}
if (ptrMap)
if (_ptrMap)
{
GSIMapEmptyMap(ptrMap);
GSIMapEmptyMap(_ptrMap);
}
if (namMap)
if (_namMap)
{
GSIMapEmptyMap(namMap);
GSIMapEmptyMap(_namMap);
}
if (repMap)
if (_repMap)
{
GSIMapEmptyMap(repMap);
GSIMapEmptyMap(_repMap);
}
NSZoneFree(clsMap->zone, (void*)clsMap);
NSZoneFree(_clsMap->zone, (void*)_clsMap);
}
return [super dealloc];
}
@ -163,7 +163,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
NS_DURING
{
[archiver encodeRootObject: rootObject];
d = AUTORELEASE([archiver->data copy]);
d = AUTORELEASE([archiver->_data copy]);
}
NS_HANDLER
{
@ -220,26 +220,26 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
*/
if (info == _GSC_NONE)
{
if (isInPreparatoryPass == NO)
if (_initialPass == NO)
{
(*tagImp)(dst, tagSel, _GSC_ARY_B);
(*serImp)(dst, serSel, &count, @encode(unsigned), nil);
(*_tagImp)(_dst, tagSel, _GSC_ARY_B);
(*_serImp)(_dst, serSel, &count, @encode(unsigned), nil);
}
for (i = 0; i < count; i++)
{
(*eValImp)(self, eValSel, type, (char*)buf + offset);
(*_eValImp)(self, eValSel, type, (char*)buf + offset);
offset += size;
}
}
else if (isInPreparatoryPass == NO)
else if (_initialPass == NO)
{
(*tagImp)(dst, tagSel, _GSC_ARY_B);
(*serImp)(dst, serSel, &count, @encode(unsigned), nil);
(*_tagImp)(_dst, tagSel, _GSC_ARY_B);
(*_serImp)(_dst, serSel, &count, @encode(unsigned), nil);
(*tagImp)(dst, tagSel, info);
(*_tagImp)(_dst, tagSel, info);
for (i = 0; i < count; i++)
{
(*serImp)(dst, serSel, (char*)buf + offset, type, nil);
(*_serImp)(_dst, serSel, (char*)buf + offset, type, nil);
offset += size;
}
}
@ -251,7 +251,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
switch (*type)
{
case _C_ID:
(*eObjImp)(self, eObjSel, *(void**)buf);
(*_eObjImp)(self, eObjSel, *(void**)buf);
return;
case _C_ARY_B:
@ -271,16 +271,16 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
int offset = 0;
if (isInPreparatoryPass == NO)
if (_initialPass == NO)
{
(*tagImp)(dst, tagSel, _GSC_STRUCT_B);
(*_tagImp)(_dst, tagSel, _GSC_STRUCT_B);
}
while (*type != _C_STRUCT_E && *type++ != '='); /* skip "<name>=" */
for (;;)
{
(*eValImp)(self, eValSel, type, (char*)buf + offset);
(*_eValImp)(self, eValSel, type, (char*)buf + offset);
offset += objc_sizeof_type(type);
type = objc_skip_typespec(type);
if (*type == _C_STRUCT_E)
@ -304,20 +304,20 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
case _C_PTR:
if (*(void**)buf == 0)
{
if (isInPreparatoryPass == NO)
if (_initialPass == NO)
{
/*
* Special case - a nul pointer gets an xref of zero
*/
(*tagImp)(dst, tagSel, _GSC_PTR | _GSC_XREF | _GSC_X_0);
(*_tagImp)(_dst, tagSel, _GSC_PTR | _GSC_XREF | _GSC_X_0);
}
}
else
{
GSIMapNode node;
node = GSIMapNodeForKey(ptrMap, (GSIMapKey)*(void**)buf);
if (isInPreparatoryPass == YES)
node = GSIMapNodeForKey(_ptrMap, (GSIMapKey)*(void**)buf);
if (_initialPass == YES)
{
/*
* First pass - add pointer to map and encode item pointed
@ -325,11 +325,11 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
*/
if (node == 0)
{
GSIMapAddPair(ptrMap,
GSIMapAddPair(_ptrMap,
(GSIMapKey)*(void**)buf, (GSIMapVal)0);
type++;
buf = *(char**)buf;
(*eValImp)(self, eValSel, type, buf);
(*_eValImp)(self, eValSel, type, buf);
}
}
else if (node == 0 || node->value.uint == 0)
@ -339,30 +339,30 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
*/
if (node == 0)
{
node = GSIMapAddPair(ptrMap,
(GSIMapKey)*(void**)buf, (GSIMapVal)++xRefP);
node = GSIMapAddPair(_ptrMap,
(GSIMapKey)*(void**)buf, (GSIMapVal)++_xRefP);
}
else
{
node->value.uint = ++xRefP;
node->value.uint = ++_xRefP;
}
(*xRefImp)(dst, xRefSel, _GSC_PTR, node->value.uint);
(*_xRefImp)(_dst, xRefSel, _GSC_PTR, node->value.uint);
type++;
buf = *(char**)buf;
(*eValImp)(self, eValSel, type, buf);
(*_eValImp)(self, eValSel, type, buf);
}
else
{
/*
* Second pass, write a cross-reference number.
*/
(*xRefImp)(dst, xRefSel, _GSC_PTR|_GSC_XREF, node->value.uint);
(*_xRefImp)(_dst, xRefSel, _GSC_PTR|_GSC_XREF, node->value.uint);
}
}
return;
default: /* Types that can be ignored in first pass. */
if (isInPreparatoryPass)
if (_initialPass)
{
return;
}
@ -377,7 +377,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
/*
* Special case - a nul pointer gets an xref of zero
*/
(*tagImp)(dst, tagSel, _GSC_CLASS | _GSC_XREF | _GSC_X_0);
(*_tagImp)(_dst, tagSel, _GSC_CLASS | _GSC_XREF | _GSC_X_0);
}
else
{
@ -385,11 +385,11 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
GSIMapNode node;
BOOL done = NO;
node = GSIMapNodeForKey(clsMap, (GSIMapKey)(void*)c);
node = GSIMapNodeForKey(_clsMap, (GSIMapKey)(void*)c);
if (node != 0)
{
(*xRefImp)(dst, xRefSel, _GSC_CLASS | _GSC_XREF,
(*_xRefImp)(_dst, xRefSel, _GSC_CLASS | _GSC_XREF,
node->value.uint);
return;
}
@ -404,17 +404,17 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
[NSException raise: NSInternalInconsistencyException
format: @"negative class version"];
}
node = GSIMapAddPair(clsMap,
(GSIMapKey)(void*)c, (GSIMapVal)++xRefC);
node = GSIMapAddPair(_clsMap,
(GSIMapKey)(void*)c, (GSIMapVal)++_xRefC);
/*
* Encode tag and crossref number.
*/
(*xRefImp)(dst, xRefSel, _GSC_CLASS, node->value.uint);
(*_xRefImp)(_dst, xRefSel, _GSC_CLASS, node->value.uint);
/*
* Encode class, and version.
*/
(*serImp)(dst, serSel, &c, @encode(Class), nil);
(*serImp)(dst, serSel, &version, @encode(unsigned), nil);
(*_serImp)(_dst, serSel, &c, @encode(Class), nil);
(*_serImp)(_dst, serSel, &version, @encode(unsigned), nil);
/*
* If we have a super class that has not been encoded,
* we must loop round to encode it here so that its
@ -423,7 +423,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
* [super initWithCoder:ccc]
*/
if (s == c || s == 0 ||
GSIMapNodeForKey(clsMap, (GSIMapKey)(void*)s) != 0)
GSIMapNodeForKey(_clsMap, (GSIMapKey)(void*)s) != 0)
{
done = YES;
}
@ -435,7 +435,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
/*
* Encode an empty tag to terminate the list of classes.
*/
(*tagImp)(dst, tagSel, _GSC_NONE);
(*_tagImp)(_dst, tagSel, _GSC_NONE);
}
return;
@ -445,26 +445,26 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
/*
* Special case - a nul pointer gets an xref of zero
*/
(*tagImp)(dst, tagSel, _GSC_SEL | _GSC_XREF | _GSC_X_0);
(*_tagImp)(_dst, tagSel, _GSC_SEL | _GSC_XREF | _GSC_X_0);
}
else
{
SEL s = *(SEL*)buf;
GSIMapNode node = GSIMapNodeForKey(ptrMap, (GSIMapKey)(void*)s);
GSIMapNode node = GSIMapNodeForKey(_ptrMap, (GSIMapKey)(void*)s);
if (node == 0)
{
node = GSIMapAddPair(ptrMap,
(GSIMapKey)(void*)s, (GSIMapVal)++xRefP);
(*xRefImp)(dst, xRefSel, _GSC_SEL, node->value.uint);
node = GSIMapAddPair(_ptrMap,
(GSIMapKey)(void*)s, (GSIMapVal)++_xRefP);
(*_xRefImp)(_dst, xRefSel, _GSC_SEL, node->value.uint);
/*
* Encode selector.
*/
(*serImp)(dst, serSel, buf, @encode(SEL), nil);
(*_serImp)(_dst, serSel, buf, @encode(SEL), nil);
}
else
{
(*xRefImp)(dst, xRefSel, _GSC_SEL|_GSC_XREF, node->value.uint);
(*_xRefImp)(_dst, xRefSel, _GSC_SEL|_GSC_XREF, node->value.uint);
}
}
return;
@ -475,88 +475,88 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
/*
* Special case - a nul pointer gets an xref of zero
*/
(*tagImp)(dst, tagSel, _GSC_CHARPTR | _GSC_XREF | _GSC_X_0);
(*_tagImp)(_dst, tagSel, _GSC_CHARPTR | _GSC_XREF | _GSC_X_0);
}
else
{
GSIMapNode node;
node = GSIMapNodeForKey(ptrMap, (GSIMapKey)*(char**)buf);
node = GSIMapNodeForKey(_ptrMap, (GSIMapKey)*(char**)buf);
if (node == 0)
{
node = GSIMapAddPair(ptrMap,
(GSIMapKey)*(char**)buf, (GSIMapVal)++xRefP);
(*xRefImp)(dst, xRefSel, _GSC_CHARPTR, node->value.uint);
(*serImp)(dst, serSel, buf, type, nil);
node = GSIMapAddPair(_ptrMap,
(GSIMapKey)*(char**)buf, (GSIMapVal)++_xRefP);
(*_xRefImp)(_dst, xRefSel, _GSC_CHARPTR, node->value.uint);
(*_serImp)(_dst, serSel, buf, type, nil);
}
else
{
(*xRefImp)(dst, xRefSel, _GSC_CHARPTR|_GSC_XREF,
(*_xRefImp)(_dst, xRefSel, _GSC_CHARPTR|_GSC_XREF,
node->value.uint);
}
}
return;
case _C_CHR:
(*tagImp)(dst, tagSel, _GSC_CHR);
(*serImp)(dst, serSel, (void*)buf, @encode(char), nil);
(*_tagImp)(_dst, tagSel, _GSC_CHR);
(*_serImp)(_dst, serSel, (void*)buf, @encode(char), nil);
return;
case _C_UCHR:
(*tagImp)(dst, tagSel, _GSC_UCHR);
(*serImp)(dst, serSel, (void*)buf, @encode(unsigned char), nil);
(*_tagImp)(_dst, tagSel, _GSC_UCHR);
(*_serImp)(_dst, serSel, (void*)buf, @encode(unsigned char), nil);
return;
case _C_SHT:
(*tagImp)(dst, tagSel, _GSC_SHT | _GSC_S_SHT);
(*serImp)(dst, serSel, (void*)buf, @encode(short), nil);
(*_tagImp)(_dst, tagSel, _GSC_SHT | _GSC_S_SHT);
(*_serImp)(_dst, serSel, (void*)buf, @encode(short), nil);
return;
case _C_USHT:
(*tagImp)(dst, tagSel, _GSC_USHT | _GSC_S_SHT);
(*serImp)(dst, serSel, (void*)buf, @encode(unsigned short), nil);
(*_tagImp)(_dst, tagSel, _GSC_USHT | _GSC_S_SHT);
(*_serImp)(_dst, serSel, (void*)buf, @encode(unsigned short), nil);
return;
case _C_INT:
(*tagImp)(dst, tagSel, _GSC_INT | _GSC_S_INT);
(*serImp)(dst, serSel, (void*)buf, @encode(int), nil);
(*_tagImp)(_dst, tagSel, _GSC_INT | _GSC_S_INT);
(*_serImp)(_dst, serSel, (void*)buf, @encode(int), nil);
return;
case _C_UINT:
(*tagImp)(dst, tagSel, _GSC_UINT | _GSC_S_INT);
(*serImp)(dst, serSel, (void*)buf, @encode(unsigned int), nil);
(*_tagImp)(_dst, tagSel, _GSC_UINT | _GSC_S_INT);
(*_serImp)(_dst, serSel, (void*)buf, @encode(unsigned int), nil);
return;
case _C_LNG:
(*tagImp)(dst, tagSel, _GSC_LNG | _GSC_S_LNG);
(*serImp)(dst, serSel, (void*)buf, @encode(long), nil);
(*_tagImp)(_dst, tagSel, _GSC_LNG | _GSC_S_LNG);
(*_serImp)(_dst, serSel, (void*)buf, @encode(long), nil);
return;
case _C_ULNG:
(*tagImp)(dst, tagSel, _GSC_ULNG | _GSC_S_LNG);
(*serImp)(dst, serSel, (void*)buf, @encode(unsigned long), nil);
(*_tagImp)(_dst, tagSel, _GSC_ULNG | _GSC_S_LNG);
(*_serImp)(_dst, serSel, (void*)buf, @encode(unsigned long), nil);
return;
#ifdef _C_LNG_LNG
case _C_LNG_LNG:
(*tagImp)(dst, tagSel, _GSC_LNG_LNG | _GSC_S_LNG_LNG);
(*serImp)(dst, serSel, (void*)buf, @encode(long long), nil);
(*_tagImp)(_dst, tagSel, _GSC_LNG_LNG | _GSC_S_LNG_LNG);
(*_serImp)(_dst, serSel, (void*)buf, @encode(long long), nil);
return;
case _C_ULNG_LNG:
(*tagImp)(dst, tagSel, _GSC_ULNG_LNG | _GSC_S_LNG_LNG);
(*serImp)(dst, serSel, (void*)buf, @encode(unsigned long long), nil);
(*_tagImp)(_dst, tagSel, _GSC_ULNG_LNG | _GSC_S_LNG_LNG);
(*_serImp)(_dst, serSel, (void*)buf, @encode(unsigned long long), nil);
return;
#endif
case _C_FLT:
(*tagImp)(dst, tagSel, _GSC_FLT);
(*serImp)(dst, serSel, (void*)buf, @encode(float), nil);
(*_tagImp)(_dst, tagSel, _GSC_FLT);
(*_serImp)(_dst, serSel, (void*)buf, @encode(float), nil);
return;
case _C_DBL:
(*tagImp)(dst, tagSel, _GSC_DBL);
(*serImp)(dst, serSel, (void*)buf, @encode(double), nil);
(*_tagImp)(_dst, tagSel, _GSC_DBL);
(*_serImp)(_dst, serSel, (void*)buf, @encode(double), nil);
return;
case _C_VOID:
@ -571,48 +571,48 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
- (void) encodeRootObject: (id)rootObject
{
if (isEncodingRootObject)
if (_encodingRoot)
{
[NSException raise: NSInvalidArgumentException
format: @"encoding root object more than once"];
}
isEncodingRootObject = YES;
_encodingRoot = YES;
/*
* First pass - find conditional objects.
*/
isInPreparatoryPass = YES;
(*eObjImp)(self, eObjSel, rootObject);
_initialPass = YES;
(*_eObjImp)(self, eObjSel, rootObject);
/*
* Second pass - write archive.
*/
isInPreparatoryPass = NO;
(*eObjImp)(self, eObjSel, rootObject);
_initialPass = NO;
(*_eObjImp)(self, eObjSel, rootObject);
/*
* Write sizes of crossref arrays to head of archive.
*/
[self serializeHeaderAt: startPos
[self serializeHeaderAt: _startPos
version: [self systemVersion]
classes: clsMap->nodeCount
objects: uIdMap->nodeCount
pointers: ptrMap->nodeCount];
classes: _clsMap->nodeCount
objects: _uIdMap->nodeCount
pointers: _ptrMap->nodeCount];
isEncodingRootObject = NO;
_encodingRoot = NO;
}
- (void) encodeConditionalObject: (id)anObject
{
if (isEncodingRootObject == NO)
if (_encodingRoot == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"conditionally encoding without root object"];
return;
}
if (isInPreparatoryPass)
if (_initialPass)
{
GSIMapNode node;
@ -628,7 +628,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
* If we have already conditionally encoded this object, we can
* ignore it this time.
*/
node = GSIMapNodeForKey(cIdMap, (GSIMapKey)anObject);
node = GSIMapNodeForKey(_cIdMap, (GSIMapKey)anObject);
if (node != 0)
{
return;
@ -638,39 +638,39 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
* If we have unconditionally encoded this object, we can ignore
* it now.
*/
node = GSIMapNodeForKey(uIdMap, (GSIMapKey)anObject);
node = GSIMapNodeForKey(_uIdMap, (GSIMapKey)anObject);
if (node != 0)
{
return;
}
GSIMapAddPair(cIdMap, (GSIMapKey)anObject, (GSIMapVal)0);
GSIMapAddPair(_cIdMap, (GSIMapKey)anObject, (GSIMapVal)0);
}
else if (anObject == nil)
{
(*eObjImp)(self, eObjSel, nil);
(*_eObjImp)(self, eObjSel, nil);
}
else
{
GSIMapNode node;
if (repMap->nodeCount)
if (_repMap->nodeCount)
{
node = GSIMapNodeForKey(repMap, (GSIMapKey)anObject);
node = GSIMapNodeForKey(_repMap, (GSIMapKey)anObject);
if (node)
{
anObject = (id)node->value.ptr;
}
}
node = GSIMapNodeForKey(cIdMap, (GSIMapKey)anObject);
node = GSIMapNodeForKey(_cIdMap, (GSIMapKey)anObject);
if (node != 0)
{
(*eObjImp)(self, eObjSel, nil);
(*_eObjImp)(self, eObjSel, nil);
}
else
{
(*eObjImp)(self, eObjSel, anObject);
(*_eObjImp)(self, eObjSel, anObject);
}
}
}
@ -679,7 +679,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
unsigned l = [anObject length];
(*eValImp)(self, eValSel, @encode(unsigned int), &l);
(*_eValImp)(self, eValSel, @encode(unsigned int), &l);
if (l)
{
const void *b = [anObject bytes];
@ -690,7 +690,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
* actual data - at present we have '0' meaning raw data. In the
* future we might want zipped data for instance.
*/
(*eValImp)(self, eValSel, @encode(unsigned char), &c);
(*_eValImp)(self, eValSel, @encode(unsigned char), &c);
[self encodeArrayOfObjCType: @encode(unsigned char)
count: l
at: b];
@ -701,12 +701,12 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
if (anObject == nil)
{
if (isInPreparatoryPass == NO)
if (_initialPass == NO)
{
/*
* Special case - encode a nil pointer as a crossref of zero.
*/
(*tagImp)(dst, tagSel, _GSC_ID | _GSC_XREF, _GSC_X_0);
(*_tagImp)(_dst, tagSel, _GSC_ID | _GSC_XREF, _GSC_X_0);
}
}
else if (fastIsInstance(anObject) == NO)
@ -715,7 +715,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
* If the object we have been given is actually a class,
* we encode it as a class instead.
*/
(*eValImp)(self, eValSel, @encode(Class), &anObject);
(*_eValImp)(self, eValSel, @encode(Class), &anObject);
}
else
{
@ -724,7 +724,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
/*
* Substitute replacement object if required.
*/
node = GSIMapNodeForKey(repMap, (GSIMapKey)anObject);
node = GSIMapNodeForKey(_repMap, (GSIMapKey)anObject);
if (node)
{
anObject = (id)node->value.ptr;
@ -733,9 +733,9 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
/*
* See if the object has already been encoded.
*/
node = GSIMapNodeForKey(uIdMap, (GSIMapKey)anObject);
node = GSIMapNodeForKey(_uIdMap, (GSIMapKey)anObject);
if (isInPreparatoryPass)
if (_initialPass)
{
if (node == 0)
{
@ -743,8 +743,8 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
* Remove object from map of conditionally encoded objects
* and add it to the map of unconditionay encoded ones.
*/
GSIMapRemoveKey(cIdMap, (GSIMapKey)anObject);
GSIMapAddPair(uIdMap, (GSIMapKey)anObject, (GSIMapVal)0);
GSIMapRemoveKey(_cIdMap, (GSIMapKey)anObject);
GSIMapAddPair(_uIdMap, (GSIMapKey)anObject, (GSIMapVal)0);
[anObject encodeWithCoder: self];
}
return;
@ -757,53 +757,53 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
if (node == 0)
{
node = GSIMapAddPair(uIdMap,
(GSIMapKey)anObject, (GSIMapVal)++xRefO);
node = GSIMapAddPair(_uIdMap,
(GSIMapKey)anObject, (GSIMapVal)++_xRefO);
}
else
{
node->value.uint = ++xRefO;
node->value.uint = ++_xRefO;
}
obj = [anObject replacementObjectForArchiver: self];
cls = [anObject classForArchiver];
(*xRefImp)(dst, xRefSel, _GSC_ID, node->value.uint);
if (namMap->nodeCount)
(*_xRefImp)(_dst, xRefSel, _GSC_ID, node->value.uint);
if (_namMap->nodeCount)
{
GSIMapNode node;
node = GSIMapNodeForKey(namMap, (GSIMapKey)cls);
node = GSIMapNodeForKey(_namMap, (GSIMapKey)cls);
if (node)
{
cls = (Class)node->value.ptr;
}
}
(*eValImp)(self, eValSel, @encode(Class), &cls);
(*_eValImp)(self, eValSel, @encode(Class), &cls);
[obj encodeWithCoder: self];
}
else if(!isInPreparatoryPass)
else if(!_initialPass)
{
(*xRefImp)(dst, xRefSel, _GSC_ID | _GSC_XREF, node->value.uint);
(*_xRefImp)(_dst, xRefSel, _GSC_ID | _GSC_XREF, node->value.uint);
}
}
}
- (NSMutableData*) archiverData
{
return data;
return _data;
}
- (NSString*) classNameEncodedForTrueClassName:(NSString*)trueName
- (NSString*) classNameEncodedForTrueClassName: (NSString*)trueName
{
if (namMap->nodeCount)
if (_namMap->nodeCount)
{
GSIMapNode node;
Class c;
c = objc_get_class([trueName cString]);
node = GSIMapNodeForKey(namMap, (GSIMapKey)c);
node = GSIMapNodeForKey(_namMap, (GSIMapKey)c);
if (node)
{
c = (Class)node->value.ptr;
@ -832,10 +832,10 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
[NSException raise: NSInternalInconsistencyException
format: @"Can't find class '%@'.", inArchiveName];
}
node = GSIMapNodeForKey(namMap, (GSIMapKey)tc);
node = GSIMapNodeForKey(_namMap, (GSIMapKey)tc);
if (node == 0)
{
GSIMapAddPair(namMap, (GSIMapKey)(void*)tc, (GSIMapVal)(void*)ic);
GSIMapAddPair(_namMap, (GSIMapKey)(void*)tc, (GSIMapVal)(void*)ic);
}
else
{
@ -858,10 +858,10 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
[NSException raise: NSInternalInconsistencyException
format: @"attempt to remap object to nil"];
}
node = GSIMapNodeForKey(namMap, (GSIMapKey)object);
node = GSIMapNodeForKey(_namMap, (GSIMapKey)object);
if (node == 0)
{
GSIMapAddPair(namMap, (GSIMapKey)object, (GSIMapVal)newObject);
GSIMapAddPair(_namMap, (GSIMapKey)object, (GSIMapVal)newObject);
}
else
{
@ -882,41 +882,41 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
- (void) resetArchiver
{
if (clsMap)
if (_clsMap)
{
GSIMapCleanMap(clsMap);
if (cIdMap)
GSIMapCleanMap(_clsMap);
if (_cIdMap)
{
GSIMapCleanMap(cIdMap);
GSIMapCleanMap(_cIdMap);
}
if (uIdMap)
if (_uIdMap)
{
GSIMapCleanMap(uIdMap);
GSIMapCleanMap(_uIdMap);
}
if (ptrMap)
if (_ptrMap)
{
GSIMapCleanMap(ptrMap);
GSIMapCleanMap(_ptrMap);
}
if (namMap)
if (_namMap)
{
GSIMapCleanMap(namMap);
GSIMapCleanMap(_namMap);
}
if (repMap)
if (_repMap)
{
GSIMapCleanMap(repMap);
GSIMapCleanMap(_repMap);
}
}
isEncodingRootObject = NO;
isInPreparatoryPass = NO;
xRefC = 0;
xRefO = 0;
xRefP = 0;
_encodingRoot = NO;
_initialPass = NO;
_xRefC = 0;
_xRefO = 0;
_xRefP = 0;
/*
* Write dummy header
*/
startPos = [data length];
[self serializeHeaderAt: startPos
_startPos = [_data length];
[self serializeHeaderAt: _startPos
version: 0
classes: 0
objects: 0
@ -936,18 +936,18 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
unsigned headerLength = strlen(PREFIX)+36;
char header[headerLength+1];
unsigned dataLength = [data length];
unsigned dataLength = [_data length];
sprintf(header, "%s%08x:%08x:%08x:%08x:", PREFIX, v, cc, oc, pc);
if (locationInData + headerLength <= dataLength)
{
[data replaceBytesInRange: NSMakeRange(locationInData, headerLength)
[_data replaceBytesInRange: NSMakeRange(locationInData, headerLength)
withBytes: header];
}
else if (locationInData == dataLength)
{
[data appendBytes: header length: headerLength];
[_data appendBytes: header length: headerLength];
}
else
{
@ -963,7 +963,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
at: (const void*)buf
withName: (id)name
{
(*eObjImp)(self, eObjSel, name);
(*_eObjImp)(self, eObjSel, name);
[self encodeArrayOfObjCType: type count: count at: buf];
}
@ -975,23 +975,23 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
at: (const void*)buf
withName: (id)name
{
(*eObjImp)(self, eObjSel, name);
(*eValImp)(self, eValSel, type, buf);
(*_eObjImp)(self, eObjSel, name);
(*_eValImp)(self, eValSel, type, buf);
}
- (void) encodeValueOfObjCType: (const char*) type
at: (const void*)buf
withName: (id)name
{
(*eObjImp)(self, eObjSel, name);
(*eValImp)(self, eValSel, type, buf);
(*_eObjImp)(self, eObjSel, name);
(*_eValImp)(self, eValSel, type, buf);
}
- (void) encodeObject: (id)anObject
withName: (id)name
{
(*eObjImp)(self, eObjSel, name);
(*eObjImp)(self, eObjSel, anObject);
(*_eObjImp)(self, eObjSel, name);
(*_eObjImp)(self, eObjSel, anObject);
}
@end

View file

@ -127,7 +127,7 @@ static IMP initImp;
{
if (!_released_head)
{
addImp = (void (*)(id, SEL, id))
_addImp = (void (*)(id, SEL, id))
[self methodForSelector: @selector(addObject:)];
/* Allocate the array that will be the new head of the list of arrays. */
_released = (struct autorelease_array_list*)
@ -229,7 +229,7 @@ static IMP initImp;
NSAutoreleasePool *pool = ARP_THREAD_VARS->current_pool;
if (pool)
(*pool->addImp)(pool, @selector(addObject:), anObj);
(*pool->_addImp)(pool, @selector(addObject:), anObj);
else
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];

View file

@ -28,41 +28,41 @@
@implementation NSBitmapCharSet
- init
- (id) init
{
return [self initWithBitmap:NULL];
return [self initWithBitmap: NULL];
}
/* Designated initializer */
- initWithBitmap:(NSData *)bitmap
- (id) initWithBitmap: (NSData*)bitmap
{
[super init];
[bitmap getBytes:data length:BITMAP_SIZE];
[bitmap getBytes: _data length: BITMAP_SIZE];
return self;
}
- (NSData *)bitmapRepresentation
- (NSData*) bitmapRepresentation
{
return [NSData dataWithBytes:data length:BITMAP_SIZE];
return [NSData dataWithBytes: _data length: BITMAP_SIZE];
}
- (BOOL)characterIsMember:(unichar)aCharacter
- (BOOL) characterIsMember: (unichar)aCharacter
{
return ISSET(data[aCharacter/8], aCharacter % 8);
return ISSET(_data[aCharacter/8], aCharacter % 8);
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[aCoder encodeObject: [self bitmapRepresentation]];
[aCoder encodeObject: [self bitmapRepresentation]];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
NSData *rep;
NSData *rep;
rep = [aCoder decodeObject];
self = [self initWithBitmap: rep];
return self;
rep = [aCoder decodeObject];
self = [self initWithBitmap: rep];
return self;
}
@end
@ -71,46 +71,46 @@
- init
{
return [self initWithBitmap:NULL];
return [self initWithBitmap: NULL];
}
/* Designated initializer */
- initWithBitmap:(NSData *)bitmap
- (id) initWithBitmap: (NSData*)bitmap
{
[super init];
if (bitmap)
[bitmap getBytes:data length:BITMAP_SIZE];
[bitmap getBytes: _data length: BITMAP_SIZE];
return self;
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[aCoder encodeObject: [self bitmapRepresentation]];
[aCoder encodeObject: [self bitmapRepresentation]];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
NSMutableData *rep;
NSMutableData *rep;
rep = [aCoder decodeObject];
self = [self initWithBitmap: rep];
return self;
rep = [aCoder decodeObject];
self = [self initWithBitmap: rep];
return self;
}
/* Need to implement the next two methods just like NSBitmapCharSet */
- (NSData *)bitmapRepresentation
- (NSData*) bitmapRepresentation
{
return [NSData dataWithBytes:data length:BITMAP_SIZE];
return [NSData dataWithBytes: _data length: BITMAP_SIZE];
}
- (BOOL)characterIsMember:(unichar)aCharacter
- (BOOL) characterIsMember: (unichar)aCharacter
{
return ISSET(data[aCharacter/8], aCharacter % 8);
return ISSET(_data[aCharacter/8], aCharacter % 8);
}
- (void)addCharactersInRange:(NSRange)aRange
- (void) addCharactersInRange: (NSRange)aRange
{
int i;
unsigned i;
if (NSMaxRange(aRange) > UNICODE_SIZE)
{
@ -119,13 +119,13 @@
/* NOT REACHED */
}
for (i=aRange.location; i < NSMaxRange(aRange); i++)
SETBIT(data[i/8], i % 8);
for (i = aRange.location; i < NSMaxRange(aRange); i++)
SETBIT(_data[i/8], i % 8);
}
- (void)addCharactersInString:(NSString *)aString
- (void) addCharactersInString: (NSString*)aString
{
int i, length;
unsigned length;
if (!aString)
{
@ -135,36 +135,46 @@
}
length = [aString length];
for (i=0; i < length; i++)
if (length > 0)
{
unichar letter = [aString characterAtIndex:i];
SETBIT(data[letter/8], letter % 8);
unsigned i;
unichar (*get)(id, SEL, unsigned);
get = (unichar (*)(id, SEL, unsigned))
[aString methodForSelector: @selector(characterAtIndex:)];
for (i = 0; i < length; i++)
{
unichar letter;
letter = (*get)(aString, @selector(characterAtIndex:), i);
SETBIT(_data[letter/8], letter % 8);
}
}
}
- (void) formUnionWithCharacterSet: (NSCharacterSet *)otherSet
- (void) formUnionWithCharacterSet: (NSCharacterSet*)otherSet
{
int i;
const char *other_bytes;
unsigned i;
const char *other_bytes;
other_bytes = [[otherSet bitmapRepresentation] bytes];
for (i = 0; i < BITMAP_SIZE; i++)
data[i] = (data[i] | other_bytes[i]);
_data[i] = (_data[i] | other_bytes[i]);
}
- (void) formIntersectionWithCharacterSet: (NSCharacterSet *)otherSet
{
int i;
const char *other_bytes;
unsigned i;
const char *other_bytes;
other_bytes = [[otherSet bitmapRepresentation] bytes];
for (i = 0; i < BITMAP_SIZE; i++)
data[i] = (data[i] & other_bytes[i]);
_data[i] = (_data[i] & other_bytes[i]);
}
- (void)removeCharactersInRange:(NSRange)aRange
- (void) removeCharactersInRange: (NSRange)aRange
{
int i;
unsigned i;
if (NSMaxRange(aRange) > UNICODE_SIZE)
{
@ -173,13 +183,13 @@
/* NOT REACHED */
}
for (i=aRange.location; i < NSMaxRange(aRange); i++)
CLRBIT(data[i/8], i % 8);
for (i = aRange.location; i < NSMaxRange(aRange); i++)
CLRBIT(_data[i/8], i % 8);
}
- (void)removeCharactersInString:(NSString *)aString
- (void) removeCharactersInString: (NSString*)aString
{
int i, length;
unsigned length;
if (!aString)
{
@ -189,19 +199,30 @@
}
length = [aString length];
for (i=0; i < length; i++)
if (length > 0)
{
unichar letter = [aString characterAtIndex:i];
CLRBIT(data[letter/8], letter % 8);
unsigned i;
unichar (*get)(id, SEL, unsigned);
get = (unichar (*)(id, SEL, unsigned))
[aString methodForSelector: @selector(characterAtIndex:)];
for (i = 0; i < length; i++)
{
unichar letter;
letter = (*get)(aString, @selector(characterAtIndex:), i);
CLRBIT(_data[letter/8], letter % 8);
}
}
}
- (void)invert
- (void) invert
{
int i;
unsigned i;
for (i=0; i < BITMAP_SIZE; i++)
data[i] = ~data[i];
for (i = 0; i < BITMAP_SIZE; i++)
_data[i] = ~_data[i];
}
@end

View file

@ -129,23 +129,23 @@
- (void) encodeWithCoder: (NSCoder*)coder
{
[coder encodeValueOfObjCType: @encode(NSTimeInterval) at: &seconds_since_ref];
[coder encodeObject: calendar_format];
[coder encodeObject: time_zone];
[coder encodeValueOfObjCType: @encode(NSTimeInterval) at: &_seconds_since_ref];
[coder encodeObject: _calendar_format];
[coder encodeObject: _time_zone];
}
- (id) initWithCoder: (NSCoder*)coder
{
[coder decodeValueOfObjCType: @encode(NSTimeInterval) at: &seconds_since_ref];
[coder decodeValueOfObjCType: @encode(id) at: &calendar_format];
[coder decodeValueOfObjCType: @encode(id) at: &time_zone];
[coder decodeValueOfObjCType: @encode(NSTimeInterval) at: &_seconds_since_ref];
[coder decodeValueOfObjCType: @encode(id) at: &_calendar_format];
[coder decodeValueOfObjCType: @encode(id) at: &_time_zone];
return self;
}
- (void) dealloc
{
RELEASE(calendar_format);
RELEASE(time_zone);
RELEASE(_calendar_format);
RELEASE(_time_zone);
[super dealloc];
}
@ -490,12 +490,12 @@
s += second;
// Assign time zone detail
time_zone = RETAIN([aTimeZone
_time_zone = RETAIN([aTimeZone
timeZoneDetailForDate:
[NSDate dateWithTimeIntervalSinceReferenceDate: s]]);
// Adjust date so it is correct for time zone.
s -= [time_zone timeZoneSecondsFromGMT];
s -= [_time_zone timeZoneSecondsFromGMT];
self = [self initWithTimeIntervalSinceReferenceDate: s];
/* Now permit up to five cycles of adjustment to allow for daylight savings.
@ -516,14 +516,14 @@
z = [aTimeZone
timeZoneDetailForDate:
[NSDate dateWithTimeIntervalSinceReferenceDate: s]];
if (z != time_zone)
if (z != _time_zone)
{
NSTimeInterval oldOffset;
NSTimeInterval newOffset;
oldOffset = [time_zone timeZoneSecondsFromGMT];
ASSIGN(time_zone, z);
newOffset = [time_zone timeZoneSecondsFromGMT];
oldOffset = [_time_zone timeZoneSecondsFromGMT];
ASSIGN(_time_zone, z);
newOffset = [_time_zone timeZoneSecondsFromGMT];
s += newOffset - oldOffset;
}
else
@ -562,11 +562,11 @@
// Default initializer
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)seconds
{
seconds_since_ref = seconds;
if (!calendar_format)
calendar_format = @"%Y-%m-%d %H:%M:%S %z";
if (!time_zone)
time_zone = RETAIN([[NSTimeZone localTimeZone]
_seconds_since_ref = seconds;
if (!_calendar_format)
_calendar_format = @"%Y-%m-%d %H:%M:%S %z";
if (!_time_zone)
_time_zone = RETAIN([[NSTimeZone localTimeZone]
timeZoneDetailForDate: self]);
return self;
}
@ -588,7 +588,7 @@
// Calculate hour, minute, and seconds
d -= GREGORIAN_REFERENCE;
d *= 86400;
a = abs(d - (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]));
a = abs(d - (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]));
b = a / 3600;
*hour = (int)b;
h = *hour;
@ -608,7 +608,7 @@
int r;
// Get reference date in terms of days
a = (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]) / 86400.0;
a = (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]) / 86400.0;
// Offset by Gregorian reference
a += GREGORIAN_REFERENCE;
r = (int)a;
@ -659,7 +659,7 @@
double a, d = [self dayOfCommonEra];
d -= GREGORIAN_REFERENCE;
d *= 86400;
a = abs(d - (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]));
a = abs(d - (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]));
a = a / 3600;
h = (int)a;
@ -677,7 +677,7 @@
double a, b, d = [self dayOfCommonEra];
d -= GREGORIAN_REFERENCE;
d *= 86400;
a = abs(d - (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]));
a = abs(d - (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]));
b = a / 3600;
h = (int)b;
h = h * 3600;
@ -704,7 +704,7 @@
double a, b, c, d = [self dayOfCommonEra];
d -= GREGORIAN_REFERENCE;
d *= 86400;
a = abs(d - (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]));
a = abs(d - (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]));
b = a / 3600;
h = (int)b;
h = h * 3600;
@ -724,7 +724,7 @@
int a;
// Get reference date in terms of days
a = (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]) / 86400;
a = (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]) / 86400;
// Offset by Gregorian reference
a += GREGORIAN_REFERENCE;
[self gregorianDateFromAbsolute: a day: &d month: &m year: &y];
@ -751,7 +751,7 @@
// Getting String Descriptions of Dates
- (NSString*) description
{
return [self descriptionWithCalendarFormat: calendar_format locale: nil];
return [self descriptionWithCalendarFormat: _calendar_format locale: nil];
}
- (NSString*) descriptionWithCalendarFormat: (NSString *)format
@ -884,7 +884,7 @@
case 'F': // milliseconds
s = ([self dayOfCommonEra] - GREGORIAN_REFERENCE) * 86400.0;
s -= (seconds_since_ref+[time_zone timeZoneSecondsFromGMT]);
s -= (_seconds_since_ref+[_time_zone timeZoneSecondsFromGMT]);
s = abs(s);
s -= floor(s);
++i;
@ -985,13 +985,13 @@
case 'Z':
++i;
k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%s",
[[time_zone timeZoneAbbreviation] cString]));
[[_time_zone timeZoneAbbreviation] cString]));
j += k;
break;
case 'z':
++i;
z = [time_zone timeZoneSecondsFromGMT];
z = [_time_zone timeZoneSecondsFromGMT];
if (z < 0) {
z = -z;
z /= 60;
@ -1040,8 +1040,8 @@
if (newDate)
{
newDate->calendar_format = [calendar_format copyWithZone: zone];
newDate->time_zone = RETAIN(time_zone);
newDate->_calendar_format = [_calendar_format copyWithZone: zone];
newDate->_time_zone = RETAIN(_time_zone);
}
}
return newDate;
@ -1049,19 +1049,19 @@
- (NSString*) descriptionWithLocale: (NSDictionary *)locale
{
return [self descriptionWithCalendarFormat: calendar_format locale: locale];
return [self descriptionWithCalendarFormat: _calendar_format locale: locale];
}
// Getting and Setting Calendar Formats
- (NSString*) calendarFormat
{
return calendar_format;
return _calendar_format;
}
- (void) setCalendarFormat: (NSString *)format
{
RELEASE(calendar_format);
calendar_format = [format copyWithZone: [self zone]];
RELEASE(_calendar_format);
_calendar_format = [format copyWithZone: [self zone]];
}
// Getting and Setting Time Zones
@ -1069,12 +1069,12 @@
{
NSTimeZoneDetail *detail = [aTimeZone timeZoneDetailForDate: self];
ASSIGN(time_zone, detail);
ASSIGN(_time_zone, detail);
}
- (NSTimeZoneDetail*) timeZoneDetail
{
return time_zone;
return _time_zone;
}
@end

View file

@ -102,7 +102,7 @@ otherTime(NSDate* other)
Class c = fastClass(other);
if (c == concreteClass || c == calendarClass)
return ((NSGDate*)other)->seconds_since_ref;
return ((NSGDate*)other)->_seconds_since_ref;
else
return [other timeIntervalSinceReferenceDate];
}
@ -1097,18 +1097,18 @@ GSTimeNow()
- (void) encodeWithCoder: (NSCoder*)coder
{
[coder encodeValueOfObjCType: @encode(NSTimeInterval) at: &seconds_since_ref];
[coder encodeValueOfObjCType: @encode(NSTimeInterval) at: &_seconds_since_ref];
}
- (id) initWithCoder: (NSCoder*)coder
{
[coder decodeValueOfObjCType: @encode(NSTimeInterval) at: &seconds_since_ref];
[coder decodeValueOfObjCType: @encode(NSTimeInterval) at: &_seconds_since_ref];
return self;
}
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
{
seconds_since_ref = secs;
_seconds_since_ref = secs;
return self;
}
@ -1119,37 +1119,37 @@ GSTimeNow()
{
/* xxx We need to check for overflow? */
return [concreteClass dateWithTimeIntervalSinceReferenceDate:
seconds_since_ref + seconds];
_seconds_since_ref + seconds];
}
- (NSTimeInterval) timeIntervalSince1970
{
return seconds_since_ref - UNIX_REFERENCE_INTERVAL;
return _seconds_since_ref - UNIX_REFERENCE_INTERVAL;
}
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate
{
return seconds_since_ref - otherTime(otherDate);
return _seconds_since_ref - otherTime(otherDate);
}
- (NSTimeInterval) timeIntervalSinceNow
{
return seconds_since_ref - GSTimeNow();
return _seconds_since_ref - GSTimeNow();
}
- (NSTimeInterval) timeIntervalSinceReferenceDate
{
return seconds_since_ref;
return _seconds_since_ref;
}
// Comparing dates
- (NSComparisonResult) compare: (NSDate*)otherDate
{
if (seconds_since_ref > otherTime(otherDate))
if (_seconds_since_ref > otherTime(otherDate))
return NSOrderedDescending;
if (seconds_since_ref < otherTime(otherDate))
if (_seconds_since_ref < otherTime(otherDate))
return NSOrderedAscending;
return NSOrderedSame;
@ -1157,7 +1157,7 @@ GSTimeNow()
- (NSDate*) earlierDate: (NSDate*)otherDate
{
if (seconds_since_ref > otherTime(otherDate))
if (_seconds_since_ref > otherTime(otherDate))
return otherDate;
return self;
}
@ -1165,21 +1165,21 @@ GSTimeNow()
- (BOOL) isEqual: (id)other
{
if ([other isKindOfClass: abstractClass]
&& 1.0 > ABS(seconds_since_ref - otherTime(other)))
&& 1.0 > ABS(_seconds_since_ref - otherTime(other)))
return YES;
return NO;
}
- (BOOL) isEqualToDate: (NSDate*)other
{
if (1.0 > ABS(seconds_since_ref - otherTime(other)))
if (1.0 > ABS(_seconds_since_ref - otherTime(other)))
return YES;
return NO;
}
- (NSDate*) laterDate: (NSDate*)otherDate
{
if (seconds_since_ref < otherTime(otherDate))
if (_seconds_since_ref < otherTime(otherDate))
return otherDate;
return self;
}
@ -1278,7 +1278,7 @@ GSTimeNow()
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
{
seconds_since_ref = DISTANT_PAST;
_seconds_since_ref = DISTANT_PAST;
return self;
}
@ -1300,7 +1300,7 @@ GSTimeNow()
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
{
seconds_since_ref = DISTANT_FUTURE;
_seconds_since_ref = DISTANT_FUTURE;
return self;
}

View file

@ -32,7 +32,7 @@
- (BOOL) allowsNaturalLanguage
{
return allowsNaturalLanguage;
return _allowsNaturalLanguage;
}
- (NSAttributedString*) attributedStringForObjectValue: (id)anObject
@ -45,18 +45,18 @@
{
NSDateFormatter *other = (id)NSCopyObject(self, 0, zone);
RETAIN(other->dateFormat);
RETAIN(other->_dateFormat);
return other;
}
- (NSString*) dateFormat
{
return dateFormat;
return _dateFormat;
}
- (void) dealloc
{
RELEASE(dateFormat);
RELEASE(_dateFormat);
[super dealloc];
}
@ -67,7 +67,7 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[aCoder encodeValuesOfObjCTypes: "@C", &dateFormat, &allowsNaturalLanguage];
[aCoder encodeValuesOfObjCTypes: "@C", &_dateFormat, &_allowsNaturalLanguage];
}
- (BOOL) getObjectValue: (id*)anObject
@ -76,10 +76,10 @@
{
NSCalendarDate *d;
d = [NSCalendarDate dateWithString: string calendarFormat: dateFormat];
d = [NSCalendarDate dateWithString: string calendarFormat: _dateFormat];
if (d == nil)
{
if (allowsNaturalLanguage)
if (_allowsNaturalLanguage)
{
d = [NSCalendarDate dateWithNaturalLanguageString: string];
}
@ -95,15 +95,15 @@
- (id) initWithCoder: (NSCoder*)aCoder
{
[aCoder decodeValuesOfObjCTypes: "@C", &dateFormat, &allowsNaturalLanguage];
[aCoder decodeValuesOfObjCTypes: "@C", &_dateFormat, &_allowsNaturalLanguage];
return self;
}
- (id) initWithDateFormat: (NSString *)format
allowNaturalLanguage: (BOOL)flag
{
dateFormat = [format copy];
allowsNaturalLanguage = flag;
_dateFormat = [format copy];
_allowsNaturalLanguage = flag;
return self;
}
@ -122,7 +122,7 @@
{
return nil;
}
return [anObject descriptionWithCalendarFormat: dateFormat
return [anObject descriptionWithCalendarFormat: _dateFormat
timeZone: [NSTimeZone defaultTimeZone]
locale: nil];
}

View file

@ -25,6 +25,7 @@
#include <config.h>
#include <Foundation/DistributedObjects.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSPort.h>
#include <Foundation/NSMethodSignature.h>
#include <Foundation/NSException.h>

View file

@ -43,18 +43,18 @@
NSFileManager *fileManager;
fileManager = [NSFileManager defaultManager];
if ([fileManager removeFileAtPath: lockPath handler: nil] == NO)
if ([fileManager removeFileAtPath: _lockPath handler: nil] == NO)
[NSException raise: NSGenericException
format: @"Failed to remove lock directory '%@' - %s",
lockPath, strerror(errno)];
RELEASE(lockTime);
lockTime = nil;
_lockPath, strerror(errno)];
RELEASE(_lockTime);
_lockTime = nil;
}
- (void) dealloc
{
RELEASE(lockPath);
RELEASE(lockTime);
RELEASE(_lockPath);
RELEASE(_lockTime);
[super dealloc];
}
@ -64,34 +64,34 @@
NSString *lockDir;
BOOL isDirectory;
lockPath = [aPath copy];
lockTime = nil;
_lockPath = [aPath copy];
_lockTime = nil;
fileManager = [NSFileManager defaultManager];
lockDir = [lockPath stringByDeletingLastPathComponent];
lockDir = [_lockPath stringByDeletingLastPathComponent];
if ([fileManager fileExistsAtPath: lockDir isDirectory: &isDirectory] == NO)
{
NSLog(@"part of the path to the lock file '%@' is missing\n", lockPath);
NSLog(@"part of the path to the lock file '%@' is missing\n", _lockPath);
RELEASE(self);
return nil;
}
if (isDirectory == NO)
{
NSLog(@"part of the path to the lock file '%@' is not a directory\n",
lockPath);
_lockPath);
RELEASE(self);
return nil;
}
if ([fileManager isWritableFileAtPath: lockDir] == NO)
{
NSLog(@"parent directory of lock file '%@' is not writable\n", lockPath);
NSLog(@"parent directory of lock file '%@' is not writable\n", _lockPath);
RELEASE(self);
return nil;
}
if ([fileManager isExecutableFileAtPath: lockDir] == NO)
{
NSLog(@"parent directory of lock file '%@' is not accessible\n",
lockPath);
_lockPath);
RELEASE(self);
return nil;
}
@ -104,7 +104,7 @@
NSDictionary *attributes;
fileManager = [NSFileManager defaultManager];
attributes = [fileManager fileAttributesAtPath: lockPath traverseLink: YES];
attributes = [fileManager fileAttributesAtPath: _lockPath traverseLink: YES];
return [attributes objectForKey: NSFileModificationDate];
}
@ -120,7 +120,7 @@
[attributesToSet setObject: [NSNumber numberWithUnsignedInt: 0755]
forKey: NSFilePosixPermissions];
locked = [fileManager createDirectoryAtPath: lockPath
locked = [fileManager createDirectoryAtPath: _lockPath
attributes: attributesToSet];
if (locked == NO)
{
@ -132,30 +132,30 @@
* then either the other process has removed it's lock (and we can retry)
* or we have a severe problem!
*/
if ([fileManager fileExistsAtPath: lockPath isDirectory: &dir] == NO)
if ([fileManager fileExistsAtPath: _lockPath isDirectory: &dir] == NO)
{
locked = [fileManager createDirectoryAtPath: lockPath
locked = [fileManager createDirectoryAtPath: _lockPath
attributes: attributesToSet];
if (locked == NO)
{
NSLog(@"Failed to create lock directory '%@' - %s",
lockPath, strerror(errno));
_lockPath, strerror(errno));
}
}
}
if (locked == NO)
{
RELEASE(lockTime);
lockTime = nil;
RELEASE(_lockTime);
_lockTime = nil;
return NO;
}
else
{
attributes = [fileManager fileAttributesAtPath: lockPath
attributes = [fileManager fileAttributesAtPath: _lockPath
traverseLink: YES];
RELEASE(lockTime);
lockTime = RETAIN([attributes objectForKey: NSFileModificationDate]);
RELEASE(_lockTime);
_lockTime = RETAIN([attributes objectForKey: NSFileModificationDate]);
return YES;
}
}
@ -165,7 +165,7 @@
NSFileManager *fileManager;
NSDictionary *attributes;
if (lockTime == nil)
if (_lockTime == nil)
[NSException raise: NSGenericException format: @"not locked by us"];
/*
@ -174,19 +174,19 @@
* testing and removing, but we do the bset we can.
*/
fileManager = [NSFileManager defaultManager];
attributes = [fileManager fileAttributesAtPath: lockPath traverseLink: YES];
if ([lockTime isEqual: [attributes objectForKey: NSFileModificationDate]])
attributes = [fileManager fileAttributesAtPath: _lockPath traverseLink: YES];
if ([_lockTime isEqual: [attributes objectForKey: NSFileModificationDate]])
{
if ([fileManager removeFileAtPath: lockPath handler: nil] == NO)
if ([fileManager removeFileAtPath: _lockPath handler: nil] == NO)
[NSException raise: NSGenericException
format: @"Failed to remove lock directory '%@' - %s",
lockPath, strerror(errno)];
_lockPath, strerror(errno)];
}
else
NSLog(@"lock '%@' already broken and in use again\n", lockPath);
NSLog(@"lock '%@' already broken and in use again\n", _lockPath);
RELEASE(lockTime);
lockTime = nil;
RELEASE(_lockTime);
_lockTime = nil;
}
@end

View file

@ -99,18 +99,18 @@ static NSDistributedNotificationCenter *defCenter = nil;
- (void) dealloc
{
if ([[remote connectionForProxy] isValid])
if ([[_remote connectionForProxy] isValid])
{
[remote unregisterClient: (id<GDNCClient>)self];
[_remote unregisterClient: (id<GDNCClient>)self];
}
RELEASE(remote);
RELEASE(_remote);
[super dealloc];
}
- (id) init
{
NSAssert(centerLock == nil, NSInternalInconsistencyException);
centerLock = [NSRecursiveLock new];
NSAssert(_centerLock == nil, NSInternalInconsistencyException);
_centerLock = [NSRecursiveLock new];
return self;
}
@ -159,11 +159,11 @@ static NSDistributedNotificationCenter *defCenter = nil;
format: @"notification name and object both nil"];
}
[centerLock lock];
[_centerLock lock];
NS_DURING
{
[self _connect];
[(id<GDNCProtocol>)remote addObserver: (unsigned long)anObserver
[(id<GDNCProtocol>)_remote addObserver: (unsigned long)anObserver
selector: NSStringFromSelector(aSelector)
name: notificationName
object: anObject
@ -172,11 +172,11 @@ static NSDistributedNotificationCenter *defCenter = nil;
}
NS_HANDLER
{
[centerLock unlock];
[_centerLock unlock];
[localException raise];
}
NS_ENDHANDLER
[centerLock unlock];
[_centerLock unlock];
}
- (void) postNotification: (NSNotification*)notification
@ -223,14 +223,14 @@ static NSDistributedNotificationCenter *defCenter = nil;
format: @"invalid notification object"];
}
[centerLock lock];
[_centerLock lock];
NS_DURING
{
NSData *d;
[self _connect];
d = [NSArchiver archivedDataWithRootObject: userInfo];
[(id<GDNCProtocol>)remote postNotificationName: notificationName
[(id<GDNCProtocol>)_remote postNotificationName: notificationName
object: anObject
userInfo: d
deliverImmediately: deliverImmediately
@ -238,11 +238,11 @@ static NSDistributedNotificationCenter *defCenter = nil;
}
NS_HANDLER
{
[centerLock unlock];
[_centerLock unlock];
[localException raise];
}
NS_ENDHANDLER
[centerLock unlock];
[_centerLock unlock];
}
- (void) removeObserver: (id)anObserver
@ -261,45 +261,45 @@ static NSDistributedNotificationCenter *defCenter = nil;
format: @"invalid notification object"];
}
[centerLock lock];
[_centerLock lock];
NS_DURING
{
[self _connect];
[(id<GDNCProtocol>)remote removeObserver: (unsigned long)anObserver
[(id<GDNCProtocol>)_remote removeObserver: (unsigned long)anObserver
name: notificationName
object: anObject
for: (id<GDNCClient>)self];
}
NS_HANDLER
{
[centerLock unlock];
[_centerLock unlock];
[localException raise];
}
NS_ENDHANDLER
[centerLock unlock];
[_centerLock unlock];
}
- (void) setSuspended: (BOOL)flag
{
[centerLock lock];
[_centerLock lock];
NS_DURING
{
[self _connect];
suspended = flag;
[(id<GDNCProtocol>)remote setSuspended: flag for: (id<GDNCClient>)self];
_suspended = flag;
[(id<GDNCProtocol>)_remote setSuspended: flag for: (id<GDNCClient>)self];
}
NS_HANDLER
{
[centerLock unlock];
[_centerLock unlock];
[localException raise];
}
NS_ENDHANDLER
[centerLock unlock];
[_centerLock unlock];
}
- (BOOL) suspended
{
return suspended;
return _suspended;
}
@end
@ -308,20 +308,20 @@ static NSDistributedNotificationCenter *defCenter = nil;
- (void) _connect
{
if (remote == nil)
if (_remote == nil)
{
/*
* Connect to the NSDistributedNotificationCenter for this host.
*/
remote = RETAIN([NSConnection rootProxyForConnectionWithRegisteredName:
_remote = RETAIN([NSConnection rootProxyForConnectionWithRegisteredName:
GDNC_SERVICE host: @""]);
if (remote != nil)
if (_remote != nil)
{
NSConnection *c = [remote connectionForProxy];
NSConnection *c = [_remote connectionForProxy];
Protocol *p = @protocol(GDNCProtocol);
[remote setProtocolForProxy: p];
[_remote setProtocolForProxy: p];
/*
* Ask to be told if the copnnection goes away.
@ -331,7 +331,7 @@ static NSDistributedNotificationCenter *defCenter = nil;
selector: @selector(_invalidated:)
name: NSConnectionDidDieNotification
object: c];
[remote registerClient: (id<GDNCClient>)self];
[_remote registerClient: (id<GDNCClient>)self];
}
else
{
@ -381,10 +381,10 @@ NSLog(@"Connection to GDNC server established.\n");
removeObserver: self
name: NSConnectionDidDieNotification
object: connection];
NSAssert(connection == [remote connectionForProxy],
NSAssert(connection == [_remote connectionForProxy],
NSInternalInconsistencyException);
RELEASE(remote);
remote = nil;
RELEASE(_remote);
_remote = nil;
}
- (void) postNotificationName: (NSString*)name

View file

@ -79,17 +79,17 @@ _NSFoundationUncaughtExceptionHandler(NSException *exception)
reason: (NSString *)reason
userInfo: (NSDictionary *)userInfo
{
ASSIGN(e_name, name);
ASSIGN(e_reason, reason);
ASSIGN(e_info, userInfo);
ASSIGN(_e_name, name);
ASSIGN(_e_reason, reason);
ASSIGN(_e_info, userInfo);
return self;
}
- (void)dealloc
{
DESTROY(e_name);
DESTROY(e_reason);
DESTROY(e_info);
DESTROY(_e_name);
DESTROY(_e_reason);
DESTROY(_e_info);
[super dealloc];
}
@ -118,17 +118,17 @@ _NSFoundationUncaughtExceptionHandler(NSException *exception)
- (NSString *) name
{
return e_name;
return _e_name;
}
- (NSString *) reason
{
return e_reason;
return _e_reason;
}
- (NSDictionary *) userInfo
{
return e_info;
return _e_info;
}
- (Class) classForPortCoder
@ -143,24 +143,24 @@ _NSFoundationUncaughtExceptionHandler(NSException *exception)
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[aCoder encodeValueOfObjCType: @encode(id) at: &e_name];
[aCoder encodeValueOfObjCType: @encode(id) at: &e_reason];
[aCoder encodeValueOfObjCType: @encode(id) at: &e_info];
[aCoder encodeValueOfObjCType: @encode(id) at: &_e_name];
[aCoder encodeValueOfObjCType: @encode(id) at: &_e_reason];
[aCoder encodeValueOfObjCType: @encode(id) at: &_e_info];
}
- (id) initWithCoder: (NSCoder*)aDecoder
{
[aDecoder decodeValueOfObjCType: @encode(id) at: &e_name];
[aDecoder decodeValueOfObjCType: @encode(id) at: &e_reason];
[aDecoder decodeValueOfObjCType: @encode(id) at: &e_info];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_e_name];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_e_reason];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_e_info];
return self;
}
- (id) deepen
{
e_name = [e_name copyWithZone: [self zone]];
e_reason = [e_reason copyWithZone: [self zone]];
e_info = [e_info copyWithZone: [self zone]];
_e_name = [_e_name copyWithZone: [self zone]];
_e_reason = [_e_reason copyWithZone: [self zone]];
_e_info = [_e_info copyWithZone: [self zone]];
return self;
}
@ -174,12 +174,12 @@ _NSFoundationUncaughtExceptionHandler(NSException *exception)
- (NSString*) description
{
if (e_info)
if (_e_info)
return [NSString stringWithFormat: @"%@ NAME:%@ REASON:%@ INFO:%@",
[super description], e_name, e_reason, e_info];
[super description], _e_name, _e_reason, _e_info];
else
return [NSString stringWithFormat: @"%@ NAME:%@ REASON:%@",
[super description], e_name, e_reason];
[super description], _e_name, _e_reason];
}
@end

View file

@ -196,7 +196,7 @@ static NSFileManager* defaultManager = nil;
- (void) dealloc
{
TEST_RELEASE(lastError);
TEST_RELEASE(_lastError);
[super dealloc];
}
@ -221,7 +221,7 @@ static NSFileManager* defaultManager = nil;
ok = CreateDirectory([self fileSystemRepresentationWithPath: path], NULL);
if (ok == NO)
ASSIGN(lastError, @"Could not create directory");
ASSIGN(_lastError, @"Could not create directory");
return ok;
#else
const char *cpath;
@ -246,13 +246,13 @@ static NSFileManager* defaultManager = nil;
len = strlen(cpath);
if (len > PATH_MAX) // name too long
{
ASSIGN(lastError, @"Could not create directory - name too long");
ASSIGN(_lastError, @"Could not create directory - name too long");
return NO;
}
if (strcmp(cpath, "/") == 0 || len == 0) // cannot use "/" or ""
{
ASSIGN(lastError, @"Could not create directory - no name given");
ASSIGN(_lastError, @"Could not create directory - no name given");
return NO;
}
@ -279,7 +279,7 @@ static NSFileManager* defaultManager = nil;
{
if (cur == len)
{
ASSIGN(lastError, @"Could not create directory - already exists");
ASSIGN(_lastError, @"Could not create directory - already exists");
return NO;
}
}
@ -292,7 +292,7 @@ static NSFileManager* defaultManager = nil;
s = [NSString stringWithFormat: @"Could not create '%s' - '%s'",
dirpath, strerror(errno)];
ASSIGN(lastError, s);
ASSIGN(_lastError, s);
return NO;
}
// if last directory and attributes then change
@ -380,7 +380,7 @@ static NSFileManager* defaultManager = nil;
NSDictionary* errorInfo
= [NSDictionary dictionaryWithObjectsAndKeys:
destination, @"Path",
lastError, @"Error",
_lastError, @"Error",
nil];
return [handler fileManager: self
shouldProceedAfterError: errorInfo];
@ -932,7 +932,7 @@ static NSFileManager* defaultManager = nil;
allOk = NO;
str = [NSString stringWithFormat:
@"Unable to change NSFileOwnerAccountNumber to '%@'", num];
ASSIGN(lastError, str);
ASSIGN(_lastError, str);
}
}
else
@ -954,7 +954,7 @@ static NSFileManager* defaultManager = nil;
allOk = NO;
str = [NSString stringWithFormat:
@"Unable to change NSFileOwnerAccountName to '%@'", str];
ASSIGN(lastError, str);
ASSIGN(_lastError, str);
}
}
}
@ -967,7 +967,7 @@ static NSFileManager* defaultManager = nil;
allOk = NO;
str = [NSString stringWithFormat:
@"Unable to change NSFileGroupOwnerAccountNumber to '%@'", num];
ASSIGN(lastError, str);
ASSIGN(_lastError, str);
}
}
else if ((str=[attributes objectForKey: NSFileGroupOwnerAccountName]) != nil)
@ -987,7 +987,7 @@ static NSFileManager* defaultManager = nil;
allOk = NO;
str = [NSString stringWithFormat:
@"Unable to change NSFileGroupOwnerAccountName to '%@'", str];
ASSIGN(lastError, str);
ASSIGN(_lastError, str);
}
}
#endif /* __WIN32__ */
@ -1000,7 +1000,7 @@ static NSFileManager* defaultManager = nil;
allOk = NO;
str = [NSString stringWithFormat:
@"Unable to change NSFilePosixPermissions to '%o'", [num intValue]];
ASSIGN(lastError, str);
ASSIGN(_lastError, str);
}
}
@ -1034,7 +1034,7 @@ static NSFileManager* defaultManager = nil;
allOk = NO;
str = [NSString stringWithFormat:
@"Unable to change NSFileModificationDate to '%@'", date];
ASSIGN(lastError, str);
ASSIGN(_lastError, str);
}
}
@ -1186,7 +1186,7 @@ static NSFileManager* defaultManager = nil;
/*
recurses into directory `path'
- pushes relative path (relative to root of search) on pathStack
- pushes relative path (relative to root of search) on _pathStack
- pushes system dir enumerator on enumPath
*/
- (void) recurseIntoDirectory: (NSString*)path relativeName: (NSString*)name
@ -1201,8 +1201,8 @@ static NSFileManager* defaultManager = nil;
if (dir)
{
[pathStack addObject: name];
[enumStack addObject: [NSValue valueWithPointer: dir]];
[_pathStack addObject: name];
[_enumStack addObject: [NSValue valueWithPointer: dir]];
}
else
NSLog(@"Failed to recurse into directory '%@' - %s",
@ -1211,18 +1211,18 @@ static NSFileManager* defaultManager = nil;
/*
backtracks enumeration to the previous dir
- pops current dir relative path from pathStack
- pops system dir enumerator from enumStack
- pops current dir relative path from _pathStack
- pops system dir enumerator from _enumStack
- sets currentFile* to nil
*/
- (void) backtrack
{
closedir((DIR*)[[enumStack lastObject] pointerValue]);
[enumStack removeLastObject];
[pathStack removeLastObject];
DESTROY(currentFileName);
DESTROY(currentFilePath);
DESTROY(fileAttributes);
closedir((DIR*)[[_enumStack lastObject] pointerValue]);
[_enumStack removeLastObject];
[_pathStack removeLastObject];
DESTROY(_currentFileName);
DESTROY(_currentFilePath);
DESTROY(_fileAttributes);
}
/*
@ -1244,13 +1244,13 @@ static NSFileManager* defaultManager = nil;
struct stat statbuf;
const char* cpath;
DESTROY(currentFileName);
DESTROY(currentFilePath);
DESTROY(fileAttributes);
DESTROY(_currentFileName);
DESTROY(_currentFilePath);
DESTROY(_fileAttributes);
while ([pathStack count])
while ([_pathStack count])
{
dir = (DIR*)[[enumStack lastObject] pointerValue];
dir = (DIR*)[[_enumStack lastObject] pointerValue];
dirbuf = readdir(dir);
if (dirbuf)
{
@ -1259,20 +1259,20 @@ static NSFileManager* defaultManager = nil;
strcmp(dirbuf->d_name, "..") == 0)
continue;
// Name of current file
currentFileName = [manager
_currentFileName = [manager
stringWithFileSystemRepresentation: dirbuf->d_name
length: strlen(dirbuf->d_name)];
currentFileName = RETAIN([[pathStack lastObject]
stringByAppendingPathComponent: currentFileName]);
_currentFileName = RETAIN([[_pathStack lastObject]
stringByAppendingPathComponent: _currentFileName]);
// Full path of current file
currentFilePath = RETAIN([topPath
stringByAppendingPathComponent: currentFileName]);
_currentFilePath = RETAIN([_topPath
stringByAppendingPathComponent: _currentFileName]);
// Check if directory
cpath = [manager fileSystemRepresentationWithPath: currentFilePath];
if (flags.isRecursive == YES)
cpath = [manager fileSystemRepresentationWithPath: _currentFilePath];
if (_flags.isRecursive == YES)
{
// Do not follow links
if (!flags.isFollowing)
if (!_flags.isFollowing)
{
if (lstat(cpath, &statbuf) != 0)
break;
@ -1287,8 +1287,8 @@ static NSFileManager* defaultManager = nil;
}
if (S_IFDIR == (S_IFMT & statbuf.st_mode))
{
[self recurseIntoDirectory: currentFilePath
relativeName: currentFileName];
[self recurseIntoDirectory: _currentFilePath
relativeName: _currentFileName];
}
}
break; // Got a file name - break out of loop
@ -1307,12 +1307,12 @@ static NSFileManager* defaultManager = nil;
followSymlinks: (BOOL)follow
prefixFiles: (BOOL)prefix
{
pathStack = [NSMutableArray new];
enumStack = [NSMutableArray new];
flags.isRecursive = recurse;
flags.isFollowing = follow;
_pathStack = [NSMutableArray new];
_enumStack = [NSMutableArray new];
_flags.isRecursive = recurse;
_flags.isFollowing = follow;
topPath = RETAIN(path);
_topPath = RETAIN(path);
[self recurseIntoDirectory: path relativeName: @""];
return self;
@ -1320,16 +1320,16 @@ static NSFileManager* defaultManager = nil;
- (void) dealloc
{
while ([pathStack count])
while ([_pathStack count])
[self backtrack];
RELEASE(pathStack);
RELEASE(enumStack);
RELEASE(topPath);
TEST_RELEASE(currentFileName);
TEST_RELEASE(currentFilePath);
TEST_RELEASE(fileAttributes);
TEST_RELEASE(directoryAttributes);
RELEASE(_pathStack);
RELEASE(_enumStack);
RELEASE(_topPath);
TEST_RELEASE(_currentFileName);
TEST_RELEASE(_currentFilePath);
TEST_RELEASE(_fileAttributes);
TEST_RELEASE(_directoryAttributes);
[super dealloc];
}
@ -1337,33 +1337,33 @@ static NSFileManager* defaultManager = nil;
- (NSDictionary*) directoryAttributes
{
if (directoryAttributes == nil)
if (_directoryAttributes == nil)
{
directoryAttributes = [[NSFileManager defaultManager]
fileAttributesAtPath: topPath
traverseLink: flags.isFollowing];
RETAIN(directoryAttributes);
_directoryAttributes = [[NSFileManager defaultManager]
fileAttributesAtPath: _topPath
traverseLink: _flags.isFollowing];
RETAIN(_directoryAttributes);
}
return directoryAttributes;
return _directoryAttributes;
}
- (NSDictionary*) fileAttributes
{
if (fileAttributes == nil)
if (_fileAttributes == nil)
{
fileAttributes = [[NSFileManager defaultManager]
fileAttributesAtPath: currentFilePath
traverseLink: flags.isFollowing];
RETAIN(fileAttributes);
_fileAttributes = [[NSFileManager defaultManager]
fileAttributesAtPath: _currentFilePath
traverseLink: _flags.isFollowing];
RETAIN(_fileAttributes);
}
return fileAttributes;
return _fileAttributes;
}
// Skipping subdirectories
- (void) skipDescendents
{
if ([pathStack count])
if ([_pathStack count])
[self backtrack];
}
@ -1372,7 +1372,7 @@ static NSFileManager* defaultManager = nil;
- (id) nextObject
{
[self findNextFile];
return currentFileName;
return _currentFileName;
}
@end /* NSDirectoryEnumerator */
@ -1381,8 +1381,8 @@ static NSFileManager* defaultManager = nil;
- (NSDictionary*) _attributesForCopy
{
return [[NSFileManager defaultManager]
_attributesAtPath: currentFilePath
traverseLink: flags.isFollowing
_attributesAtPath: _currentFilePath
traverseLink: _flags.isFollowing
forCopy: YES];
}
@end
@ -1578,7 +1578,7 @@ static NSFileManager* defaultManager = nil;
errorInfo = [NSDictionary dictionaryWithObjectsAndKeys:
destinationFile, @"Path",
lastError, @"Error", nil];
_lastError, @"Error", nil];
if (![handler fileManager: self
shouldProceedAfterError: errorInfo])
return NO;
@ -1629,7 +1629,7 @@ static NSFileManager* defaultManager = nil;
s = [NSString stringWithFormat: @"cannot copy file type '%@'",
fileType];
ASSIGN(lastError, s);
ASSIGN(_lastError, s);
NSLog(@"%@: %@", sourceFile, s);
continue;
}

View file

@ -130,10 +130,10 @@ static SEL remSel = @selector(removeObjectAtIndex:);
static void (*remImp)() = 0;
#define NEWINFO(Z,O,L) ((*infImp)(infCls, infSel, (Z), (O), (L)))
#define ADDOBJECT(O) ((*addImp)(infoArray, addSel, (O)))
#define INSOBJECT(O,I) ((*insImp)(infoArray, insSel, (O), (I)))
#define OBJECTAT(I) ((*oatImp)(infoArray, oatSel, (I)))
#define REMOVEAT(I) ((*remImp)(infoArray, remSel, (I)))
#define ADDOBJECT(O) ((*addImp)(_infoArray, addSel, (O)))
#define INSOBJECT(O,I) ((*insImp)(_infoArray, insSel, (O), (I)))
#define OBJECTAT(I) ((*oatImp)(_infoArray, oatSel, (I)))
#define REMOVEAT(I) ((*remImp)(_infoArray, remSel, (I)))
static void _setup()
{
@ -155,9 +155,9 @@ static void
_setAttributesFrom(
NSAttributedString *attributedString,
NSRange aRange,
NSMutableArray *infoArray)
NSMutableArray *_infoArray)
{
NSZone *z = fastZone(infoArray);
NSZone *z = fastZone(_infoArray);
NSRange range;
NSDictionary *attr;
GSAttrInfo *info;
@ -166,7 +166,7 @@ _setAttributesFrom(
/*
* remove any old attributes of the string.
*/
[infoArray removeAllObjects];
[_infoArray removeAllObjects];
if (aRange.length <= 0)
return;
@ -192,7 +192,7 @@ _attributesAtIndexEffectiveRange(
unsigned int index,
NSRange *aRange,
unsigned int tmpLength,
NSMutableArray *infoArray,
NSMutableArray *_infoArray,
unsigned int *foundIndex)
{
unsigned low, high, used, cnt, nextLoc;
@ -205,7 +205,7 @@ _attributesAtIndexEffectiveRange(
@"_attributesAtIndexEffectiveRange()"];
}
used = (*cntImp)(infoArray, cntSel);
used = (*cntImp)(_infoArray, cntSel);
/*
* Binary search for efficiency in huge attributed strings
@ -274,15 +274,15 @@ _attributesAtIndexEffectiveRange(
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
[aCoder encodeValueOfObjCType: @encode(id) at: &textChars];
[aCoder encodeValueOfObjCType: @encode(id) at: &infoArray];
[aCoder encodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder encodeValueOfObjCType: @encode(id) at: &_infoArray];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
self = [super initWithCoder: aCoder];
[aCoder decodeValueOfObjCType: @encode(id) at: &textChars];
[aCoder decodeValueOfObjCType: @encode(id) at: &infoArray];
[aCoder decodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder decodeValueOfObjCType: @encode(id) at: &_infoArray];
return self;
}
@ -291,13 +291,13 @@ _attributesAtIndexEffectiveRange(
{
NSZone *z = fastZone(self);
infoArray = [[NSGMutableArray allocWithZone: z] initWithCapacity: 1];
_infoArray = [[NSGMutableArray allocWithZone: z] initWithCapacity: 1];
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
{
NSAttributedString *as = (NSAttributedString*)aString;
aString = [as string];
_setAttributesFrom(as, NSMakeRange(0, [aString length]), infoArray);
_setAttributesFrom(as, NSMakeRange(0, [aString length]), _infoArray);
}
else
{
@ -308,28 +308,28 @@ _attributesAtIndexEffectiveRange(
RELEASE(info);
}
if (aString == nil)
textChars = @"";
_textChars = @"";
else
textChars = [aString copyWithZone: z];
_textChars = [aString copyWithZone: z];
return self;
}
- (NSString*) string
{
return textChars;
return _textChars;
}
- (NSDictionary*) attributesAtIndex: (unsigned)index
effectiveRange: (NSRange*)aRange
{
return _attributesAtIndexEffectiveRange(
index, aRange, [textChars length], infoArray, NULL);
index, aRange, [_textChars length], _infoArray, NULL);
}
- (void) dealloc
{
RELEASE(textChars);
RELEASE(infoArray);
RELEASE(_textChars);
RELEASE(_infoArray);
[super dealloc];
}
@ -356,15 +356,15 @@ _attributesAtIndexEffectiveRange(
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
[aCoder encodeValueOfObjCType: @encode(id) at: &textChars];
[aCoder encodeValueOfObjCType: @encode(id) at: &infoArray];
[aCoder encodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder encodeValueOfObjCType: @encode(id) at: &_infoArray];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
self = [super initWithCoder: aCoder];
[aCoder decodeValueOfObjCType: @encode(id) at: &textChars];
[aCoder decodeValueOfObjCType: @encode(id) at: &infoArray];
[aCoder decodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder decodeValueOfObjCType: @encode(id) at: &_infoArray];
return self;
}
@ -373,13 +373,13 @@ _attributesAtIndexEffectiveRange(
{
NSZone *z = fastZone(self);
infoArray = [[NSGMutableArray allocWithZone: z] initWithCapacity: 1];
_infoArray = [[NSGMutableArray allocWithZone: z] initWithCapacity: 1];
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
{
NSAttributedString *as = (NSAttributedString*)aString;
aString = [as string];
_setAttributesFrom(as, NSMakeRange(0, [aString length]), infoArray);
_setAttributesFrom(as, NSMakeRange(0, [aString length]), _infoArray);
}
else
{
@ -390,22 +390,22 @@ _attributesAtIndexEffectiveRange(
RELEASE(info);
}
if (aString == nil)
textChars = [[NSGMutableString allocWithZone: z] init];
_textChars = [[NSGMutableString allocWithZone: z] init];
else
textChars = [aString mutableCopyWithZone: z];
_textChars = [aString mutableCopyWithZone: z];
return self;
}
- (NSString*) string
{
return textChars;
return _textChars;
}
- (NSDictionary*) attributesAtIndex: (unsigned)index
effectiveRange: (NSRange*)aRange
{
return _attributesAtIndexEffectiveRange(
index, aRange, [textChars length], infoArray, NULL);
index, aRange, [_textChars length], _infoArray, NULL);
}
- (void) setAttributes: (NSDictionary*)attributes
@ -420,13 +420,13 @@ _attributesAtIndexEffectiveRange(
if (!attributes)
attributes = [NSDictionary dictionary];
tmpLength = [textChars length];
tmpLength = [_textChars length];
GS_RANGE_CHECK(range, tmpLength);
arraySize = (*cntImp)(infoArray, cntSel);
arraySize = (*cntImp)(_infoArray, cntSel);
if (NSMaxRange(range) < tmpLength)
{
attrs = _attributesAtIndexEffectiveRange(
NSMaxRange(range), &effectiveRange, tmpLength, infoArray, &arrayIndex);
NSMaxRange(range), &effectiveRange, tmpLength, _infoArray, &arrayIndex);
afterRangeLoc = NSMaxRange(range);
if (effectiveRange.location > range.location)
@ -503,13 +503,13 @@ _attributesAtIndexEffectiveRange(
if (!aString)
aString = @"";
tmpLength = [textChars length];
tmpLength = [_textChars length];
GS_RANGE_CHECK(range, tmpLength);
arraySize = (*cntImp)(infoArray, cntSel);
arraySize = (*cntImp)(_infoArray, cntSel);
if (NSMaxRange(range) < tmpLength)
{
attrs = _attributesAtIndexEffectiveRange(
NSMaxRange(range), &effectiveRange, tmpLength, infoArray, &arrayIndex);
NSMaxRange(range), &effectiveRange, tmpLength, _infoArray, &arrayIndex);
moveLocations = [aString length] - range.length;
afterRangeLoc = NSMaxRange(range) + moveLocations;
@ -537,7 +537,7 @@ _attributesAtIndexEffectiveRange(
NSRange r = NSMakeRange(arrayIndex + 1, l);
GSAttrInfo *objs[l];
[infoArray getObjects: objs range: r];
[_infoArray getObjects: objs range: r];
for (cnt = 0; cnt < l; cnt++)
{
objs[cnt]->loc += moveLocations;
@ -558,13 +558,13 @@ _attributesAtIndexEffectiveRange(
REMOVEAT(arrayIndex);
arrayIndex--;
}
[textChars replaceCharactersInRange: range withString: aString];
[_textChars replaceCharactersInRange: range withString: aString];
}
- (void) dealloc
{
RELEASE(textChars);
RELEASE(infoArray);
RELEASE(_textChars);
RELEASE(_infoArray);
[super dealloc];
}

View file

@ -62,7 +62,7 @@
@implementation NSGSetEnumerator
- initWithSet: (NSSet*)d
- (id) initWithSet: (NSSet*)d
{
[super init];
set = (NSGSet*)RETAIN(d);
@ -70,7 +70,7 @@
return self;
}
- nextObject
- (id) nextObject
{
GSIMapNode old = node;

View file

@ -19,7 +19,7 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
*/
#include <config.h>
#include <base/preface.h>
@ -30,7 +30,7 @@
#include <Foundation/NSString.h>
#include <Foundation/NSCoder.h>
#include <netdb.h>
/* #include <libc.h> */
/* #include <libc.h>*/
#if defined(__WIN32__) && !defined(__CYGWIN__)
#include <Windows32/Sockets.h>
@ -40,21 +40,21 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif /* __WIN32__ */
#endif /* __WIN32__*/
static NSLock *_hostCacheLock = nil;
static NSLock*_hostCacheLock = nil;
static BOOL _hostCacheEnabled = NO;
static NSMutableDictionary *_hostCache = nil;
static NSMutableDictionary*_hostCache = nil;
@interface NSHost (Private)
+ (NSHost *)_hostWithHostEntry: (struct hostent *)entry;
+ (NSHost *)_hostWithHostEntry: (struct hostent *)entry name: name;
- _initWithHostEntry: (struct hostent *)entry name: name;
+ (NSHost*) _hostWithHostEntry: (struct hostent*)entry;
+ (NSHost*) _hostWithHostEntry: (struct hostent*)entry name: name;
- (id) _initWithHostEntry: (struct hostent*)entry name: name;
@end
@implementation NSHost (Private)
+ (NSHost *)_hostWithHostEntry: (struct hostent *)entry
+ (NSHost*) _hostWithHostEntry: (struct hostent*)entry
{
if (!entry)
return nil;
@ -63,9 +63,9 @@ static NSMutableDictionary *_hostCache = nil;
name: [NSString stringWithCString: entry->h_name]];
}
+ (NSHost *)_hostWithHostEntry: (struct hostent *)entry name: name
+ (NSHost*) _hostWithHostEntry: (struct hostent*)entry name: name
{
NSHost *res = nil;
NSHost*res = nil;
[_hostCacheLock lock];
if (_hostCacheEnabled == YES)
@ -79,43 +79,43 @@ static NSMutableDictionary *_hostCache = nil;
_initWithHostEntry: entry name: name]);
}
- _initWithHostEntry: (struct hostent *)entry name: name
- (id) _initWithHostEntry: (struct hostent*)entry name: name
{
int i;
char *ptr;
char*ptr;
struct in_addr in;
NSString *h_name;
NSString*h_name;
[super init];
if (entry == (struct hostent *)NULL)
if (entry == (struct hostent*)NULL)
{
return nil;
}
names = RETAIN([NSMutableArray array]);
addresses = RETAIN([NSMutableArray array]);
_names = RETAIN([NSMutableArray array]);
_addresses = RETAIN([NSMutableArray array]);
[names addObject: name];
[_names addObject: name];
h_name = [NSString stringWithCString: entry->h_name];
if (![h_name isEqual: name])
{
[names addObject: h_name];
[_names addObject: h_name];
}
for (i = 0, ptr = entry->h_aliases[0]; ptr != NULL; i++,
ptr = entry->h_aliases[i])
{
[names addObject: [NSString stringWithCString: ptr]];
[_names addObject: [NSString stringWithCString: ptr]];
}
for (i = 0, ptr = entry->h_addr_list[0]; ptr != NULL; i++,
ptr = entry->h_addr_list[i])
{
memcpy((void *)&in.s_addr, (const void *)ptr,
memcpy((void*)&in.s_addr, (const void*)ptr,
entry->h_length);
[addresses addObject: [NSString
[_addresses addObject: [NSString
stringWithCString: (char*)inet_ntoa(in)]];
}
@ -133,22 +133,26 @@ static NSMutableDictionary *_hostCache = nil;
@implementation NSHost
- init
- (id) init
{
[self dealloc];
return nil;
}
+ (void)initialize
+ (void) initialize
{
_hostCacheLock = [[NSConditionLock alloc] init];
_hostCache = [NSMutableDictionary new];
if (self == [NSHost class])
{
_hostCacheLock = [[NSConditionLock alloc] init];
_hostCache = [NSMutableDictionary new];
}
}
+ (NSHost *)currentHost
+ (NSHost*) currentHost
{
char name[MAXHOSTNAMELEN];
int res;
struct hostent *h;
struct hostent*h;
res = gethostname(name, sizeof(name));
if (res < 0)
@ -168,9 +172,9 @@ static NSMutableDictionary *_hostCache = nil;
stringWithCString: name]];
}
+ (NSHost *)hostWithName: (NSString *)name
+ (NSHost*) hostWithName: (NSString*)name
{
struct hostent *h;
struct hostent*h;
if (name == nil)
{
@ -178,15 +182,15 @@ static NSMutableDictionary *_hostCache = nil;
return nil;
}
h = gethostbyname((char *)[name cString]);
h = gethostbyname((char*)[name cString]);
return [self _hostWithHostEntry: h name: name];
}
+ (NSHost *)hostWithAddress: (NSString *)address
+ (NSHost*) hostWithAddress: (NSString*)address
{
struct hostent *h;
struct hostent*h;
struct in_addr hostaddr;
if (address == nil)
@ -195,24 +199,24 @@ static NSMutableDictionary *_hostCache = nil;
return nil;
}
hostaddr.s_addr = inet_addr((char *)[address cString]);
hostaddr.s_addr = inet_addr((char*)[address cString]);
if (hostaddr.s_addr == -1)
{
return nil;
}
h = gethostbyaddr((char *)&hostaddr, sizeof(hostaddr), AF_INET);
h = gethostbyaddr((char*)&hostaddr, sizeof(hostaddr), AF_INET);
return [self _hostWithHostEntry: h];
}
+ (void)setHostCacheEnabled: (BOOL)flag
+ (void) setHostCacheEnabled: (BOOL)flag
{
[_hostCacheLock lock];
_hostCacheEnabled = flag;
[_hostCacheLock unlock];
}
+ (BOOL)isHostCacheEnabled;
+ (BOOL) isHostCacheEnabled;
{
BOOL res;
@ -223,19 +227,20 @@ static NSMutableDictionary *_hostCache = nil;
return res;
}
+ (void)flushHostCache
+ (void) flushHostCache
{
[_hostCacheLock lock];
[_hostCache removeAllObjects];
[_hostCacheLock unlock];
}
/* Methods for encoding/decoding */
/* Methods for encoding/decoding*/
- (Class) classForPortCoder
{
return [self class];
}
- replacementObjectForPortCoder: (NSPortCoder*)aCoder
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
{
return self;
}
@ -246,17 +251,17 @@ static NSMutableDictionary *_hostCache = nil;
}
#if 1
/* GNUstep specific method for more efficient decoding. */
/* GNUstep specific method for more efficient decoding.*/
+ (id) newWithCoder: (NSCoder*)aCoder
{
NSString *address = [aCoder decodeObject];
return [NSHost hostWithAddress: address];
}
#else
/* OpenStep methods for decoding (not used) */
/* OpenStep methods for decoding (not used)*/
- (id) awakeAfterUsingCoder: (NSCoder*)aCoder
{
return [NSHost hostWithAddress: [addresses objectAtIndex: 0]];
return [NSHost hostWithAddress: [_addresses objectAtIndex: 0]];
}
- (id) initWithCoder: (NSCoder*)aCoder
@ -265,21 +270,21 @@ static NSMutableDictionary *_hostCache = nil;
[super initWithCoder: aCoder];
address = [aCoder decodeObject];
addresses = [NSArray arrayWithObject: address];
_addresses = [NSArray arrayWithObject: address];
return self;
}
#endif
/*
* The OpenStep spec says that [-hash] must be the same for any two
* objects that [-isEqual: ] returns YES for. We have a problem in
* that [-isEqualToHost: ] is specified to return YES if any name or
* address part of two hosts is the same. That means we can't
* reasonably calculate a hash since two hosts with radically
* different ivar contents may be 'equal'. The best I can think of
* is for all hosts to hash to the same value - which makes it very
* inefficient to store them in a set, dictionary, map or hash table.
*/
* The OpenStep spec says that [-hash] must be the same for any two
* objects that [-isEqual: ] returns YES for. We have a problem in
* that [-isEqualToHost: ] is specified to return YES if any name or
* address part of two hosts is the same. That means we can't
* reasonably calculate a hash since two hosts with radically
* different ivar contents may be 'equal'. The best I can think of
* is for all hosts to hash to the same value - which makes it very
* inefficient to store them in a set, dictionary, map or hash table.
*/
- (unsigned) hash
{
return 1;
@ -294,7 +299,7 @@ static NSMutableDictionary *_hostCache = nil;
return NO;
}
- (BOOL)isEqualToHost: (NSHost *)aHost
- (BOOL) isEqualToHost: (NSHost*)aHost
{
NSArray* a;
int i;
@ -304,49 +309,47 @@ static NSMutableDictionary *_hostCache = nil;
a = [aHost addresses];
for (i = 0; i < [a count]; i++)
if ([addresses containsObject: [a objectAtIndex: i]])
if ([_addresses containsObject: [a objectAtIndex: i]])
return YES;
a = [aHost names];
for (i = 0; i < [a count]; i++)
if ([addresses containsObject: [a objectAtIndex: i]])
if ([_addresses containsObject: [a objectAtIndex: i]])
return YES;
return NO;
}
- (NSString *)name
- (NSString*) name
{
return [names objectAtIndex: 0];
return [_names objectAtIndex: 0];
}
- (NSArray *)names
- (NSArray*) names
{
return names;
return _names;
}
- (NSString *)address
- (NSString*) address
{
return [addresses objectAtIndex: 0];
return [_addresses objectAtIndex: 0];
}
- (NSArray *)addresses
- (NSArray*) addresses
{
return addresses;
return _addresses;
}
- (NSString *)description
- (NSString*) description
{
return [NSString stringWithFormat: @"Host %@ (%@ %@)", [self
name],
[[self names] description], [[self addresses]
description]];
return [NSString stringWithFormat: @"Host %@ (%@ %@)",
[self name], [[self names] description], [[self addresses] description]];
}
- (void) dealloc
{
RELEASE(names);
RELEASE(addresses);
RELEASE(_names);
RELEASE(_addresses);
[super dealloc];
}

View file

@ -32,49 +32,50 @@
@implementation NSInvocation
+ (NSInvocation*) invocationWithMethodSignature: (NSMethodSignature*)signature
+ (NSInvocation*) invocationWithMethodSignature: (NSMethodSignature*)_signature
{
return AUTORELEASE([[NSInvocation alloc] initWithMethodSignature: signature]);
return AUTORELEASE([[NSInvocation alloc]
initWithMethodSignature: _signature]);
}
- (void) dealloc
{
if (argsRetained)
if (_argsRetained)
{
RELEASE(target);
argsRetained = NO;
if (argframe && sig)
RELEASE(_target);
_argsRetained = NO;
if (_argframe && _sig)
{
int i;
for (i = 3; i <= numArgs; i++)
for (i = 3; i <= _numArgs; i++)
{
if (*info[i].type == _C_CHARPTR)
if (*_info[i].type == _C_CHARPTR)
{
char *str;
mframe_get_arg(argframe, &info[i], &str);
mframe_get_arg(_argframe, &_info[i], &str);
objc_free(str);
}
else if (*info[i].type == _C_ID)
else if (*_info[i].type == _C_ID)
{
id obj;
mframe_get_arg(argframe, &info[i], &obj);
mframe_get_arg(_argframe, &_info[i], &obj);
RELEASE(obj);
}
}
}
}
if (argframe)
if (_argframe)
{
mframe_destroy_argframe([sig methodType], argframe);
mframe_destroy_argframe([_sig methodType], _argframe);
}
if (retval)
if (_retval)
{
objc_free(retval);
objc_free(_retval);
}
RELEASE(sig);
RELEASE(_sig);
[super dealloc];
}
@ -85,23 +86,23 @@
- (void) getArgument: (void*)buffer
atIndex: (int)index
{
if ((unsigned)index >= numArgs)
if ((unsigned)index >= _numArgs)
{
[NSException raise: NSInvalidArgumentException
format: @"bad invocation argument index"];
}
if (index == 0)
{
*(id*)buffer = target;
*(id*)buffer = _target;
}
else if (index == 1)
{
*(SEL*)buffer = selector;
*(SEL*)buffer = _selector;
}
else
{
index++; /* Allow offset for return type info. */
mframe_get_arg(argframe, &info[index], buffer);
index++; /* Allow offset for return type _info. */
mframe_get_arg(_argframe, &_info[index], buffer);
}
}
@ -109,34 +110,34 @@
{
const char *type;
if (validReturn == NO)
if (_validReturn == NO)
{
[NSException raise: NSGenericException
format: @"getReturnValue with no value set"];
}
type = [sig methodReturnType];
type = [_sig methodReturnType];
if (*info[0].type != _C_VOID)
if (*_info[0].type != _C_VOID)
{
int length = info[0].size;
int length = _info[0].size;
#if WORDS_BIGENDIAN
if (length < sizeof(void*))
length = sizeof(void*);
#endif
memcpy(buffer, retval, length);
memcpy(buffer, _retval, length);
}
}
- (SEL) selector
{
return selector;
return _selector;
}
- (void) setArgument: (void*)buffer
atIndex: (int)index
{
if ((unsigned)index >= numArgs)
if ((unsigned)index >= _numArgs)
{
[NSException raise: NSInvalidArgumentException
format: @"bad invocation argument index"];
@ -151,17 +152,17 @@
}
else
{
int i = index+1; /* Allow for return type in 'info' */
const char *type = info[i].type;
int i = index+1; /* Allow for return type in '_info' */
const char *type = _info[i].type;
if (argsRetained && (*type == _C_ID || *type == _C_CHARPTR))
if (_argsRetained && (*type == _C_ID || *type == _C_CHARPTR))
{
if (*type == _C_ID)
{
id old;
mframe_get_arg(argframe, &info[i], &old);
mframe_set_arg(argframe, &info[i], buffer);
mframe_get_arg(_argframe, &_info[i], &old);
mframe_set_arg(_argframe, &_info[i], buffer);
RETAIN(*(id*)buffer);
if (old != nil)
{
@ -173,17 +174,17 @@
char *oldstr;
char *newstr = *(char**)buffer;
mframe_get_arg(argframe, &info[i], &oldstr);
mframe_get_arg(_argframe, &_info[i], &oldstr);
if (newstr == 0)
{
mframe_set_arg(argframe, &info[i], buffer);
mframe_set_arg(_argframe, &_info[i], buffer);
}
else
{
char *tmp = objc_malloc(strlen(newstr)+1);
strcpy(tmp, newstr);
mframe_set_arg(argframe, &info[i], tmp);
mframe_set_arg(_argframe, &_info[i], tmp);
}
if (oldstr != 0)
{
@ -193,7 +194,7 @@
}
else
{
mframe_set_arg(argframe, &info[i], buffer);
mframe_set_arg(_argframe, &_info[i], buffer);
}
}
}
@ -202,38 +203,38 @@
{
const char *type;
type = info[0].type;
type = _info[0].type;
if (*type != _C_VOID)
{
int length = info[0].size;
int length = _info[0].size;
#if WORDS_BIGENDIAN
if (length < sizeof(void*))
length = sizeof(void*);
#endif
memcpy(retval, buffer, length);
memcpy(_retval, buffer, length);
}
validReturn = YES;
_validReturn = YES;
}
- (void) setSelector: (SEL)aSelector
{
selector = aSelector;
_selector = aSelector;
}
- (void) setTarget: (id)anObject
{
if (argsRetained)
if (_argsRetained)
{
ASSIGN(target, anObject);
ASSIGN(_target, anObject);
}
target = anObject;
_target = anObject;
}
- (id) target
{
return target;
return _target;
}
/*
@ -242,12 +243,12 @@
- (BOOL) argumentsRetained
{
return argsRetained;
return _argsRetained;
}
- (void)retainArguments
- (void) retainArguments
{
if (argsRetained)
if (_argsRetained)
{
return;
}
@ -255,21 +256,21 @@
{
int i;
argsRetained = YES;
RETAIN(target);
if (argframe == 0)
_argsRetained = YES;
RETAIN(_target);
if (_argframe == 0)
{
return;
}
for (i = 3; i <= numArgs; i++)
for (i = 3; i <= _numArgs; i++)
{
if (*info[i].type == _C_ID || *info[i].type == _C_CHARPTR)
if (*_info[i].type == _C_ID || *_info[i].type == _C_CHARPTR)
{
if (*info[i].type == _C_ID)
if (*_info[i].type == _C_ID)
{
id old;
mframe_get_arg(argframe, &info[i], &old);
mframe_get_arg(_argframe, &_info[i], &old);
if (old != nil)
{
RETAIN(old);
@ -279,13 +280,13 @@
{
char *str;
mframe_get_arg(argframe, &info[i], &str);
mframe_get_arg(_argframe, &_info[i], &str);
if (str != 0)
{
char *tmp = objc_malloc(strlen(str)+1);
strcpy(tmp, str);
mframe_set_arg(argframe, &info[i], &tmp);
mframe_set_arg(_argframe, &_info[i], &tmp);
}
}
}
@ -299,10 +300,10 @@
- (void) invoke
{
[self invokeWithTarget: target];
[self invokeWithTarget: _target];
}
- (void) invokeWithTarget:(id)anObject
- (void) invokeWithTarget: (id)anObject
{
id old_target;
retval_t returned;
@ -314,57 +315,57 @@
*/
if (anObject == nil)
{
memset(retval, '\0', info[0].size); /* Clear return value */
memset(_retval, '\0', _info[0].size); /* Clear return value */
return;
}
NSAssert(selector != 0, @"you must set the selector before invoking");
NSAssert(_selector != 0, @"you must set the selector before invoking");
/*
* Temporarily set new target and copy it (and the selector) into the
* argframe.
* _argframe.
*/
old_target = RETAIN(target);
old_target = RETAIN(_target);
[self setTarget: anObject];
mframe_set_arg(argframe, &info[1], &target);
mframe_set_arg(_argframe, &_info[1], &_target);
mframe_set_arg(argframe, &info[2], &selector);
mframe_set_arg(_argframe, &_info[2], &_selector);
imp = method_get_imp(object_is_instance(target) ?
imp = method_get_imp(object_is_instance(_target) ?
class_get_instance_method(
((struct objc_class*)target)->class_pointer, selector)
((struct objc_class*)_target)->class_pointer, _selector)
: class_get_class_method(
((struct objc_class*)target)->class_pointer, selector));
((struct objc_class*)_target)->class_pointer, _selector));
/*
* If fast lookup failed, we may be forwarding or something ...
*/
if (imp == 0)
imp = objc_msg_lookup(target, selector);
imp = objc_msg_lookup(_target, _selector);
[self setTarget: old_target];
RELEASE(old_target);
stack_argsize = [sig frameLength];
stack_argsize = [_sig frameLength];
returned = __builtin_apply((void(*)(void))imp, argframe, stack_argsize);
if (info[0].size)
returned = __builtin_apply((void(*)(void))imp, _argframe, stack_argsize);
if (_info[0].size)
{
mframe_decode_return(info[0].type, retval, returned);
mframe_decode_return(_info[0].type, _retval, returned);
}
validReturn = YES;
_validReturn = YES;
}
/*
* Getting the method signature.
* Getting the method _signature.
*/
- (NSMethodSignature*) methodSignature
{
return sig;
return _sig;
}
- (NSString*)description
- (NSString*) description
{
/*
* Don't use -[NSString stringWithFormat:] method because it can cause
@ -375,8 +376,8 @@
sprintf (buffer, "<%s %p selector: %s target: %s>", \
(char*)object_get_class_name(self), \
self, \
selector ? [NSStringFromSelector(selector) cString] : "nil", \
target ? [NSStringFromClass([target class]) cString] : "nil" \
_selector ? [NSStringFromSelector(_selector) cString] : "nil", \
_target ? [NSStringFromClass([_target class]) cString] : "nil" \
);
return [NSString stringWithCString:buffer];
@ -384,23 +385,23 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
const char *types = [sig methodType];
const char *types = [_sig methodType];
int i;
[aCoder encodeValueOfObjCType: @encode(char*)
at: &types];
[aCoder encodeObject: target];
[aCoder encodeObject: _target];
[aCoder encodeValueOfObjCType: info[2].type
at: &selector];
[aCoder encodeValueOfObjCType: _info[2].type
at: &_selector];
for (i = 3; i <= numArgs; i++)
for (i = 3; i <= _numArgs; i++)
{
const char *type = info[i].type;
const char *type = _info[i].type;
void *datum;
datum = mframe_arg_addr(argframe, &info[i]);
datum = mframe_arg_addr(_argframe, &_info[i]);
if (*type == _C_ID)
{
@ -417,12 +418,12 @@
[aCoder encodeValueOfObjCType: type at: datum];
}
}
if (*info[0].type != _C_VOID)
if (*_info[0].type != _C_VOID)
{
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &validReturn];
if (validReturn)
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_validReturn];
if (_validReturn)
{
[aCoder encodeValueOfObjCType: info[0].type at: retval];
[aCoder encodeValueOfObjCType: _info[0].type at: _retval];
}
}
}
@ -438,32 +439,32 @@
newSig = [NSMethodSignature signatureWithObjCTypes: types];
self = [self initWithMethodSignature: newSig];
[aCoder decodeValueOfObjCType: @encode(id) at: &target];
[aCoder decodeValueOfObjCType: @encode(id) at: &_target];
[aCoder decodeValueOfObjCType: @encode(SEL) at: &selector];
[aCoder decodeValueOfObjCType: @encode(SEL) at: &_selector];
for (i = 3; i <= numArgs; i++)
for (i = 3; i <= _numArgs; i++)
{
datum = mframe_arg_addr(argframe, &info[i]);
datum = mframe_arg_addr(_argframe, &_info[i]);
#if MFRAME_STRUCT_BYREF
{
const char *t = info[i].type;
const char *t = _info[i].type;
if (*t == _C_STRUCT_B || *t == _C_UNION_B || *t == _C_ARY_B)
{
*(void**)datum = _fastMallocBuffer(info[i].size);
*(void**)datum = _fastMallocBuffer(_info[i].size);
datum = *(void**)datum;
}
}
#endif
[aCoder decodeValueOfObjCType: info[i].type at: datum];
[aCoder decodeValueOfObjCType: _info[i].type at: datum];
}
argsRetained = YES;
if (*info[0].type != _C_VOID)
_argsRetained = YES;
if (*_info[0].type != _C_VOID)
{
[aCoder decodeValueOfObjCType: @encode(BOOL) at: &validReturn];
if (validReturn)
[aCoder decodeValueOfObjCType: @encode(BOOL) at: &_validReturn];
if (_validReturn)
{
[aCoder decodeValueOfObjCType: info[0].type at: retval];
[aCoder decodeValueOfObjCType: _info[0].type at: _retval];
}
}
return self;
@ -475,7 +476,7 @@
@implementation NSInvocation (GNUstep)
- initWithArgframe: (arglist_t)frame selector: (SEL)aSelector
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector
{
const char *types;
NSMethodSignature *newSig;
@ -497,16 +498,16 @@
{
[self setSelector: aSelector];
/*
* Copy the argframe we were given.
* Copy the _argframe we were given.
*/
if (frame)
{
int i;
mframe_get_arg(frame, &info[1], &target);
for (i = 1; i <= numArgs; i++)
mframe_get_arg(frame, &_info[1], &_target);
for (i = 1; i <= _numArgs; i++)
{
mframe_cpy_arg(argframe, frame, &info[i]);
mframe_cpy_arg(_argframe, frame, &_info[i]);
}
}
}
@ -514,27 +515,27 @@
}
/*
* This is the designated initialiser.
* This is the de_signated initialiser.
*/
- initWithMethodSignature: (NSMethodSignature*)aSignature
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature
{
sig = RETAIN(aSignature);
numArgs = [aSignature numberOfArguments];
info = [aSignature methodInfo];
argframe = mframe_create_argframe([sig methodType], &retval);
if (retval == 0 && info[0].size > 0)
_sig = RETAIN(aSignature);
_numArgs = [aSignature numberOfArguments];
_info = [aSignature methodInfo];
_argframe = mframe_create_argframe([_sig methodType], &_retval);
if (_retval == 0 && _info[0].size > 0)
{
retval = objc_malloc(info[0].size);
_retval = objc_malloc(_info[0].size);
}
return self;
}
- initWithSelector: (SEL)aSelector
- (id) initWithSelector: (SEL)aSelector
{
return [self initWithArgframe: 0 selector: aSelector];
}
- initWithTarget: anObject selector: (SEL)aSelector, ...
- (id) initWithTarget: anObject selector: (SEL)aSelector, ...
{
va_list ap;
@ -545,27 +546,27 @@
[self setTarget: anObject];
va_start (ap, aSelector);
for (i = 3; i <= numArgs; i++)
for (i = 3; i <= _numArgs; i++)
{
const char *type = info[i].type;
unsigned size = info[i].size;
const char *type = _info[i].type;
unsigned size = _info[i].size;
void *datum;
datum = mframe_arg_addr(argframe, &info[i]);
datum = mframe_arg_addr(_argframe, &_info[i]);
#define CASE_TYPE(_C,_T) case _C: *(_T*)datum = va_arg (ap, _T); break
switch (*type)
{
case _C_ID:
*(id*)datum = va_arg (ap, id);
if (argsRetained)
if (_argsRetained)
{
RETAIN(*(id*)datum);
}
break;
case _C_CHARPTR:
*(char**)datum = va_arg (ap, char*);
if (argsRetained)
if (_argsRetained)
{
char *old = *(char**)datum;
@ -612,7 +613,7 @@
- (void*) returnFrame: (arglist_t)argFrame
{
return mframe_handle_return(info[0].type, retval, argFrame);
return mframe_handle_return(_info[0].type, _retval, argFrame);
}
@end

View file

@ -1,5 +1,5 @@
/* Mutual exclusion locking classes
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996 Free Software Foundation< Inc.
Author: Scott Christley <scottc@net-community.com>
Created: 1996
@ -9,16 +9,16 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 2 of the License< or (at your option) any later version.
This library is distributed in the hope that it will be useful,
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
License along with this library; if not< write to the Free
Software Foundation< Inc.< 59 Temple Place< Suite 330< Boston< MA 02111 USA.
*/
#include <config.h>
@ -63,13 +63,13 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
@implementation NSLock
// Designated initializer
- init
- (id) init
{
[super init];
// Allocate the mutex from the runtime
mutex = objc_mutex_allocate();
if (!mutex)
_mutex = objc_mutex_allocate();
if (!_mutex)
{
NSLog(@"Failed to allocate a mutex");
return nil;
@ -81,7 +81,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
{
// Ask the runtime to deallocate the mutex
// If there are outstanding locks then it will block
if (objc_mutex_deallocate (mutex) == -1)
if (objc_mutex_deallocate(_mutex) == -1)
{
[NSException raise:NSLockException
format:@"invalid mutex"];
@ -94,16 +94,16 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
// Does not block
- (BOOL) tryLock
{
CHECK_RECURSIVE_LOCK (mutex);
CHECK_RECURSIVE_LOCK(_mutex);
// Ask the runtime to acquire a lock on the mutex
if (objc_mutex_trylock (mutex) == -1)
if (objc_mutex_trylock(_mutex) == -1)
return NO;
else
return YES;
}
- (BOOL)lockBeforeDate:(NSDate *)limit
- (BOOL) lockBeforeDate: (NSDate *)limit
{
[self notImplemented: _cmd];
return NO;
@ -112,11 +112,11 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
// NSLocking protocol
- (void) lock
{
CHECK_RECURSIVE_LOCK (mutex);
CHECK_RECURSIVE_LOCK(_mutex);
// Ask the runtime to acquire a lock on the mutex
// This will block
if (objc_mutex_lock (mutex) == -1)
if (objc_mutex_lock(_mutex) == -1)
{
[NSException raise:NSLockException
format:@"failed to lock mutex"];
@ -124,10 +124,10 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
}
- (void)unlock
- (void) unlock
{
// Ask the runtime to release a lock on the mutex
if (objc_mutex_unlock (mutex) == -1)
if (objc_mutex_unlock(_mutex) == -1)
{
[NSException raise:NSLockException
format:@"unlock: failed to unlock mutex"];
@ -143,28 +143,28 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
@implementation NSConditionLock
- init
- (id) init
{
return [self initWithCondition: 0];
}
// Designated initializer
// Initialize lock with condition
- (id)initWithCondition:(int)value
- (id) initWithCondition: (int)value
{
[super init];
condition_value = value;
_condition_value = value;
// Allocate the mutex from the runtime
condition = objc_condition_allocate ();
if (!condition)
_condition = objc_condition_allocate ();
if (!_condition)
{
NSLog(@"Failed to allocate a condition");
return nil;
}
mutex = objc_mutex_allocate ();
if (!mutex)
_mutex = objc_mutex_allocate ();
if (!_mutex)
{
NSLog(@"Failed to allocate a mutex");
return nil;
@ -172,17 +172,17 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
return self;
}
- (void)dealloc
- (void) dealloc
{
// Ask the runtime to deallocate the mutex
// If there are outstanding locks then it will block
if (objc_condition_deallocate (condition) == -1)
if (objc_condition_deallocate(_condition) == -1)
{
[NSException raise:NSConditionLockException
format:@"dealloc: invalid condition"];
/* NOT REACHED */
}
if (objc_mutex_deallocate (mutex) == -1)
if (objc_mutex_deallocate(_mutex) == -1)
{
[NSException raise:NSConditionLockException
format:@"dealloc: invalid mutex"];
@ -192,26 +192,26 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
// Return the current condition of the lock
- (int)condition
- (int) condition
{
return condition_value;
return _condition_value;
}
// Acquiring and release the lock
- (void) lockWhenCondition: (int)value
{
CHECK_RECURSIVE_CONDITION_LOCK (mutex);
CHECK_RECURSIVE_CONDITION_LOCK(_mutex);
if (objc_mutex_lock (mutex) == -1)
if (objc_mutex_lock(_mutex) == -1)
{
[NSException raise:NSConditionLockException
format:@"lockWhenCondition: failed to lock mutex"];
/* NOT REACHED */
}
while (condition_value != value)
while (_condition_value != value)
{
if (objc_condition_wait (condition,mutex) == -1)
if (objc_condition_wait(_condition, _mutex) == -1)
{
[NSException raise:NSConditionLockException
format:@"objc_condition_wait failed"];
@ -225,7 +225,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
int depth;
// First check to make sure we have the lock
depth = objc_mutex_trylock (mutex);
depth = objc_mutex_trylock(_mutex);
// Another thread has the lock so abort
if (depth == -1)
@ -236,7 +236,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
// If the depth is only 1 then we just acquired
// the lock above, bogus unlock so abort
// the lock above< bogus unlock so abort
if (depth == 1)
{
[NSException raise:NSConditionLockException
@ -245,10 +245,10 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
// This is a valid unlock so set the condition
condition_value = value;
_condition_value = value;
// wake up blocked threads
if (objc_condition_broadcast(condition) == -1)
if (objc_condition_broadcast(_condition) == -1)
{
[NSException raise:NSConditionLockException
format:@"unlockWithCondition: objc_condition_broadcast failed"];
@ -256,8 +256,8 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
// and unlock twice
if ((objc_mutex_unlock (mutex) == -1)
|| (objc_mutex_unlock (mutex) == -1))
if ((objc_mutex_unlock(_mutex) == -1)
|| (objc_mutex_unlock(_mutex) == -1))
{
[NSException raise:NSConditionLockException
format:@"unlockWithCondition: failed to unlock mutex"];
@ -267,10 +267,10 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
- (BOOL) tryLock
{
CHECK_RECURSIVE_CONDITION_LOCK (mutex);
CHECK_RECURSIVE_CONDITION_LOCK(_mutex);
// Ask the runtime to acquire a lock on the mutex
if (objc_mutex_trylock(mutex) == -1)
if (objc_mutex_trylock(_mutex) == -1)
return NO;
else
return YES;
@ -285,7 +285,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
return NO;
// If we got the lock is it the right condition?
if (condition_value == value)
if (_condition_value == value)
return YES;
else
{
@ -296,15 +296,15 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
// Acquiring the lock with a date condition
- (BOOL)lockBeforeDate:(NSDate *)limit
- (BOOL) lockBeforeDate: (NSDate*)limit
{
[self notImplemented: _cmd];
return NO;
}
- (BOOL)lockWhenCondition:(int)condition_to_meet
beforeDate:(NSDate *)limitDate
- (BOOL) lockWhenCondition: (int)condition_to_meet
beforeDate: (NSDate*)limitDate
{
#ifndef HAVE_OBJC_CONDITION_TIMEDWAIT
[self notImplemented: _cmd];
@ -313,13 +313,13 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
NSTimeInterval atimeinterval;
struct timespec endtime;
CHECK_RECURSIVE_CONDITION_LOCK (mutex);
CHECK_RECURSIVE_CONDITION_LOCK(_mutex);
if( -1 == objc_mutex_lock(mutex) )
if (-1 == objc_mutex_lock(_mutex))
[NSException raise:NSConditionLockException
format:@"lockWhenCondition: failed to lock mutex"];
if( condition_value == condition_to_meet )
if (_condition_value == condition_to_meet)
return YES;
atimeinterval = [limitDate timeIntervalSince1970];
@ -327,9 +327,9 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
endtime.tv_nsec = (unsigned int)((atimeinterval - (float)endtime.tv_sec)
* 1000000000.0);
while( condition_value != condition_to_meet )
while( _condition_value != condition_to_meet)
{
switch(objc_condition_timedwait(condition,mutex,&endtime))
switch(objc_condition_timedwait(_condition, _mutex, &endtime))
{
case 0:
break;
@ -353,11 +353,11 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
// These methods ignore the condition
- (void) lock
{
CHECK_RECURSIVE_CONDITION_LOCK (mutex);
CHECK_RECURSIVE_CONDITION_LOCK(_mutex);
// Ask the runtime to acquire a lock on the mutex
// This will block
if (objc_mutex_lock (mutex) == -1)
if (objc_mutex_lock(_mutex) == -1)
{
[NSException raise:NSConditionLockException
format:@"lock: failed to lock mutex"];
@ -365,10 +365,10 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
}
- (void)unlock
- (void) unlock
{
// wake up blocked threads
if (objc_condition_broadcast(condition) == -1)
if (objc_condition_broadcast(_condition) == -1)
{
[NSException raise:NSConditionLockException
format:@"unlockWithCondition: objc_condition_broadcast failed"];
@ -376,7 +376,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
// Ask the runtime to release a lock on the mutex
if (objc_mutex_unlock (mutex) == -1)
if (objc_mutex_unlock(_mutex) == -1)
{
[NSException raise:NSConditionLockException
format:@"unlock: failed to unlock mutex"];
@ -397,13 +397,13 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
@implementation NSRecursiveLock
// Designated initializer
- init
- (id) init
{
[super init];
// Allocate the mutex from the runtime
mutex = objc_mutex_allocate();
if (!mutex)
_mutex = objc_mutex_allocate();
if (!_mutex)
{
NSLog(@"Failed to allocate a mutex");
return nil;
@ -415,7 +415,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
{
// Ask the runtime to deallocate the mutex
// If there are outstanding locks then it will block
if (objc_mutex_deallocate (mutex) == -1)
if (objc_mutex_deallocate(_mutex) == -1)
{
[NSException raise:NSRecursiveLockException
format:@"dealloc: invalid mutex"];
@ -429,13 +429,13 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
- (BOOL) tryLock
{
// Ask the runtime to acquire a lock on the mutex
if (objc_mutex_trylock (mutex) == -1)
if (objc_mutex_trylock(_mutex) == -1)
return NO;
else
return YES;
}
- (BOOL)lockBeforeDate:(NSDate *)limit
- (BOOL) lockBeforeDate: (NSDate *)limit
{
[self notImplemented: _cmd];
return NO;
@ -446,7 +446,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
{
// Ask the runtime to acquire a lock on the mutex
// This will block
if (objc_mutex_lock (mutex) == -1)
if (objc_mutex_lock(_mutex) == -1)
{
[NSException raise:NSRecursiveLockException
format:@"lock: failed to lock mutex"];
@ -454,10 +454,10 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
}
}
- (void)unlock
- (void) unlock
{
// Ask the runtime to release a lock on the mutex
if (objc_mutex_unlock (mutex) == -1)
if (objc_mutex_unlock(_mutex) == -1)
{
[NSException raise:NSRecursiveLockException
format:@"unlock: failed to unlock mutex"];

View file

@ -36,79 +36,86 @@
+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)t
{
NSMethodSignature *newMs = [[NSMethodSignature alloc] autorelease];
NSMethodSignature *newMs = [[NSMethodSignature alloc] autorelease];
newMs->methodTypes = mframe_build_signature(t, &newMs->argFrameLength,
&newMs->numArgs, 0);
newMs->_methodTypes = mframe_build_signature(t, &newMs->_argFrameLength,
&newMs->_numArgs, 0);
return newMs;
return newMs;
}
- (NSArgumentInfo) argumentInfoAtIndex: (unsigned)index
{
if (index >= numArgs) {
[NSException raise: NSInvalidArgumentException
format: @"Index too high."];
if (index >= _numArgs)
{
[NSException raise: NSInvalidArgumentException
format: @"Index too high."];
}
if (info == 0) {
[self methodInfo];
if (_info == 0)
{
[self methodInfo];
}
return info[index+1];
return _info[index+1];
}
- (unsigned) frameLength
{
return argFrameLength;
return _argFrameLength;
}
- (const char*) getArgumentTypeAtIndex: (unsigned)index
{
if (index >= numArgs) {
[NSException raise: NSInvalidArgumentException
format: @"Index too high."];
if (index >= _numArgs)
{
[NSException raise: NSInvalidArgumentException
format: @"Index too high."];
}
if (info == 0) {
[self methodInfo];
if (_info == 0)
{
[self methodInfo];
}
return info[index+1].type;
return _info[index+1].type;
}
- (BOOL) isOneway
{
if (info == 0) {
[self methodInfo];
if (_info == 0)
{
[self methodInfo];
}
return (info[0].qual & _F_ONEWAY) ? YES : NO;
return (_info[0].qual & _F_ONEWAY) ? YES : NO;
}
- (unsigned) methodReturnLength
{
if (info == 0) {
[self methodInfo];
if (_info == 0)
{
[self methodInfo];
}
return info[0].size;
return _info[0].size;
}
- (const char*) methodReturnType
{
if (info == 0) {
[self methodInfo];
if (_info == 0)
{
[self methodInfo];
}
return info[0].type;
return _info[0].type;
}
- (unsigned) numberOfArguments
{
return numArgs;
return _numArgs;
}
- (void) dealloc
{
if (methodTypes)
objc_free((void*)methodTypes);
if (info)
objc_free((void*)info);
[super dealloc];
if (_methodTypes)
objc_free((void*)_methodTypes);
if (_info)
objc_free((void*)_info);
[super dealloc];
}
@end
@ -116,20 +123,22 @@
@implementation NSMethodSignature(GNU)
- (NSArgumentInfo*) methodInfo
{
if (info == 0) {
const char *types = methodTypes;
int i;
if (_info == 0)
{
const char *types = _methodTypes;
int i;
info = objc_malloc(sizeof(NSArgumentInfo)*(numArgs+1));
for (i = 0; i <= numArgs; i++) {
types = mframe_next_arg(types, &info[i]);
_info = objc_malloc(sizeof(NSArgumentInfo)*(_numArgs+1));
for (i = 0; i <= _numArgs; i++)
{
types = mframe_next_arg(types, &_info[i]);
}
}
return info;
return _info;
}
- (const char*) methodType
{
return methodTypes;
return _methodTypes;
}
@end

View file

@ -192,7 +192,7 @@ typedef struct NCTbl {
short cacheIndex;
} NCTable;
#define TABLE ((NCTable*)table)
#define TABLE ((NCTable*)_table)
#define WILDCARD (TABLE->wildcard)
#define NAMELESS (TABLE->nameless)
#define NAMED (TABLE->named)

View file

@ -232,12 +232,12 @@ static void
remove_from_queue(
NSNotificationQueueList* queue,
NSNotificationQueueRegistration* item,
NSZone* zone)
NSZone* _zone)
{
remove_from_queue_no_release(queue, item);
RELEASE(item->notification);
RELEASE(item->modes);
NSZoneFree(zone, item);
NSZoneFree(_zone, item);
}
static void
@ -245,10 +245,10 @@ add_to_queue(
NSNotificationQueueList* queue,
NSNotification* notification,
NSArray* modes,
NSZone* zone)
NSZone* _zone)
{
NSNotificationQueueRegistration* item =
NSZoneCalloc(zone, 1, sizeof(NSNotificationQueueRegistration));
NSZoneCalloc(_zone, 1, sizeof(NSNotificationQueueRegistration));
item->notification = RETAIN(notification);
item->name = [notification name];
@ -297,12 +297,12 @@ add_to_queue(
- (id) initWithNotificationCenter: (NSNotificationCenter*)notificationCenter
{
zone = [self zone];
_zone = [self zone];
// init queue
center = RETAIN(notificationCenter);
asapQueue = NSZoneCalloc(zone, 1, sizeof(NSNotificationQueueList));
idleQueue = NSZoneCalloc(zone, 1, sizeof(NSNotificationQueueList));
_center = RETAIN(notificationCenter);
_asapQueue = NSZoneCalloc(_zone, 1, sizeof(NSNotificationQueueList));
_idleQueue = NSZoneCalloc(_zone, 1, sizeof(NSNotificationQueueList));
// insert in global queue list
[NotificationQueueList registerQueue: self];
@ -318,15 +318,15 @@ add_to_queue(
[NotificationQueueList unregisterQueue: self];
// release self
for (item = asapQueue->head; item; item=item->prev)
remove_from_queue(asapQueue, item, zone);
NSZoneFree(zone, asapQueue);
for (item = _asapQueue->head; item; item=item->prev)
remove_from_queue(_asapQueue, item, _zone);
NSZoneFree(_zone, _asapQueue);
for (item = idleQueue->head; item; item=item->prev)
remove_from_queue(idleQueue, item, zone);
NSZoneFree(zone, idleQueue);
for (item = _idleQueue->head; item; item=item->prev)
remove_from_queue(_idleQueue, item, _zone);
NSZoneFree(_zone, _idleQueue);
RELEASE(center);
RELEASE(_center);
[super dealloc];
}
@ -341,37 +341,37 @@ add_to_queue(
id object = [notification object];
// find in ASAP notification in queue
for (item = asapQueue->tail; item; item=next)
for (item = _asapQueue->tail; item; item=next)
{
next = item->next;
if ((coalesceMask & NSNotificationCoalescingOnName)
&& [name isEqual: item->name])
{
remove_from_queue(asapQueue, item, zone);
remove_from_queue(_asapQueue, item, _zone);
continue;
}
if ((coalesceMask & NSNotificationCoalescingOnSender)
&& (object == item->object))
{
remove_from_queue(asapQueue, item, zone);
remove_from_queue(_asapQueue, item, _zone);
continue;
}
}
// find in idle notification in queue
for (item = idleQueue->tail; item; item=next)
for (item = _idleQueue->tail; item; item=next)
{
next = item->next;
if ((coalesceMask & NSNotificationCoalescingOnName)
&& [name isEqual: item->name])
{
remove_from_queue(asapQueue, item, zone);
remove_from_queue(_asapQueue, item, _zone);
continue;
}
if ((coalesceMask & NSNotificationCoalescingOnSender)
&& (object == item->object))
{
remove_from_queue(asapQueue, item, zone);
remove_from_queue(_asapQueue, item, _zone);
continue;
}
}
@ -386,7 +386,7 @@ add_to_queue(
if (mode == nil || modes == nil
|| [modes indexOfObject: mode] != NSNotFound)
{
[center postNotification: notification];
[_center postNotification: notification];
}
}
@ -415,10 +415,10 @@ add_to_queue(
[self postNotification: notification forModes: modes];
break;
case NSPostASAP:
add_to_queue(asapQueue, notification, modes, zone);
add_to_queue(_asapQueue, notification, modes, _zone);
break;
case NSPostWhenIdle:
add_to_queue(idleQueue, notification, modes, zone);
add_to_queue(_idleQueue, notification, modes, _zone);
break;
}
}
@ -432,7 +432,7 @@ add_to_queue(
static inline void notifyASAP(NSNotificationQueue *q)
{
NSNotificationQueueList *list = ((accessQueue)q)->asapQueue;
NSNotificationQueueList *list = ((accessQueue)q)->_asapQueue;
/*
* post all ASAP notifications in queue
@ -447,7 +447,7 @@ static inline void notifyASAP(NSNotificationQueue *q)
[q postNotification: notification forModes: modes];
RELEASE(notification);
RELEASE(modes);
NSZoneFree(((accessQueue)q)->zone, item);
NSZoneFree(((accessQueue)q)->_zone, item);
}
}
@ -463,7 +463,7 @@ GSNotifyASAP()
static inline void notifyIdle(NSNotificationQueue *q)
{
NSNotificationQueueList *list = ((accessQueue)q)->idleQueue;
NSNotificationQueueList *list = ((accessQueue)q)->_idleQueue;
/*
* post next IDLE notification in queue
@ -478,7 +478,7 @@ static inline void notifyIdle(NSNotificationQueue *q)
[q postNotification: notification forModes: modes];
RELEASE(notification);
RELEASE(modes);
NSZoneFree(((accessQueue)q)->zone, item);
NSZoneFree(((accessQueue)q)->_zone, item);
}
/*
* Post all ASAP notifications.
@ -502,7 +502,7 @@ GSNotifyMore()
NotificationQueueList *item;
for (item = currentList(); item; item = item->next)
if (item->queue && ((accessQueue)item->queue)->idleQueue->head)
if (item->queue && ((accessQueue)item->queue)->_idleQueue->head)
return YES;
return NO;
}

View file

@ -54,7 +54,7 @@ NSString *NSPortTimeoutException
- (id) delegate
{
return delegate;
return _delegate;
}
- (void) encodeWithCoder: (NSCoder*)aCoder
@ -87,7 +87,7 @@ NSString *NSPortTimeoutException
- (void) invalidate
{
[[NSPortNameServer defaultPortNameServer] removePort: self];
is_valid = NO;
_is_valid = NO;
[[NSNotificationCenter defaultCenter]
postNotificationName: NSPortDidBecomeInvalidNotification
object: self];
@ -95,7 +95,7 @@ NSString *NSPortTimeoutException
- (BOOL) isValid
{
return is_valid;
return _is_valid;
}
- (int) machPort
@ -106,7 +106,7 @@ NSString *NSPortTimeoutException
- (void) release
{
if (is_valid && [self retainCount] == 1)
if (_is_valid && [self retainCount] == 1)
{
NSAutoreleasePool *arp;
@ -126,11 +126,11 @@ NSString *NSPortTimeoutException
[super release];
}
- (void) setDelegate: anObject
- (void) setDelegate: (id) anObject
{
NSAssert([anObject respondsToSelector: @selector(handlePortMessage:)],
NSInvalidArgumentException);
delegate = anObject;
_delegate = anObject;
}
- (void) addConnection: (NSConnection*)aConnection

View file

@ -32,7 +32,7 @@
- (void) dealloc
{
RELEASE(components);
RELEASE(_components);
[super dealloc];
}
@ -57,11 +57,11 @@
self = [super init];
if (self)
{
components = [[NSMutableArray allocWithZone: [self zone]]
_components = [[NSMutableArray allocWithZone: [self zone]]
initWithCapacity: [items count] + 2];
[components addObject: aPort];
[components addObject: anotherPort];
[components addObjectsFromArray: items];
[_components addObject: aPort];
[_components addObject: anotherPort];
[_components addObjectsFromArray: items];
}
return self;
}
@ -71,24 +71,24 @@
NSAssert([aComponent isKindOfClass: [NSData class]]
|| [aComponent isKindOfClass: [NSPort class]],
NSInvalidArgumentException);
[components addObject: aComponent];
[_components addObject: aComponent];
}
- (NSArray*) components
{
NSRange r = NSMakeRange(2, [components count]-2);
NSRange r = NSMakeRange(2, [_components count]-2);
return [components subarrayWithRange: r];
return [_components subarrayWithRange: r];
}
- (unsigned) msgid
{
return msgid;
return _msgid;
}
- (NSPort*) receivePort
{
return [components objectAtIndex: 1];
return [_components objectAtIndex: 1];
}
- (BOOL) sendBeforeDate: (NSDate*)when
@ -103,12 +103,12 @@
- (NSPort*) sendPort
{
return [components objectAtIndex: 0];
return [_components objectAtIndex: 0];
}
- (void) setMsgid: (unsigned)anId
{
msgid = anId;
_msgid = anId;
}
@end

View file

@ -125,10 +125,10 @@ static NSPortNameServer *defaultServer = nil;
return defaultServer;
}
s = (NSPortNameServer*)NSAllocateObject(self, 0, NSDefaultMallocZone());
s->data = [NSMutableData new];
s->portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
s->_data = [NSMutableData new];
s->_portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
s->nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
defaultServer = s;
[serverLock unlock];
@ -207,28 +207,28 @@ static NSPortNameServer *defaultServer = nil;
NS_DURING
{
[self _open: nil];
expecting = sizeof(msg);
[handle writeInBackgroundAndNotify: dat
forModes: modes];
_expecting = sizeof(msg);
[_handle writeInBackgroundAndNotify: dat
forModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: writeTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out writing to gdomap"];
}
expecting = sizeof(unsigned);
[data setLength: 0];
[handle readInBackgroundAndNotifyForModes: modes];
_expecting = sizeof(unsigned);
[_data setLength: 0];
[_handle readInBackgroundAndNotifyForModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: readTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out reading from gdomap"];
}
numSvrs = NSSwapBigIntToHost(*(unsigned*)[data bytes]);
numSvrs = NSSwapBigIntToHost(*(unsigned*)[_data bytes]);
if (numSvrs == 0)
{
[NSException raise: NSInternalInconsistencyException
@ -249,34 +249,34 @@ static NSPortNameServer *defaultServer = nil;
* We may already have some/all of the data, in which case
* we don't need to do a read.
*/
length = [data length] - sizeof(unsigned);
length = [_data length] - sizeof(unsigned);
if (length > 0)
{
void *bytes = [data mutableBytes];
void *bytes = [_data mutableBytes];
memcpy(bytes, bytes+sizeof(unsigned), length);
[data setLength: length];
[_data setLength: length];
}
else
{
[data setLength: 0];
[_data setLength: 0];
}
if (length < bufsiz)
{
expecting = bufsiz;
[handle readInBackgroundAndNotifyForModes: modes];
_expecting = bufsiz;
[_handle readInBackgroundAndNotifyForModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow:
readTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out reading from gdomap"];
}
}
[data getBytes: (void*)svrs length: bufsiz];
[_data getBytes: (void*)svrs length: bufsiz];
[self _close];
}
NS_HANDLER
@ -325,27 +325,27 @@ static NSPortNameServer *defaultServer = nil;
addr = [NSString stringWithCString: (char*)inet_ntoa(svrs[count])];
[self _open: addr];
expecting = sizeof(msg);
[handle writeInBackgroundAndNotify: dat
forModes: modes];
_expecting = sizeof(msg);
[_handle writeInBackgroundAndNotify: dat
forModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: writeTimeout]];
if (expecting)
if (_expecting)
{
[self _close];
}
else
{
expecting = sizeof(unsigned);
[data setLength: 0];
[handle readInBackgroundAndNotifyForModes: modes];
_expecting = sizeof(unsigned);
[_data setLength: 0];
[_handle readInBackgroundAndNotifyForModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow:
readTimeout]];
[self _close];
if (expecting == 0)
if (_expecting == 0)
{
portNum = NSSwapBigIntToHost(*(unsigned*)[data bytes]);
portNum = NSSwapBigIntToHost(*(unsigned*)[_data bytes]);
if (portNum != 0)
{
break;
@ -438,7 +438,7 @@ static NSPortNameServer *defaultServer = nil;
NS_DURING
{
NSMutableSet *known = NSMapGet(portMap, port);
NSMutableSet *known = NSMapGet(_portMap, port);
/*
* If there is no set of names for this port - create one.
@ -446,7 +446,7 @@ static NSPortNameServer *defaultServer = nil;
if (known == nil)
{
known = [NSMutableSet new];
NSMapInsert(portMap, port, known);
NSMapInsert(_portMap, port, known);
RELEASE(known);
}
@ -466,12 +466,12 @@ static NSPortNameServer *defaultServer = nil;
[self _open: nil];
expecting = sizeof(msg);
[handle writeInBackgroundAndNotify: dat
forModes: modes];
_expecting = sizeof(msg);
[_handle writeInBackgroundAndNotify: dat
forModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: writeTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out writing to gdomap"];
@ -481,18 +481,18 @@ static NSPortNameServer *defaultServer = nil;
* Queue a read request in our own run mode then run until the
* timeout period or until the read completes.
*/
expecting = sizeof(unsigned);
[data setLength: 0];
[handle readInBackgroundAndNotifyForModes: modes];
_expecting = sizeof(unsigned);
[_data setLength: 0];
[_handle readInBackgroundAndNotifyForModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: readTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out reading from gdomap"];
}
if ([data length] != sizeof(unsigned))
if ([_data length] != sizeof(unsigned))
{
[NSException raise: NSInternalInconsistencyException
format: @"too much data read from gdomap"];
@ -513,12 +513,12 @@ static NSPortNameServer *defaultServer = nil;
* Queue a write request in our own run mode then run until the
* timeout period or until the write completes.
*/
expecting = sizeof(msg);
[handle writeInBackgroundAndNotify: dat
forModes: modes];
_expecting = sizeof(msg);
[_handle writeInBackgroundAndNotify: dat
forModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: writeTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out writing to gdomap"];
@ -528,25 +528,25 @@ static NSPortNameServer *defaultServer = nil;
* Queue a read request in our own run mode then run until the
* timeout period or until the read completes.
*/
expecting = sizeof(unsigned);
[data setLength: 0];
[handle readInBackgroundAndNotifyForModes: modes];
_expecting = sizeof(unsigned);
[_data setLength: 0];
[_handle readInBackgroundAndNotifyForModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: readTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out reading from gdomap"];
}
if ([data length] != sizeof(unsigned))
if ([_data length] != sizeof(unsigned))
{
[NSException raise: NSInternalInconsistencyException
format: @"too much data read from gdomap"];
}
else
{
unsigned result = NSSwapBigIntToHost(*(unsigned*)[data bytes]);
unsigned result = NSSwapBigIntToHost(*(unsigned*)[_data bytes]);
if (result == 0)
{
@ -560,7 +560,7 @@ static NSPortNameServer *defaultServer = nil;
* is known by and to the name map.
*/
[known addObject: name];
NSMapInsert(nameMap, name, port);
NSMapInsert(_nameMap, name, port);
}
}
}
@ -625,12 +625,12 @@ static NSPortNameServer *defaultServer = nil;
* Queue a write request in our own run mode then run until the
* timeout period or until the write completes.
*/
expecting = sizeof(msg);
[handle writeInBackgroundAndNotify: dat
forModes: modes];
_expecting = sizeof(msg);
[_handle writeInBackgroundAndNotify: dat
forModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: writeTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out writing to gdomap"];
@ -640,12 +640,12 @@ static NSPortNameServer *defaultServer = nil;
* Queue a read request in our own run mode then run until the
* timeout period or until the read completes.
*/
expecting = sizeof(unsigned);
[data setLength: 0];
[handle readInBackgroundAndNotifyForModes: modes];
_expecting = sizeof(unsigned);
[_data setLength: 0];
[_handle readInBackgroundAndNotifyForModes: modes];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: readTimeout]];
if (expecting)
if (_expecting)
{
[NSException raise: NSPortTimeoutException
format: @"timed out reading from gdomap"];
@ -656,14 +656,14 @@ static NSPortNameServer *defaultServer = nil;
*/
[self _close];
if ([data length] != sizeof(unsigned))
if ([_data length] != sizeof(unsigned))
{
[NSException raise: NSInternalInconsistencyException
format: @"too much data read from gdomap"];
}
else
{
unsigned result = NSSwapBigIntToHost(*(unsigned*)[data bytes]);
unsigned result = NSSwapBigIntToHost(*(unsigned*)[_data bytes]);
if (result == 0)
{
@ -677,19 +677,19 @@ static NSPortNameServer *defaultServer = nil;
* Find the port that was registered for this name and
* remove the mapping table entries.
*/
port = NSMapGet(nameMap, name);
port = NSMapGet(_nameMap, name);
if (port)
{
NSMutableSet *known;
NSMapRemove(nameMap, name);
known = NSMapGet(portMap, port);
NSMapRemove(_nameMap, name);
known = NSMapGet(_portMap, port);
if (known)
{
[known removeObject: name];
if ([known count] == 0)
{
NSMapRemove(portMap, port);
NSMapRemove(_portMap, port);
}
}
}
@ -713,22 +713,22 @@ static NSPortNameServer *defaultServer = nil;
@implementation NSPortNameServer (Private)
- (void) _close
{
if (handle)
if (_handle)
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc removeObserver: self
name: GSFileHandleConnectCompletionNotification
object: handle];
object: _handle];
[nc removeObserver: self
name: NSFileHandleReadCompletionNotification
object: handle];
object: _handle];
[nc removeObserver: self
name: GSFileHandleWriteCompletionNotification
object: handle];
[handle closeFile];
RELEASE(handle);
handle = nil;
object: _handle];
[_handle closeFile];
RELEASE(_handle);
_handle = nil;
}
}
@ -747,14 +747,14 @@ static NSPortNameServer *defaultServer = nil;
/*
* There should now be nothing for the runloop to do so
* control should return to the method that started the connection.
* Set 'expecting' to zero to show that the connection worked and
* Set '_expecting' to zero to show that the connection worked and
* stop watching for connection completion.
*/
expecting = 0;
_expecting = 0;
[[NSNotificationCenter defaultCenter]
removeObserver: self
name: GSFileHandleConnectCompletionNotification
object: handle];
object: _handle];
}
}
@ -773,22 +773,22 @@ static NSPortNameServer *defaultServer = nil;
}
else
{
[data appendData: d];
if ([data length] < expecting)
[_data appendData: d];
if ([_data length] < _expecting)
{
/*
* Not enough data read yet - go read some more.
*/
[handle readInBackgroundAndNotifyForModes: modes];
[_handle readInBackgroundAndNotifyForModes: modes];
}
else
{
/*
* There should now be nothing for the runloop to do so
* control should return to the method that started the read.
* Set 'expecting' to zero to show that the data was read.
* Set '_expecting' to zero to show that the data was read.
*/
expecting = 0;
_expecting = 0;
}
}
}
@ -810,9 +810,9 @@ static NSPortNameServer *defaultServer = nil;
/*
* There should now be nothing for the runloop to do so
* control should return to the method that started the write.
* Set 'expecting' to zero to show that the data was written.
* Set '_expecting' to zero to show that the data was written.
*/
expecting = 0;
_expecting = 0;
}
}
@ -823,7 +823,7 @@ static NSPortNameServer *defaultServer = nil;
NSString *hostname = host;
BOOL isLocal = NO;
if (handle)
if (_handle)
{
return; /* Connection already open. */
}
@ -849,7 +849,7 @@ static NSPortNameServer *defaultServer = nil;
NS_DURING
{
handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
_handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
service: serverPort
protocol: @"tcp"
forModes: modes];
@ -859,7 +859,7 @@ static NSPortNameServer *defaultServer = nil;
if ([[localException name] isEqual: NSInvalidArgumentException])
{
NSLog(@"Exception looking up port for gdomap - %@\n", localException);
handle = nil;
_handle = nil;
}
else
{
@ -868,7 +868,7 @@ static NSPortNameServer *defaultServer = nil;
}
NS_ENDHANDLER
if (handle == nil)
if (_handle == nil)
{
NSLog(@"Failed to find gdomap port with name '%@',\nperhaps your "
@"/etc/services file is not correctly set up?\n"
@ -876,7 +876,7 @@ static NSPortNameServer *defaultServer = nil;
serverPort);
NS_DURING
{
handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
_handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
service: @"538"
protocol: @"tcp"
forModes: modes];
@ -886,39 +886,39 @@ static NSPortNameServer *defaultServer = nil;
[localException raise];
}
NS_ENDHANDLER
if (handle)
if (_handle)
{
RELEASE(serverPort);
serverPort = @"538";
}
}
if (handle == nil)
if (_handle == nil)
{
[NSException raise: NSGenericException
format: @"failed to create file handle to gdomap on %@",
hostname];
}
expecting = 1;
RETAIN(handle);
_expecting = 1;
RETAIN(_handle);
nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self
selector: @selector(_didConnect:)
name: GSFileHandleConnectCompletionNotification
object: handle];
object: _handle];
[nc addObserver: self
selector: @selector(_didRead:)
name: NSFileHandleReadCompletionNotification
object: handle];
object: _handle];
[nc addObserver: self
selector: @selector(_didWrite:)
name: GSFileHandleWriteCompletionNotification
object: handle];
object: _handle];
loop = [NSRunLoop currentRunLoop];
[loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: connectTimeout]];
if (expecting)
if (_expecting)
{
static BOOL retrying = NO;
@ -984,7 +984,7 @@ static NSPortNameServer *defaultServer = nil;
[serverLock lock];
NS_DURING
{
NSMutableSet *known = (NSMutableSet*)NSMapGet(portMap, port);
NSMutableSet *known = (NSMutableSet*)NSMapGet(_portMap, port);
NSString *name;
while ((name = [known anyObject]) != nil)

View file

@ -56,7 +56,7 @@
userInfo: nil]
raise];
[anInvocation invokeWithTarget: myTarget];
[anInvocation invokeWithTarget: _myTarget];
length = [[anInvocation methodSignature] methodReturnLength];
buffer = (void *)malloc(length);
@ -66,7 +66,7 @@
[[anInvocation methodSignatureForSelector:
@selector(init: )] methodReturnType]) )
{
if (((id)buffer) == myTarget)
if (((id)buffer) == _myTarget)
{
((id)buffer) = self;
[anInvocation setReturnValue: buffer];
@ -79,8 +79,8 @@
- (id) init
{
myProtocol = nil;
myTarget = nil;
_myProtocol = nil;
_myTarget = nil;
return self;
}
@ -96,9 +96,9 @@
{
[super init];
myProtocol = aProtocol;
_myProtocol = aProtocol;
ASSIGN(myTarget, anObject);
ASSIGN(_myTarget, anObject);
return self;
}
@ -109,7 +109,7 @@
- (struct objc_method_description *)methodDescriptionForSelector: (SEL)aSelector
{
return [myProtocol descriptionForInstanceMethod: aSelector];
return [_myProtocol descriptionForInstanceMethod: aSelector];
}
// Returns the protocol object the checker uses to verify whether a
@ -118,20 +118,20 @@
- (Protocol *)protocol
{
if (nil == myProtocol)
if (nil == _myProtocol)
[[NSException exceptionWithName: NSInvalidArgumentException
reason: @"No protocol specified"
userInfo: nil]
raise];
return myProtocol;
return _myProtocol;
}
// Returns the target of the NSProtocolChecker.
- (NSObject *)target
{
return myTarget;
return _myTarget;
}
@end

View file

@ -48,14 +48,14 @@ static SEL memSel = @selector(characterIsMember:);
*/
typedef struct {
@defs(NSGString)
} *stringAccess;
} *stringDefs;
typedef struct {
@defs(NSGCString)
} *cStringAccess;
#define myLength() (((stringAccess)string)->_count)
#define myUnicode(I) (((stringAccess)string)->_contents_chars[I])
#define myChar(I) chartouni((((cStringAccess)string)->_contents_chars[I]))
#define myCharacter(I) (isUnicode ? myUnicode(I) : myChar(I))
} *cStringDefs;
#define myLength() (((stringDefs)_string)->_count)
#define myUnicode(I) (((stringDefs)_string)->_contents_chars[I])
#define myChar(I) chartouni((((cStringDefs)_string)->_contents_chars[I]))
#define myCharacter(I) (_isUnicode ? myUnicode(I) : myChar(I))
/*
* Scan characters to be skipped.
@ -64,10 +64,10 @@ typedef struct {
* For internal use only.
*/
#define skipToNextField() ({ \
while (scanLocation < myLength() \
&& (*skipImp)(charactersToBeSkipped, memSel, myUnicode(scanLocation))) \
scanLocation++; \
(scanLocation >= myLength()) ? NO : YES; \
while (_scanLocation < myLength() \
&& (*_skipImp)(_charactersToBeSkipped, memSel, myUnicode(_scanLocation))) \
_scanLocation++; \
(_scanLocation >= myLength()) ? NO : YES; \
})
+ (void) initialize
@ -116,18 +116,18 @@ typedef struct {
*/
if (fastClass(aString) == NSGString_class)
{
isUnicode = YES;
string = RETAIN(aString);
_isUnicode = YES;
_string = RETAIN(aString);
}
else if (fastClass(aString) == NSGCString_class)
{
isUnicode = NO;
string = RETAIN(aString);
_isUnicode = NO;
_string = RETAIN(aString);
}
else if ([aString isKindOfClass: NSString_class])
{
isUnicode = YES;
string = [[NSGString_class alloc] initWithString: aString];
_isUnicode = YES;
_string = [[NSGString_class alloc] initWithString: aString];
}
else
{
@ -136,7 +136,7 @@ typedef struct {
format: @"Scanner initialised with something not a string"];
}
[self setCharactersToBeSkipped: defaultSkipSet];
decimal = '.';
_decimal = '.';
return self;
}
@ -145,9 +145,9 @@ typedef struct {
*/
- (void) dealloc
{
RELEASE(string);
TEST_RELEASE(locale);
RELEASE(charactersToBeSkipped);
RELEASE(_string);
TEST_RELEASE(_locale);
RELEASE(_charactersToBeSkipped);
[super dealloc];
}
@ -158,14 +158,14 @@ typedef struct {
*/
- (BOOL) isAtEnd
{
unsigned int save_scanLocation;
unsigned int save__scanLocation;
BOOL ret;
if (scanLocation >= myLength())
if (_scanLocation >= myLength())
return YES;
save_scanLocation = scanLocation;
save__scanLocation = _scanLocation;
ret = !skipToNextField();
scanLocation = save_scanLocation;
_scanLocation = save__scanLocation;
return ret;
}
@ -191,24 +191,24 @@ typedef struct {
BOOL got_digits = NO;
/* Check for sign */
if (scanLocation < myLength())
if (_scanLocation < myLength())
{
switch (myCharacter(scanLocation))
switch (myCharacter(_scanLocation))
{
case '+':
scanLocation++;
_scanLocation++;
break;
case '-':
negative = YES;
scanLocation++;
_scanLocation++;
break;
}
}
/* Process digits */
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
unichar digit = myCharacter(scanLocation);
unichar digit = myCharacter(_scanLocation);
if ((digit < '0') || (digit > '9'))
break;
@ -219,7 +219,7 @@ typedef struct {
else
num = num * 10 + (digit - '0');
}
scanLocation++;
_scanLocation++;
got_digits = YES;
}
@ -244,11 +244,11 @@ typedef struct {
*/
- (BOOL) scanInt: (int*)value
{
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
if (skipToNextField() && [self _scanInt: value])
return YES;
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
@ -263,16 +263,16 @@ typedef struct {
unsigned int num = 0;
unsigned int numLimit, digitLimit, digitValue;
BOOL overflow = NO;
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
/* Set limits */
numLimit = UINT_MAX / radix;
digitLimit = UINT_MAX % radix;
/* Process digits */
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
unichar digit = myCharacter(scanLocation);
unichar digit = myCharacter(_scanLocation);
switch (digit)
{
@ -312,14 +312,14 @@ typedef struct {
else
num = num * radix + digitValue;
}
scanLocation++;
_scanLocation++;
gotDigits = YES;
}
/* Save result */
if (!gotDigits)
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
if (value)
@ -339,29 +339,29 @@ typedef struct {
{
int radix;
BOOL gotDigits = NO;
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
/* Skip whitespace */
if (!skipToNextField())
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
/* Check radix */
radix = 10;
if ((scanLocation < myLength()) && (myCharacter(scanLocation) == '0'))
if ((_scanLocation < myLength()) && (myCharacter(_scanLocation) == '0'))
{
radix = 8;
scanLocation++;
_scanLocation++;
gotDigits = YES;
if (scanLocation < myLength())
if (_scanLocation < myLength())
{
switch (myCharacter(scanLocation))
switch (myCharacter(_scanLocation))
{
case 'x':
case 'X':
scanLocation++;
_scanLocation++;
radix = 16;
gotDigits = NO;
break;
@ -370,7 +370,7 @@ typedef struct {
}
if ( [self scanUnsignedInt_: value radix: radix gotDigits: gotDigits])
return YES;
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
@ -379,17 +379,17 @@ typedef struct {
*/
- (BOOL) scanHexInt: (unsigned int *)value
{
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
/* Skip whitespace */
if (!skipToNextField())
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
if ([self scanUnsignedInt_: value radix: 16 gotDigits: NO])
return YES;
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
@ -405,34 +405,34 @@ typedef struct {
BOOL negative = NO;
BOOL overflow = NO;
BOOL got_digits = NO;
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
/* Skip whitespace */
if (!skipToNextField())
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
/* Check for sign */
if (scanLocation < myLength())
if (_scanLocation < myLength())
{
switch (myCharacter(scanLocation))
switch (myCharacter(_scanLocation))
{
case '+':
scanLocation++;
_scanLocation++;
break;
case '-':
negative = YES;
scanLocation++;
_scanLocation++;
break;
}
}
/* Process digits */
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
unichar digit = myCharacter(scanLocation);
unichar digit = myCharacter(_scanLocation);
if ((digit < '0') || (digit > '9'))
break;
@ -442,14 +442,14 @@ typedef struct {
else
num = num * 10 + (digit - '0');
}
scanLocation++;
_scanLocation++;
got_digits = YES;
}
/* Save result */
if (!got_digits)
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
if (value)
@ -503,34 +503,34 @@ typedef struct {
BOOL negative = NO;
BOOL got_dot = NO;
BOOL got_digit = NO;
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
/* Skip whitespace */
if (!skipToNextField())
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
/* Check for sign */
if (scanLocation < myLength())
if (_scanLocation < myLength())
{
switch (myCharacter(scanLocation))
switch (myCharacter(_scanLocation))
{
case '+':
scanLocation++;
_scanLocation++;
break;
case '-':
negative = YES;
scanLocation++;
_scanLocation++;
break;
}
}
/* Process number */
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
c = myCharacter(scanLocation);
c = myCharacter(_scanLocation);
if ((c >= '0') && (c <= '9'))
{
/* Ensure that the number being accumulated will not overflow. */
@ -548,7 +548,7 @@ typedef struct {
if (got_dot)
--exponent;
}
else if (!got_dot && (c == decimal))
else if (!got_dot && (c == _decimal))
{
/* Note that we have found the decimal point. */
got_dot = YES;
@ -558,20 +558,20 @@ typedef struct {
/* Any other character terminates the number. */
break;
}
scanLocation++;
_scanLocation++;
}
if (!got_digit)
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
/* Check for trailing exponent */
if ((scanLocation < myLength()) && ((c == 'e') || (c == 'E')))
if ((_scanLocation < myLength()) && ((c == 'e') || (c == 'E')))
{
int expval;
scanLocation++;
_scanLocation++;
if ([self _scanInt: &expval])
{
/* Check for exponent overflow */
@ -589,10 +589,10 @@ typedef struct {
{
#ifdef _ACCEPT_BAD_EXPONENTS_
/* Numbers like 1.23eFOO are accepted (as 1.23). */
scanLocation = expScanLocation;
_scanLocation = expScanLocation;
#else
/* Numbers like 1.23eFOO are rejected. */
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
#endif
}
@ -640,52 +640,52 @@ typedef struct {
- (BOOL) scanCharactersFromSet: (NSCharacterSet *)aSet
intoString: (NSString **)value;
{
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
if (skipToNextField())
{
unsigned int start;
BOOL (*memImp)(NSCharacterSet*, SEL, unichar);
if (aSet == charactersToBeSkipped)
memImp = skipImp;
if (aSet == _charactersToBeSkipped)
memImp = _skipImp;
else
memImp = (BOOL (*)(NSCharacterSet*, SEL, unichar))
[aSet methodForSelector: memSel];
start = scanLocation;
if (isUnicode)
start = _scanLocation;
if (_isUnicode)
{
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
if ((*memImp)(aSet, memSel, myUnicode(scanLocation)) == NO)
if ((*memImp)(aSet, memSel, myUnicode(_scanLocation)) == NO)
break;
scanLocation++;
_scanLocation++;
}
}
else
{
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
if ((*memImp)(aSet, memSel, myChar(scanLocation)) == NO)
if ((*memImp)(aSet, memSel, myChar(_scanLocation)) == NO)
break;
scanLocation++;
_scanLocation++;
}
}
if (scanLocation != start)
if (_scanLocation != start)
{
if (value != 0)
{
NSRange range;
range.location = start;
range.length = scanLocation - start;
*value = [string substringFromRange: range];
range.length = _scanLocation - start;
*value = [_string substringFromRange: range];
}
return YES;
}
}
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
@ -699,42 +699,42 @@ typedef struct {
- (BOOL) scanUpToCharactersFromSet: (NSCharacterSet *)set
intoString: (NSString **)value;
{
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
unsigned int start;
BOOL (*memImp)(NSCharacterSet*, SEL, unichar);
if (!skipToNextField())
return NO;
if (set == charactersToBeSkipped)
memImp = skipImp;
if (set == _charactersToBeSkipped)
memImp = _skipImp;
else
memImp = (BOOL (*)(NSCharacterSet*, SEL, unichar))
[set methodForSelector: memSel];
start = scanLocation;
if (isUnicode)
start = _scanLocation;
if (_isUnicode)
{
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
if ((*memImp)(set, memSel, myUnicode(scanLocation)) == YES)
if ((*memImp)(set, memSel, myUnicode(_scanLocation)) == YES)
break;
scanLocation++;
_scanLocation++;
}
}
else
{
while (scanLocation < myLength())
while (_scanLocation < myLength())
{
if ((*memImp)(set, memSel, myChar(scanLocation)) == YES)
if ((*memImp)(set, memSel, myChar(_scanLocation)) == YES)
break;
scanLocation++;
_scanLocation++;
}
}
if (scanLocation == start)
if (_scanLocation == start)
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
if (value)
@ -742,8 +742,8 @@ typedef struct {
NSRange range;
range.location = start;
range.length = scanLocation - start;
*value = [string substringFromRange: range];
range.length = _scanLocation - start;
*value = [_string substringFromRange: range];
}
return YES;
}
@ -759,24 +759,24 @@ typedef struct {
- (BOOL) scanString: (NSString *)aString intoString: (NSString **)value;
{
NSRange range;
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
skipToNextField();
range.location = scanLocation;
range.location = _scanLocation;
range.length = [aString length];
if (range.location + range.length > myLength())
return NO;
range = [string rangeOfString: aString
options: caseSensitive ? 0 : NSCaseInsensitiveSearch
range = [_string rangeOfString: aString
options: _caseSensitive ? 0 : NSCaseInsensitiveSearch
range: range];
if (range.length == 0)
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
if (value)
*value = [string substringFromRange: range];
scanLocation += range.length;
*value = [_string substringFromRange: range];
_scanLocation += range.length;
return YES;
}
@ -792,24 +792,24 @@ typedef struct {
{
NSRange range;
NSRange found;
unsigned int saveScanLocation = scanLocation;
unsigned int saveScanLocation = _scanLocation;
skipToNextField();
range.location = scanLocation;
range.length = myLength() - scanLocation;
found = [string rangeOfString: aString
options: caseSensitive ? 0 : NSCaseInsensitiveSearch
range: range];
range.location = _scanLocation;
range.length = myLength() - _scanLocation;
found = [_string rangeOfString: aString
options: _caseSensitive ? 0 : NSCaseInsensitiveSearch
range: range];
if (found.length)
range.length = found.location - scanLocation;
range.length = found.location - _scanLocation;
if (range.length == 0)
{
scanLocation = saveScanLocation;
_scanLocation = saveScanLocation;
return NO;
}
if (value)
*value = [string substringFromRange: range];
scanLocation += range.length;
*value = [_string substringFromRange: range];
_scanLocation += range.length;
return YES;
}
@ -818,7 +818,7 @@ typedef struct {
*/
- (NSString *) string
{
return string;
return _string;
}
/*
@ -827,7 +827,7 @@ typedef struct {
*/
- (unsigned) scanLocation
{
return scanLocation;
return _scanLocation;
}
/*
@ -836,8 +836,8 @@ typedef struct {
*/
- (void) setScanLocation: (unsigned int)anIndex
{
if (scanLocation <= myLength())
scanLocation = anIndex;
if (_scanLocation <= myLength())
_scanLocation = anIndex;
else
[NSException raise: NSRangeException
format: @"Attempt to set scan location beyond end of string"];
@ -849,7 +849,7 @@ typedef struct {
*/
- (BOOL) caseSensitive
{
return caseSensitive;
return _caseSensitive;
}
/*
@ -859,7 +859,7 @@ typedef struct {
*/
- (void) setCaseSensitive: (BOOL)flag
{
caseSensitive = flag;
_caseSensitive = flag;
}
/*
@ -868,7 +868,7 @@ typedef struct {
*/
- (NSCharacterSet *) charactersToBeSkipped
{
return charactersToBeSkipped;
return _charactersToBeSkipped;
}
/*
@ -877,9 +877,9 @@ typedef struct {
*/
- (void) setCharactersToBeSkipped: (NSCharacterSet *)aSet
{
ASSIGNCOPY(charactersToBeSkipped, aSet);
skipImp = (BOOL (*)(NSCharacterSet*, SEL, unichar))
[charactersToBeSkipped methodForSelector: memSel];
ASSIGNCOPY(_charactersToBeSkipped, aSet);
_skipImp = (BOOL (*)(NSCharacterSet*, SEL, unichar))
[_charactersToBeSkipped methodForSelector: memSel];
}
/*
@ -888,7 +888,7 @@ typedef struct {
*/
- (NSDictionary *) locale
{
return locale;
return _locale;
}
/*
@ -897,23 +897,23 @@ typedef struct {
*/
- (void) setLocale: (NSDictionary *)localeDictionary
{
ASSIGN(locale, localeDictionary);
ASSIGN(_locale, localeDictionary);
/*
* Get decimal point character from locale if necessary.
*/
if (locale == nil)
if (_locale == nil)
{
decimal = '.';
_decimal = '.';
}
else
{
NSString *pointString;
pointString = [locale objectForKey: NSDecimalSeparator];
pointString = [_locale objectForKey: NSDecimalSeparator];
if ([pointString length] > 0)
decimal = [pointString characterAtIndex: 0];
_decimal = [pointString characterAtIndex: 0];
else
decimal = '.';
_decimal = '.';
}
}
@ -924,11 +924,11 @@ typedef struct {
{
NSScanner *n = [[self class] allocWithZone: zone];
[n initWithString: string];
[n setCharactersToBeSkipped: charactersToBeSkipped];
[n setLocale: locale];
[n setScanLocation: scanLocation];
[n setCaseSensitive: caseSensitive];
[n initWithString: _string];
[n setCharactersToBeSkipped: _charactersToBeSkipped];
[n setLocale: _locale];
[n setScanLocation: _scanLocation];
[n setCaseSensitive: _caseSensitive];
return n;
}

View file

@ -125,20 +125,20 @@ static void handleSignal(int sig)
- (void) gcFinalize
{
[tasksLock lock];
NSMapRemove(activeTasks, (void*)taskId);
NSMapRemove(activeTasks, (void*)_taskId);
[tasksLock unlock];
}
- (void) dealloc
{
[self gcFinalize];
RELEASE(arguments);
RELEASE(environment);
RELEASE(launchPath);
RELEASE(currentDirectoryPath);
RELEASE(standardError);
RELEASE(standardInput);
RELEASE(standardOutput);
RELEASE(_arguments);
RELEASE(_environment);
RELEASE(_launchPath);
RELEASE(_currentDirectoryPath);
RELEASE(_standardError);
RELEASE(_standardInput);
RELEASE(_standardOutput);
[super dealloc];
}
@ -149,58 +149,58 @@ static void handleSignal(int sig)
- (NSArray*) arguments
{
return arguments;
return _arguments;
}
- (NSString*) currentDirectoryPath
{
if (currentDirectoryPath == nil)
if (_currentDirectoryPath == nil)
{
[self setCurrentDirectoryPath:
[[NSFileManager defaultManager] currentDirectoryPath]];
}
return currentDirectoryPath;
return _currentDirectoryPath;
}
- (NSDictionary*) environment
{
if (environment == nil)
if (_environment == nil)
{
[self setEnvironment: [[NSProcessInfo processInfo] environment]];
}
return environment;
return _environment;
}
- (NSString*) launchPath
{
return launchPath;
return _launchPath;
}
- (id) standardError
{
if (standardError == nil)
if (_standardError == nil)
{
[self setStandardError: [NSFileHandle fileHandleWithStandardError]];
}
return standardError;
return _standardError;
}
- (id) standardInput
{
if (standardInput == nil)
if (_standardInput == nil)
{
[self setStandardInput: [NSFileHandle fileHandleWithStandardInput]];
}
return standardInput;
return _standardInput;
}
- (id) standardOutput
{
if (standardOutput == nil)
if (_standardOutput == nil)
{
[self setStandardOutput: [NSFileHandle fileHandleWithStandardOutput]];
}
return standardOutput;
return _standardOutput;
}
/*
@ -209,78 +209,78 @@ static void handleSignal(int sig)
- (void) setArguments: (NSArray*)args
{
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(arguments, args);
ASSIGN(_arguments, args);
}
- (void) setCurrentDirectoryPath: (NSString*)path
{
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(currentDirectoryPath, path);
ASSIGN(_currentDirectoryPath, path);
}
- (void) setEnvironment: (NSDictionary*)env
{
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(environment, env);
ASSIGN(_environment, env);
}
- (void) setLaunchPath: (NSString*)path
{
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(launchPath, path);
ASSIGN(_launchPath, path);
}
- (void) setStandardError: (id)hdl
{
NSAssert([hdl isKindOfClass: [NSFileHandle class]] ||
[hdl isKindOfClass: [NSPipe class]], NSInvalidArgumentException);
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(standardError, hdl);
ASSIGN(_standardError, hdl);
}
- (void) setStandardInput: (NSFileHandle*)hdl
{
NSAssert([hdl isKindOfClass: [NSFileHandle class]] ||
[hdl isKindOfClass: [NSPipe class]], NSInvalidArgumentException);
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(standardInput, hdl);
ASSIGN(_standardInput, hdl);
}
- (void) setStandardOutput: (NSFileHandle*)hdl
{
NSAssert([hdl isKindOfClass: [NSFileHandle class]] ||
[hdl isKindOfClass: [NSPipe class]], NSInvalidArgumentException);
if (hasLaunched)
if (_hasLaunched)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has been launched"];
}
ASSIGN(standardOutput, hdl);
ASSIGN(_standardOutput, hdl);
}
/*
@ -289,15 +289,15 @@ static void handleSignal(int sig)
- (BOOL) isRunning
{
if (hasLaunched == NO)
if (_hasLaunched == NO)
{
return NO;
}
if (hasCollected == NO)
if (_hasCollected == NO)
{
[self _collectChild];
}
if (hasTerminated == YES)
if (_hasTerminated == YES)
{
return NO;
}
@ -306,21 +306,21 @@ static void handleSignal(int sig)
- (int) terminationStatus
{
if (hasLaunched == NO)
if (_hasLaunched == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"];
}
if (hasCollected == NO)
if (_hasCollected == NO)
{
[self _collectChild];
}
if (hasTerminated == NO)
if (_hasTerminated == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet terminated"];
}
return terminationStatus;
return _terminationStatus;
}
/*
@ -361,12 +361,12 @@ extern char *objc_find_executable(const char *name);
id hdl;
int i;
if (hasLaunched)
if (_hasLaunched)
{
return;
}
if (launchPath == nil)
if (_launchPath == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - no launch path set"];
@ -379,8 +379,8 @@ extern char *objc_find_executable(const char *name);
* Third choice - base_path/prog.
* Otherwise - try using PATH environment variable if possible.
*/
prog = [launchPath lastPathComponent];
base_path = [launchPath stringByDeletingLastPathComponent];
prog = [_launchPath lastPathComponent];
base_path = [_launchPath stringByDeletingLastPathComponent];
if ([[base_path lastPathComponent] isEqualToString: libs] == YES)
base_path = [base_path stringByDeletingLastPathComponent];
if ([[base_path lastPathComponent] isEqualToString: arch] == YES)
@ -560,12 +560,12 @@ extern char *objc_find_executable(const char *name);
}
else
{
taskId = pid;
hasLaunched = YES;
ASSIGN(launchPath, lpath); // Actual path used.
_taskId = pid;
_hasLaunched = YES;
ASSIGN(_launchPath, lpath); // Actual path used.
[tasksLock lock];
NSMapInsert(activeTasks, (void*)taskId, (void*)self);
NSMapInsert(activeTasks, (void*)_taskId, (void*)self);
[tasksLock unlock];
/*
@ -582,21 +582,21 @@ extern char *objc_find_executable(const char *name);
- (void) terminate
{
if (hasLaunched == NO)
if (_hasLaunched == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"];
}
if (hasTerminated)
if (_hasTerminated)
{
return;
}
hasTerminated = YES;
_hasTerminated = YES;
#ifdef HAVE_KILLPG
killpg(taskId, SIGTERM);
killpg(_taskId, SIGTERM);
#else
kill(-taskId, SIGTERM);
kill(-_taskId, SIGTERM);
#endif
}
@ -621,49 +621,49 @@ extern char *objc_find_executable(const char *name);
- (void) _collectChild
{
if (hasCollected == NO)
if (_hasCollected == NO)
{
int result;
errno = 0;
result = waitpid(taskId, &terminationStatus, WNOHANG);
result = waitpid(_taskId, &_terminationStatus, WNOHANG);
if (result < 0)
{
NSLog(@"waitpid %d, result %d, error %s",
taskId, result, strerror(errno));
_taskId, result, strerror(errno));
[self _terminatedChild: -1];
}
else if (result == taskId || (result == 0 && errno == 0))
else if (result == _taskId || (result == 0 && errno == 0))
{
if (WIFEXITED(terminationStatus))
if (WIFEXITED(_terminationStatus))
{
#ifdef WAITDEBUG
NSLog(@"waitpid %d, termination status = %d",
taskId, terminationStatus);
_taskId, _terminationStatus);
#endif
[self _terminatedChild: WEXITSTATUS(terminationStatus)];
[self _terminatedChild: WEXITSTATUS(_terminationStatus)];
}
#ifdef WAITDEBUG
else
NSLog(@"waitpid %d, event status = %d",
taskId, terminationStatus);
_taskId, _terminationStatus);
#endif
}
#ifdef WAITDEBUG
else
NSLog(@"waitpid %d, result %d, error %s",
taskId, result, strerror(errno));
_taskId, result, strerror(errno));
#endif
}
}
- (void) _sendNotification
{
if (hasNotified == NO)
if (_hasNotified == NO)
{
NSNotification *n;
hasNotified = YES;
_hasNotified = YES;
n = [NSNotification notificationWithName: NSTaskDidTerminateNotification
object: self
userInfo: nil];
@ -678,12 +678,12 @@ extern char *objc_find_executable(const char *name);
- (void) _terminatedChild: (int)status
{
[tasksLock lock];
NSMapRemove(activeTasks, (void*)taskId);
NSMapRemove(activeTasks, (void*)_taskId);
[tasksLock unlock];
terminationStatus = status;
hasCollected = YES;
hasTerminated = YES;
if (hasNotified == NO)
_terminationStatus = status;
_hasCollected = YES;
_hasTerminated = YES;
if (_hasNotified == NO)
{
[self _sendNotification];
}

View file

@ -11,7 +11,7 @@
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
@ -41,110 +41,112 @@ function may be incorrect
#include <Foundation/NSURLHandle.h>
#include <Foundation/NSURL.h>
NSString* NSURLFileScheme=@"file";
NSString* NSURLFileScheme = @"file";
NSString* NSURLPartKey_host=@"host";
NSString* NSURLPartKey_port=@"port";
NSString* NSURLPartKey_user=@"user";
NSString* NSURLPartKey_password=@"password";
NSString* NSURLPartKey_path=@"path";
NSString* NSURLPartKey_fragment=@"fragment";
NSString* NSURLPartKey_parameterString=@"parameterString";
NSString* NSURLPartKey_query=@"query";
NSString* NSURLPartKey_host = @"host";
NSString* NSURLPartKey_port = @"port";
NSString* NSURLPartKey_user = @"user";
NSString* NSURLPartKey_password = @"password";
NSString* NSURLPartKey_path = @"path";
NSString* NSURLPartKey_fragment = @"fragment";
NSString* NSURLPartKey_parameterString = @"parameterString";
NSString* NSURLPartKey_query = @"query";
//=============================================================================
@implementation NSURL
//-----------------------------------------------------------------------------
+ (id) fileURLWithPath: (NSString*)_path
+ (id) fileURLWithPath: (NSString*)aPath
{
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: _path]);
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: aPath]);
}
//-----------------------------------------------------------------------------
+ (id)URLWithString: (NSString*)_urlString
+ (id) URLWithString: (NSString*)aUrlString
{
return AUTORELEASE([[NSURL alloc] initWithString: _urlString]);
return AUTORELEASE([[NSURL alloc] initWithString: aUrlString]);
}
//-----------------------------------------------------------------------------
+ (id)URLWithString: (NSString*)_urlString
relativeToURL: (NSURL*)_baseURL
+ (id) URLWithString: (NSString*)aUrlString
relativeToURL: (NSURL*)aBaseUrl
{
return AUTORELEASE([[NSURL alloc] initWithString: _urlString
relativeToURL: _baseURL]);
return AUTORELEASE([[NSURL alloc] initWithString: aUrlString
relativeToURL: aBaseUrl]);
}
//-----------------------------------------------------------------------------
- (id) initWithScheme: (NSString*)_scheme
host: (NSString*)_host
path: (NSString*)_path
- (id) initWithScheme: (NSString*)aScheme
host: (NSString*)aHost
path: (NSString*)aPath
{
NSString* _urlString=nil;
if (_host)
_urlString=[NSString stringWithFormat: @"%@: //%@",_scheme,_host];
NSString *aUrlString = nil;
if (aHost)
aUrlString = [NSString stringWithFormat: @"%@://%@", aScheme, aHost];
else
_urlString=[NSString stringWithFormat: @"%@: ",_scheme];
if (_path)
_urlString=[_urlString stringByAppendingString: _path];
self=[self initWithString: _urlString];
aUrlString = [NSString stringWithFormat: @"%@:", aScheme];
if (aPath)
aUrlString = [aUrlString stringByAppendingString: aPath];
self = [self initWithString: aUrlString];
return self;
}
//-----------------------------------------------------------------------------
//Non Standard Function
- (id) initWithScheme: (NSString*)_scheme
host: (NSString*)_host
port: (NSNumber*)_port
path: (NSString*)_path
- (id) initWithScheme: (NSString*)aScheme
host: (NSString*)aHost
port: (NSNumber*)aPort
path: (NSString*)aPath
{
NSString* tmpHost=nil;
if (_port)
tmpHost=[NSString stringWithFormat: @"%@: %@",_host,_port];
NSString *tmpHost = nil;
if (aPort)
tmpHost = [NSString stringWithFormat: @"%@:%@", aHost, aPort];
else
tmpHost=_host;
self=[self initWithScheme: _scheme
tmpHost = aHost;
self = [self initWithScheme: aScheme
host: tmpHost
path: _path];
path: aPath];
return self;
}
//-----------------------------------------------------------------------------
//Do a initWithScheme: NSFileScheme host: nil path: _path
- (id) initFileURLWithPath: (NSString*)_path
//Do a initWithScheme: NSFileScheme host: nil path: aPath
- (id) initFileURLWithPath: (NSString*)aPath
{
self=[self initWithScheme: NSURLFileScheme
self = [self initWithScheme: NSURLFileScheme
host: nil
path: _path];
path: aPath];
return self;
}
//-----------------------------------------------------------------------------
// urlString is escaped
- (id) initWithString: (NSString*)_urlString
// _urlString is escaped
- (id) initWithString: (NSString*)aUrlString
{
self=[self init];
ASSIGNCOPY(urlString,_urlString);
self = [self init];
ASSIGNCOPY(_urlString, aUrlString);
return self;
}
//-----------------------------------------------------------------------------
//urlString!=nil
// urlString is escaped
- (id) initWithString: (NSString*)_urlString
relativeToURL: (NSURL*)_baseURL
//_urlString!= nil
// _urlString is escaped
- (id) initWithString: (NSString*)aUrlString
relativeToURL: (NSURL*)aBaseUrl
{
self=[self init];
ASSIGNCOPY(urlString,_urlString);
ASSIGNCOPY(baseURL,_baseURL);
self = [self init];
ASSIGNCOPY(_urlString, aUrlString);
ASSIGNCOPY(_baseURL, aBaseUrl);
return self;
}
//-----------------------------------------------------------------------------
- (void) dealloc
{
DESTROY(urlString);
DESTROY(baseURL);
DESTROY(_urlString);
DESTROY(_baseURL);
[super dealloc];
}
@ -152,8 +154,8 @@ NSString* NSURLPartKey_query=@"query";
- (id) copyWithZone: (NSZone*)zone
{
if (NSShouldRetainWithZone(self, zone) == NO)
return [[isa allocWithZone: zone] initWithString: urlString
relativeToURL: baseURL];
return [[isa allocWithZone: zone] initWithString: _urlString
relativeToURL: _baseURL];
else
return RETAIN(self);
}
@ -162,18 +164,18 @@ NSString* NSURLPartKey_query=@"query";
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
[aCoder encodeObject: urlString];
[aCoder encodeObject: baseURL];
//FIXME? clients ?
[aCoder encodeObject: _urlString];
[aCoder encodeObject: _baseURL];
//FIXME? _clients ?
}
//-----------------------------------------------------------------------------
- (id) initWithCoder: (NSCoder*)aCoder
{
self = [super initWithCoder: aCoder];
[aCoder decodeValueOfObjCType: @encode(id) at: &urlString];
[aCoder decodeValueOfObjCType: @encode(id) at: &baseURL];
//FIXME? clients ?
[aCoder decodeValueOfObjCType: @encode(id) at: &_urlString];
[aCoder decodeValueOfObjCType: @encode(id) at: &_baseURL];
//FIXME? _clients ?
return self;
}
@ -181,9 +183,10 @@ NSString* NSURLPartKey_query=@"query";
//-----------------------------------------------------------------------------
- (NSString*) description
{
NSString* dscr=urlString;
if (baseURL)
dscr=[dscr stringByAppendingFormat: @" -- %@",baseURL];
NSString *dscr = _urlString;
if (_baseURL)
dscr = [dscr stringByAppendingFormat: @" -- %@", _baseURL];
return dscr;
}
@ -191,180 +194,189 @@ NSString* NSURLPartKey_query=@"query";
// Non Standard Function
- (NSString*) baseURLAbsolutePart
{
if (baseURL)
{
NSString* suffix=[baseURL path];
NSString* tmp=nil;
if ([baseURL query])
suffix=[suffix stringByAppendingFormat: @"?%@",[baseURL query]];
// /test?aa=bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
// ==> http: //user: passwd@www.gnustep.org: 80/
tmp=[[baseURL absoluteString]stringWithoutSuffix: suffix];
if (_baseURL)
{
NSString* suffix = [_baseURL path];
NSString* tmp = nil;
if ([_baseURL query])
suffix = [suffix stringByAppendingFormat: @"?%@", [_baseURL query]];
// /test?aa = bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
// ==> http: //user: passwd@www.gnustep.org: 80/
tmp = [[_baseURL absoluteString]stringWithoutSuffix: suffix];
// ==> http: //user: passwd@www.gnustep.org: 80
if ([tmp hasSuffix: @"/"])
tmp=[tmp stringWithoutSuffix: @"/"];
return tmp;
}
// ==> http: //user: passwd@www.gnustep.org: 80
if ([tmp hasSuffix: @"/"])
tmp = [tmp stringWithoutSuffix: @"/"];
return tmp;
}
else
return @"";
return @"";
}
//-----------------------------------------------------------------------------
- (NSString*) absoluteString
{
NSString* absString=nil;
if (baseURL)
{
// /test?aa=bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
// ==> http: //user: passwd@www.gnustep.org: 80
absString=[self baseURLAbsolutePart];
NSString* absString = nil;
if (_baseURL)
{
// /test?aa = bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
// ==> http: //user: passwd@www.gnustep.org: 80
absString = [self baseURLAbsolutePart];
if ([urlString hasPrefix: @"/"])
absString=[absString stringByAppendingString: urlString];
else
absString=[absString stringByAppendingFormat: @"/%@",urlString];
}
if ([_urlString hasPrefix: @"/"])
absString = [absString stringByAppendingString: _urlString];
else
absString = [absString stringByAppendingFormat: @"/%@", _urlString];
}
else
absString=urlString;
absString = _urlString;
return absString;
}
//-----------------------------------------------------------------------------
- (NSString*) relativeString
{
return urlString;
return _urlString;
}
//-----------------------------------------------------------------------------
- (NSURL*) baseURL
{
return baseURL;
return _baseURL;
}
//-----------------------------------------------------------------------------
- (NSURL*) absoluteURL
{
if (!baseURL)
return self;
if (!_baseURL)
return self;
else
return [NSURL URLWithString: [self absoluteString]];
return [NSURL URLWithString: [self absoluteString]];
}
//-----------------------------------------------------------------------------
- (NSString*) scheme
{
NSString* scheme=nil;
NSString* absoluteString=[self absoluteString];
NSRange range=[absoluteString rangeOfString: @": //"];
NSString *scheme = nil;
NSString *absoluteString = [self absoluteString];
NSRange range = [absoluteString rangeOfString: @": //"];
if (range.length>0)
scheme=[absoluteString substringToIndex: range.location];
scheme = [absoluteString substringToIndex: range.location];
return scheme;
}
//-----------------------------------------------------------------------------
- (NSString*) resourceSpecifier
{
NSString* absoluteString=[self absoluteString];
NSRange range=[absoluteString rangeOfString: @": //"];
if (range.length>0)
return [absoluteString substringFromIndex: range.location+1];
NSString *absoluteString = [self absoluteString];
NSRange range = [absoluteString rangeOfString: @"://"];
if (range.length > 0)
return [absoluteString substringFromIndex: range.location+1];
else
return absoluteString;
return absoluteString;
}
//-----------------------------------------------------------------------------
//Non Standard Function
- (NSDictionary*) explode
{
NSMutableDictionary* elements=nil;
NSString* resourceSpecifier=[self resourceSpecifier];
if ([resourceSpecifier hasPrefix: @"//"])
{
int index=2;
NSRange range;
elements = [NSMutableDictionary dictionaryWithCapacity: 0];
if (![[self scheme] isEqualToString: NSURLFileScheme])
{
range=[resourceSpecifier rangeOfString: @"/"
options: 0
range: NSMakeRange(index,[resourceSpecifier length]-index)];
if (range.length>0)
{
NSString* userPasswordHostPort=[resourceSpecifier substringWithRange: NSMakeRange(index,range.location-index)];
NSString* userPassword=nil;
NSString* hostPort=nil;
index=range.location;
range=[userPasswordHostPort rangeOfString: @"@"];
if (range.length>0)
{
if (range.location>0)
userPassword=[userPasswordHostPort substringToIndex: range.location];
if (range.location+1<[userPasswordHostPort length])
hostPort=[userPasswordHostPort substringFromIndex: range.location+1];
}
else
hostPort=userPasswordHostPort;
if (userPassword)
{
range=[userPassword rangeOfString: @": "];
if (range.length>0)
{
if (range.location>0)
[elements setObject: [userPassword substringToIndex: range.location]
forKey: NSURLPartKey_user];
if (range.location+1<[userPassword length])
[elements setObject: [userPassword substringFromIndex: range.location+1]
forKey: NSURLPartKey_password];
}
else
[elements setObject: userPassword
forKey: NSURLPartKey_user];
}
NSMutableDictionary *elements = nil;
NSString *resourceSpecifier = [self resourceSpecifier];
if (hostPort)
{
range=[hostPort rangeOfString: @": "];
if (range.length>0)
{
if (range.location>0)
[elements setObject: [hostPort substringToIndex: range.location]
forKey: NSURLPartKey_host];
if (range.location+1<[hostPort length])
[elements setObject: [NSNumber valueFromString:
[hostPort substringFromIndex: range.location+1]]
forKey: NSURLPartKey_port];
}
else
[elements setObject: hostPort
forKey: NSURLPartKey_host];
};
}
}
else
index--; //To Take a /
range=[resourceSpecifier rangeOfString: @"?"
options: 0
range: NSMakeRange(index,[resourceSpecifier length]-index)];
if ([resourceSpecifier hasPrefix: @"//"])
{
int index = 2;
NSRange range;
elements = [NSMutableDictionary dictionaryWithCapacity: 0];
if (![[self scheme] isEqualToString: NSURLFileScheme])
{
range = [resourceSpecifier rangeOfString: @"/" options: 0
range: NSMakeRange(index, [resourceSpecifier length]-index)];
if (range.length>0)
{
NSString *userPasswordHostPort;
NSString *userPassword = nil;
NSString *hostPort = nil;
userPasswordHostPort
= [resourceSpecifier substringWithRange:
NSMakeRange(index, range.location-index)];
index = range.location;
range = [userPasswordHostPort rangeOfString: @"@"];
if (range.length>0)
{
if (range.location>0)
[elements setObject: [resourceSpecifier substringWithRange: NSMakeRange(index,range.location-index)]
forKey: NSURLPartKey_path];
if (range.location+1<[resourceSpecifier length])
[elements setObject: [resourceSpecifier substringFromIndex: range.location+1]
forKey: NSURLPartKey_query];
userPassword
= [userPasswordHostPort substringToIndex: range.location];
if (range.location+1<[userPasswordHostPort length])
hostPort = [userPasswordHostPort
substringFromIndex: range.location+1];
}
else
[elements setObject: [resourceSpecifier substringFromIndex: index]
forKey: NSURLPartKey_path];
else
hostPort = userPasswordHostPort;
if (userPassword)
{
range = [userPassword rangeOfString: @": "];
if (range.length>0)
{
if (range.location>0)
[elements setObject: [userPassword substringToIndex: range.location]
forKey: NSURLPartKey_user];
if (range.location+1<[userPassword length])
[elements setObject: [userPassword substringFromIndex: range.location+1]
forKey: NSURLPartKey_password];
}
else
[elements setObject: userPassword
forKey: NSURLPartKey_user];
}
if (hostPort)
{
range = [hostPort rangeOfString: @": "];
if (range.length>0)
{
if (range.location>0)
[elements setObject: [hostPort substringToIndex: range.location]
forKey: NSURLPartKey_host];
if (range.location+1<[hostPort length])
[elements setObject: [NSNumber valueFromString:
[hostPort substringFromIndex: range.location+1]]
forKey: NSURLPartKey_port];
}
else
[elements setObject: hostPort
forKey: NSURLPartKey_host];
}
}
}
else
else
index--; //To Take a /
range = [resourceSpecifier rangeOfString: @"?"
options: 0
range: NSMakeRange(index, [resourceSpecifier length]-index)];
if (range.length>0)
{
[NSException raise: NSGenericException
format: @"'%@' is a bad URL",self];
if (range.location>0)
[elements setObject: [resourceSpecifier substringWithRange: NSMakeRange(index, range.location-index)]
forKey: NSURLPartKey_path];
if (range.location+1<[resourceSpecifier length])
[elements setObject: [resourceSpecifier substringFromIndex: range.location+1]
forKey: NSURLPartKey_query];
}
else
[elements setObject: [resourceSpecifier substringFromIndex: index]
forKey: NSURLPartKey_path];
}
else
{
[NSException raise: NSGenericException
format: @"'%@' is a bad URL", self];
}
return elements;
}
@ -467,7 +479,7 @@ NSString* NSURLPartKey_query=@"query";
}
//-----------------------------------------------------------------------------
- (void) URLHandle: (NSURLHandle*)sender
- (void) URLHandle: (NSURLHandle*)sender
resourceDidFailLoadingWithReason: (NSString*)reason
{
//FIXME
@ -480,45 +492,45 @@ NSString* NSURLPartKey_query=@"query";
{
NSURL* url2;
NSURL* url3;
NSURL* url=[NSURL URLWithString: @"http: //user: passwd@www.gnustep.org: 80/apache"];
url2=[NSURL URLWithString: @"/test?aa=bb&cc=dd" relativeToURL: url];
url3=[NSURL URLWithString: @"test?aa=bb&cc=dd" relativeToURL: url];
NSLog(@"===url===");
NSURL* url = [NSURL URLWithString: @"http: //user: passwd@www.gnustep.org: 80/apache"];
url2= [NSURL URLWithString: @"/test?aa = bb&cc=dd" relativeToURL: url];
url3= [NSURL URLWithString: @"test?aa = bb&cc=dd" relativeToURL: url];
NSLog(@"=== url ===");
[NSURL testPrint: url];
NSLog(@"===url2===");
NSLog(@"=== url2===");
[NSURL testPrint: url2];
NSLog(@"===url3===");
NSLog(@"=== url3===");
[NSURL testPrint: url3];
}
+ (void) testPrint: (NSURL*)url
{
id _baseURL=nil;
id _urlString=nil;
void* _clients=0;
GSGetInstanceVariable(url,@"baseURL",&_baseURL);
GSGetInstanceVariable(url,@"urlString",&_urlString);
GSGetInstanceVariable(url,@"clients",&_clients);
NSLog(@"*BaseURL: %ld",(long)_baseURL);
NSLog(@"*BaseURL: %@",[_baseURL description]);
NSLog(@"*urlString: %@",_urlString);
NSLog(@"*clients: %ld",(long)_clients);
NSLog(@"*host: %@",[url host]);
NSLog(@"*port: %@",[url port]);
NSLog(@"*user: %@",[url user]);
NSLog(@"*password: %@",[url password]);
NSLog(@"*path: %@",[url path]);
NSLog(@"*fragment: %@",[url fragment]);
NSLog(@"*parameterString: %@",[url parameterString]);
NSLog(@"*query: %@",[url query]);
NSLog(@"*relativePath: %@",[url relativePath]);
NSLog(@"*absoluteString: %@",[url absoluteString]);
NSLog(@"*relativeString: %@",[url relativeString]);
NSLog(@"*baseURL: %@",[[url baseURL] description]);
NSLog(@"*absoluteURL: %@",[[url absoluteURL] description]);
NSLog(@"*scheme: %@",[url scheme]);
NSLog(@"*resourceSpecifier: %@",[url resourceSpecifier]);
NSLog(@"*description: %@",[url description]);
id aBaseUrl = nil;
id aUrlString = nil;
void* __clients =0;
GSGetInstanceVariable(url, @"_baseURL", &aBaseUrl);
GSGetInstanceVariable(url, @"_urlString", &aUrlString);
GSGetInstanceVariable(url, @"_clients", &__clients);
NSLog(@"*BaseURL: %ld", (long)aBaseUrl);
NSLog(@"*BaseURL: %@", [aBaseUrl description]);
NSLog(@"*_urlString: %@", aUrlString);
NSLog(@"*_clients: %ld", (long)__clients);
NSLog(@"*host: %@", [url host]);
NSLog(@"*port: %@", [url port]);
NSLog(@"*user: %@", [url user]);
NSLog(@"*password: %@", [url password]);
NSLog(@"*path: %@", [url path]);
NSLog(@"*fragment: %@", [url fragment]);
NSLog(@"*parameterString: %@", [url parameterString]);
NSLog(@"*query: %@", [url query]);
NSLog(@"*relativePath: %@", [url relativePath]);
NSLog(@"*absoluteString: %@", [url absoluteString]);
NSLog(@"*relativeString: %@", [url relativeString]);
NSLog(@"*_baseURL: %@", [[url baseURL] description]);
NSLog(@"*absoluteURL: %@", [[url absoluteURL] description]);
NSLog(@"*scheme: %@", [url scheme]);
NSLog(@"*resourceSpecifier: %@", [url resourceSpecifier]);
NSLog(@"*description: %@", [url description]);
}
@end
@ -535,7 +547,7 @@ NSString* NSURLPartKey_query=@"query";
//-----------------------------------------------------------------------------
- (void) loadResourceDataNotifyingClient: (id)client
usingCache: (BOOL)shouldUseCache
usingCache: (BOOL)shouldUseCache
{
//FIXME
[self notImplemented: _cmd];

View file

@ -1,4 +1,4 @@
/* NSURLHandle.h - Class NSURLHandle
/* NSURLHandle.m - Class NSURLHandle
Copyright (C) 1999 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com>

View file

@ -160,9 +160,9 @@ NSString *NSUndoManagerWillUndoChangeNotification =
@implementation NSUndoManager (Private)
- (void) _loop: (id)arg
{
if (groupsByEvent)
if (_groupsByEvent)
{
if (group != nil)
if (_group != nil)
{
[self endUndoGrouping];
}
@ -182,17 +182,17 @@ NSString *NSUndoManagerWillUndoChangeNotification =
{
PrivateUndoGroup *parent;
if (isUndoing == NO)
if (_isUndoing == NO)
{
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerCheckpointNotification
object: self];
}
parent = (PrivateUndoGroup*)group;
group = [[PrivateUndoGroup alloc] initWithParent: parent];
if (group == nil)
parent = (PrivateUndoGroup*)_group;
_group = [[PrivateUndoGroup alloc] initWithParent: parent];
if (_group == nil)
{
group = parent;
_group = parent;
[NSException raise: NSInternalInconsistencyException
format: @"beginUndoGrouping failed to greate group"];
}
@ -211,7 +211,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerCheckpointNotification
object: self];
if ([redoStack count] > 0)
if ([_redoStack count] > 0)
{
return YES;
}
@ -223,11 +223,11 @@ NSString *NSUndoManagerWillUndoChangeNotification =
- (BOOL) canUndo
{
if ([undoStack count] > 0)
if ([_undoStack count] > 0)
{
return YES;
}
if (group != nil && [[group actions] count] > 0)
if (_group != nil && [[_group actions] count] > 0)
{
return YES;
}
@ -239,25 +239,25 @@ NSString *NSUndoManagerWillUndoChangeNotification =
[[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_loop:)
target: self
argument: nil];
RELEASE(redoStack);
RELEASE(undoStack);
RELEASE(actionName);
RELEASE(group);
RELEASE(modes);
RELEASE(_redoStack);
RELEASE(_undoStack);
RELEASE(_actionName);
RELEASE(_group);
RELEASE(_modes);
[super dealloc];
}
- (void) disableUndoRegistration
{
disableCount++;
_disableCount++;
}
- (void) enableUndoRegistration
{
if (disableCount > 0)
if (_disableCount > 0)
{
disableCount--;
registeredUndo = NO; /* No operations since registration enabled. */
_disableCount--;
_registeredUndo = NO; /* No operations since registration enabled. */
}
else
{
@ -271,7 +271,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
PrivateUndoGroup *g;
PrivateUndoGroup *p;
if (group == nil)
if (_group == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"endUndoGrouping without beginUndoGrouping"];
@ -279,30 +279,30 @@ NSString *NSUndoManagerWillUndoChangeNotification =
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerCheckpointNotification
object: self];
g = (PrivateUndoGroup*)group;
g = (PrivateUndoGroup*)_group;
p = RETAIN([g parent]);
group = p;
_group = p;
[g orphan];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerWillCloseUndoGroupNotification
object: self];
if (p == nil)
{
if (isUndoing)
if (_isUndoing)
{
if (levelsOfUndo > 0 && [redoStack count] == levelsOfUndo)
if (_levelsOfUndo > 0 && [_redoStack count] == _levelsOfUndo)
{
[redoStack removeObjectAtIndex: 0];
[_redoStack removeObjectAtIndex: 0];
}
[redoStack addObject: g];
[_redoStack addObject: g];
}
else
{
if (levelsOfUndo > 0 && [undoStack count] == levelsOfUndo)
if (_levelsOfUndo > 0 && [_undoStack count] == _levelsOfUndo)
{
[undoStack removeObjectAtIndex: 0];
[_undoStack removeObjectAtIndex: 0];
}
[undoStack addObject: g];
[_undoStack addObject: g];
}
}
else if ([g actions] != nil)
@ -320,32 +320,32 @@ NSString *NSUndoManagerWillUndoChangeNotification =
- (void) forwardInvocation: (NSInvocation*)anInvocation
{
if (disableCount == 0)
if (_disableCount == 0)
{
if (nextTarget == nil)
if (_nextTarget == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"forwardInvocation without perparation"];
}
if (group == nil)
if (_group == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"forwardInvocation without beginUndoGrouping"];
}
[anInvocation setTarget: nextTarget];
nextTarget = nil;
[group addInvocation: anInvocation];
if (isUndoing == NO)
[anInvocation setTarget: _nextTarget];
_nextTarget = nil;
[_group addInvocation: anInvocation];
if (_isUndoing == NO)
{
[redoStack removeAllObjects];
[_redoStack removeAllObjects];
}
registeredUndo = YES;
_registeredUndo = YES;
}
}
- (int) groupingLevel
{
PrivateUndoGroup *g = (PrivateUndoGroup*)group;
PrivateUndoGroup *g = (PrivateUndoGroup*)_group;
int level = 0;
while (g != nil)
@ -358,7 +358,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
- (BOOL) groupsByEvent
{
return groupsByEvent;
return _groupsByEvent;
}
- (id) init
@ -366,9 +366,9 @@ NSString *NSUndoManagerWillUndoChangeNotification =
self = [super init];
if (self)
{
actionName = @"";
redoStack = [[NSMutableArray alloc] initWithCapacity: 16];
undoStack = [[NSMutableArray alloc] initWithCapacity: 16];
_actionName = @"";
_redoStack = [[NSMutableArray alloc] initWithCapacity: 16];
_undoStack = [[NSMutableArray alloc] initWithCapacity: 16];
[self setRunLoopModes:
[NSArray arrayWithObjects: NSDefaultRunLoopMode, nil]];
}
@ -377,17 +377,17 @@ NSString *NSUndoManagerWillUndoChangeNotification =
- (BOOL) isRedoing
{
return isRedoing;
return _isRedoing;
}
- (BOOL) isUndoing
{
return isUndoing;
return _isUndoing;
}
- (BOOL) isUndoRegistrationEnabled
{
if (disableCount == 0)
if (_disableCount == 0)
{
return YES;
}
@ -399,18 +399,18 @@ NSString *NSUndoManagerWillUndoChangeNotification =
- (unsigned int) levelsOfUndo
{
return levelsOfUndo;
return _levelsOfUndo;
}
- (id) prepareWithInvocationTarget: (id)target
{
nextTarget = target;
_nextTarget = target;
return self;
}
- (void) redo
{
if (isUndoing || isRedoing)
if (_isUndoing || _isRedoing)
{
[NSException raise: NSInternalInconsistencyException
format: @"redo while undoing or redoing"];
@ -418,7 +418,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerCheckpointNotification
object: self];
if ([redoStack count] > 0)
if ([_redoStack count] > 0)
{
PrivateUndoGroup *oldGroup;
PrivateUndoGroup *groupToRedo;
@ -426,18 +426,18 @@ NSString *NSUndoManagerWillUndoChangeNotification =
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerWillRedoChangeNotification
object: self];
groupToRedo = [redoStack objectAtIndex: [redoStack count] - 1];
groupToRedo = [_redoStack objectAtIndex: [_redoStack count] - 1];
RETAIN(groupToRedo);
[redoStack removeObjectAtIndex: [redoStack count] - 1];
oldGroup = group;
group = nil;
isRedoing = YES;
[_redoStack removeObjectAtIndex: [_redoStack count] - 1];
oldGroup = _group;
_group = nil;
_isRedoing = YES;
[self beginUndoGrouping];
[groupToRedo perform];
RELEASE(groupToRedo);
[self endUndoGrouping];
isRedoing = NO;
group = oldGroup;
_isRedoing = NO;
_group = oldGroup;
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerDidRedoChangeNotification
object: self];
@ -450,7 +450,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
{
return nil;
}
return actionName;
return _actionName;
}
- (NSString*) redoMenuItemTitle
@ -478,111 +478,111 @@ NSString *NSUndoManagerWillUndoChangeNotification =
selector: (SEL)aSelector
object: (id)anObject
{
if (disableCount == 0)
if (_disableCount == 0)
{
NSMethodSignature *sig;
NSInvocation *inv;
PrivateUndoGroup *g;
if (group == nil)
if (_group == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"registerUndo without beginUndoGrouping"];
}
g = group;
g = _group;
sig = [target methodSignatureForSelector: aSelector];
inv = [NSInvocation invocationWithMethodSignature: sig];
[inv setTarget: target];
[inv setSelector: aSelector];
[inv setArgument: &anObject atIndex: 2];
[g addInvocation: inv];
if (isUndoing == NO)
if (_isUndoing == NO)
{
[redoStack removeAllObjects];
[_redoStack removeAllObjects];
}
registeredUndo = YES;
_registeredUndo = YES;
}
}
- (void) removeAllActions
{
[redoStack removeAllObjects];
[undoStack removeAllObjects];
isRedoing = NO;
isUndoing = NO;
disableCount = 0;
[_redoStack removeAllObjects];
[_undoStack removeAllObjects];
_isRedoing = NO;
_isUndoing = NO;
_disableCount = 0;
}
- (void) removeAllActionsWithTarget: (id)target
{
unsigned i;
i = [redoStack count];
i = [_redoStack count];
while (i-- > 0)
{
PrivateUndoGroup *g;
g = [redoStack objectAtIndex: i];
g = [_redoStack objectAtIndex: i];
if ([g removeActionsForTarget: target] == NO)
{
[redoStack removeObjectAtIndex: i];
[_redoStack removeObjectAtIndex: i];
}
}
i = [undoStack count];
i = [_undoStack count];
while (i-- > 0)
{
PrivateUndoGroup *g;
g = [undoStack objectAtIndex: i];
g = [_undoStack objectAtIndex: i];
if ([g removeActionsForTarget: target] == NO)
{
[undoStack removeObjectAtIndex: i];
[_undoStack removeObjectAtIndex: i];
}
}
}
- (NSArray*) runLoopModes
{
return modes;
return _modes;
}
- (void) setActionName: (NSString*)name
{
if (name != nil && actionName != name)
if (name != nil && _actionName != name)
{
ASSIGNCOPY(actionName, name);
ASSIGNCOPY(_actionName, name);
}
}
- (void) setGroupsByEvent: (BOOL)flag
{
if (groupsByEvent != flag)
if (_groupsByEvent != flag)
{
groupsByEvent = flag;
_groupsByEvent = flag;
}
}
- (void) setLevelsOfUndo: (unsigned)num
{
levelsOfUndo = num;
_levelsOfUndo = num;
if (num > 0)
{
while ([undoStack count] > num)
while ([_undoStack count] > num)
{
[undoStack removeObjectAtIndex: 0];
[_undoStack removeObjectAtIndex: 0];
}
while ([redoStack count] > num)
while ([_redoStack count] > num)
{
[redoStack removeObjectAtIndex: 0];
[_redoStack removeObjectAtIndex: 0];
}
}
}
- (void) setRunLoopModes: (NSArray*)newModes
{
if (modes != newModes)
if (_modes != newModes)
{
ASSIGN(modes, newModes);
ASSIGN(_modes, newModes);
[[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_loop:)
target: self
argument: nil];
@ -590,7 +590,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
target: self
argument: nil
order: 0
modes: modes];
modes: _modes];
}
}
@ -600,7 +600,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
{
[self endUndoGrouping];
}
if (group != nil)
if (_group != nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"undo with nested groups"];
@ -614,7 +614,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
{
return nil;
}
return actionName;
return _actionName;
}
- (NSString*) undoMenuItemTitle
@ -653,46 +653,46 @@ NSString *NSUndoManagerWillUndoChangeNotification =
* It would make more sense to raise an exception if NO undo operations
* had been registered.
*/
if (registeredUndo)
if (_registeredUndo)
{
[NSException raise: NSInternalInconsistencyException
format: @"undoNestedGroup with registered undo ops"];
}
#endif
if (isUndoing || isRedoing)
if (_isUndoing || _isRedoing)
{
[NSException raise: NSInternalInconsistencyException
format: @"undoNestedGroup while undoing or redoing"];
}
if (group != nil && [undoStack count] == 0)
if (_group != nil && [_undoStack count] == 0)
{
return;
}
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerWillUndoChangeNotification
object: self];
oldGroup = group;
group = nil;
isUndoing = YES;
oldGroup = _group;
_group = nil;
_isUndoing = YES;
if (oldGroup)
{
groupToUndo = oldGroup;
oldGroup = RETAIN([oldGroup parent]);
[groupToUndo orphan];
[redoStack addObject: groupToUndo];
[_redoStack addObject: groupToUndo];
}
else
{
groupToUndo = [undoStack objectAtIndex: [undoStack count] - 1];
groupToUndo = [_undoStack objectAtIndex: [_undoStack count] - 1];
RETAIN(groupToUndo);
[undoStack removeObjectAtIndex: [undoStack count] - 1];
[_undoStack removeObjectAtIndex: [_undoStack count] - 1];
}
[self beginUndoGrouping];
[groupToUndo perform];
RELEASE(groupToUndo);
[self endUndoGrouping];
isUndoing = NO;
group = oldGroup;
_isUndoing = NO;
_group = oldGroup;
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUndoManagerDidUndoChangeNotification
object: self];

View file

@ -297,42 +297,42 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
[super init];
// Find the user's home folder and build the paths (executed only once)
if (!defaultsDatabase)
if (!_defaultsDatabase)
{
if (path != nil && [path isEqual: @""] == NO)
defaultsDatabase = (NSMutableString*)[path mutableCopy];
_defaultsDatabase = (NSMutableString*)[path mutableCopy];
else
{
defaultsDatabase =
_defaultsDatabase =
(NSMutableString*)[NSMutableString stringWithFormat: @"%@/%@",
NSHomeDirectoryForUser(NSUserName()),
GNU_UserDefaultsDatabase];
RETAIN(defaultsDatabase);
RETAIN(_defaultsDatabase);
}
if ([[defaultsDatabase lastPathComponent] isEqual:
if ([[_defaultsDatabase lastPathComponent] isEqual:
[GNU_UserDefaultsDatabase lastPathComponent]] == YES)
defaultsDatabaseLockName =
_defaultsDatabaseLockName =
(NSMutableString*)[NSMutableString stringWithFormat: @"%@/%@",
[defaultsDatabase stringByDeletingLastPathComponent],
[_defaultsDatabase stringByDeletingLastPathComponent],
[GNU_UserDefaultsDatabaseLock lastPathComponent]];
else
defaultsDatabaseLockName =
_defaultsDatabaseLockName =
(NSMutableString*)[NSMutableString stringWithFormat: @"%@/%@",
NSHomeDirectoryForUser(NSUserName()),
GNU_UserDefaultsDatabaseLock];
RETAIN(defaultsDatabaseLockName);
defaultsDatabaseLock =
RETAIN([NSDistributedLock lockWithPath: defaultsDatabaseLockName]);
RETAIN(_defaultsDatabaseLockName);
_defaultsDatabaseLock =
RETAIN([NSDistributedLock lockWithPath: _defaultsDatabaseLockName]);
}
if (processName == nil)
processName = RETAIN([[NSProcessInfo processInfo] processName]);
// Create an empty search list
searchList = [[NSMutableArray alloc] initWithCapacity: 10];
_searchList = [[NSMutableArray alloc] initWithCapacity: 10];
// Initialize persDomains from the archived user defaults (persistent)
persDomains = [[NSMutableDictionary alloc] initWithCapacity: 10];
// Initialize _persDomains from the archived user defaults (persistent)
_persDomains = [[NSMutableDictionary alloc] initWithCapacity: 10];
if ([self synchronize] == NO)
{
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
@ -355,26 +355,26 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
}
// Check and if not existent add the Application and the Global domains
if (![persDomains objectForKey: processName])
if (![_persDomains objectForKey: processName])
{
[persDomains setObject:
[_persDomains setObject:
[NSMutableDictionary
dictionaryWithCapacity: 10] forKey: processName];
[self __changePersistentDomain: processName];
}
if (![persDomains objectForKey: NSGlobalDomain])
if (![_persDomains objectForKey: NSGlobalDomain])
{
[persDomains setObject:
[_persDomains setObject:
[NSMutableDictionary
dictionaryWithCapacity: 10] forKey: NSGlobalDomain];
[self __changePersistentDomain: NSGlobalDomain];
}
// Create volatile defaults and add the Argument and the Registration domains
tempDomains = [[NSMutableDictionary alloc] initWithCapacity: 10];
[tempDomains setObject: [self __createArgumentDictionary]
_tempDomains = [[NSMutableDictionary alloc] initWithCapacity: 10];
[_tempDomains setObject: [self __createArgumentDictionary]
forKey: NSArgumentDomain];
[tempDomains setObject:
[_tempDomains setObject:
[NSMutableDictionary
dictionaryWithCapacity: 10] forKey: NSRegistrationDomain];
@ -383,14 +383,14 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
- (void)dealloc
{
if (tickingTimer)
[tickingTimer invalidate];
RELEASE(lastSync);
RELEASE(searchList);
RELEASE(persDomains);
RELEASE(tempDomains);
RELEASE(changedDomains);
RELEASE(dictionaryRep);
if (_tickingTimer)
[_tickingTimer invalidate];
RELEASE(_lastSync);
RELEASE(_searchList);
RELEASE(_persDomains);
RELEASE(_tempDomains);
RELEASE(_changedDomains);
RELEASE(_dictionaryRep);
[super dealloc];
}
@ -464,7 +464,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
- (id)objectForKey: (NSString *)defaultName
{
NSEnumerator *enumerator = [searchList objectEnumerator];
NSEnumerator *enumerator = [_searchList objectEnumerator];
id object = nil;
id dN;
@ -472,10 +472,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
{
id dict;
dict = [persDomains objectForKey: dN];
dict = [_persDomains objectForKey: dN];
if (dict && (object = [dict objectForKey: defaultName]))
break;
dict = [tempDomains objectForKey: dN];
dict = [_tempDomains objectForKey: dN];
if (dict && (object = [dict objectForKey: defaultName]))
break;
}
@ -485,11 +485,11 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
- (void)removeObjectForKey: (NSString *)defaultName
{
id obj = [[persDomains objectForKey: processName] objectForKey: defaultName];
id obj = [[_persDomains objectForKey: processName] objectForKey: defaultName];
if (obj)
{
id obj = [persDomains objectForKey: processName];
id obj = [_persDomains objectForKey: processName];
NSMutableDictionary *dict;
if ([obj isKindOfClass: [NSMutableDictionary class]] == YES)
@ -499,7 +499,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
else
{
dict = [obj mutableCopy];
[persDomains setObject: dict forKey: processName];
[_persDomains setObject: dict forKey: processName];
}
[dict removeObjectForKey: defaultName];
[self __changePersistentDomain: processName];
@ -535,7 +535,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
{
if (value && defaultName && ([defaultName length] > 0))
{
id obj = [persDomains objectForKey: processName];
id obj = [_persDomains objectForKey: processName];
NSMutableDictionary *dict;
if ([obj isKindOfClass: [NSMutableDictionary class]] == YES)
@ -545,7 +545,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
else
{
dict = [obj mutableCopy];
[persDomains setObject: dict forKey: processName];
[_persDomains setObject: dict forKey: processName];
}
[dict setObject: value forKey: defaultName];
[self __changePersistentDomain: processName];
@ -584,14 +584,14 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
*************************************************************************/
- (NSMutableArray *)searchList
{
return searchList;
return _searchList;
}
- (void)setSearchList: (NSArray*)newList
{
DESTROY(dictionaryRep);
RELEASE(searchList);
searchList = [newList mutableCopy];
DESTROY(_dictionaryRep);
RELEASE(_searchList);
_searchList = [newList mutableCopy];
}
/*************************************************************************
@ -599,19 +599,19 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
*************************************************************************/
- (NSDictionary *)persistentDomainForName: (NSString *)domainName
{
return [[persDomains objectForKey: domainName] copy];
return [[_persDomains objectForKey: domainName] copy];
}
- (NSArray *)persistentDomainNames
{
return [persDomains allKeys];
return [_persDomains allKeys];
}
- (void)removePersistentDomainForName: (NSString *)domainName
{
if ([persDomains objectForKey: domainName])
if ([_persDomains objectForKey: domainName])
{
[persDomains removeObjectForKey: domainName];
[_persDomains removeObjectForKey: domainName];
[self __changePersistentDomain: domainName];
}
return;
@ -620,7 +620,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
- (void)setPersistentDomain: (NSDictionary *)domain
forName: (NSString *)domainName
{
id dict = [tempDomains objectForKey: domainName];
id dict = [_tempDomains objectForKey: domainName];
if (dict)
{
@ -629,7 +629,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
domainName];
return;
}
[persDomains setObject: domain forKey: domainName];
[_persDomains setObject: domain forKey: domainName];
[self __changePersistentDomain: domainName];
return;
}
@ -641,9 +641,9 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
NSDictionary *attr;
NSDate *mod;
if (tickingTimer == nil)
if (_tickingTimer == nil)
{
tickingTimer = [NSTimer scheduledTimerWithTimeInterval: 30
_tickingTimer = [NSTimer scheduledTimerWithTimeInterval: 30
target: self
selector: @selector(__timerTicked:)
userInfo: nil
@ -654,22 +654,22 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
* If we haven't changed anything, we only need to synchronise if
* the on-disk database has been changed by someone else.
*/
if (changedDomains == NO)
if (_changedDomains == NO)
{
BOOL wantRead = NO;
if (lastSync == nil)
if (_lastSync == nil)
wantRead = YES;
else
{
attr = [mgr fileAttributesAtPath: defaultsDatabase
attr = [mgr fileAttributesAtPath: _defaultsDatabase
traverseLink: YES];
if (attr == nil)
wantRead = YES;
else
{
mod = [attr objectForKey: NSFileModificationDate];
if ([lastSync earlierDate: mod] != lastSync)
if ([_lastSync earlierDate: mod] != _lastSync)
wantRead = YES;
}
}
@ -680,12 +680,12 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
/*
* Get file lock - break any lock that is more than five minute old.
*/
if ([defaultsDatabaseLock tryLock] == NO)
if ([_defaultsDatabaseLock tryLock] == NO)
{
if ([[defaultsDatabaseLock lockDate] timeIntervalSinceNow] < -300.0)
if ([[_defaultsDatabaseLock lockDate] timeIntervalSinceNow] < -300.0)
{
[defaultsDatabaseLock breakLock];
if ([defaultsDatabaseLock tryLock] == NO)
[_defaultsDatabaseLock breakLock];
if ([_defaultsDatabaseLock tryLock] == NO)
{
return NO;
}
@ -696,23 +696,23 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
}
}
DESTROY(dictionaryRep);
DESTROY(_dictionaryRep);
// Read the persistent data from the stored database
if ([mgr fileExistsAtPath: defaultsDatabase])
if ([mgr fileExistsAtPath: _defaultsDatabase])
{
newDict = [[NSMutableDictionary allocWithZone: [self zone]]
initWithContentsOfFile: defaultsDatabase];
initWithContentsOfFile: _defaultsDatabase];
}
else
{
attr = [NSDictionary dictionaryWithObjectsAndKeys:
NSUserName(), NSFileOwnerAccountName, nil];
NSLog(@"Creating defaults database file %@", defaultsDatabase);
[mgr createFileAtPath: defaultsDatabase
NSLog(@"Creating defaults database file %@", _defaultsDatabase);
[mgr createFileAtPath: _defaultsDatabase
contents: nil
attributes: attr];
[[NSDictionary dictionary] writeToFile: defaultsDatabase atomically: YES];
[[NSDictionary dictionary] writeToFile: _defaultsDatabase atomically: YES];
}
if (!newDict)
@ -721,14 +721,14 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
initWithCapacity: 1];
}
if (changedDomains)
if (_changedDomains)
{ // Synchronize both dictionaries
NSEnumerator *enumerator = [changedDomains objectEnumerator];
NSEnumerator *enumerator = [_changedDomains objectEnumerator];
id obj, dict;
while ((obj = [enumerator nextObject]))
{
dict = [persDomains objectForKey: obj];
dict = [_persDomains objectForKey: obj];
if (dict) // Domain was added or changet
{
[newDict setObject: dict forKey: obj];
@ -738,31 +738,31 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
[newDict removeObjectForKey: obj];
}
}
RELEASE(persDomains);
persDomains = newDict;
RELEASE(_persDomains);
_persDomains = newDict;
// Save the changes
if (![persDomains writeToFile: defaultsDatabase atomically: YES])
if (![_persDomains writeToFile: _defaultsDatabase atomically: YES])
{
[defaultsDatabaseLock unlock];
[_defaultsDatabaseLock unlock];
return NO;
}
attr = [mgr fileAttributesAtPath: defaultsDatabase
attr = [mgr fileAttributesAtPath: _defaultsDatabase
traverseLink: YES];
mod = [attr objectForKey: NSFileModificationDate];
ASSIGN(lastSync, mod);
[defaultsDatabaseLock unlock]; // release file lock
ASSIGN(_lastSync, mod);
[_defaultsDatabaseLock unlock]; // release file lock
}
else
{
attr = [mgr fileAttributesAtPath: defaultsDatabase
attr = [mgr fileAttributesAtPath: _defaultsDatabase
traverseLink: YES];
mod = [attr objectForKey: NSFileModificationDate];
ASSIGN(lastSync, mod);
[defaultsDatabaseLock unlock]; // release file lock
if ([persDomains isEqual: newDict] == NO)
ASSIGN(_lastSync, mod);
[_defaultsDatabaseLock unlock]; // release file lock
if ([_persDomains isEqual: newDict] == NO)
{
RELEASE(persDomains);
persDomains = newDict;
RELEASE(_persDomains);
_persDomains = newDict;
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUserDefaultsDidChangeNotification
object: nil];
@ -782,14 +782,14 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
*************************************************************************/
- (void)removeVolatileDomainForName: (NSString *)domainName
{
DESTROY(dictionaryRep);
[tempDomains removeObjectForKey: domainName];
DESTROY(_dictionaryRep);
[_tempDomains removeObjectForKey: domainName];
}
- (void)setVolatileDomain: (NSDictionary *)domain
forName: (NSString *)domainName
{
id dict = [persDomains objectForKey: domainName];
id dict = [_persDomains objectForKey: domainName];
if (dict)
{
@ -798,19 +798,19 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
domainName];
return;
}
DESTROY(dictionaryRep);
[tempDomains setObject: domain forKey: domainName];
DESTROY(_dictionaryRep);
[_tempDomains setObject: domain forKey: domainName];
return;
}
- (NSDictionary *)volatileDomainForName: (NSString *)domainName
{
return [tempDomains objectForKey: domainName];
return [_tempDomains objectForKey: domainName];
}
- (NSArray *)volatileDomainNames
{
return [tempDomains allKeys];
return [_tempDomains allKeys];
}
/*************************************************************************
@ -818,38 +818,38 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
*************************************************************************/
- (NSDictionary *) dictionaryRepresentation
{
if (dictionaryRep == nil)
if (_dictionaryRep == nil)
{
NSEnumerator *enumerator;
NSMutableDictionary *dictRep;
id obj;
id dict;
enumerator = [searchList reverseObjectEnumerator];
enumerator = [_searchList reverseObjectEnumerator];
dictRep = [NSMutableDictionary allocWithZone: NSDefaultMallocZone()];
dictRep = [dictRep initWithCapacity: 512];
while ((obj = [enumerator nextObject]))
{
if ( (dict = [persDomains objectForKey: obj])
|| (dict = [tempDomains objectForKey: obj]) )
if ( (dict = [_persDomains objectForKey: obj])
|| (dict = [_tempDomains objectForKey: obj]) )
[dictRep addEntriesFromDictionary: dict];
}
dictionaryRep = [dictRep copy];
_dictionaryRep = [dictRep copy];
RELEASE(dictRep);
}
return dictionaryRep;
return _dictionaryRep;
}
- (void) registerDefaults: (NSDictionary*)newVals
{
NSMutableDictionary *regDefs;
regDefs = [tempDomains objectForKey: NSRegistrationDomain];
regDefs = [_tempDomains objectForKey: NSRegistrationDomain];
if (regDefs == nil)
{
regDefs = [NSMutableDictionary dictionaryWithCapacity: [newVals count]];
}
DESTROY(dictionaryRep);
DESTROY(_dictionaryRep);
[regDefs addEntriesFromDictionary: newVals];
}
@ -865,22 +865,22 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
// Note: The search list should exist!
// 1. NSArgumentDomain
[searchList addObject: NSArgumentDomain];
[_searchList addObject: NSArgumentDomain];
// 2. Application
[searchList addObject: processName];
[_searchList addObject: processName];
// 3. User's preferred languages
while ((object = [enumerator nextObject]))
{
[searchList addObject: object];
[_searchList addObject: object];
}
// 4. NSGlobalDomain
[searchList addObject: NSGlobalDomain];
[_searchList addObject: NSGlobalDomain];
// 5. NSRegistrationDomain
[searchList addObject: NSRegistrationDomain];
[_searchList addObject: NSRegistrationDomain];
return;
}
@ -888,7 +888,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
- (NSDictionary *)__createArgumentDictionary
{
NSArray *args = [[NSProcessInfo processInfo] arguments];
//$$$ NSArray *args = searchList; // $$$
//$$$ NSArray *args = _searchList; // $$$
NSEnumerator *enumerator = [args objectEnumerator];
NSMutableDictionary *argDict =
[NSMutableDictionary dictionaryWithCapacity: 2];
@ -946,28 +946,28 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
NSEnumerator *enumerator = nil;
id obj;
DESTROY(dictionaryRep);
if (!changedDomains)
DESTROY(_dictionaryRep);
if (!_changedDomains)
{
changedDomains = [[NSMutableArray alloc] initWithCapacity: 5];
_changedDomains = [[NSMutableArray alloc] initWithCapacity: 5];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSUserDefaultsDidChangeNotification object: nil];
}
enumerator = [changedDomains objectEnumerator];
enumerator = [_changedDomains objectEnumerator];
while ((obj = [enumerator nextObject]))
{
if ([obj isEqualToString: domainName])
return;
}
[changedDomains addObject: domainName];
[_changedDomains addObject: domainName];
return;
}
- (void) __timerTicked: (NSTimer*)tim
{
if (tim == tickingTimer)
tickingTimer = nil;
if (tim == _tickingTimer)
_tickingTimer = nil;
[self synchronize];
}

View file

@ -33,7 +33,7 @@
- init
{
[super init];
is_valid = YES;
_is_valid = YES;
return self;
}

View file

@ -1080,7 +1080,7 @@ static NSMapTable* port_number_2_port;
don't create a new one, just return the old one. */
if ((p = (id) NSMapGet (port_number_2_port, (void*)((int)n))))
{
NSAssert(p->is_valid, NSInternalInconsistencyException);
NSAssert(p->_is_valid, NSInternalInconsistencyException);
return [p retain];
}
@ -1283,7 +1283,7 @@ static NSMapTable* port_number_2_port;
- (struct sockaddr_in*) _listeningSockaddr
{
NSAssert(is_valid, NSInternalInconsistencyException);
NSAssert(_is_valid, NSInternalInconsistencyException);
return &_listening_address;
}
@ -1520,7 +1520,7 @@ static NSMapTable* port_number_2_port;
{
int s = [p _port_socket];
NSAssert(is_valid, NSInternalInconsistencyException);
NSAssert(_is_valid, NSInternalInconsistencyException);
/* Make sure it hasn't already been added. */
NSAssert(!NSMapGet (_client_sock_2_out_port, (void*)s), NSInternalInconsistencyException);
@ -1534,7 +1534,7 @@ static NSMapTable* port_number_2_port;
id packet;
int s = [p _port_socket];
NSAssert(is_valid, NSInternalInconsistencyException);
NSAssert(_is_valid, NSInternalInconsistencyException);
if (debug_tcp_port)
NSLog(@"%s: Closed connection from\n %@\n",
object_get_class_name (self), [p description]);
@ -1572,7 +1572,7 @@ static NSMapTable* port_number_2_port;
- (void) invalidate
{
if (is_valid)
if (_is_valid)
{
NSMapEnumerator me = NSEnumerateMapTable (_client_sock_2_out_port);
int count = NSCountMapTable (_client_sock_2_out_port);
@ -1644,7 +1644,7 @@ static NSMapTable* port_number_2_port;
return [NSString
stringWithFormat: @"%s%c0x%x port %hd socket %d",
object_get_class_name (self),
is_valid ? ' ' : '-',
_is_valid ? ' ' : '-',
(unsigned)self,
GSSwapBigI16ToHost(_listening_address.sin_port),
_port_socket];
@ -1668,7 +1668,7 @@ static NSMapTable* port_number_2_port;
- (void) encodeWithCoder: aCoder
{
NSAssert(is_valid, NSInternalInconsistencyException);
NSAssert(_is_valid, NSInternalInconsistencyException);
/* We are actually encoding a "send right" (ala Mach),
not a receive right.
These values must match those expected by [TcpOutPort +newWithCoder] */
@ -1770,7 +1770,7 @@ static NSMapTable *out_port_bag = NULL;
/* Assume that sin_family is equal. Using memcmp() doesn't
work because sin_zero's may differ. */
{
NSAssert(p->is_valid, NSInternalInconsistencyException);
NSAssert(p->_is_valid, NSInternalInconsistencyException);
return [p retain];
}
}
@ -1835,7 +1835,7 @@ static NSMapTable *out_port_bag = NULL;
}
if (p)
{
NSAssert(p->is_valid, NSInternalInconsistencyException);
NSAssert(p->_is_valid, NSInternalInconsistencyException);
return [p retain];
}
}
@ -2016,7 +2016,7 @@ static NSMapTable *out_port_bag = NULL;
{
id reply_port = [packet replyInPort];
NSAssert(is_valid, NSInternalInconsistencyException);
NSAssert(_is_valid, NSInternalInconsistencyException);
/* If the socket of this TcpOutPort isn't already being polled
for incoming data by a TcpInPort, and if the packet's REPLY_PORT
@ -2070,7 +2070,7 @@ static NSMapTable *out_port_bag = NULL;
- (void) invalidate
{
if (is_valid)
if (_is_valid)
{
id port = _polling_in_port;
@ -2145,7 +2145,7 @@ static NSMapTable *out_port_bag = NULL;
return [NSString
stringWithFormat: @"%s%c0x%x host %s port %hd socket %d",
object_get_class_name (self),
is_valid ? ' ' : '-',
_is_valid ? ' ' : '-',
(unsigned)self,
inet_ntoa (_remote_in_port_address.sin_addr),
GSSwapBigI16ToHost(_remote_in_port_address.sin_port),
@ -2154,7 +2154,7 @@ static NSMapTable *out_port_bag = NULL;
- (void) encodeWithCoder: aCoder
{
NSAssert(is_valid, NSInternalInconsistencyException);
NSAssert(_is_valid, NSInternalInconsistencyException);
NSAssert(!_polling_in_port
|| (GSSwapBigI16ToHost(_remote_in_port_address.sin_port)
!= [_polling_in_port portNumber]), NSInternalInconsistencyException);

View file

@ -263,7 +263,7 @@ static NSMapTable *port_number_2_in_port = NULL;
- (void) invalidate
{
if (is_valid)
if (_is_valid)
{
close (_port_socket);
[super invalidate];