Tidyups for removal of bloat

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6693 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-06-16 11:06:06 +00:00
parent 31c105a659
commit d68e2997e8
21 changed files with 55 additions and 415 deletions

View file

@ -1,3 +1,26 @@
2000-06-16 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/gnustep/base/NSGArchiver.h: removed obsolete file.
* Source/NSGArchiver.m: removed obsolete file.
* configure.in: Check for existence of NSArray.m to find source
* Headers/gnustep/base/NSDictionary.h: Remove unused headers.
* Headers/gnustep/base/Port.h: ditto
* Headers/gnustep/base/NSConnection.h: ditto
* Headers/gnustep/base/TcpPort.h: ditto
* Headers/gnustep/base/NSGArray.h: ditto
* Headers/gnustep/base/NSSet.h: ditto
* Headers/gnustep/base/NSGSet.h: ditto
* Headers/gnustep/base/NSRange.h: ditto
* Source/Coder.m: Removed dependencies on some old classes
* Source/Decoder.m: ditto
* Source/Port.m: ditto
* Source/TcpPort.m: ditto
* Source/UdpPort.m: ditto
* Source/NSGCString.m: ditto
* Source/NSGString.m: ditto
* Source/NSObject.m: ditto
* Source/NSString.m: ditto
2000-06-15 Adam Fedor <fedor@gnu.org>
* Headers/gnustep/base/NSObject.h: Add base/preface include

View file

@ -195,7 +195,7 @@ GS_EXPORT NSString *NSConnectionProxyCount; /* Objects received */
/* When you get an invalidation notification from a connection, use
this method in order to find out if any of the proxy objects you're
using are going away. */
- (id <Collecting>) proxies;
- (id) proxies;
/* For getting the root object of a connection or port */
@ -222,10 +222,9 @@ GS_EXPORT NSString *NSConnectionProxyCount; /* Objects received */
- (void) removeProxy: (NSDistantObject*)aProxy;
// It seems to be a non pure-OPENSTEP definition...
//- (id <Collecting>) localObjects;
//
// new def :
- (NSArray *)localObjects;
- (NSArray*)localObjects;
- (void) addLocalObject: anObj;
- (id) includesLocalObject: anObj;
- (void) removeLocalObject: anObj;

View file

@ -95,13 +95,8 @@
#ifndef NO_GNUSTEP
#include <base/KeyedCollecting.h>
#include <Foundation/NSDictionary.h>
/* Eventually we'll make a Constant version of this protocol.*/
@interface NSDictionary (GNU) <KeyedCollecting>
@end
@interface NSMutableDictionary (GNU)
+ (unsigned) defaultCapacity;
- (id) initWithType: (const char*)contentEncoding

View file

@ -1,42 +0,0 @@
/* Interface to concrete implementation of NSArchiver
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Date: April 1995
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 __NSGArchiver_h_GNUSTEP_BASE_INCLUDE
#define __NSGArchiver_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSArchiver.h>
#include <base/Coding.h>
@interface NSGArchiver : NSArchiver
@end
@interface NSGArchiver (GNU) <Encoding>
@end
@interface NSGUnarchiver : NSUnarchiver
@end
@interface NSGUnarchiver (GNU) <Decoding>
@end
#endif /* __NSGArchiver_h_GNUSTEP_BASE_INCLUDE */

View file

