diff --git a/ChangeLog b/ChangeLog index f75574377..7ece1cd2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-06-19 Richard Frith-Macdonald + + * Source/NSDate.m: Remove obsolete classForConnectedCoder method + * Source/NSPort.m: ditto + * Source/NSTcpPort.m: ditto + * Source/NSUdpPort.m: ditto + * Source/GNUmakefile: remove ConnectedCoder + * Source/ConnectedCoder.m: removed + * Headers/gnustep/base/ConnectedCoder.h: removed + 2000-06-16 Richard Frith-Macdonald Removal of non-OpenStep unused classes. diff --git a/Headers/gnustep/base/Coder.h b/Headers/gnustep/base/Coder.h index df8f74182..ed40a71b6 100644 --- a/Headers/gnustep/base/Coder.h +++ b/Headers/gnustep/base/Coder.h @@ -136,13 +136,6 @@ + newWithCoder: (Coder*)aDecoder; @end -@interface NSObject (CoderAdditions) -/* not needed because of NSCoding */ -/* These methods here temporarily until ObjC runtime category bug fixed */ -- classForConnectedCoder:aRmc; -+ (void) encodeObject: anObject withConnectedCoder: aRmc; -@end - GS_EXPORT id CoderSignatureMalformedException; #endif /* __Coder_h_GNUSTEP_BASE_INCLUDE */ diff --git a/Headers/gnustep/base/ConnectedCoder.h b/Headers/gnustep/base/ConnectedCoder.h deleted file mode 100644 index 4ad720e7c..000000000 --- a/Headers/gnustep/base/ConnectedCoder.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Interface for coder object for distributed objects - Copyright (C) 1994, 1996 Free Software Foundation, Inc. - - Written by: Andrew Kachites McCallum - Date: July 1994 - - This file is part of the GNUstep Base 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 - version 2 of the License, or (at your option) any later version. - - 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. - */ - -#ifndef __ConnectedCoder_h -#define __ConnectedCoder_h - -#include -#include - -/* ConnectedCoder identifiers */ -enum { - METHOD_REQUEST = 0, - METHOD_REPLY, - ROOTPROXY_REQUEST, - ROOTPROXY_REPLY, - CONNECTION_SHUTDOWN, - METHODTYPE_REQUEST, /* these two only needed with NeXT runtime */ - METHODTYPE_REPLY -}; - -@class NSConnection; - -@interface ConnectedEncoder : Encoder -{ - NSConnection *connection; - unsigned sequence_number; - int identifier; -} - -+ newForWritingWithConnection: (NSConnection*)c - sequenceNumber: (int)n - identifier: (int)i; -- (void) dismiss; - -- connection; -- (unsigned) sequenceNumber; -- (int) identifier; - -@end - -@interface ConnectedDecoder : Decoder -{ - NSConnection *connection; - unsigned sequence_number; - int identifier; -} - -+ newDecodingWithPacket: (InPacket*)packet - connection: (NSConnection*)c; -+ newDecodingWithConnection: (NSConnection*)c - timeout: (int) timeout; -- (void) dismiss; - -- connection; -- (unsigned) sequenceNumber; -- (int) identifier; - -- replyPort; - -@end - -#endif /* __ConnectedCoder_h */ diff --git a/Headers/gnustep/base/DistributedObjects.h b/Headers/gnustep/base/DistributedObjects.h index b437d27e9..0c5043bf5 100644 --- a/Headers/gnustep/base/DistributedObjects.h +++ b/Headers/gnustep/base/DistributedObjects.h @@ -27,12 +27,11 @@ /* * Changes from GNU DO to OPENSTEP style DO * - * Classes should implement [-classForPortCoder] instead of the old - * [-classForConnectedCoder] to return the class that should be sent - * over the wire. + * Classes should implement [-classForPortCoder] to return the class + * that should be sent over the wire. * - * Classes should implement [-replacementObjectForPortCoder:] instead of - * [+encodeObject:withConnectedCoder:] to encode objects. + * Classes should implement [-replacementObjectForPortCoder:] to encode + * objects. * The default action is to send a proxy. */ diff --git a/Source/ConnectedCoder.m b/Source/ConnectedCoder.m deleted file mode 100644 index cd53a44be..000000000 --- a/Source/ConnectedCoder.m +++ /dev/null @@ -1,318 +0,0 @@ -/* Implementation of coder object for remote messaging - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. - - Written by: Andrew Kachites McCallum - Created: July 1994 - - This file is part of the GNUstep Base 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 - version 2 of the License, or (at your option) any later version. - - 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PTR2LONG(P) (((char*)(P))-(char*)0) -#define LONG2PTR(L) (((char*)0)+(L)) - -#define DEFAULT_SIZE 256 - -#define CONNECTED_CODER_FORMAT_VERSION 0 - -static BOOL debug_connected_coder = NO; - -@implementation ConnectedEncoder - -- (void) writeSignature -{ - return; -} - -- _initForWritingWithConnection: (NSConnection*)c - sequenceNumber: (int)n - identifier: (int)i -{ - OutPacket* packet = [[[[c sendPort] outPacketClass] alloc] - initForSendingWithCapacity: DEFAULT_SIZE - replyInPort: [c receivePort]]; - [super initForWritingToStream: packet]; - [packet release]; - connection = c; - sequence_number = n; - identifier = i; - [self encodeValueOfCType: @encode(typeof(sequence_number)) - at: &sequence_number - withName: @"ConnectedCoder sequence number"]; - [self encodeValueOfCType: @encode(typeof(identifier)) - at: &identifier - withName: @"ConnectedCoder sequence number"]; - return self; -} - -+ newForWritingWithConnection: (NSConnection*)c - sequenceNumber: (int)n - identifier: (int)i -{ - /* Export this method and not the -init... method because eventually - we may do some caching of old ConnectedEncoder's to speed things up. */ - return [[self alloc] _initForWritingWithConnection: c - sequenceNumber: n - identifier: i]; -} - -- (void) dismiss -{ - id packet = [cstream stream]; - [[connection sendPort] sendPacket: packet timeout:15.0]; - if (debug_connected_coder) - fprintf(stderr, "dismiss 0x%x: #=%d i=%d %d\n", - (unsigned)self, sequence_number, identifier, - [packet streamEofPosition]); - [self release]; -} - - -/* Access to ivars. */ - -- (int) identifier -{ - return identifier; -} - -- connection -{ - return connection; -} - -- (unsigned) sequenceNumber -{ - return sequence_number; -} - - -/* This is called by Coder's designated object encoder */ -- (void) _doEncodeObject: anObj -{ - id c = [anObj classForConnectedCoder: self]; - /* xxx Should I also do classname substition here? */ - [self encodeClass: c]; - [c encodeObject: anObj withConnectedCoder: self]; -} - -@end - - -@implementation ConnectedDecoder - -+ (void) readSignatureFromCStream: (id ) cs - getClassname: (char *) name - formatVersion: (int*) version -{ - const char *classname = class_get_class_name (self); - strcpy (name, classname); - *version = CONNECTED_CODER_FORMAT_VERSION; -} - - -+ newDecodingWithConnection: (NSConnection*)c - timeout: (int) timeout -{ - ConnectedDecoder *cd; - id in_port; - id packet; - id reply_port; - - /* Try to get a packet. */ - in_port = [c receivePort]; - packet = [in_port receivePacketWithTimeout: timeout]; - if (!packet) - return nil; /* timeout */ - - /* Create the new ConnectedDecoder */ - cd = [self newReadingFromStream: packet]; - [packet release]; - reply_port = [packet replyPort]; - cd->connection = [NSConnection newForInPort: in_port - outPort: reply_port - ancestorConnection: c]; - - /* Decode the ConnectedDecoder's ivars. */ - [cd decodeValueOfCType: @encode(typeof(cd->sequence_number)) - at: &(cd->sequence_number) - withName: NULL]; - [cd decodeValueOfCType: @encode(typeof(cd->identifier)) - at: &(cd->identifier) - withName: NULL]; - - if (debug_connected_coder) - fprintf(stderr, "newDecoding #=%d id=%d\n", - cd->sequence_number, cd->identifier); - return cd; -} - -+ newDecodingWithPacket: (InPacket*)packet - connection: (NSConnection*)c -{ - ConnectedDecoder *cd; - id in_port; - id reply_port; - - in_port = [c receivePort]; - - /* Create the new ConnectedDecoder */ - cd = [self newReadingFromStream: packet]; - [packet release]; - reply_port = [packet replyOutPort]; - cd->connection = [NSConnection newForInPort: in_port - outPort: reply_port - ancestorConnection: c]; - - /* Decode the ConnectedDecoder's ivars. */ - [cd decodeValueOfCType: @encode(typeof(cd->sequence_number)) - at: &(cd->sequence_number) - withName: NULL]; - [cd decodeValueOfCType: @encode(typeof(cd->identifier)) - at: &(cd->identifier) - withName: NULL]; - - if (debug_connected_coder) - fprintf(stderr, "newDecoding #=%d id=%d\n", - cd->sequence_number, cd->identifier); - return cd; -} - - - -#if CONNECTION_WIDE_OBJECT_REFERENCES - -/* xxx We need to think carefully about reference counts, bycopy and - remote objects before we do this. */ - -/* Some notes: - - Is it really more efficient to send "retain" messages across the - wire than to resend the object? - - How is this related to bycopy objects? Yipes. - - Never let a Proxy be free'd completely until the connection does - down? The other connection is assuming we'll keep track of it and - be able to access it simply by the reference number. - - Even if this is unacceptable, and we always have to sent enough info - to be able to recreate the proxy, we still win with the choice of - +encodeObject:withConnectedCoder because we avoid having - to keep around the local proxies. */ - -#warning These names need to be updated for the new xref scheme. - -- (BOOL) _coderReferenceForObject: xref -{ - if (is_decoding) - return [connection includesProxyForTarget:xref]; - else - return [connection includesLocalObject:(id)LONG2PTR(xref)]; -} - -- _coderObjectAtReference: (unsigned)xref; -{ - if (is_decoding) - return [connection proxyForTarget:xref]; - else - return (id)LONG2PTR(xref); -} - -- (void) _coderPutObject: anObj atReference: (unsigned)xref -{ - /* xxx But we need to deal with bycopy's too!!! Not all of the - "anObj"s are Proxies! */ - if (is_decoding) - { - NSAssert([anObj isProxy], NSInternalInconsistencyException); - /* This gets done in Proxy +newForRemote:connection: - [connection addProxy:anObj]; */ - } - else - { - NSAssert(PTR2LONG(anObj) == xref, NSInternalInconsistencyException); - [connection addLocalObject:anObj]; - } -} - -#endif /* CONNECTION_WIDE_REFERENCES */ - - -/* Access to ivars. */ - -- (int) identifier -{ - return identifier; -} - -- connection -{ - return connection; -} - -- replyPort -{ - return [(id)[cstream stream] replyPort]; -} - -- (unsigned) sequenceNumber -{ - return sequence_number; -} - -- (void) resetConnectedCoder /* xxx rename resetCoder */ -{ - [self notImplemented:_cmd]; - /* prepare the receiver to do it's stuff again, - save time by doing this instead of free/malloc for each message */ -} - -- (void) dismiss -{ - [self release]; -} - -@end - - -@implementation NSObject (ConnectedCoderCallbacks) - -/* By default, Object's encode themselves as proxies across Connection's */ -- classForConnectedCoder: aRmc -{ - return [[aRmc connection] proxyClass]; -} - -/* But if any object overrides the above method to return [Object class] - instead, the Object implementation of the coding method will actually - encode the object itself, not a proxy */ -+ (void) encodeObject: anObject withConnectedCoder: aRmc -{ - [anObject encodeWithCoder: aRmc]; -} - -@end diff --git a/Source/Encoder.m b/Source/Encoder.m index 2b42196f9..63d9ac569 100644 --- a/Source/Encoder.m +++ b/Source/Encoder.m @@ -580,7 +580,7 @@ my_object_is_class(id object) to the object, we're actually going to encode an object (either a proxy to the object or the object itself). - ConnectedCoder overrides _doEncodeObject: in order to implement + NSPortCoder overrides _doEncodeObject: in order to implement the encoding of proxies. */ - (void) _doEncodeBycopyObject: anObj diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 925177d6b..888baa16d 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -70,7 +70,6 @@ FILE_AUTHORS = \ GNU_MFILES = \ BinaryCStream.m \ -ConnectedCoder.m \ Coder.m \ CStream.m \ Decoder.m \ @@ -137,7 +136,6 @@ BinaryCStream.h \ Coder.h \ CoderPrivate.h \ Coding.h \ -ConnectedCoder.h \ CStream.h \ CStreaming.h \ Enumerating.h \ diff --git a/Source/NSDate.m b/Source/NSDate.m index 87de29b02..409888d86 100644 --- a/Source/NSDate.m +++ b/Source/NSDate.m @@ -861,18 +861,13 @@ GSTimeNow() return NSCopyObject(self, 0, zone); } -- (Class) classForConnectedCoder: aRmc +- (Class) classForPortCoder { /* Make sure that Connection's always send us bycopy, i.e. as our own class, not a Proxy class. */ return abstractClass; } -- (Class) classForPortCoder -{ - return abstractClass; -} - - replacementObjectForPortCoder: aRmc { return self; diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index 183559336..1113b70f6 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -48,8 +48,8 @@ static BOOL debug_connected_coder = NO; /* * The PortEncoder class is essentially the old ConnectedEncoder class * with a name change. - * It uses the OPENSTEP method [-classForPortCoder] rather than the - * [-classForConnectedCoder] method to ask an object what class to encode. + * It uses the OPENSTEP method [-classForPortCoder] to ask an object + * what class to encode. */ @interface PortEncoder : Encoder { diff --git a/Source/Port.m b/Source/Port.m index 9c3561e80..23be04b3c 100644 --- a/Source/Port.m +++ b/Source/Port.m @@ -54,17 +54,12 @@ return nil; } -- (Class) classForConnectedCoder: aRmc +- (Class) classForPortCoder { /* Make sure that Connection's always send us bycopy, i.e. as our own class, not a Proxy class. */ return [self class]; } - -- (Class) classForPortCoder -{ - return [self class]; -} - replacementObjectForPortCoder: aRmc { return self; diff --git a/Source/TcpPort.m b/Source/TcpPort.m index b8b0a6624..2799037b5 100644 --- a/Source/TcpPort.m +++ b/Source/TcpPort.m @@ -915,17 +915,12 @@ static NSMapTable* port_number_2_port; _port_socket]; } -- (Class) classForConnectedCoder: aRmc +- (Class) classForPortCoder { /* Make sure that Connection's always send us bycopy, not a Proxy class. Also, encode a "send right" (ala Mach), not the "receive right". */ return [TcpOutPort class]; } - -- (Class) classForPortCoder -{ - return [TcpOutPort class]; -} - replacementObjectForPortCoder: aRmc { return self; diff --git a/Source/UdpPort.m b/Source/UdpPort.m index c61b962cd..b592f9d5f 100644 --- a/Source/UdpPort.m +++ b/Source/UdpPort.m @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -283,17 +283,12 @@ static NSMapTable *port_number_2_in_port = NULL; return [UdpInPacket class]; } -- (Class) classForConnectedCoder: aRmc +- (Class) classForPortCoder { /* Make sure that Connection's always send us bycopy, not a Proxy class. Also, don't encode a "receive right" (ala Mach), encode a "send right". */ return [UdpOutPort class]; } - -- (Class) classForPortCoder -{ - return [UdpOutPort class]; -} - replacementObjectForPortCoder: aRmc { return self;