diff --git a/Headers/gnustep/base/Coder.h b/Headers/gnustep/base/Coder.h index c082555b8..10f89c20b 100644 --- a/Headers/gnustep/base/Coder.h +++ b/Headers/gnustep/base/Coder.h @@ -1,5 +1,5 @@ /* Interface for GNU Objective-C coder object for use serializing - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Free Software Foundation, Inc. Written by: R. Andrew McCallum Date: July 1994 @@ -21,8 +21,8 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __Coder_h -#define __Coder_h +#ifndef __Coder_h_OBJECTS_INCLUDE +#define __Coder_h_OBJECTS_INCLUDE #include #include @@ -31,7 +31,7 @@ @class Dictionary; @class Stack; -@interface Coder : NSObject +@interface Coder : NSObject { int format_version; int concrete_format_version; @@ -48,102 +48,14 @@ + defaultStreamClass; + setDebugging: (BOOL)f; -- initEncodingOnStream: (Stream *)s; -- initDecodingOnStream: (Stream *)s; -- initEncoding; -- initDecoding; -- init; - -- (void) dealloc; -- (BOOL) isDecoding; - -- (void) encodeValueOfType: (const char*)type - at: (const void*)d - withName: (const char *)name; -- (void) decodeValueOfType: (const char*)type - at: (void*)d - withName: (const char **)namePtr; - -- (void) encodeWithName: (const char *)name - valuesOfTypes: (const char *)types, ...; -- (void) decodeWithName: (const char **)name - valuesOfTypes: (const char *)types, ...; - -- (void) encodeArrayOfType: (const char *)type - at: (const void *)d - count: (unsigned)c - withName: (const char *)name; -- (void) decodeArrayOfType: (const char *)type - at: (void *)d - count: (unsigned *)c - withName: (const char **)name; - -- (void) encodeObject: anObj - withName: (const char *)name; -- (void) encodeObjectBycopy: anObj - withName: (const char *)name; -- (void) decodeObjectAt: (id*)anObjPtr - withName: (const char **)name; - -- (void) encodeRootObject: anObj - withName: (const char *)name; -- (void) encodeObjectReference: anObj - withName: (const char *)name; -- (void) startEncodingInterconnectedObjects; -- (void) finishEncodingInterconnectedObjects; -- (void) startDecodingInterconnectedObjects; -- (void) finishDecodingInterconnectedObjects; - -- (void) encodeAtomicString: (const char*)sp - withName: (const char*)name; -- (const char *) decodeAtomicStringWithName: (const char **)name; - -- decodeClass; -- (void) encodeClass: aClass; - -/* For inserting a name into a TextCoder stream */ -- (void) encodeName: (const char*)n; -- (void) decodeName: (const char**)n; - -/* For subclasses that want to keep track of recursion */ -- (void) encodeIndent; -- (void) encodeUnindent; -- (void) decodeIndent; -- (void) decodeUnindent; - -/* Implemented by concrete subclasses */ -- (void) encodeValueOfSimpleType: (const char*)type - at: (const void*)d - withName: (const char *)name; -- (void) decodeValueOfSimpleType: (const char*)type - at: (void*)d - withName: (const char **)namePtr; -- (void) encodeBytes: (const char *)b - count: (unsigned)c - withName: (const char *)name; -- (void) decodeBytes: (char *)b - count: (unsigned*)c - withName: (const char **)name; - -- (int) coderFormatVersion; -- (int) coderConcreteFormatVersion; - -- (void) resetCoder; /* xxx remove this? */ - -- doInitOnStream: (Stream *)s isDecoding: (BOOL)f; -/* Internal designated initializer. Override it, but don't call it yourself. - This method name may change. */ - -+ (int) coderFormatVersion; -+ (int) coderConcreteFormatVersion; -+ (const char *) coderSignature; - @end -@interface NSObject (CoderAdditions) - -- (void) encodeWithCoder: (Coder*)anEncoder; +@interface NSObject (OptionalNewWithCoder) + newWithCoder: (Coder*)aDecoder; +@end + +@interface NSObject (CoderAdditions) +/* not needed because of NSCoding */ /* These methods here temporarily until ObjC runtime category bug fixed */ - classForConnectedCoder:aRmc; @@ -151,4 +63,4 @@ @end -#endif /* __Coder_h */ +#endif /* __Coder_h_OBJECTS_INCLUDE */ diff --git a/Headers/gnustep/base/CollectionPrivate.h b/Headers/gnustep/base/CollectionPrivate.h index c11231834..1b7183022 100644 --- a/Headers/gnustep/base/CollectionPrivate.h +++ b/Headers/gnustep/base/CollectionPrivate.h @@ -1,5 +1,5 @@ /* Collection definitions for the use of subclass implementations only - Copyright (C) 1993,1994 Free Software Foundation, Inc. + Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc. Written by: R. Andrew McCallum Date: May 1993 @@ -36,10 +36,10 @@ - _readContents: (TypedStream*)aStream; /* The Coding versions of the above */ -- (void) _encodeCollectionWithCoder: (Coder*) aCoder; -+ _newCollectionWithCoder: (Coder*) aCoder; -- (void) _encodeContentsWithCoder: (Coder*)aCoder; -- (void) _decodeContentsWithCoder: (Coder*)aCoder; +- (void) _encodeCollectionWithCoder: (id )aCoder; +- _initCollectionWithCoder: (id )aCoder; +- (void) _encodeContentsWithCoder: (id )aCoder; +- (void) _decodeContentsWithCoder: (id )aCoder; @end @interface Collection (DeallocationHelpers) diff --git a/Headers/gnustep/base/EltNode-m b/Headers/gnustep/base/EltNode-m index 7a09f7fe9..7f40e43dc 100644 --- a/Headers/gnustep/base/EltNode-m +++ b/Headers/gnustep/base/EltNode-m @@ -1,5 +1,5 @@ /* Code for implementation for Objective-C EltNode objects - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 1995 Free Software Foundation, Inc. Written by: R. Andrew McCallum Dept. of Computer Science, U. of Rochester, Rochester, NY 14627 @@ -45,7 +45,7 @@ /* Archiving must mimic the above designated initializer */ -- (void) encodeWithCoder: (Coder*)aCoder +- (void) encodeWithCoder: aCoder { const char *encoding; @@ -68,20 +68,19 @@ return &_elt_comparison_function; } -+ newWithCoder: (Coder*)aCoder +- initWithCoder: aCoder { - id n; char *encoding; - n = [super newWithCoder:aCoder]; + [super initWithCoder:aCoder]; [aCoder decodeValueOfType:@encode(char*) at:&encoding withName:NULL]; - *[n _eltComparisonFunctionPtr] = elt_get_comparison_function(encoding); + *[self _eltComparisonFunctionPtr] = elt_get_comparison_function(encoding); [aCoder decodeValueOfType:encoding - at:[n _elementDataPtr] + at:[self _elementDataPtr] withName:NULL]; - return n; + return self; } - (int(*)(elt,elt)) comparisonFunction diff --git a/Headers/gnustep/base/NSCoder.h b/Headers/gnustep/base/NSCoder.h index 2476d6e16..c7ec4dbe3 100644 --- a/Headers/gnustep/base/NSCoder.h +++ b/Headers/gnustep/base/NSCoder.h @@ -2,7 +2,7 @@ Copyright (C) 1994 NeXT Computer, Inc. This file is part of the GNU Objective C Class Library. - + 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 @@ -18,8 +18,8 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __NSCoder__include__ -#define __NSCoder__include__ +#ifndef __NSCoder_h_OBJECTS_INCLUDE +#define __NSCoder_h_OBJECTS_INCLUDE #include #include @@ -28,53 +28,50 @@ @class NSMutableData, NSData, NSString; @interface NSCoder : NSObject -{ - NSMutableData *_data; -} // Encoding Data -- (void)encodeArrayOfObjCType:(const char *)types - count:(unsigned)count - at:(const void *)array; -- (void)encodeBycopyObject:(id)anObject; -- (void)encodeConditionalObject:(id)anObject; -- (void)encodeDataObject:(NSData *)data; -- (void)encodeObject:(id)anObject; -- (void)encodePropertyList:(id)plist; -- (void)encodePoint:(NSPoint)point; -- (void)encodeRect:(NSRect)rect; -- (void)encodeRootObject:(id)rootObject; -- (void)encodeSize:(NSSize)size; -- (void)encodeValueOfObjCType:(const char *)type - at:(const void *)address; -- (void)encodeValuesOfObjCTypes:(const char *)types,...; +- (void) encodeArrayOfObjCType: (const char*)types + count: (unsigned)count + at: (const void*)array; +- (void) encodeBycopyObject: (id)anObject; +- (void) encodeConditionalObject: (id)anObject; +- (void) encodeDataObject: (NSData*)data; +- (void) encodeObject: (id)anObject; +- (void) encodePropertyList: (id)plist; +- (void) encodePoint: (NSPoint)point; +- (void) encodeRect: (NSRect)rect; +- (void) encodeRootObject: (id)rootObject; +- (void) encodeSize: (NSSize)size; +- (void) encodeValueOfObjCType: (const char*)type + at: (const void*)address; +- (void) encodeValuesOfObjCTypes: (const char*)types,...; // Decoding Data -- (void)decodeArrayOfObjCType:(const char *)types - count:(unsigned)count - at:(void *)address; -- (NSData *)decodeDataObject; -- (id)decodeObject; -- (id)decodePropertyList; -- (NSPoint)decodePoint; -- (NSRect)decodeRect; -- (NSSize)decodeSize; -- (void)decodeValueOfObjCType:(const char *)type - at:(void *)address; -- (void)decodeValuesOfObjCTypes:(const char *)types,...; +- (void) decodeArrayOfObjCType: (const char*)types + count: (unsigned)count + at: (void*)address; +- (NSData*) decodeDataObject; +- (id) decodeObject; +- (id) decodePropertyList; +- (NSPoint) decodePoint; +- (NSRect) decodeRect; +- (NSSize) decodeSize; +- (void) decodeValueOfObjCType: (const char*)type + at: (void*)address; +- (void) decodeValuesOfObjCTypes: (const char*)types,...; // Managing Zones -- (NSZone *)objectZone; -- (void)setObjectZone:(NSZone *)zone; +- (NSZone*) objectZone; +- (void) setObjectZone: (NSZone*)zone; // Getting a Version -- (unsigned int)systemVersion; -- (unsigned int)versionForClassName:(NSString *)className; - +- (unsigned int) systemVersion; +- (unsigned int) versionForClassName: (NSString*)className; + @end -#endif /* __NSCoder__include__ */ +#endif /* __NSCoder_h_OBJECTS_INCLUDE */ diff --git a/Headers/gnustep/base/NSObject.h b/Headers/gnustep/base/NSObject.h index 65c101fa5..c669913be 100644 --- a/Headers/gnustep/base/NSObject.h +++ b/Headers/gnustep/base/NSObject.h @@ -63,8 +63,8 @@ @end @protocol NSCoding -// - (void)encodeWithCoder:(NSCoder *)aCoder; /* xxx Fix this! */ -// - initWithCoder:(NSCoder *)aDecoder; +- (void) encodeWithCoder: (NSCoder*)aCoder; +- (id) initWithCoder: (NSCoder*)aDecoder; @end @@ -111,6 +111,7 @@ NSObject *NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone); void NSDeallocateObject(NSObject *anObject); NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone); + BOOL NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone); void NSIncrementExtraRefCount(id anObject); BOOL NSDecrementExtraRefCountWasZero(id anObject); diff --git a/Source/objects/Coder.h b/Source/objects/Coder.h index c082555b8..10f89c20b 100644 --- a/Source/objects/Coder.h +++ b/Source/objects/Coder.h @@ -1,5 +1,5 @@ /* Interface for GNU Objective-C coder object for use serializing - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Free Software Foundation, Inc. Written by: R. Andrew McCallum Date: July 1994 @@ -21,8 +21,8 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __Coder_h -#define __Coder_h +#ifndef __Coder_h_OBJECTS_INCLUDE +#define __Coder_h_OBJECTS_INCLUDE #include #include @@ -31,7 +31,7 @@ @class Dictionary; @class Stack; -@interface Coder : NSObject +@interface Coder : NSObject { int format_version; int concrete_format_version; @@ -48,102 +48,14 @@ + defaultStreamClass; + setDebugging: (BOOL)f; -- initEncodingOnStream: (Stream *)s; -- initDecodingOnStream: (Stream *)s; -- initEncoding; -- initDecoding; -- init; - -- (void) dealloc; -- (BOOL) isDecoding; - -- (void) encodeValueOfType: (const char*)type - at: (const void*)d - withName: (const char *)name; -- (void) decodeValueOfType: (const char*)type - at: (void*)d - withName: (const char **)namePtr; - -- (void) encodeWithName: (const char *)name - valuesOfTypes: (const char *)types, ...; -- (void) decodeWithName: (const char **)name - valuesOfTypes: (const char *)types, ...; - -- (void) encodeArrayOfType: (const char *)type - at: (const void *)d - count: (unsigned)c - withName: (const char *)name; -- (void) decodeArrayOfType: (const char *)type - at: (void *)d - count: (unsigned *)c - withName: (const char **)name; - -- (void) encodeObject: anObj - withName: (const char *)name; -- (void) encodeObjectBycopy: anObj - withName: (const char *)name; -- (void) decodeObjectAt: (id*)anObjPtr - withName: (const char **)name; - -- (void) encodeRootObject: anObj - withName: (const char *)name; -- (void) encodeObjectReference: anObj - withName: (const char *)name; -- (void) startEncodingInterconnectedObjects; -- (void) finishEncodingInterconnectedObjects; -- (void) startDecodingInterconnectedObjects; -- (void) finishDecodingInterconnectedObjects; - -- (void) encodeAtomicString: (const char*)sp - withName: (const char*)name; -- (const char *) decodeAtomicStringWithName: (const char **)name; - -- decodeClass; -- (void) encodeClass: aClass; - -/* For inserting a name into a TextCoder stream */ -- (void) encodeName: (const char*)n; -- (void) decodeName: (const char**)n; - -/* For subclasses that want to keep track of recursion */ -- (void) encodeIndent; -- (void) encodeUnindent; -- (void) decodeIndent; -- (void) decodeUnindent; - -/* Implemented by concrete subclasses */ -- (void) encodeValueOfSimpleType: (const char*)type - at: (const void*)d - withName: (const char *)name; -- (void) decodeValueOfSimpleType: (const char*)type - at: (void*)d - withName: (const char **)namePtr; -- (void) encodeBytes: (const char *)b - count: (unsigned)c - withName: (const char *)name; -- (void) decodeBytes: (char *)b - count: (unsigned*)c - withName: (const char **)name; - -- (int) coderFormatVersion; -- (int) coderConcreteFormatVersion; - -- (void) resetCoder; /* xxx remove this? */ - -- doInitOnStream: (Stream *)s isDecoding: (BOOL)f; -/* Internal designated initializer. Override it, but don't call it yourself. - This method name may change. */ - -+ (int) coderFormatVersion; -+ (int) coderConcreteFormatVersion; -+ (const char *) coderSignature; - @end -@interface NSObject (CoderAdditions) - -- (void) encodeWithCoder: (Coder*)anEncoder; +@interface NSObject (OptionalNewWithCoder) + newWithCoder: (Coder*)aDecoder; +@end + +@interface NSObject (CoderAdditions) +/* not needed because of NSCoding */ /* These methods here temporarily until ObjC runtime category bug fixed */ - classForConnectedCoder:aRmc; @@ -151,4 +63,4 @@ @end -#endif /* __Coder_h */ +#endif /* __Coder_h_OBJECTS_INCLUDE */ diff --git a/Source/objects/CollectionPrivate.h b/Source/objects/CollectionPrivate.h index c11231834..1b7183022 100644 --- a/Source/objects/CollectionPrivate.h +++ b/Source/objects/CollectionPrivate.h @@ -1,5 +1,5 @@ /* Collection definitions for the use of subclass implementations only - Copyright (C) 1993,1994 Free Software Foundation, Inc. + Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc. Written by: R. Andrew McCallum Date: May 1993 @@ -36,10 +36,10 @@ - _readContents: (TypedStream*)aStream; /* The Coding versions of the above */ -- (void) _encodeCollectionWithCoder: (Coder*) aCoder; -+ _newCollectionWithCoder: (Coder*) aCoder; -- (void) _encodeContentsWithCoder: (Coder*)aCoder; -- (void) _decodeContentsWithCoder: (Coder*)aCoder; +- (void) _encodeCollectionWithCoder: (id )aCoder; +- _initCollectionWithCoder: (id )aCoder; +- (void) _encodeContentsWithCoder: (id )aCoder; +- (void) _decodeContentsWithCoder: (id )aCoder; @end @interface Collection (DeallocationHelpers) diff --git a/Source/objects/EltNode-m b/Source/objects/EltNode-m index 7a09f7fe9..7f40e43dc 100644 --- a/Source/objects/EltNode-m +++ b/Source/objects/EltNode-m @@ -1,5 +1,5 @@ /* Code for implementation for Objective-C EltNode objects - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 1995 Free Software Foundation, Inc. Written by: R. Andrew McCallum Dept. of Computer Science, U. of Rochester, Rochester, NY 14627 @@ -45,7 +45,7 @@ /* Archiving must mimic the above designated initializer */ -- (void) encodeWithCoder: (Coder*)aCoder +- (void) encodeWithCoder: aCoder { const char *encoding; @@ -68,20 +68,19 @@ return &_elt_comparison_function; } -+ newWithCoder: (Coder*)aCoder +- initWithCoder: aCoder { - id n; char *encoding; - n = [super newWithCoder:aCoder]; + [super initWithCoder:aCoder]; [aCoder decodeValueOfType:@encode(char*) at:&encoding withName:NULL]; - *[n _eltComparisonFunctionPtr] = elt_get_comparison_function(encoding); + *[self _eltComparisonFunctionPtr] = elt_get_comparison_function(encoding); [aCoder decodeValueOfType:encoding - at:[n _elementDataPtr] + at:[self _elementDataPtr] withName:NULL]; - return n; + return self; } - (int(*)(elt,elt)) comparisonFunction