@ -25,7 +25,6 @@
#define __NSGArray_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSArray.h>
#include <base/Array.h>
@interface NSGArray : NSArray
{

View file

@ -25,8 +25,6 @@
#define __NSGSet_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSSet.h>
#include <base/Set.h>
#include <base/Bag.h>
@interface NSGSet : NSSet
@end

View file

@ -157,6 +157,11 @@ GS_EXPORT NSRange NSRangeFromString(NSString *aString);
[NSException raise: NSRangeException \
format: @"in %s, range { %u, %u } extends beyond size (%u)", \
sel_get_name(_cmd), RANGE.location, RANGE.length, SIZE]
#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \
if (INDEX >= OVER) \
[NSException raise: NSRangeException \
format: @"in %s, index %d is out of range", \
sel_get_name (_cmd), INDEX]
#endif
#endif /* __NSRange_h_GNUSTEP_BASE_INCLUDE */

View file

@ -129,23 +129,6 @@ id GSUnique(id anObject);
void GSUPurge(unsigned count);
id GSUSet(id anObject, unsigned count);
#include <base/KeyedCollecting.h>
/* Eventually we'll make a Constant version of this protocol. */
@interface NSSet (GNU) <Collecting>
/* These methods will be moved to NSMutableSet as soon as GNU's
collection objects are separated by mutability. */
+ (unsigned) defaultCapacity;
- (id)initWithType: (const char *)contentEncoding
capacity: (unsigned)aCapacity;
@end
@interface NSMutableSet (GNU)
@end
@interface NSCountedSet (GNU) <Collecting>
@end
#endif /* NO_GNUSTEP */
#endif

View file

@ -29,7 +29,6 @@
#include <Foundation/NSPort.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSString.h>
#include <base/Invocation.h>
/* xxx Use something like this? */
@protocol PacketSending
@ -64,7 +63,7 @@
packet arrives, INVOCATION will be invoked with the new packet
as an argument. The INVOCATION is responsible for releasing
the packet. */
- (void) setReceivedPacketInvocation: (id <Invoking>)invocation;
- (void) setReceivedPacketInvocation: (id)invocation;
/* An alternative to the above way for receiving packets from this port.
Get a packet from the net and return it. If no packet is received

View file

@ -48,13 +48,8 @@
+ newForReceivingFromPortNumber: (unsigned short)n;
/* Get a packet from the net and return it. If no packet is received
within MILLISECONDS, then return nil. The caller is responsible
for releasing the packet. */
- newPacketReceivedBeforeDate: date;
- (int) portNumber;
- (id <Collecting>) connectedOutPorts;
- (id) connectedOutPorts;
- (unsigned) numberOfConnectedOutPorts;
@end

View file

@ -28,8 +28,6 @@
#include <base/CoderPrivate.h>
#include <base/MemoryStream.h>
#include <base/Coding.h>
#include <base/Stack.h>
#include <base/Set.h>
#include <base/Streaming.h>
#include <base/Stream.h>
#include <base/CStreaming.h>

View file

@ -28,7 +28,7 @@
#include <base/CStream.h>
#include <base/Stream.h>
#include <base/StdioStream.h>
#include <base/Array.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSException.h>
extern BOOL sel_types_match(const char* t1, const char* t2);
@ -135,15 +135,15 @@ static id dummyObject;
{
if (!xref_2_object)
{
xref_2_object = [Array new];
xref_2_object = [NSArray new];
/* Append an object so our xref numbers are in sync with the
Encoders, which start at 1. */
[xref_2_object appendObject: dummyObject];
[xref_2_object addObject: dummyObject];
}
if (debug_coder)
fprintf (stderr, "Decoder registering object xref %u\n",
[xref_2_object count] - 1);
[xref_2_object appendObject: anObj]; // xxx but this will retain anObj. NO.
[xref_2_object addObject: anObj]; // xxx but this will retain anObj. NO.
/* This return value should be the same as the index of anObj
in xref_2_object. */
return ([xref_2_object count] - 1);
@ -169,7 +169,7 @@ static id dummyObject;
- (void) _coderPushRootObjectTable
{
if (!xref_2_object_root)
xref_2_object_root = [Array new];
xref_2_object_root = [NSArray new];
}
- (void) _coderPopRootObjectTable
@ -186,12 +186,12 @@ static id dummyObject;
{
if (!xref_2_object_root)
{
xref_2_object_root = [Array new];
xref_2_object_root = [NSArray new];
/* Append an object so our xref numbers are in sync with the
Encoders, which start at 1. */
[xref_2_object_root appendObject: dummyObject];
[xref_2_object_root addObject: dummyObject];
}
[xref_2_object_root appendObject: anObj];
[xref_2_object_root addObject: anObj];
/* This return value should be the same as the index of anObj
in xref_2_object_root. */
return ([xref_2_object_root count] - 1);

View file

@ -1,248 +0,0 @@
/* Concrete NSArchiver for GNUStep based on GNU Coder class
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Created: April 1995
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 <config.h>
#include <base/preface.h>
#include <Foundation/NSGArchiver.h>
#include <base/Archiver.h>
#include <base/CStream.h>
#include <base/behavior.h>
#include <base/CoderPrivate.h>
#include <base/MemoryStream.h>
#include <Foundation/NSException.h>
#define USE_OPENSTEP_STYLE_FORWARD_REFERENCES 1
#if USE_OPENSTEP_STYLE_FORWARD_REFERENCES
@interface NSGArchiverNullCStream : CStream
@end
@implementation NSGArchiverNullCStream
- (void) encodeValueOfCType: (const char*)type
at: (const void*)d
withName: (NSString*) name
{
return;
}
- (void) decodeValueOfCType: (const char*)type
at: (void*)d
withName: (NSString* *)namePtr
{
[self shouldNotImplement: _cmd];
}
@end
@interface NSGArchiver (Private)
- (void) _coderInternalCreateReferenceForObject: anObj;
- (void) encodeTag: (unsigned char)t;
@end
#endif /* USE_OPENSTEP_STYLE_FORWARD_REFERENCES */
@implementation NSGArchiver
+ (void) initialize
{
if (self == [NSGArchiver class])
class_add_behavior([NSGArchiver class], [Archiver class]);
}
#if USE_OPENSTEP_STYLE_FORWARD_REFERENCES
/* Use this if you want to define any other methods... */
//#define self ((Archiver*)self)
#define cstream (((Archiver*)self)->cstream)
#define in_progress_table (((Archiver*)self)->in_progress_table)
#define object_2_fref (((Archiver*)self)->object_2_fref)
#define object_2_xref (((Archiver*)self)->object_2_xref)
#define const_ptr_2_xref (((Archiver*)self)->const_ptr_2_xref)
#define fref_counter (((Archiver*)self)->fref_counter)
- init
{
/* initialise with autoreleased mutable data so we don't leak memory */
return [self initForWritingWithMutableData:
[[[NSMutableData alloc] init] autorelease]];
}
/* Unlike the GNU version, this cannot be called recursively. */
- (void) encodeRootObject: anObj
withName: (NSString*)name
{
id saved_cstream;
/* Make sure that we're in a clean state. */
NSParameterAssert (!object_2_xref);
NSParameterAssert (!object_2_fref);
object_2_fref =
NSCreateMapTable (NSNonOwnedPointerOrNullMapKeyCallBacks,
NSIntMapValueCallBacks, 0);
/* First encode to a null cstream, and record all the objects that
will be encoded. They will get recorded in [NSGArchiver
-_coderCreateReferenceForObject:] */
saved_cstream = cstream;
cstream = [[NSGArchiverNullCStream alloc] init];
[self startEncodingInterconnectedObjects];
[self encodeObject: anObj withName: name];
[self finishEncodingInterconnectedObjects];
[cstream release];
cstream = saved_cstream;
/* Reset ourselves, except for object_2_fref. */
NSAssert(!in_progress_table, NSInternalInconsistencyException);
NSResetMapTable (object_2_xref);
NSResetMapTable (const_ptr_2_xref);
NSAssert(fref_counter == 0, NSInternalInconsistencyException);
/* Then encode everything "for real". */
[self encodeName: @"Root Object"];
[self encodeIndent];
[(id)self encodeTag: CODER_OBJECT_ROOT];
[self startEncodingInterconnectedObjects];
[self encodeObject: anObj withName: name];
[self finishEncodingInterconnectedObjects];
[self encodeUnindent];
}
- (void) encodeConditionalObject: (id)anObject
{
if ([cstream class] == [NSGArchiverNullCStream class])
/* If we're gathering a list of all the objects that will be
encoded (for the first half of a -encodeRootObject:), then do
nothing. */
return;
else
{
/* Otherwise, we've already gathered a list of all the objects
into objects_2_fref; if the object is there, encode it. */
if (NSMapGet (object_2_fref, anObject))
[self encodeObject: anObject];
else
[self encodeObject: nil];
}
}
- (void) encodeObjectReference: anObject
{
/* Be sure to do the OpenStep-style thing. */
[self encodeConditionalObject: anObject];
}
/* For handling forward references. */
- (unsigned) _coderCreateReferenceForObject: anObj
{
if ([cstream class] == [NSGArchiverNullCStream class])
/* If we're just gathering a list of all the objects that will be
encoded (for the first half of a -encodeRootObject:), then just
put it in object_2_fref. */
NSMapInsert (object_2_fref, anObj, (void*)1);
/* Do the normal thing. */
return (unsigned) CALL_METHOD_IN_CLASS ([Archiver class],
_coderCreateReferenceForObject:,
anObj);
}
- (unsigned) _coderCreateForwardReferenceForObject: anObject
{
/* We should never get here. */
[self shouldNotImplement: _cmd];
return 0;
}
- (unsigned) _coderForwardReferenceForObject: anObject
{
return 0;
}
- (void) _objectWillBeInProgress: anObj
{
/* OpenStep-style coding doesn't keep an in-progress table. */
/* Register that we have encoded it so that future encoding can
do backward references properly. */
[self _coderInternalCreateReferenceForObject: anObj];
}
- (void) _objectNoLongerInProgress: anObj
{
/* OpenStep-style coding doesn't keep an in-progress table. */
return;
}
/* xxx This method interface may change in the future. */
- (const char *) defaultDecoderClassname
{
return "NSGUnarchiver";
}
/* Attempting to use the archiver after this will
mess up in a big way. NB. If the archiver was not writing to an
NSData object, we can't give one out, so we return nil. */
- (NSMutableData*) archiverData
{
id s = [cstream stream];
if ([s isKindOfClass:[MemoryStream class]])
{
[s rewindStream];
return [s mutableData];
}
if ([s isKindOfClass:[NSMutableData class]])
{
return (NSMutableData*)s;
}
return nil;
}
#undef self
#endif /* USE_OPENSTEP_STYLE_FORWARD_REFERENCES */
@end
@implementation NSGUnarchiver
+ (void) initialize
{
if (self == [NSGUnarchiver class])
class_add_behavior([NSGUnarchiver class], [Unarchiver class]);
}
#if USE_OPENSTEP_STYLE_FORWARD_REFERENCES
/* This method is called by Decoder to determine whether to add
an object to the xref table before it has been initialized. */
- (BOOL) _createReferenceBeforeInit
{
return YES;
}
#endif /* USE_OPENSTEP_STYLE_FORWARD_REFERENCES */
@end

View file

@ -32,10 +32,9 @@
#include <Foundation/NSDictionary.h>
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSRange.h>
#include <Foundation/NSException.h>
#include <base/NSGString.h>
#include <base/NSGCString.h>
#include <base/IndexedCollection.h>
#include <base/IndexedCollectionPrivate.h>
#include <Foundation/NSValue.h>
#include <base/behavior.h>
@ -561,10 +560,7 @@ static IMP msInitImp; /* designated initialiser for mutable */
return NO;
}
// FOR IndexedCollection SUPPORT;
- objectAtIndex: (unsigned)index
- (id) objectAtIndex: (unsigned)index
{
CHECK_INDEX_RANGE_ERROR(index, _count);
return [NSNumber numberWithChar: _contents_chars[index]];
@ -1122,11 +1118,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
return [self initWithCStringNoCopy: 0 length: 0 fromZone: 0];
}
/* For IndexedCollecting Protocol and other GNU libobjects conformity. */
/* xxx This should be made to return void, but we need to change
IndexedCollecting and its conformers */
- (void) removeRange: (IndexRange)range
- (void) removeRange: (NSRange)range
{
stringDecrementCountAndFillHoleAt((NSGMutableCStringStruct*)self,
range.location, range.length);
@ -1148,8 +1140,6 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
return self;
}
/* For IndexedCollecting protocol */
- (char) charAtIndex: (unsigned)index
{
CHECK_INDEX_RANGE_ERROR(index, _count);
@ -1157,8 +1147,6 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
}
// FOR IndexedCollection and OrderedCollection SUPPORT;
- (void) insertObject: newObject atIndex: (unsigned)index
{
CHECK_INDEX_RANGE_ERROR(index, _count+1);

View file

@ -39,8 +39,7 @@
#include <Foundation/NSDictionary.h>
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSRange.h>
#include <base/IndexedCollection.h>
#include <base/IndexedCollectionPrivate.h>
#include <Foundation/NSException.h>
#include <Foundation/NSValue.h>
#include <base/behavior.h>
/* memcpy(), strlen(), strcmp() are gcc builtin's */
@ -754,11 +753,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableStringStruct *self,
_hash = 0;
}
/* For IndexedCollecting Protocol and other GNU libobjects conformity. */
/* xxx This should be made to return void, but we need to change
IndexedCollecting and its conformers */
- (void) removeRange: (IndexRange)range
- (void) removeRange: (NSRange)range
{
stringDecrementCountAndFillHoleAt((NSGMutableStringStruct*)self,
range.location, range.length);
@ -780,8 +775,6 @@ stringDecrementCountAndFillHoleAt(NSGMutableStringStruct *self,
return self;
}
/* For IndexedCollecting protocol */
- (char) charAtIndex: (unsigned)index
{
CHECK_INDEX_RANGE_ERROR(index, _count);

View file

@ -28,7 +28,6 @@
#include <objc/Protocol.h>
#include <objc/objc-api.h>
#include <Foundation/NSMethodSignature.h>
#include <base/Invocation.h>
#include <Foundation/NSInvocation.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSString.h>

View file

@ -55,11 +55,9 @@
#include <Foundation/NSPortCoder.h>
#include <Foundation/NSPathUtilities.h>
#include <Foundation/NSRange.h>
#include <base/IndexedCollection.h>
#include <Foundation/NSException.h>
#include <Foundation/NSData.h>
#include <Foundation/NSBundle.h>
#include <base/IndexedCollectionPrivate.h>
#include <limits.h>
#include <string.h> // for strstr()
#include <sys/stat.h>

View file

@ -118,7 +118,7 @@
return nil;
}
- (void) setReceivedPacketInvocation: (id <Invoking>)invocation
- (void) setReceivedPacketInvocation: (id)invocation
{
NSAssert(!_packet_invocation, NSInternalInconsistencyException);
_packet_invocation = invocation;

View file

@ -561,7 +561,7 @@ static NSMapTable* port_number_2_port;
return [self newForReceivingFromPortNumber: 0];
}
- (id <Collecting>) connectedOutPorts
- (id) connectedOutPorts
{
NSMapEnumerator me = NSEnumerateMapTable (_client_sock_2_out_port);
int count = NSCountMapTable (_client_sock_2_out_port);
@ -587,41 +587,6 @@ static NSMapTable* port_number_2_port;
return &_listening_address;
}
/* Usually, you would run the run loop to get packets, but if you
want to wait for one directly from a port, you can use this method. */
- newPacketReceivedBeforeDate: date
{
NSString* saved_mode = [NSRunLoop currentMode];
id saved_packet_invocation;
id packet = nil;
id handle_packet (id p)
{
packet = p;
return nil;
}
/* Swap in our own temporary handler. */
saved_packet_invocation = _packet_invocation;
_packet_invocation = [[ObjectFunctionInvocation alloc]
initWithObjectFunction: handle_packet];
/* Make sure we're in the run loop, and run it, waiting for the
incoming packet. */
[[NSRunLoop currentRunLoop] addPort: self
forMode: saved_mode];
while ([NSRunLoop runOnceBeforeDate: date]
&& !packet)
;
/* Clean up, getting ready to return. Swap back in the old packet
handler, and decrement the number of times we've been added to
this run loop. */
_packet_invocation = saved_packet_invocation;
[[NSRunLoop currentRunLoop] removePort: self
forMode: saved_mode];
return packet;
}
/* Read some data from FD; if we read enough to complete a packet,
return the packet. Otherwise, keep the partially read packet in

View file

@ -27,7 +27,6 @@
#include <base/UdpPort.h>
#include <base/Coder.h>
#include <base/ConnectedCoder.h>
#include <base/Array.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSException.h>
#include <Foundation/NSHost.h>
@ -191,14 +190,6 @@ static NSMapTable *port_number_2_in_port = NULL;
return [self newForReceivingFromPortNumber: n];
}
/* Usually, you would run the run loop to get packets, but if you
want to wait for one directly from a port, you can use this method. */
- newPacketReceivedBeforeDate: date
{
return nil;
}
/* Returns nil on timeout.
Pass -1 for milliseconds to ignore timeout parameter and block indefinitely.
*/
@ -340,13 +331,13 @@ static NSMapTable *port_number_2_in_port = NULL;
@implementation UdpOutPort
static Array *udp_out_port_array;
static NSArray *udp_out_port_array;
+ (void) initialize
{
if (self == [UdpOutPort class])
{
udp_out_port_array = [Array new];
udp_out_port_array = [NSArray new];
}
}
@ -362,16 +353,18 @@ static Array *udp_out_port_array;
+ newForSendingToSockaddr: (struct sockaddr_in*)sockaddr
{
UdpOutPort *p;
unsigned i;
unsigned c = [udp_out_port_array count];
/* See if there already exists a port for this sockaddr;
if so, just return it. */
FOR_ARRAY (udp_out_port_array, p)
for (i = 0; i < c; i++)
{
p = [udp_out_port_array objectAtIndex: i];
/* xxx Come up with a way to do this with a hashtable, not a list. */
if (SOCKADDR_EQUAL (sockaddr, &(p->_address)))
return p;
}
END_FOR_ARRAY (udp_out_port_array);
/* Create a new port. */
p = [[self alloc] init];

View file

@ -1,4 +1,4 @@
AC_INIT(Source/Collection.m)
AC_INIT(Source/NSArray.m)
# configure.in for GNU Objective-C library
# Process this file with autoconf to produce a configure script.