mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
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:
parent
bf8112f13a
commit
83fc572410
25 changed files with 207 additions and 118 deletions
|
@ -1,5 +1,7 @@
|
||||||
Mon Mar 3 14:41:01 1997 Andrew McCallum <mccallum@jprc.com>
|
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
|
* src/NSHost.m, src/include/NSHost.h: New files from Luke Howard
|
||||||
<lukeh@xedoc.com.au>.
|
<lukeh@xedoc.com.au>.
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ VPATH = @srcdir@
|
||||||
|
|
||||||
# Installation location
|
# Installation location
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
infodir = $(prefix)/info
|
infodir = @infodir@
|
||||||
|
|
||||||
MAKEINFO = makeinfo
|
MAKEINFO = makeinfo
|
||||||
TEXI2DVI = texi2dvi
|
TEXI2DVI = texi2dvi
|
||||||
|
|
|
@ -35,7 +35,7 @@ CPPFLAGS =
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
DEFS = @DEFS@
|
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 =
|
EXEEXT =
|
||||||
OEXT = .o
|
OEXT = .o
|
||||||
|
|
|
@ -56,6 +56,7 @@ typedef double NSTimeInterval;
|
||||||
- (NSDate*) initWithTimeInterval: (NSTimeInterval)secsToBeAdded
|
- (NSDate*) initWithTimeInterval: (NSTimeInterval)secsToBeAdded
|
||||||
sinceDate: (NSDate*)anotherDate;
|
sinceDate: (NSDate*)anotherDate;
|
||||||
- (NSDate*) initWithTimeIntervalSinceNow: (NSTimeInterval)secsToBeAdded;
|
- (NSDate*) initWithTimeIntervalSinceNow: (NSTimeInterval)secsToBeAdded;
|
||||||
|
- (NSDate*) initWithTimeIntervalSince1970: (NSTimeInterval)seconds;
|
||||||
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs;
|
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs;
|
||||||
|
|
||||||
// Converting to NSCalendar
|
// Converting to NSCalendar
|
||||||
|
@ -73,6 +74,7 @@ typedef double NSTimeInterval;
|
||||||
// Adding and getting intervals
|
// Adding and getting intervals
|
||||||
|
|
||||||
- (NSDate*) addTimeInterval: (NSTimeInterval)seconds;
|
- (NSDate*) addTimeInterval: (NSTimeInterval)seconds;
|
||||||
|
- (NSTimeInterval) timeIntervalSince1970;
|
||||||
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate;
|
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate;
|
||||||
- (NSTimeInterval) timeIntervalSinceNow;
|
- (NSTimeInterval) timeIntervalSinceNow;
|
||||||
- (NSTimeInterval) timeIntervalSinceReferenceDate;
|
- (NSTimeInterval) timeIntervalSinceReferenceDate;
|
||||||
|
|
|
@ -33,17 +33,18 @@
|
||||||
+ allocWithZone: (NSZone*)zone;
|
+ allocWithZone: (NSZone*)zone;
|
||||||
+ dictionary;
|
+ dictionary;
|
||||||
+ dictionaryWithContentsOfFile:(NSString *)path;
|
+ dictionaryWithContentsOfFile:(NSString *)path;
|
||||||
+ dictionaryWithObjects: (id*)objects forKeys: (NSString**)keys
|
+ dictionaryWithObjects: (id*)objects forKeys: (NSObject**)keys
|
||||||
count: (unsigned)count;
|
count: (unsigned)count;
|
||||||
+ dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
+ dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
||||||
|
+ dictionaryWithObjectsAndKeys:(id)firstObject, ...;
|
||||||
- initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
- initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
||||||
- initWithObjects: (id*)objects forKeys: (NSString**)keys
|
- initWithObjects: (id*)objects forKeys: (NSObject**)keys
|
||||||
count: (unsigned)count;
|
count: (unsigned)count;
|
||||||
- initWithDictionary: (NSDictionary*)otherDictionary;
|
- initWithDictionary: (NSDictionary*)otherDictionary;
|
||||||
- initWithContentsOfFile: (NSString*)path;
|
- initWithContentsOfFile: (NSString*)path;
|
||||||
|
|
||||||
- (unsigned) count;
|
- (unsigned) count;
|
||||||
- objectForKey: (NSString*)aKey;
|
- objectForKey: (NSObject*)aKey;
|
||||||
- (NSEnumerator*) keyEnumerator;
|
- (NSEnumerator*) keyEnumerator;
|
||||||
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
|
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
|
||||||
- (NSString*) description;
|
- (NSString*) description;
|
||||||
|
@ -62,8 +63,8 @@
|
||||||
+ dictionaryWithCapacity: (unsigned)numItems;
|
+ dictionaryWithCapacity: (unsigned)numItems;
|
||||||
- initWithCapacity: (unsigned)numItems;
|
- initWithCapacity: (unsigned)numItems;
|
||||||
|
|
||||||
- (void) setObject: anObject forKey: (NSString*)aKey;
|
- (void) setObject: anObject forKey: (NSObject*)aKey;
|
||||||
- (void) removeObjectForKey: (NSString*)aKey;
|
- (void) removeObjectForKey: (NSObject*)aKey;
|
||||||
- (void) removeAllObjects;
|
- (void) removeAllObjects;
|
||||||
- (void) removeObjectsForKeys: (NSArray*)keyArray;
|
- (void) removeObjectsForKeys: (NSArray*)keyArray;
|
||||||
- (void) addEntriesFromDictionary: (NSDictionary*)otherDictionary;
|
- (void) addEntriesFromDictionary: (NSDictionary*)otherDictionary;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <objc/objc.h>
|
#include <objc/objc.h>
|
||||||
#include <objc/Protocol.h>
|
#include <objc/Protocol.h>
|
||||||
#include <Foundation/NSZone.h>
|
#include <Foundation/NSZone.h>
|
||||||
|
#include <gnustep/base/fake-main.h>
|
||||||
|
|
||||||
@class NSArchiver;
|
@class NSArchiver;
|
||||||
@class NSCoder;
|
@class NSCoder;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
@interface TcpInPort : InPort
|
@interface TcpInPort : InPort
|
||||||
{
|
{
|
||||||
int _socket;
|
int _port_socket;
|
||||||
struct sockaddr_in _listening_address;
|
struct sockaddr_in _listening_address;
|
||||||
NSMapTable *_client_sock_2_out_port;
|
NSMapTable *_client_sock_2_out_port;
|
||||||
NSMapTable *_client_sock_2_packet;
|
NSMapTable *_client_sock_2_packet;
|
||||||
|
@ -61,13 +61,13 @@
|
||||||
|
|
||||||
@interface TcpOutPort : OutPort
|
@interface TcpOutPort : OutPort
|
||||||
{
|
{
|
||||||
int _socket;
|
int _port_socket;
|
||||||
/* This is actually the address of the listen()'ing socket of the remote
|
/* 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;
|
struct sockaddr_in _remote_in_port_address;
|
||||||
/* This is the address of our remote peer socket. */
|
/* This is the address of our remote peer socket. */
|
||||||
struct sockaddr_in _peer_address;
|
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;
|
id _polling_in_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
@interface UdpInPort : InPort
|
@interface UdpInPort : InPort
|
||||||
{
|
{
|
||||||
int _socket;
|
int _port_socket;
|
||||||
struct sockaddr_in _address;
|
struct sockaddr_in _address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,15 @@ all: src
|
||||||
src doc checks examples: FORCE
|
src doc checks examples: FORCE
|
||||||
cd $@; $(MAKE) $(MAKEDEFINES)
|
cd $@; $(MAKE) $(MAKEDEFINES)
|
||||||
|
|
||||||
install uninstall TAGS:
|
install uninstall TAGS: FORCE
|
||||||
for i in $(SUBDIRS); do \
|
for i in $(SUBDIRS); do \
|
||||||
(cd $$i; $(MAKE) $(MAKEDEFINES) $@); \
|
(cd $$i; $(MAKE) $(MAKEDEFINES) $@); \
|
||||||
done
|
done
|
||||||
|
|
||||||
info dvi:
|
info dvi: FORCE
|
||||||
cd doc; $(MAKE) $(MAKEDEFINES) $@
|
cd doc; $(MAKE) $(MAKEDEFINES) $@
|
||||||
|
|
||||||
check:
|
check: FORCE
|
||||||
cd checks; $(MAKE) $(MAKEDEFINES)
|
cd checks; $(MAKE) $(MAKEDEFINES)
|
||||||
|
|
||||||
Makefile: Makefile.in config.status
|
Makefile: Makefile.in config.status
|
||||||
|
|
|
@ -28,8 +28,10 @@ srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
datadir = $(prefix)/share
|
exec_prefix = @exec_prefix@
|
||||||
charsetdir = $(datadir)/NSCharacterSets
|
libdir = @libdir@
|
||||||
|
gnustep_libdir = $(libdir)/gnustep
|
||||||
|
charsetdir = $(gnustep_libdir)/NSCharacterSets
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
@ -58,7 +60,7 @@ DIST_FILES = $(RCS_FILES) $(CHARSET_FILES) README.CharSet
|
||||||
INSTALL_FILES = $(CHARSET_FILES) README.CharSet
|
INSTALL_FILES = $(CHARSET_FILES) README.CharSet
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
$(srcdir)/../mkinstalldirs $(charsetdir)
|
$(srcdir)/../mkinstalldirs $(libdir) $(gnustep_libdir) $(charsetdir)
|
||||||
install: installdirs
|
install: installdirs
|
||||||
for file in $(INSTALL_FILES); do \
|
for file in $(INSTALL_FILES); do \
|
||||||
$(INSTALL_DATA) $(srcdir)/$$file $(charsetdir)/$$file ; \
|
$(INSTALL_DATA) $(srcdir)/$$file $(charsetdir)/$$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
|
runtime. That is, you must install the new runtime patches in order
|
||||||
to compile this version of the GNUstepBase Library.
|
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.
|
||||||
|
|
|
@ -31,8 +31,9 @@ VPATH = @srcdir@
|
||||||
# Installation locations
|
# Installation locations
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
libdir = $(exec_prefix)/lib
|
libdir = @libdir@
|
||||||
includedir = $(prefix)/include
|
gnustep_libdir = $(libdir)/gnustep
|
||||||
|
includedir = @includedir@
|
||||||
|
|
||||||
CC = @CC@ -pipe
|
CC = @CC@ -pipe
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
@ -51,7 +52,8 @@ YACC = bison
|
||||||
|
|
||||||
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
|
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
|
||||||
# the installing person may set it on the `make' command line.
|
# 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
|
# File name extensions
|
||||||
OEXT = .o
|
OEXT = .o
|
||||||
|
@ -367,6 +369,7 @@ NSDeallocateObject.m \
|
||||||
NSDictionary.m \
|
NSDictionary.m \
|
||||||
NSEnumerator.m \
|
NSEnumerator.m \
|
||||||
NSException.m \
|
NSException.m \
|
||||||
|
NSFileManager.m \
|
||||||
NSGeometry.m \
|
NSGeometry.m \
|
||||||
NSGArchiver.m \
|
NSGArchiver.m \
|
||||||
NSGArray.m \
|
NSGArray.m \
|
||||||
|
@ -443,6 +446,7 @@ include/NSData.h \
|
||||||
include/NSDate.h \
|
include/NSDate.h \
|
||||||
include/NSDictionary.h \
|
include/NSDictionary.h \
|
||||||
include/NSException.h \
|
include/NSException.h \
|
||||||
|
include/NSFileManager.h \
|
||||||
include/NSGeometry.h \
|
include/NSGeometry.h \
|
||||||
include/NSGArchiver.h \
|
include/NSGArchiver.h \
|
||||||
include/NSGArray.h \
|
include/NSGArray.h \
|
||||||
|
@ -509,9 +513,9 @@ lib$(LIBRARY_NAME).so.$(VERSION): $(HEADERS_INSTALL) $(OBJS_INSTALL_PIC)
|
||||||
$(OBJS_INSTALL_PIC)
|
$(OBJS_INSTALL_PIC)
|
||||||
rm -f lib$(LIBRARY_NAME).so.$(MAJOR_VERSION)
|
rm -f lib$(LIBRARY_NAME).so.$(MAJOR_VERSION)
|
||||||
rm -f lib$(LIBRARY_NAME).so
|
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)
|
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).so
|
||||||
|
|
||||||
lib$(LIBRARY_NAME)$(LIBEXT): $(HEADERS_INSTALL) $(OBJS_INSTALL)
|
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)
|
$(RANLIB) lib$(LIBRARY_NAME)$(LIBEXT)
|
||||||
|
|
||||||
# Local links to the include files
|
# Local links to the include files
|
||||||
gnustep/base:
|
gnustep/base: $(HEADERS_INSTALL)
|
||||||
rm -f gnustep base
|
rm -rf gnustep
|
||||||
ln -s . gnustep
|
mkdir gnustep
|
||||||
ln -s ./include base
|
cd gnustep ; $(LN_S) ../include base
|
||||||
# Make necessary links to source headers if compiling in seperate dir
|
# Make necessary links to source headers if compiling in seperate dir
|
||||||
# These are separate directories because one contains the .h files
|
# These are separate directories because one contains the .h files
|
||||||
# generated during the build; the other contains the unchanged sources.
|
# generated during the build; the other contains the unchanged sources.
|
||||||
if [ ! -r ./include/Collection.h ]; then \
|
if [ ! -r ./include/Collection.h ]; then \
|
||||||
mkdir srcdir-include; \
|
mkdir srcdir-include; \
|
||||||
mkdir srcdir-include/gnustep; \
|
mkdir srcdir-include/gnustep; \
|
||||||
(cd srcdir-include/gnustep; ln -s ../../$(srcdir)/include ./base) ; \
|
(cd srcdir-include/gnustep; $(LN_S) ../../$(srcdir)/include ./base) ; \
|
||||||
(cd srcdir-include; ln -s ../$(srcdir)/include ./Foundation) ; \
|
(cd srcdir-include; $(LN_S) ../$(srcdir)/include ./Foundation) ; \
|
||||||
fi
|
fi
|
||||||
# This deletion is necessary, because the CVS repository contains
|
# This deletion is necessary, because the CVS repository contains
|
||||||
# an emtpy `Foundation' directory that used to hold the OpenStep headers.
|
# an emtpy `Foundation' directory that used to hold the OpenStep headers.
|
||||||
Foundation: ../configure
|
Foundation: ../configure $(HEADERS_INSTALL)
|
||||||
rm -rf Foundation
|
rm -rf Foundation
|
||||||
ln -s $(srcdir)/include Foundation
|
$(LN_S) $(srcdir)/include Foundation
|
||||||
|
|
||||||
install: installdirs all
|
install: installdirs all
|
||||||
# Install the library
|
# Install the library
|
||||||
|
@ -546,9 +550,9 @@ install: installdirs all
|
||||||
$(INSTALL_DATA) lib$(LIBRARY_NAME).so.$(VERSION) $(libdir) ; \
|
$(INSTALL_DATA) lib$(LIBRARY_NAME).so.$(VERSION) $(libdir) ; \
|
||||||
rm -f $(libdir)/lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) ; \
|
rm -f $(libdir)/lib$(LIBRARY_NAME).so.$(MAJOR_VERSION) ; \
|
||||||
rm -f $(libdir)/lib$(LIBRARY_NAME).so ; \
|
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) ; \
|
$(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 ; \
|
$(libdir)/lib$(LIBRARY_NAME).so ; \
|
||||||
fi
|
fi
|
||||||
# Install the headers
|
# Install the headers
|
||||||
|
@ -556,19 +560,25 @@ install: installdirs all
|
||||||
$(INSTALL_DATA) $(srcdir)/$$file \
|
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||||
$(includedir)/gnustep/base/`basename $$file` ; \
|
$(includedir)/gnustep/base/`basename $$file` ; \
|
||||||
done
|
done
|
||||||
cd $(includedir); rm -f Foundation; ln -s ./gnustep/base ./Foundation
|
cd $(includedir); rm -rf Foundation; $(LN_S) ./gnustep/base ./Foundation
|
||||||
cd $(includedir); rm -f objc; ln -s ./gnustep/base ./objc
|
for file in $(NEXTSTEP_HEADERS); do \
|
||||||
cd $(includedir)/objc; rm -f README; ln -s ../include/README .
|
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||||
|
$(includedir)/objc/`basename $$file` ; \
|
||||||
|
done
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
$(srcdir)/../mkinstalldirs \
|
$(srcdir)/../mkinstalldirs \
|
||||||
$(libdir) \
|
$(libdir) \
|
||||||
$(includedir)/gnustep/base
|
$(includedir)/gnustep/base \
|
||||||
|
$(includedir)/objc
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(libdir)/lib$(LIBRARY_NAME)$(LIBEXT)
|
rm -f $(libdir)/lib$(LIBRARY_NAME)$(LIBEXT)
|
||||||
rm -rf $(includedir)/gnustep/base
|
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
|
# Creation of NSValue and NSNumber concrete classes from templates
|
||||||
$(NSVALUE_MFILES) : NSCTemplateValue.m
|
$(NSVALUE_MFILES) : NSCTemplateValue.m
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
|
|
||||||
#ifndef NSCharacterSet_PATH
|
#ifndef NSCharacterSet_PATH
|
||||||
#define NSCharacterSet_PATH OBJC_STRINGIFY(GNUSTEP_INSTALL_PREFIX) @"/share"
|
#define NSCharacterSet_PATH OBJC_STRINGIFY(GNUSTEP_INSTALL_LIBDIR) @"/NSCharacterSets"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* A simple array for caching standard bitmap sets */
|
/* A simple array for caching standard bitmap sets */
|
||||||
|
|
|
@ -176,6 +176,12 @@
|
||||||
[[self class] timeIntervalSinceReferenceDate] + secsToBeAdded];
|
[[self class] timeIntervalSinceReferenceDate] + secsToBeAdded];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDate *)initWithTimeIntervalSince1970:(NSTimeInterval)seconds
|
||||||
|
{
|
||||||
|
return [self initWithTimeIntervalSinceReferenceDate:
|
||||||
|
UNIX_REFERENCE_INTERVAL + seconds];
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
|
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
|
||||||
{
|
{
|
||||||
[super init];
|
[super init];
|
||||||
|
@ -251,6 +257,11 @@
|
||||||
seconds_since_ref + seconds];
|
seconds_since_ref + seconds];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSTimeInterval) timeIntervalSince1970
|
||||||
|
{
|
||||||
|
return seconds_since_ref - UNIX_REFERENCE_INTERVAL;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate
|
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate
|
||||||
{
|
{
|
||||||
return seconds_since_ref - [otherDate timeIntervalSinceReferenceDate];
|
return seconds_since_ref - [otherDate timeIntervalSinceReferenceDate];
|
||||||
|
|
|
@ -73,7 +73,7 @@ static Class NSMutableDictionary_concrete_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ dictionaryWithObjects: (id*)objects
|
+ dictionaryWithObjects: (id*)objects
|
||||||
forKeys: (NSString**)keys
|
forKeys: (NSObject**)keys
|
||||||
count: (unsigned)count
|
count: (unsigned)count
|
||||||
{
|
{
|
||||||
return [[[self alloc] initWithObjects:objects
|
return [[[self alloc] initWithObjects:objects
|
||||||
|
@ -151,7 +151,7 @@ static Class NSMutableDictionary_concrete_class;
|
||||||
|
|
||||||
/* This is the designated initializer */
|
/* This is the designated initializer */
|
||||||
- initWithObjects: (id*)objects
|
- initWithObjects: (id*)objects
|
||||||
forKeys: (NSString**)keys
|
forKeys: (NSObject**)keys
|
||||||
count: (unsigned)count
|
count: (unsigned)count
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
[self subclassResponsibility:_cmd];
|
||||||
|
@ -205,7 +205,7 @@ static Class NSMutableDictionary_concrete_class;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- objectForKey: (NSString*)aKey
|
- objectForKey: (NSObject*)aKey
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
[self subclassResponsibility:_cmd];
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -326,7 +326,7 @@ static Class NSMutableDictionary_concrete_class;
|
||||||
/* a deep copy */
|
/* a deep copy */
|
||||||
int count = [self count];
|
int count = [self count];
|
||||||
id objects[count];
|
id objects[count];
|
||||||
NSString *keys[count];
|
NSObject *keys[count];
|
||||||
id enumerator = [self keyEnumerator];
|
id enumerator = [self keyEnumerator];
|
||||||
id key;
|
id key;
|
||||||
int i;
|
int i;
|
||||||
|
@ -373,7 +373,7 @@ static Class NSMutableDictionary_concrete_class;
|
||||||
|
|
||||||
/* Override superclass's designated initializer */
|
/* Override superclass's designated initializer */
|
||||||
- initWithObjects: (id*)objects
|
- initWithObjects: (id*)objects
|
||||||
forKeys: (NSString**)keys
|
forKeys: (NSObject**)keys
|
||||||
count: (unsigned)count
|
count: (unsigned)count
|
||||||
{
|
{
|
||||||
[self initWithCapacity:count];
|
[self initWithCapacity:count];
|
||||||
|
@ -382,12 +382,12 @@ static Class NSMutableDictionary_concrete_class;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setObject:anObject forKey:(NSString *)aKey
|
- (void) setObject:anObject forKey:(NSObject *)aKey
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
[self subclassResponsibility:_cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObjectForKey:(NSString *)aKey
|
- (void) removeObjectForKey:(NSObject *)aKey
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
[self subclassResponsibility:_cmd];
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
/*
|
/*
|
||||||
Comes from Dictionary.m
|
Comes from Dictionary.m
|
||||||
- initWithObjects: (id*)objects
|
- initWithObjects: (id*)objects
|
||||||
forKeys: (NSString**)keys
|
forKeys: (NSObject**)keys
|
||||||
count: (unsigned)count
|
count: (unsigned)count
|
||||||
- (unsigned) count
|
- (unsigned) count
|
||||||
- (NSEnumerator*) keyEnumerator
|
- (NSEnumerator*) keyEnumerator
|
||||||
|
@ -116,12 +116,12 @@
|
||||||
- initWithCapacity: (unsigned)numItems
|
- initWithCapacity: (unsigned)numItems
|
||||||
*/
|
*/
|
||||||
|
|
||||||
- (void) setObject:anObject forKey:(NSString *)aKey
|
- (void) setObject:anObject forKey:(NSObject *)aKey
|
||||||
{
|
{
|
||||||
[self putObject: anObject atKey: aKey];
|
[self putObject: anObject atKey: aKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObjectForKey:(NSString *)aKey
|
- (void) removeObjectForKey:(NSObject *)aKey
|
||||||
{
|
{
|
||||||
[self removeObjectAtKey: aKey];
|
[self removeObjectAtKey: aKey];
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
+ (NSNumber *)numberWithLong:(long)value
|
+ (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
|
+ (NSNumber *)numberWithLongLong:(long long)value
|
||||||
|
|
|
@ -211,6 +211,12 @@ handle_printf_atsign (FILE *stream,
|
||||||
autorelease];
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSString*) stringWithContentsOfFile:(NSString *)path
|
||||||
|
{
|
||||||
|
return [[[self alloc]
|
||||||
|
initWithContentsOfFile: path] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSString*) stringWithCharacters: (const unichar*)chars
|
+ (NSString*) stringWithCharacters: (const unichar*)chars
|
||||||
length: (unsigned int)length
|
length: (unsigned int)length
|
||||||
{
|
{
|
||||||
|
@ -502,9 +508,8 @@ handle_printf_atsign (FILE *stream,
|
||||||
NSRange search;
|
NSRange search;
|
||||||
NSRange found;
|
NSRange found;
|
||||||
NSMutableArray *array = [NSMutableArray array];
|
NSMutableArray *array = [NSMutableArray array];
|
||||||
int myLength = [self length];
|
|
||||||
|
|
||||||
search = NSMakeRange (0, myLength);
|
search = NSMakeRange (0, [self length]);
|
||||||
found = [self rangeOfString: separator];
|
found = [self rangeOfString: separator];
|
||||||
while (found.length)
|
while (found.length)
|
||||||
{
|
{
|
||||||
|
@ -512,12 +517,14 @@ handle_printf_atsign (FILE *stream,
|
||||||
current = NSMakeRange (search.location,
|
current = NSMakeRange (search.location,
|
||||||
found.location - search.location);
|
found.location - search.location);
|
||||||
[array addObject: [self substringFromRange: current]];
|
[array addObject: [self substringFromRange: current]];
|
||||||
search = NSMakeRange (found.location + found.length,
|
search = NSMakeRange (found.location + 1,
|
||||||
myLength - (found.location + found.length));
|
search.length - found.location - 1);
|
||||||
found = [self rangeOfString: separator
|
found = [self rangeOfString: separator
|
||||||
options: 0
|
options: 0
|
||||||
range: search];
|
range: search];
|
||||||
}
|
}
|
||||||
|
// Add the last search string range
|
||||||
|
[array addObject: [self substringFromRange: search]];
|
||||||
|
|
||||||
// FIXME: Need to make mutable array into non-mutable array?
|
// FIXME: Need to make mutable array into non-mutable array?
|
||||||
return array;
|
return array;
|
||||||
|
@ -838,6 +845,8 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
- (NSString*) description
|
- (NSString*) description
|
||||||
{
|
{
|
||||||
|
return self;
|
||||||
|
#if 0
|
||||||
const char *src = [self cString];
|
const char *src = [self cString];
|
||||||
char *dest;
|
char *dest;
|
||||||
char *src_ptr,*dest_ptr;
|
char *src_ptr,*dest_ptr;
|
||||||
|
@ -909,6 +918,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
ret = [NSString stringWithCString:dest];
|
ret = [NSString stringWithCString:dest];
|
||||||
objc_free (dest);
|
objc_free (dest);
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) writeToFile: (NSString*)filename
|
- (BOOL) writeToFile: (NSString*)filename
|
||||||
|
@ -1475,7 +1485,10 @@ handle_printf_atsign (FILE *stream,
|
||||||
/* Inefficient. */
|
/* Inefficient. */
|
||||||
- (void) appendString: (NSString*)aString
|
- (void) appendString: (NSString*)aString
|
||||||
{
|
{
|
||||||
id tmp = [self stringByAppendingString:aString];
|
id tmp;
|
||||||
|
if (!aString)
|
||||||
|
return;
|
||||||
|
tmp = [self stringByAppendingString:aString];
|
||||||
[self setString:tmp];
|
[self setString:tmp];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ NSString *NSAMPMDesignation = @"NSAMPMDesignation";
|
||||||
@interface NSUserDefaults (__local_NSUserDefaults)
|
@interface NSUserDefaults (__local_NSUserDefaults)
|
||||||
- (void)__createStandardSearchList;
|
- (void)__createStandardSearchList;
|
||||||
- (NSDictionary *)__createArgumentDictionary;
|
- (NSDictionary *)__createArgumentDictionary;
|
||||||
- (void)__changePersitentDomain:(NSString *)domainName;
|
- (void)__changePersistentDomain:(NSString *)domainName;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSUserDefaults: NSObject
|
@implementation NSUserDefaults: NSObject
|
||||||
|
@ -231,14 +231,14 @@ static NSMutableString *processName = nil;
|
||||||
[persDomains setObject:
|
[persDomains setObject:
|
||||||
[NSMutableDictionary
|
[NSMutableDictionary
|
||||||
dictionaryWithCapacity:10] forKey:processName];
|
dictionaryWithCapacity:10] forKey:processName];
|
||||||
[self __changePersitentDomain:processName];
|
[self __changePersistentDomain:processName];
|
||||||
}
|
}
|
||||||
if (![persDomains objectForKey:NSGlobalDomain])
|
if (![persDomains objectForKey:NSGlobalDomain])
|
||||||
{
|
{
|
||||||
[persDomains setObject:
|
[persDomains setObject:
|
||||||
[NSMutableDictionary
|
[NSMutableDictionary
|
||||||
dictionaryWithCapacity:10] forKey:NSGlobalDomain];
|
dictionaryWithCapacity:10] forKey:NSGlobalDomain];
|
||||||
[self __changePersitentDomain:NSGlobalDomain];
|
[self __changePersistentDomain:NSGlobalDomain];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create volatile defaults and add the Argument and the Registration domains
|
// Create volatile defaults and add the Argument and the Registration domains
|
||||||
|
@ -359,7 +359,7 @@ static NSMutableString *processName = nil;
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
[[persDomains objectForKey:processName] removeObjectForKey:defaultName];
|
[[persDomains objectForKey:processName] removeObjectForKey:defaultName];
|
||||||
[self __changePersitentDomain:processName];
|
[self __changePersistentDomain:processName];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ static NSMutableString *processName = nil;
|
||||||
{
|
{
|
||||||
[[persDomains objectForKey:processName]
|
[[persDomains objectForKey:processName]
|
||||||
setObject:value forKey:defaultName];
|
setObject:value forKey:defaultName];
|
||||||
[self __changePersitentDomain:processName];
|
[self __changePersistentDomain:processName];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ static NSMutableString *processName = nil;
|
||||||
if ([persDomains objectForKey:domainName])
|
if ([persDomains objectForKey:domainName])
|
||||||
{
|
{
|
||||||
[persDomains removeObjectForKey:domainName];
|
[persDomains removeObjectForKey:domainName];
|
||||||
[self __changePersitentDomain:domainName];
|
[self __changePersistentDomain:domainName];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,7 @@ static NSMutableString *processName = nil;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[persDomains setObject:domain forKey:domainName];
|
[persDomains setObject:domain forKey:domainName];
|
||||||
[self __changePersitentDomain:domainName];
|
[self __changePersistentDomain:domainName];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ static NSMutableString *processName = nil;
|
||||||
return argDict;
|
return argDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)__changePersitentDomain:(NSString *)domainName
|
- (void)__changePersistentDomain:(NSString *)domainName
|
||||||
{
|
{
|
||||||
NSEnumerator *enumerator = nil;
|
NSEnumerator *enumerator = nil;
|
||||||
id obj;
|
id obj;
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int debug_tcp_port = 0;
|
||||||
/* Private interfaces */
|
/* Private interfaces */
|
||||||
|
|
||||||
@interface TcpInPort (Private)
|
@interface TcpInPort (Private)
|
||||||
- (int) _socket;
|
- (int) _port_socket;
|
||||||
- (struct sockaddr_in*) _listeningSockaddr;
|
- (struct sockaddr_in*) _listeningSockaddr;
|
||||||
- (void) _addClientOutPort: p;
|
- (void) _addClientOutPort: p;
|
||||||
- (void) _connectedOutPortInvalidated: p;
|
- (void) _connectedOutPortInvalidated: p;
|
||||||
|
@ -69,7 +69,7 @@ static int debug_tcp_port = 0;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface TcpOutPort (Private)
|
@interface TcpOutPort (Private)
|
||||||
- (int) _socket;
|
- (int) _port_socket;
|
||||||
- _initWithSocket: (int)s inPort: ip;
|
- _initWithSocket: (int)s inPort: ip;
|
||||||
+ _newWithAcceptedSocket: (int)s peeraddr: (struct sockaddr_in*)addr inPort: p;
|
+ _newWithAcceptedSocket: (int)s peeraddr: (struct sockaddr_in*)addr inPort: p;
|
||||||
- (struct sockaddr_in*) _remoteInPortSockaddr;
|
- (struct sockaddr_in*) _remoteInPortSockaddr;
|
||||||
|
@ -100,7 +100,7 @@ static int debug_tcp_port = 0;
|
||||||
|
|
||||||
@interface TcpInStream : NSObject
|
@interface TcpInStream : NSObject
|
||||||
{
|
{
|
||||||
int _socket;
|
int _port_socket;
|
||||||
id _listening_in_port;
|
id _listening_in_port;
|
||||||
}
|
}
|
||||||
- initWithAcceptedSocket: (int)s inPort: p;
|
- initWithAcceptedSocket: (int)s inPort: p;
|
||||||
|
@ -133,7 +133,7 @@ name_2_port_number (const char *name)
|
||||||
static NSMapTable *socket_2_port = NULL;
|
static NSMapTable *socket_2_port = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_socket_2_port ()
|
init_port_socket_2_port ()
|
||||||
{
|
{
|
||||||
if (!socket_2_port)
|
if (!socket_2_port)
|
||||||
socket_2_port =
|
socket_2_port =
|
||||||
|
@ -160,7 +160,7 @@ static NSMapTable* port_number_2_port;
|
||||||
port_number_2_port =
|
port_number_2_port =
|
||||||
NSCreateMapTable (NSIntMapKeyCallBacks,
|
NSCreateMapTable (NSIntMapKeyCallBacks,
|
||||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||||
init_socket_2_port ();
|
init_port_socket_2_port ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the designated initializer.
|
/* This is the designated initializer.
|
||||||
|
@ -185,16 +185,16 @@ static NSMapTable* port_number_2_port;
|
||||||
p = [[TcpInPort alloc] init];
|
p = [[TcpInPort alloc] init];
|
||||||
|
|
||||||
/* Create the socket. */
|
/* Create the socket. */
|
||||||
p->_socket = socket (AF_INET, SOCK_STREAM, 0);
|
p->_port_socket = socket (AF_INET, SOCK_STREAM, 0);
|
||||||
if (p->_socket < 0)
|
if (p->_port_socket < 0)
|
||||||
{
|
{
|
||||||
perror ("[TcpInPort +newForReceivingFromPortNumber:] socket()");
|
perror ("[TcpInPort +newForReceivingFromPortNumber:] socket()");
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the port object according to its socket. */
|
/* Register the port object according to its socket. */
|
||||||
assert (!NSMapGet (socket_2_port, (void*)p->_socket));
|
assert (!NSMapGet (socket_2_port, (void*)p->_port_socket));
|
||||||
NSMapInsert (socket_2_port, (void*)p->_socket, p);
|
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
|
||||||
|
|
||||||
/* Give the socket a name using bind() and INADDR_ANY for the
|
/* Give the socket a name using bind() and INADDR_ANY for the
|
||||||
machine address in _LISTENING_ADDRESS; then put the network
|
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);
|
p->_listening_address.sin_port = htons (n);
|
||||||
/* N may be zero, in which case bind() will choose a port number
|
/* N may be zero, in which case bind() will choose a port number
|
||||||
for us. */
|
for us. */
|
||||||
if (bind (p->_socket,
|
if (bind (p->_port_socket,
|
||||||
(struct sockaddr*) &(p->_listening_address),
|
(struct sockaddr*) &(p->_listening_address),
|
||||||
sizeof (p->_listening_address))
|
sizeof (p->_listening_address))
|
||||||
< 0)
|
< 0)
|
||||||
|
@ -252,7 +252,7 @@ static NSMapTable* port_number_2_port;
|
||||||
/* xxx Perhaps I should do this unconditionally? */
|
/* xxx Perhaps I should do this unconditionally? */
|
||||||
{
|
{
|
||||||
int size = sizeof (p->_listening_address);
|
int size = sizeof (p->_listening_address);
|
||||||
if (getsockname (p->_socket,
|
if (getsockname (p->_port_socket,
|
||||||
(struct sockaddr*)&(p->_listening_address),
|
(struct sockaddr*)&(p->_listening_address),
|
||||||
&size)
|
&size)
|
||||||
< 0)
|
< 0)
|
||||||
|
@ -265,7 +265,7 @@ static NSMapTable* port_number_2_port;
|
||||||
|
|
||||||
/* Set it up to accept connections, let 10 pending connections queue */
|
/* Set it up to accept connections, let 10 pending connections queue */
|
||||||
/* xxx Make this "10" a class variable? */
|
/* xxx Make this "10" a class variable? */
|
||||||
if (listen (p->_socket, 10) < 0)
|
if (listen (p->_port_socket, 10) < 0)
|
||||||
{
|
{
|
||||||
perror ("[TcpInPort +newForReceivingFromPortNumber] listen()");
|
perror ("[TcpInPort +newForReceivingFromPortNumber] listen()");
|
||||||
abort ();
|
abort ();
|
||||||
|
@ -364,7 +364,7 @@ static NSMapTable* port_number_2_port;
|
||||||
|
|
||||||
- _tryToGetPacketFromReadableFD: (int)fd_index
|
- _tryToGetPacketFromReadableFD: (int)fd_index
|
||||||
{
|
{
|
||||||
if (fd_index == _socket)
|
if (fd_index == _port_socket)
|
||||||
{
|
{
|
||||||
/* This is a connection request on the original listen()'ing socket. */
|
/* This is a connection request on the original listen()'ing socket. */
|
||||||
int new;
|
int new;
|
||||||
|
@ -373,7 +373,7 @@ static NSMapTable* port_number_2_port;
|
||||||
struct sockaddr_in clientname;
|
struct sockaddr_in clientname;
|
||||||
|
|
||||||
size = sizeof (clientname);
|
size = sizeof (clientname);
|
||||||
new = accept (_socket, (struct sockaddr*)&clientname, &size);
|
new = accept (_port_socket, (struct sockaddr*)&clientname, &size);
|
||||||
if (new < 0)
|
if (new < 0)
|
||||||
{
|
{
|
||||||
perror ("[TcpInPort receivePacketWithTimeout:] accept()");
|
perror ("[TcpInPort receivePacketWithTimeout:] accept()");
|
||||||
|
@ -480,7 +480,7 @@ static NSMapTable* port_number_2_port;
|
||||||
|
|
||||||
/* Put in our listening socket. */
|
/* Put in our listening socket. */
|
||||||
*count = 0;
|
*count = 0;
|
||||||
fds[(*count)++] = _socket;
|
fds[(*count)++] = _port_socket;
|
||||||
|
|
||||||
/* Enumerate all our client sockets, and put them in. */
|
/* Enumerate all our client sockets, and put them in. */
|
||||||
me = NSEnumerateMapTable (_client_sock_2_out_port);
|
me = NSEnumerateMapTable (_client_sock_2_out_port);
|
||||||
|
@ -506,7 +506,7 @@ static NSMapTable* port_number_2_port;
|
||||||
|
|
||||||
- (void) _addClientOutPort: p
|
- (void) _addClientOutPort: p
|
||||||
{
|
{
|
||||||
int s = [p _socket];
|
int s = [p _port_socket];
|
||||||
|
|
||||||
assert (is_valid);
|
assert (is_valid);
|
||||||
/* Make sure it hasn't already been added. */
|
/* Make sure it hasn't already been added. */
|
||||||
|
@ -520,7 +520,7 @@ static NSMapTable* port_number_2_port;
|
||||||
- (void) _connectedOutPortInvalidated: p
|
- (void) _connectedOutPortInvalidated: p
|
||||||
{
|
{
|
||||||
id packet;
|
id packet;
|
||||||
int s = [p _socket];
|
int s = [p _port_socket];
|
||||||
|
|
||||||
assert (is_valid);
|
assert (is_valid);
|
||||||
if (debug_tcp_port)
|
if (debug_tcp_port)
|
||||||
|
@ -545,9 +545,9 @@ static NSMapTable* port_number_2_port;
|
||||||
userInfo: p];
|
userInfo: p];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) _socket
|
- (int) _port_socket
|
||||||
{
|
{
|
||||||
return _socket;
|
return _port_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) portNumber
|
- (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()
|
However, then the process might run out of FD's if the close()
|
||||||
was delayed too long. */
|
was delayed too long. */
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
closesocket (_socket);
|
closesocket (_port_socket);
|
||||||
#else
|
#else
|
||||||
close (_socket);
|
close (_port_socket);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These are here, and not in -dealloc, to prevent
|
/* These are here, and not in -dealloc, to prevent
|
||||||
+newForReceivingFromPortNumber: from returning invalid sockets. */
|
+newForReceivingFromPortNumber: from returning invalid sockets. */
|
||||||
NSMapRemove (socket_2_port, (void*)_socket);
|
NSMapRemove (socket_2_port, (void*)_port_socket);
|
||||||
NSMapRemove (port_number_2_port,
|
NSMapRemove (port_number_2_port,
|
||||||
(void*)(int) ntohs(_listening_address.sin_port));
|
(void*)(int) ntohs(_listening_address.sin_port));
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ static NSMapTable* port_number_2_port;
|
||||||
is_valid ? ' ' : '-',
|
is_valid ? ' ' : '-',
|
||||||
(unsigned)self,
|
(unsigned)self,
|
||||||
ntohs (_listening_address.sin_port),
|
ntohs (_listening_address.sin_port),
|
||||||
_socket];
|
_port_socket];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Class) classForConnectedCoder: aRmc
|
- (Class) classForConnectedCoder: aRmc
|
||||||
|
@ -670,7 +670,7 @@ static NSMapTable* port_number_2_port;
|
||||||
|
|
||||||
/* TcpOutPort - An object that represents a connection to a remote
|
/* TcpOutPort - An object that represents a connection to a remote
|
||||||
host. Although it is officially an "Out" Port, we actually receive
|
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. */
|
takes care of this. */
|
||||||
|
|
||||||
@implementation TcpOutPort
|
@implementation TcpOutPort
|
||||||
|
@ -683,7 +683,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
{
|
{
|
||||||
if (self == [TcpOutPort class])
|
if (self == [TcpOutPort class])
|
||||||
{
|
{
|
||||||
init_socket_2_port ();
|
init_port_socket_2_port ();
|
||||||
out_port_bag = NSCreateMapTable (NSNonOwnedPointerMapKeyCallBacks,
|
out_port_bag = NSCreateMapTable (NSNonOwnedPointerMapKeyCallBacks,
|
||||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
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
|
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
|
the socket on which the remote TcpInPort is listen()'ing. Note
|
||||||
that it is *not* the address of the TcpOutPort's
|
that it is *not* the address of the TcpOutPort's
|
||||||
getsockname(_socket,...), and it is not the address of the
|
getsockname(_port_socket,...), and it is not the address of the
|
||||||
TcpOutPort's getpeername(_socket,...).
|
TcpOutPort's getpeername(_port_socket,...).
|
||||||
|
|
||||||
SOCK can be either an already-created socket, or 0, in which case a
|
SOCK can be either an already-created socket, or 0, in which case a
|
||||||
socket will be created.
|
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
|
_remote_in_port_address set, we should make sure that there isn't
|
||||||
already an OutPort with that address. */
|
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
|
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
|
call may be a request to set the TcpOutPort's _remote_in_port_address
|
||||||
ivar. */
|
ivar. */
|
||||||
|
@ -793,11 +793,11 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
|
|
||||||
/* Set its socket. */
|
/* Set its socket. */
|
||||||
if (sock)
|
if (sock)
|
||||||
p->_socket = sock;
|
p->_port_socket = sock;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->_socket = socket (AF_INET, SOCK_STREAM, 0);
|
p->_port_socket = socket (AF_INET, SOCK_STREAM, 0);
|
||||||
if (p->_socket < 0)
|
if (p->_port_socket < 0)
|
||||||
{
|
{
|
||||||
perror ("[TcpOutPort newForSendingToSockaddr:...] socket()");
|
perror ("[TcpOutPort newForSendingToSockaddr:...] socket()");
|
||||||
abort ();
|
abort ();
|
||||||
|
@ -825,14 +825,14 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
p->_remote_in_port_address.sin_addr.s_addr = 0;
|
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
|
/* Connect the socket to its destination, (if it hasn't been done
|
||||||
already by a previous accept() call. */
|
already by a previous accept() call. */
|
||||||
if (!sock)
|
if (!sock)
|
||||||
{
|
{
|
||||||
assert (p->_remote_in_port_address.sin_family);
|
assert (p->_remote_in_port_address.sin_family);
|
||||||
if (connect (p->_socket,
|
if (connect (p->_port_socket,
|
||||||
(struct sockaddr*)&(p->_remote_in_port_address),
|
(struct sockaddr*)&(p->_remote_in_port_address),
|
||||||
sizeof(p->_remote_in_port_address))
|
sizeof(p->_remote_in_port_address))
|
||||||
< 0)
|
< 0)
|
||||||
|
@ -843,8 +843,8 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put it in the shared socket->port map table. */
|
/* Put it in the shared socket->port map table. */
|
||||||
assert (!NSMapGet (socket_2_port, (void*)p->_socket));
|
assert (!NSMapGet (socket_2_port, (void*)p->_port_socket));
|
||||||
NSMapInsert (socket_2_port, (void*)p->_socket, p);
|
NSMapInsert (socket_2_port, (void*)p->_port_socket, p);
|
||||||
|
|
||||||
/* Put it in TcpOutPort's registry. */
|
/* Put it in TcpOutPort's registry. */
|
||||||
NSMapInsert (out_port_bag, (void*)p, (void*)p);
|
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
|
and the reply port address. If REPLY_PORT is nil, the second argument
|
||||||
to this call with be NULL, and __writeToSocket:withReplySockaddr: will
|
to this call with be NULL, and __writeToSocket:withReplySockaddr: will
|
||||||
know that there is no reply port. */
|
know that there is no reply port. */
|
||||||
[packet _writeToSocket: _socket
|
[packet _writeToSocket: _port_socket
|
||||||
withReplySockaddr: [reply_port _listeningSockaddr]];
|
withReplySockaddr: [reply_port _listeningSockaddr]];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) _socket
|
- (int) _port_socket
|
||||||
{
|
{
|
||||||
return _socket;
|
return _port_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) portNumber
|
- (int) portNumber
|
||||||
|
@ -993,9 +993,9 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
/* xxx Perhaps should delay this close() to keep another port from
|
/* xxx Perhaps should delay this close() to keep another port from
|
||||||
getting it. This may help Connection invalidation confusion. */
|
getting it. This may help Connection invalidation confusion. */
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
if (closesocket (_socket) < 0)
|
if (closesocket (_port_socket) < 0)
|
||||||
#else
|
#else
|
||||||
if (close (_socket) < 0)
|
if (close (_port_socket) < 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
perror ("[TcpOutPort -invalidate] close()");
|
perror ("[TcpOutPort -invalidate] close()");
|
||||||
|
@ -1012,7 +1012,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
/* This is here, and not in -dealloc, because invalidated
|
/* This is here, and not in -dealloc, because invalidated
|
||||||
but not dealloc'ed ports should not be returned from
|
but not dealloc'ed ports should not be returned from
|
||||||
the socket_2_port in +newForSendingToSockaddr:... */
|
the socket_2_port in +newForSendingToSockaddr:... */
|
||||||
NSMapRemove (socket_2_port, (void*)_socket);
|
NSMapRemove (socket_2_port, (void*)_port_socket);
|
||||||
|
|
||||||
/* This also posts a PortBecameInvalidNotification. */
|
/* This also posts a PortBecameInvalidNotification. */
|
||||||
[super invalidate];
|
[super invalidate];
|
||||||
|
@ -1051,7 +1051,7 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
(unsigned)self,
|
(unsigned)self,
|
||||||
inet_ntoa (_remote_in_port_address.sin_addr),
|
inet_ntoa (_remote_in_port_address.sin_addr),
|
||||||
ntohs (_remote_in_port_address.sin_port),
|
ntohs (_remote_in_port_address.sin_port),
|
||||||
_socket];
|
_port_socket];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder: aCoder
|
- (void) encodeWithCoder: aCoder
|
||||||
|
|
|
@ -110,7 +110,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
p = [[self alloc] init];
|
p = [[self alloc] init];
|
||||||
|
|
||||||
/* Make a new socket for the port object */
|
/* 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()");
|
perror("[UdpInPort +newForReceivingFromPortNumber:] socket()");
|
||||||
abort ();
|
abort ();
|
||||||
|
@ -141,7 +141,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
p->_address.sin_port = htons (n);
|
p->_address.sin_port = htons (n);
|
||||||
/* N may be zero, in which case bind() will choose a port number
|
/* N may be zero, in which case bind() will choose a port number
|
||||||
for us. */
|
for us. */
|
||||||
if (bind (p->_socket,
|
if (bind (p->_port_socket,
|
||||||
(struct sockaddr*) &(p->_address),
|
(struct sockaddr*) &(p->_address),
|
||||||
sizeof (p->_address))
|
sizeof (p->_address))
|
||||||
< 0)
|
< 0)
|
||||||
|
@ -157,7 +157,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
/* xxx Perhaps I should do this unconditionally? */
|
/* xxx Perhaps I should do this unconditionally? */
|
||||||
{
|
{
|
||||||
int size = sizeof (p->_address);
|
int size = sizeof (p->_address);
|
||||||
if (getsockname (p->_socket,
|
if (getsockname (p->_port_socket,
|
||||||
(struct sockaddr*)&(p->_address),
|
(struct sockaddr*)&(p->_address),
|
||||||
&size)
|
&size)
|
||||||
< 0)
|
< 0)
|
||||||
|
@ -174,7 +174,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
|
|
||||||
if (udp_port_debug)
|
if (udp_port_debug)
|
||||||
fprintf(stderr, "created new UdpInPort 0x%x, fd=%d port_number=%d\n",
|
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;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -218,8 +218,8 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
timeout.tv_sec = milliseconds / 1000;
|
timeout.tv_sec = milliseconds / 1000;
|
||||||
timeout.tv_usec = (milliseconds % 1000) * 1000;
|
timeout.tv_usec = (milliseconds % 1000) * 1000;
|
||||||
FD_ZERO(&ready);
|
FD_ZERO(&ready);
|
||||||
FD_SET(_socket, &ready);
|
FD_SET(_port_socket, &ready);
|
||||||
if ((r = select(_socket + 1, &ready, 0, 0, &timeout)) < 0)
|
if ((r = select(_port_socket + 1, &ready, 0, 0, &timeout)) < 0)
|
||||||
{
|
{
|
||||||
perror("select");
|
perror("select");
|
||||||
abort ();
|
abort ();
|
||||||
|
@ -227,7 +227,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
|
|
||||||
if (r == 0) /* timeout */
|
if (r == 0) /* timeout */
|
||||||
return nil;
|
return nil;
|
||||||
if (!FD_ISSET(_socket, &ready))
|
if (!FD_ISSET(_port_socket, &ready))
|
||||||
[self error:"select lied"];
|
[self error:"select lied"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
|
|
||||||
/* Fill it with the UDP packet data. */
|
/* Fill it with the UDP packet data. */
|
||||||
remote_len = sizeof(remote_addr);
|
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)
|
(struct sockaddr*)&remote_addr, &remote_len)
|
||||||
< 0)
|
< 0)
|
||||||
{
|
{
|
||||||
|
@ -258,7 +258,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
{
|
{
|
||||||
if (is_valid)
|
if (is_valid)
|
||||||
{
|
{
|
||||||
close (_socket);
|
close (_port_socket);
|
||||||
[super invalidate];
|
[super invalidate];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
|
|
||||||
- (int) socket
|
- (int) socket
|
||||||
{
|
{
|
||||||
return _socket;
|
return _port_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) portNumber
|
- (int) portNumber
|
||||||
|
|
|
@ -38,7 +38,8 @@ DYNAMIC_BUNDLER_LINKER=@DYNAMIC_BUNDLER_LINKER@
|
||||||
DYNAMIC_LDFLAGS=@DYNAMIC_LDFLAGS@
|
DYNAMIC_LDFLAGS=@DYNAMIC_LDFLAGS@
|
||||||
DYNAMIC_CFLAGS=@DYNAMIC_CFLAGS@
|
DYNAMIC_CFLAGS=@DYNAMIC_CFLAGS@
|
||||||
DEFS = @DEFS@
|
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 =
|
EXEEXT =
|
||||||
OEXT = .o
|
OEXT = .o
|
||||||
|
@ -99,7 +100,8 @@ release.m \
|
||||||
nsscanner.m \
|
nsscanner.m \
|
||||||
nsdate.m \
|
nsdate.m \
|
||||||
awake.m \
|
awake.m \
|
||||||
thread-except.m
|
thread-except.m \
|
||||||
|
nscharacterset.m
|
||||||
|
|
||||||
tcpport: FORCE
|
tcpport: FORCE
|
||||||
(cd ../src; $(MAKE))
|
(cd ../src; $(MAKE))
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
long lrand48();
|
long lrand48();
|
||||||
#define random lrand48
|
#define random lrand48
|
||||||
#else
|
#else
|
||||||
#if WIN32
|
#if _WIN32 || __WIN32__
|
||||||
#define random rand
|
#define random rand
|
||||||
#else
|
#else
|
||||||
long random();
|
long random();
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#include <Foundation/NSObject.h>
|
#include <Foundation/NSObject.h>
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
|
#ifndef _WIN32
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
@interface ReleaseTester : NSObject
|
@interface ReleaseTester : NSObject
|
||||||
{
|
{
|
||||||
|
|
29
configure.in
29
configure.in
|
@ -29,6 +29,11 @@ AC_INIT(src/Collection.m)
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_CONFIG_HEADER(src/include/config.h)
|
AC_CONFIG_HEADER(src/include/config.h)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Determine the host, build, and target systems
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
AC_CANONICAL_SYSTEM
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Find the compiler
|
# Find the compiler
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
@ -297,6 +302,30 @@ else
|
||||||
fi
|
fi
|
||||||
AC_SUBST(CFLAGS_SHAREDLIB)
|
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
|
# Write the Makefiles
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue