Changes by Scott Christley. See ChangeLog Feb 25

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2209 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1997-03-03 20:07:35 +00:00
parent bf8112f13a
commit 83fc572410
25 changed files with 207 additions and 118 deletions

View file

@ -1,5 +1,7 @@
Mon Mar 3 14:41:01 1997 Andrew McCallum <mccallum@jprc.com>
* doc/Makefile.in (TEXI_FILES): Added gnustep-zones.texi.
* src/NSHost.m, src/include/NSHost.h: New files from Luke Howard
<lukeh@xedoc.com.au>.

View file

@ -29,7 +29,7 @@ VPATH = @srcdir@
# Installation location
prefix = @prefix@
infodir = $(prefix)/info
infodir = @infodir@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi

View file

@ -35,7 +35,7 @@ CPPFLAGS =
LDFLAGS =
DEFS = @DEFS@
LIBS = -L../src -l$(LIBRARY_NAME) @LIBOBJC@ @LIBS@ -lm
LIBS = -L../src @whole_archive@ -l$(LIBRARY_NAME) @no_whole_archive@ @LIBOBJC@ @LIBS@ -lm
EXEEXT =
OEXT = .o

View file

@ -56,6 +56,7 @@ typedef double NSTimeInterval;
- (NSDate*) initWithTimeInterval: (NSTimeInterval)secsToBeAdded
sinceDate: (NSDate*)anotherDate;
- (NSDate*) initWithTimeIntervalSinceNow: (NSTimeInterval)secsToBeAdded;
- (NSDate*) initWithTimeIntervalSince1970: (NSTimeInterval)seconds;
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs;
// Converting to NSCalendar
@ -73,6 +74,7 @@ typedef double NSTimeInterval;
// Adding and getting intervals
- (NSDate*) addTimeInterval: (NSTimeInterval)seconds;
- (NSTimeInterval) timeIntervalSince1970;
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate;
- (NSTimeInterval) timeIntervalSinceNow;
- (NSTimeInterval) timeIntervalSinceReferenceDate;

View file

@ -33,17 +33,18 @@
+ allocWithZone: (NSZone*)zone;
+ dictionary;
+ dictionaryWithContentsOfFile:(NSString *)path;
+ dictionaryWithObjects: (id*)objects forKeys: (NSString**)keys
+ dictionaryWithObjects: (id*)objects forKeys: (NSObject**)keys
count: (unsigned)count;
+ dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
+ dictionaryWithObjectsAndKeys:(id)firstObject, ...;
- initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
- initWithObjects: (id*)objects forKeys: (NSString**)keys
- initWithObjects: (id*)objects forKeys: (NSObject**)keys
count: (unsigned)count;
- initWithDictionary: (NSDictionary*)otherDictionary;
- initWithContentsOfFile: (NSString*)path;
- (unsigned) count;
- objectForKey: (NSString*)aKey;
- objectForKey: (NSObject*)aKey;
- (NSEnumerator*) keyEnumerator;
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
- (NSString*) description;
@ -62,8 +63,8 @@
+ dictionaryWithCapacity: (unsigned)numItems;
- initWithCapacity: (unsigned)numItems;
- (void) setObject: anObject forKey: (NSString*)aKey;
- (void) removeObjectForKey: (NSString*)aKey;
- (void) setObject: anObject forKey: (NSObject*)aKey;
- (void) removeObjectForKey: (NSObject*)aKey;
- (void) removeAllObjects;
- (void) removeObjectsForKeys: (NSArray*)keyArray;
- (void) addEntriesFromDictionary: (NSDictionary*)otherDictionary;

View file

@ -27,6 +27,7 @@
#include <objc/objc.h>
#include <objc/Protocol.h>
#include <Foundation/NSZone.h>
#include <gnustep/base/fake-main.h>
@class NSArchiver;
@class NSCoder;

View file

@ -39,7 +39,7 @@
@interface TcpInPort : InPort
{
int _socket;
int _port_socket;
struct sockaddr_in _listening_address;
NSMapTable *_client_sock_2_out_port;
NSMapTable *_client_sock_2_packet;
@ -61,13 +61,13 @@
@interface TcpOutPort : OutPort
{
int _socket;
int _port_socket;
/* This is actually the address of the listen()'ing socket of the remote
TcpInPort we are connected to, not the address of the _socket ivar. */
TcpInPort we are connected to, not the address of the _port_socket ivar. */
struct sockaddr_in _remote_in_port_address;
/* This is the address of our remote peer socket. */
struct sockaddr_in _peer_address;
/* The TcpInPort that is polling our _socket with select(). */
/* The TcpInPort that is polling our _port_socket with select(). */
id _polling_in_port;
}

View file

@ -34,7 +34,7 @@
@interface UdpInPort : InPort
{
int _socket;
int _port_socket;
struct sockaddr_in _address;
}

View file

@ -64,15 +64,15 @@ all: src
src doc checks examples: FORCE
cd $@; $(MAKE) $(MAKEDEFINES)
install uninstall TAGS:
install uninstall TAGS: FORCE
for i in $(SUBDIRS); do \
(cd $$i; $(MAKE) $(MAKEDEFINES) $@); \
done
info dvi:
info dvi: FORCE
cd doc; $(MAKE) $(MAKEDEFINES) $@
check:
check: FORCE
cd checks; $(MAKE) $(MAKEDEFINES)
Makefile: Makefile.in config.status

View file

@ -28,8 +28,10 @@ srcdir = @srcdir@
VPATH = @srcdir@
prefix = @prefix@
datadir = $(prefix)/share
charsetdir = $(datadir)/NSCharacterSets
exec_prefix = @exec_prefix@
libdir = @libdir@
gnustep_libdir = $(libdir)/gnustep
charsetdir = $(gnustep_libdir)/NSCharacterSets
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -58,7 +60,7 @@ DIST_FILES = $(RCS_FILES) $(CHARSET_FILES) README.CharSet
INSTALL_FILES = $(CHARSET_FILES) README.CharSet
installdirs:
$(srcdir)/../mkinstalldirs $(charsetdir)
$(srcdir)/../mkinstalldirs $(libdir) $(gnustep_libdir) $(charsetdir)
install: installdirs
for file in $(INSTALL_FILES); do \
$(INSTALL_DATA) $(srcdir)/$$file $(charsetdir)/$$file ; \

View file

@ -4,3 +4,17 @@ required GNUstep Base Library changes are not compatible with the old
runtime. That is, you must install the new runtime patches in order
to compile this version of the GNUstepBase Library.
Each thread now has their own exception handler and assertion handler.
(I haven't tested the assertion handler, though it should probably
work).
The biggest change with this patch is that the zone functions use
objc_malloc() to get more memory and that the default zone can be set
by the user with NSSetDefaultMallocZone().
I've extended the functionality of zones. Now one can obtain memory
statistics and also check for integrity. There is also more detailed
documentation, which I've sent in a separate message.

View file

@ -31,8 +31,9 @@ VPATH = @srcdir@
# Installation locations
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
libdir = @libdir@
gnustep_libdir = $(libdir)/gnustep
includedir = @includedir@
CC = @CC@ -pipe
RANLIB = @RANLIB@
@ -51,7 +52,8 @@ YACC = bison
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
# the installing person may set it on the `make' command line.
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(prefix) -DPLATFORM_OS=\"@PLATFORM_OS@\" @DEFS@
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(prefix) -DPLATFORM_OS=\"@PLATFORM_OS@\" \
-DGNUSTEP_INSTALL_LIBDIR=$(gnustep_libdir) @DEFS@
# File name extensions
OEXT = .o
@ -367,6 +369,7 @@ NSDeallocateObject.m \
NSDictionary.m \
NSEnumerator.m \
NSException.m \
NSFileManager.m \
NSGeometry.m \
NSGArchiver.m \
NSGArray.m \
@ -443,6 +446,7 @@ include/NSData.h \
include/NSDate.h \
include/NSDictionary.h \
include/NSException.h \
include/NSFileManager.h \
include/NSGeometry.h \
include/NSGArchiver.h \
include/NSGArray.h \
@ -509,9 +513,9 @@ lib$(LIBRARY_NAME).so.$(VERSION): $(HEADERS_INSTALL) $(OBJS_INSTALL_PIC)
$(OBJS_INSTALL_PIC)
rm -f lib$(LIBRARY_NAME).so.$(MAJOR_VERSION)
rm -f lib$(LIBRARY_NAME).so
ln -s lib$(LIBRARY_NAME).so.$(VERSION) \
$(LN_S) lib$(LIBRARY_NAME).so.$(VERSION) \
lib$(LIBRARY_NAME).so.$(MAJOR_VERSION)
ln -s lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) \
$(LN_S) lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) \
lib$(LIBRARY_NAME).so
lib$(LIBRARY_NAME)$(LIBEXT): $(HEADERS_INSTALL) $(OBJS_INSTALL)
@ -519,24 +523,24 @@ lib$(LIBRARY_NAME)$(LIBEXT): $(HEADERS_INSTALL) $(OBJS_INSTALL)
$(RANLIB) lib$(LIBRARY_NAME)$(LIBEXT)
# Local links to the include files
gnustep/base:
rm -f gnustep base
ln -s . gnustep
ln -s ./include base
gnustep/base: $(HEADERS_INSTALL)
rm -rf gnustep
mkdir gnustep
cd gnustep ; $(LN_S) ../include base
# Make necessary links to source headers if compiling in seperate dir
# These are separate directories because one contains the .h files
# generated during the build; the other contains the unchanged sources.
if [ ! -r ./include/Collection.h ]; then \
mkdir srcdir-include; \
mkdir srcdir-include/gnustep; \
(cd srcdir-include/gnustep; ln -s ../../$(srcdir)/include ./base) ; \
(cd srcdir-include; ln -s ../$(srcdir)/include ./Foundation) ; \
(cd srcdir-include/gnustep; $(LN_S) ../../$(srcdir)/include ./base) ; \
(cd srcdir-include; $(LN_S) ../$(srcdir)/include ./Foundation) ; \
fi
# This deletion is necessary, because the CVS repository contains
# an emtpy `Foundation' directory that used to hold the OpenStep headers.
Foundation: ../configure
Foundation: ../configure $(HEADERS_INSTALL)
rm -rf Foundation
ln -s $(srcdir)/include Foundation
$(LN_S) $(srcdir)/include Foundation
install: installdirs all
# Install the library
@ -546,9 +550,9 @@ install: installdirs all
$(INSTALL_DATA) lib$(LIBRARY_NAME).so.$(VERSION) $(libdir) ; \
rm -f $(libdir)/lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) ; \
rm -f $(libdir)/lib$(LIBRARY_NAME).so ; \
ln -s $(libdir)/lib$(LIBRARY_NAME).so.$(VERSION) \
$(LN_S) $(libdir)/lib$(LIBRARY_NAME).so.$(VERSION) \
$(libdir)/lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) ; \
ln -s $(libdir)/lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) \
$(LN_S) $(libdir)/lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) \
$(libdir)/lib$(LIBRARY_NAME).so ; \
fi
# Install the headers
@ -556,19 +560,25 @@ install: installdirs all
$(INSTALL_DATA) $(srcdir)/$$file \
$(includedir)/gnustep/base/`basename $$file` ; \
done
cd $(includedir); rm -f Foundation; ln -s ./gnustep/base ./Foundation
cd $(includedir); rm -f objc; ln -s ./gnustep/base ./objc
cd $(includedir)/objc; rm -f README; ln -s ../include/README .
cd $(includedir); rm -rf Foundation; $(LN_S) ./gnustep/base ./Foundation
for file in $(NEXTSTEP_HEADERS); do \
$(INSTALL_DATA) $(srcdir)/$$file \
$(includedir)/objc/`basename $$file` ; \
done
installdirs:
$(srcdir)/../mkinstalldirs \
$(libdir) \
$(includedir)/gnustep/base
$(includedir)/gnustep/base \
$(includedir)/objc
uninstall:
rm -f $(libdir)/lib$(LIBRARY_NAME)$(LIBEXT)
rm -rf $(includedir)/gnustep/base
rm -f $(includedir)/Foundation
rm -rf $(includedir)/Foundation
for file in $(NEXTSTEP_HEADERS); do \
rm -rf $(includedir)/objc/`basename $$file` ; \
done
# Creation of NSValue and NSNumber concrete classes from templates
$(NSVALUE_MFILES) : NSCTemplateValue.m

View file

@ -28,7 +28,7 @@
#include <Foundation/NSLock.h>
#ifndef NSCharacterSet_PATH
#define NSCharacterSet_PATH OBJC_STRINGIFY(GNUSTEP_INSTALL_PREFIX) @"/share"
#define NSCharacterSet_PATH OBJC_STRINGIFY(GNUSTEP_INSTALL_LIBDIR) @"/NSCharacterSets"
#endif
/* A simple array for caching standard bitmap sets */

View file

@ -176,6 +176,12 @@
[[self class] timeIntervalSinceReferenceDate] + secsToBeAdded];
}
- (NSDate *)initWithTimeIntervalSince1970:(NSTimeInterval)seconds
{
return [self initWithTimeIntervalSinceReferenceDate:
UNIX_REFERENCE_INTERVAL + seconds];
}
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
{
[super init];
@ -251,6 +257,11 @@
seconds_since_ref + seconds];
}
- (NSTimeInterval) timeIntervalSince1970
{
return seconds_since_ref - UNIX_REFERENCE_INTERVAL;
}
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate
{
return seconds_since_ref - [otherDate timeIntervalSinceReferenceDate];

View file

@ -73,7 +73,7 @@ static Class NSMutableDictionary_concrete_class;
}
+ dictionaryWithObjects: (id*)objects
forKeys: (NSString**)keys
forKeys: (NSObject**)keys
count: (unsigned)count
{
return [[[self alloc] initWithObjects:objects
@ -151,7 +151,7 @@ static Class NSMutableDictionary_concrete_class;
/* This is the designated initializer */
- initWithObjects: (id*)objects
forKeys: (NSString**)keys
forKeys: (NSObject**)keys
count: (unsigned)count
{
[self subclassResponsibility:_cmd];
@ -205,7 +205,7 @@ static Class NSMutableDictionary_concrete_class;
return 0;
}
- objectForKey: (NSString*)aKey
- objectForKey: (NSObject*)aKey
{
[self subclassResponsibility:_cmd];
return 0;
@ -326,7 +326,7 @@ static Class NSMutableDictionary_concrete_class;
/* a deep copy */
int count = [self count];
id objects[count];
NSString *keys[count];
NSObject *keys[count];
id enumerator = [self keyEnumerator];
id key;
int i;
@ -373,7 +373,7 @@ static Class NSMutableDictionary_concrete_class;
/* Override superclass's designated initializer */
- initWithObjects: (id*)objects
forKeys: (NSString**)keys
forKeys: (NSObject**)keys
count: (unsigned)count
{
[self initWithCapacity:count];
@ -382,12 +382,12 @@ static Class NSMutableDictionary_concrete_class;
return self;
}
- (void) setObject:anObject forKey:(NSString *)aKey
- (void) setObject:anObject forKey:(NSObject *)aKey
{
[self subclassResponsibility:_cmd];
}
- (void) removeObjectForKey:(NSString *)aKey
- (void) removeObjectForKey:(NSObject *)aKey
{
[self subclassResponsibility:_cmd];
}

View file

@ -94,7 +94,7 @@
/*
Comes from Dictionary.m
- initWithObjects: (id*)objects
forKeys: (NSString**)keys
forKeys: (NSObject**)keys
count: (unsigned)count
- (unsigned) count
- (NSEnumerator*) keyEnumerator
@ -116,12 +116,12 @@
- initWithCapacity: (unsigned)numItems
*/
- (void) setObject:anObject forKey:(NSString *)aKey
- (void) setObject:anObject forKey:(NSObject *)aKey
{
[self putObject: anObject atKey: aKey];
}
- (void) removeObjectForKey:(NSString *)aKey
- (void) removeObjectForKey:(NSObject *)aKey
{
[self removeObjectAtKey: aKey];
}

View file

@ -120,7 +120,7 @@
+ (NSNumber *)numberWithLong:(long)value
{
return [[[NSNumber alloc] initValue:&value withObjCType:NULL] autorelease];
return [[[NSLongNumber alloc] initValue:&value withObjCType:NULL] autorelease];
}
+ (NSNumber *)numberWithLongLong:(long long)value

View file

@ -211,6 +211,12 @@ handle_printf_atsign (FILE *stream,
autorelease];
}
+ (NSString*) stringWithContentsOfFile:(NSString *)path
{
return [[[self alloc]
initWithContentsOfFile: path] autorelease];
}
+ (NSString*) stringWithCharacters: (const unichar*)chars
length: (unsigned int)length
{
@ -502,9 +508,8 @@ handle_printf_atsign (FILE *stream,
NSRange search;
NSRange found;
NSMutableArray *array = [NSMutableArray array];
int myLength = [self length];
search = NSMakeRange (0, myLength);
search = NSMakeRange (0, [self length]);
found = [self rangeOfString: separator];
while (found.length)
{
@ -512,12 +517,14 @@ handle_printf_atsign (FILE *stream,
current = NSMakeRange (search.location,
found.location - search.location);
[array addObject: [self substringFromRange: current]];
search = NSMakeRange (found.location + found.length,
myLength - (found.location + found.length));
search = NSMakeRange (found.location + 1,
search.length - found.location - 1);
found = [self rangeOfString: separator
options: 0
range: search];
}
// Add the last search string range
[array addObject: [self substringFromRange: search]];
// FIXME: Need to make mutable array into non-mutable array?
return array;
@ -838,6 +845,8 @@ handle_printf_atsign (FILE *stream,
- (NSString*) description
{
return self;
#if 0
const char *src = [self cString];
char *dest;
char *src_ptr,*dest_ptr;
@ -909,6 +918,7 @@ handle_printf_atsign (FILE *stream,
ret = [NSString stringWithCString:dest];
objc_free (dest);
return ret;
#endif
}
- (BOOL) writeToFile: (NSString*)filename
@ -1475,7 +1485,10 @@ handle_printf_atsign (FILE *stream,
/* Inefficient. */
- (void) appendString: (NSString*)aString
{
id tmp = [self stringByAppendingString:aString];
id tmp;
if (!aString)
return;
tmp = [self stringByAppendingString:aString];
[self setString:tmp];
}

View file

@ -89,7 +89,7 @@ NSString *NSAMPMDesignation = @"NSAMPMDesignation";
@interface NSUserDefaults (__local_NSUserDefaults)
- (void)__createStandardSearchList;
- (NSDictionary *)__createArgumentDictionary;
- (void)__changePersitentDomain:(NSString *)domainName;
- (void)__changePersistentDomain:(NSString *)domainName;
@end
@implementation NSUserDefaults: NSObject
@ -231,14 +231,14 @@ static NSMutableString *processName = nil;
[persDomains setObject:
[NSMutableDictionary
dictionaryWithCapacity:10] forKey:processName];
[self __changePersitentDomain:processName];
[self __changePersistentDomain:processName];
}
if (![persDomains objectForKey:NSGlobalDomain])
{
[persDomains setObject:
[NSMutableDictionary
dictionaryWithCapacity:10] forKey:NSGlobalDomain];
[self __changePersitentDomain:NSGlobalDomain];
[self __changePersistentDomain:NSGlobalDomain];
}
// Create volatile defaults and add the Argument and the Registration domains
@ -359,7 +359,7 @@ static NSMutableString *processName = nil;
if (obj)
{
[[persDomains objectForKey:processName] removeObjectForKey:defaultName];
[self __changePersitentDomain:processName];
[self __changePersistentDomain:processName];
}
return;
}
@ -394,7 +394,7 @@ static NSMutableString *processName = nil;
{
[[persDomains objectForKey:processName]
setObject:value forKey:defaultName];
[self __changePersitentDomain:processName];
[self __changePersistentDomain:processName];
}
return;
}
@ -451,7 +451,7 @@ static NSMutableString *processName = nil;
if ([persDomains objectForKey:domainName])
{
[persDomains removeObjectForKey:domainName];
[self __changePersitentDomain:domainName];
[self __changePersistentDomain:domainName];
}
return;
}
@ -469,7 +469,7 @@ static NSMutableString *processName = nil;
return;
}
[persDomains setObject:domain forKey:domainName];
[self __changePersitentDomain:domainName];
[self __changePersistentDomain:domainName];
return;
}
@ -659,7 +659,7 @@ static NSMutableString *processName = nil;
return argDict;
}
- (void)__changePersitentDomain:(NSString *)domainName
- (void)__changePersistentDomain:(NSString *)domainName
{
NSEnumerator *enumerator = nil;
id obj;

View file

@ -61,7 +61,7 @@ static int debug_tcp_port = 0;
/* Private interfaces */
@interface TcpInPort (Private)
- (int) _socket;
- (int) _port_socket;
- (struct sockaddr_in*) _listeningSockaddr;
- (void) _addClientOutPort: p;
- (void) _connectedOutPortInvalidated: p;
@ -69,7 +69,7 @@ static int debug_tcp_port = 0;
@end
@interface TcpOutPort (Private)
- (int) _socket;
- (int) _port_socket;
- _initWithSocket: (int)s inPort: ip;
+ _newWithAcceptedSocket: (int)s peeraddr: (struct sockaddr_in*)addr inPort: p;
- (struct sockaddr_in*) _remoteInPortSockaddr;
@ -100,7 +100,7 @@ static int debug_tcp_port = 0;
@interface TcpInStream : NSObject
{
int _socket;
int _port_socket;
id _listening_in_port;
}
- initWithAcceptedSocket: (int)s inPort: p;
@ -133,7 +133,7 @@ name_2_port_number (const char *name)
static NSMapTable *socket_2_port = NULL;
static void
init_socket_2_port ()
init_port_socket_2_port ()
{
if (!socket_2_port)
socket_2_port =
@ -160,7 +160,7 @@ static NSMapTable* port_number_2_port;
port_number_2_port =
NSCreateMapTable (NSIntMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
init_socket_2_port ();
init_port_socket_2_port ();
}
/* This is the designated initializer.
@ -185,16 +185,16 @@ static NSMapTable* port_number_2_port;
p = [[TcpInPort alloc] init];
/* Create the socket. */
p->_socket = socket (AF_INET, SOCK_STREAM, 0);
if (p->_socket < 0)
p->_port_socket = socket (AF_INET, SOCK_STREAM, 0);
if (p->_port_socket < 0)
{
perror ("[TcpInPort +newForReceivingFromPortNumber:] socket()");
abort ();
}
/* Register the port object according to its socket. */
assert (!NSMapGet (socket_2_port, (void*)p->_socket));
NSMapInsert (socket_2_port, (void*)p->_socket, p);
assert (!NSMapGet (socket_2_port, (void*)p->_port_socket));
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
/* Give the socket a name using bind() and INADDR_ANY for the
machine address in _LISTENING_ADDRESS; then put the network
@ -215,7 +215,7 @@ static NSMapTable* port_number_2_port;
p->_listening_address.sin_port = htons (n);
/* N may be zero, in which case bind() will choose a port number
for us. */
if (bind (p->_socket,
if (bind (p->_port_socket,
(struct sockaddr*) &(p->_listening_address),
sizeof (p->_listening_address))
< 0)
@ -252,7 +252,7 @@ static NSMapTable* port_number_2_port;
/* xxx Perhaps I should do this unconditionally? */
{
int size = sizeof (p->_listening_address);
if (getsockname (p->_socket,
if (getsockname (p->_port_socket,
(struct sockaddr*)&(p->_listening_address),
&size)
< 0)
@ -265,7 +265,7 @@ static NSMapTable* port_number_2_port;
/* Set it up to accept connections, let 10 pending connections queue */
/* xxx Make this "10" a class variable? */
if (listen (p->_socket, 10) < 0)
if (listen (p->_port_socket, 10) < 0)
{
perror ("[TcpInPort +newForReceivingFromPortNumber] listen()");
abort ();
@ -364,7 +364,7 @@ static NSMapTable* port_number_2_port;
- _tryToGetPacketFromReadableFD: (int)fd_index
{
if (fd_index == _socket)
if (fd_index == _port_socket)
{
/* This is a connection request on the original listen()'ing socket. */
int new;
@ -373,7 +373,7 @@ static NSMapTable* port_number_2_port;
struct sockaddr_in clientname;
size = sizeof (clientname);
new = accept (_socket, (struct sockaddr*)&clientname, &size);
new = accept (_port_socket, (struct sockaddr*)&clientname, &size);
if (new < 0)
{
perror ("[TcpInPort receivePacketWithTimeout:] accept()");
@ -480,7 +480,7 @@ static NSMapTable* port_number_2_port;
/* Put in our listening socket. */
*count = 0;
fds[(*count)++] = _socket;
fds[(*count)++] = _port_socket;
/* Enumerate all our client sockets, and put them in. */
me = NSEnumerateMapTable (_client_sock_2_out_port);
@ -506,7 +506,7 @@ static NSMapTable* port_number_2_port;
- (void) _addClientOutPort: p
{
int s = [p _socket];
int s = [p _port_socket];
assert (is_valid);
/* Make sure it hasn't already been added. */
@ -520,7 +520,7 @@ static NSMapTable* port_number_2_port;
- (void) _connectedOutPortInvalidated: p
{
id packet;
int s = [p _socket];
int s = [p _port_socket];
assert (is_valid);
if (debug_tcp_port)
@ -545,9 +545,9 @@ static NSMapTable* port_number_2_port;
userInfo: p];
}
- (int) _socket
- (int) _port_socket
{
return _socket;
return _port_socket;
}
- (int) portNumber
@ -582,14 +582,14 @@ static NSMapTable* port_number_2_port;
However, then the process might run out of FD's if the close()
was delayed too long. */
#ifdef __WIN32__
closesocket (_socket);
closesocket (_port_socket);
#else
close (_socket);
close (_port_socket);
#endif
/* These are here, and not in -dealloc, to prevent
+newForReceivingFromPortNumber: from returning invalid sockets. */
NSMapRemove (socket_2_port, (void*)_socket);
NSMapRemove (socket_2_port, (void*)_port_socket);
NSMapRemove (port_number_2_port,
(void*)(int) ntohs(_listening_address.sin_port));
@ -630,7 +630,7 @@ static NSMapTable* port_number_2_port;
is_valid ? ' ' : '-',
(unsigned)self,
ntohs (_listening_address.sin_port),
_socket];
_port_socket];
}
- (Class) classForConnectedCoder: aRmc
@ -670,7 +670,7 @@ static NSMapTable* port_number_2_port;
/* TcpOutPort - An object that represents a connection to a remote
host. Although it is officially an "Out" Port, we actually receive
data on the socket that is this object's `_socket' ivar; TcpInPort
data on the socket that is this object's `_port_socket' ivar; TcpInPort
takes care of this. */
@implementation TcpOutPort
@ -683,7 +683,7 @@ static NSMapTable *out_port_bag = NULL;
{
if (self == [TcpOutPort class])
{
init_socket_2_port ();
init_port_socket_2_port ();
out_port_bag = NSCreateMapTable (NSNonOwnedPointerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
}
@ -700,8 +700,8 @@ static NSMapTable *out_port_bag = NULL;
If SOCK is 0, then SOCKADDR must be non-NULL. It is the address of
the socket on which the remote TcpInPort is listen()'ing. Note
that it is *not* the address of the TcpOutPort's
getsockname(_socket,...), and it is not the address of the
TcpOutPort's getpeername(_socket,...).
getsockname(_port_socket,...), and it is not the address of the
TcpOutPort's getpeername(_port_socket,...).
SOCK can be either an already-created socket, or 0, in which case a
socket will be created.
@ -749,7 +749,7 @@ static NSMapTable *out_port_bag = NULL;
_remote_in_port_address set, we should make sure that there isn't
already an OutPort with that address. */
/* See if there already exists a TcpOutPort object with ivar _socket
/* See if there already exists a TcpOutPort object with ivar _port_socket
equal to SOCK. If there is, and if sockaddr is non-null, this
call may be a request to set the TcpOutPort's _remote_in_port_address
ivar. */
@ -793,11 +793,11 @@ static NSMapTable *out_port_bag = NULL;
/* Set its socket. */
if (sock)
p->_socket = sock;
p->_port_socket = sock;
else
{
p->_socket = socket (AF_INET, SOCK_STREAM, 0);
if (p->_socket < 0)
p->_port_socket = socket (AF_INET, SOCK_STREAM, 0);
if (p->_port_socket < 0)
{
perror ("[TcpOutPort newForSendingToSockaddr:...] socket()");
abort ();
@ -825,14 +825,14 @@ static NSMapTable *out_port_bag = NULL;
p->_remote_in_port_address.sin_addr.s_addr = 0;
}
/* xxx Do I need to bind(_socket) to this address? I don't think so. */
/* xxx Do I need to bind(_port_socket) to this address? I don't think so. */
/* Connect the socket to its destination, (if it hasn't been done
already by a previous accept() call. */
if (!sock)
{
assert (p->_remote_in_port_address.sin_family);
if (connect (p->_socket,
if (connect (p->_port_socket,
(struct sockaddr*)&(p->_remote_in_port_address),
sizeof(p->_remote_in_port_address))
< 0)
@ -843,8 +843,8 @@ static NSMapTable *out_port_bag = NULL;
}
/* Put it in the shared socket->port map table. */
assert (!NSMapGet (socket_2_port, (void*)p->_socket));
NSMapInsert (socket_2_port, (void*)p->_socket, p);
assert (!NSMapGet (socket_2_port, (void*)p->_port_socket));
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
/* Put it in TcpOutPort's registry. */
NSMapInsert (out_port_bag, (void*)p, (void*)p);
@ -966,14 +966,14 @@ static NSMapTable *out_port_bag = NULL;
and the reply port address. If REPLY_PORT is nil, the second argument
to this call with be NULL, and __writeToSocket:withReplySockaddr: will
know that there is no reply port. */
[packet _writeToSocket: _socket
[packet _writeToSocket: _port_socket
withReplySockaddr: [reply_port _listeningSockaddr]];
return YES;
}
- (int) _socket
- (int) _port_socket
{
return _socket;
return _port_socket;
}
- (int) portNumber
@ -993,9 +993,9 @@ static NSMapTable *out_port_bag = NULL;
/* xxx Perhaps should delay this close() to keep another port from
getting it. This may help Connection invalidation confusion. */
#ifdef __WIN32__
if (closesocket (_socket) < 0)
if (closesocket (_port_socket) < 0)
#else
if (close (_socket) < 0)
if (close (_port_socket) < 0)
#endif
{
perror ("[TcpOutPort -invalidate] close()");
@ -1012,7 +1012,7 @@ static NSMapTable *out_port_bag = NULL;
/* This is here, and not in -dealloc, because invalidated
but not dealloc'ed ports should not be returned from
the socket_2_port in +newForSendingToSockaddr:... */
NSMapRemove (socket_2_port, (void*)_socket);
NSMapRemove (socket_2_port, (void*)_port_socket);
/* This also posts a PortBecameInvalidNotification. */
[super invalidate];
@ -1051,7 +1051,7 @@ static NSMapTable *out_port_bag = NULL;
(unsigned)self,
inet_ntoa (_remote_in_port_address.sin_addr),
ntohs (_remote_in_port_address.sin_port),
_socket];
_port_socket];
}
- (void) encodeWithCoder: aCoder

View file

@ -110,7 +110,7 @@ static NSMapTable *port_number_2_in_port = NULL;
p = [[self alloc] init];
/* Make a new socket for the port object */
if ((p->_socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
if ((p->_port_socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
{
perror("[UdpInPort +newForReceivingFromPortNumber:] socket()");
abort ();
@ -141,7 +141,7 @@ static NSMapTable *port_number_2_in_port = NULL;
p->_address.sin_port = htons (n);
/* N may be zero, in which case bind() will choose a port number
for us. */
if (bind (p->_socket,
if (bind (p->_port_socket,
(struct sockaddr*) &(p->_address),
sizeof (p->_address))
< 0)
@ -157,7 +157,7 @@ static NSMapTable *port_number_2_in_port = NULL;
/* xxx Perhaps I should do this unconditionally? */
{
int size = sizeof (p->_address);
if (getsockname (p->_socket,
if (getsockname (p->_port_socket,
(struct sockaddr*)&(p->_address),
&size)
< 0)
@ -174,7 +174,7 @@ static NSMapTable *port_number_2_in_port = NULL;
if (udp_port_debug)
fprintf(stderr, "created new UdpInPort 0x%x, fd=%d port_number=%d\n",
(unsigned)p, p->_socket, htons(p->_address.sin_port));
(unsigned)p, p->_port_socket, htons(p->_address.sin_port));
return p;
}
@ -218,8 +218,8 @@ static NSMapTable *port_number_2_in_port = NULL;
timeout.tv_sec = milliseconds / 1000;
timeout.tv_usec = (milliseconds % 1000) * 1000;
FD_ZERO(&ready);
FD_SET(_socket, &ready);
if ((r = select(_socket + 1, &ready, 0, 0, &timeout)) < 0)
FD_SET(_port_socket, &ready);
if ((r = select(_port_socket + 1, &ready, 0, 0, &timeout)) < 0)
{
perror("select");
abort ();
@ -227,7 +227,7 @@ static NSMapTable *port_number_2_in_port = NULL;
if (r == 0) /* timeout */
return nil;
if (!FD_ISSET(_socket, &ready))
if (!FD_ISSET(_port_socket, &ready))
[self error:"select lied"];
}
@ -238,7 +238,7 @@ static NSMapTable *port_number_2_in_port = NULL;
/* Fill it with the UDP packet data. */
remote_len = sizeof(remote_addr);
if (recvfrom (_socket, [packet streamBuffer], MAX_PACKET_SIZE, 0,
if (recvfrom (_port_socket, [packet streamBuffer], MAX_PACKET_SIZE, 0,
(struct sockaddr*)&remote_addr, &remote_len)
< 0)
{
@ -258,7 +258,7 @@ static NSMapTable *port_number_2_in_port = NULL;
{
if (is_valid)
{
close (_socket);
close (_port_socket);
[super invalidate];
}
}
@ -271,7 +271,7 @@ static NSMapTable *port_number_2_in_port = NULL;
- (int) socket
{
return _socket;
return _port_socket;
}
- (int) portNumber

View file

@ -38,7 +38,8 @@ DYNAMIC_BUNDLER_LINKER=@DYNAMIC_BUNDLER_LINKER@
DYNAMIC_LDFLAGS=@DYNAMIC_LDFLAGS@
DYNAMIC_CFLAGS=@DYNAMIC_CFLAGS@
DEFS = @DEFS@
LIBS = -L../src -l$(LIBRARY_NAME) @LIBOBJC@ @LIBS@ -lm
LIBS = -L../src @whole_archive@ -l$(LIBRARY_NAME) @no_whole_archive@ \
@LIBOBJC@ @LIBS@ -lm
EXEEXT =
OEXT = .o
@ -99,7 +100,8 @@ release.m \
nsscanner.m \
nsdate.m \
awake.m \
thread-except.m
thread-except.m \
nscharacterset.m
tcpport: FORCE
(cd ../src; $(MAKE))

View file

@ -10,7 +10,7 @@
long lrand48();
#define random lrand48
#else
#if WIN32
#if _WIN32 || __WIN32__
#define random rand
#else
long random();

View file

@ -1,7 +1,9 @@
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSAutoreleasePool.h>
#ifndef _WIN32
#include "malloc.h"
#endif
@interface ReleaseTester : NSObject
{

View file

@ -29,6 +29,11 @@ AC_INIT(src/Collection.m)
#--------------------------------------------------------------------
AC_CONFIG_HEADER(src/include/config.h)
#--------------------------------------------------------------------
# Determine the host, build, and target systems
#--------------------------------------------------------------------
AC_CANONICAL_SYSTEM
#--------------------------------------------------------------------
# Find the compiler
#--------------------------------------------------------------------
@ -297,6 +302,30 @@ else
fi
AC_SUBST(CFLAGS_SHAREDLIB)
#--------------------------------------------------------------------
# Custom configuration based upon the target
#--------------------------------------------------------------------
# On some platforms, ld doesn't link in the complete library which
# can cause problems with the dynamic nature of ObjC. Programs call
# methods for classes which don't exist in the executable!!
# The variables turn on/off the behaviour of ld to include the
# whole archive.
# Note that executable sizes will be larger.
# Note that these variables are passed to GCC not ld directly
whole_archive=''
no_whole_archive=''
case "${target}" in
i[[345]]86-*-cygwin32)
whole_archive='-Wl,--whole-archive'
no_whole_archive='-Wl,--no-whole-archive'
;;
esac
AC_SUBST(whole_archive)
AC_SUBST(no_whole_archive)
#--------------------------------------------------------------------
# Write the Makefiles
#--------------------------------------------------------------------