Documentation and port name server fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17291 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-07-22 08:52:37 +00:00
parent 6efeed0154
commit 1ba4b76c03
12 changed files with 230 additions and 169 deletions

View file

@ -4,6 +4,18 @@
* Source/NSUser.m: Use HOMEPATH in preference to USERPROFILE for * Source/NSUser.m: Use HOMEPATH in preference to USERPROFILE for
OPENSTEP compatibility and because USERPROFILE generally doesn't OPENSTEP compatibility and because USERPROFILE generally doesn't
work due to the presence of spaces. work due to the presence of spaces.
* Headers/gnustep/base/NSDebug.h: Minor documentation fix.
* Headers/gnustep/base/NSHashTable.h: ditto
* Headers/gnustep/base/NSPort.h: ditto
* Headers/gnustep/base/NSPortNameServer.h: ditto
* Source/DocMakefile: Document serialization classes
* Source/NSDebug.m: Fix broken cross reference
* Source/NSLog.m: ditto
* Source/NSMessagePortNameServer.m: Tidied
* Source/NSPortNameServer.m: Tidied and documented.
* Source/NSSocketPortNameServer.m: Documented and fixed methods
to return NO on failure rather than raising exception.
* Source/NSUndoManager.m: Fix documentation markup errors.
2003-07-21 Richard Frith-Macdonald <rfm@gnu.org> 2003-07-21 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -125,7 +125,7 @@ GS_EXPORT void GSDebugAllocationActiveRecordingObjects(Class c);
/** /**
* Returns an array containing all the allocated objects * Returns an array containing all the allocated objects
* of a certain class which have been recorded. * of a certain class which have been recorded.
* Presumably, you will immediately call -description on * Presumably, you will immediately call [NSObject-description] on
* them to find out the objects you are leaking. * them to find out the objects you are leaking.
* Warning - the objects are put in an array, so until * Warning - the objects are put in an array, so until
* the array is autoreleased, the objects are not released. * the array is autoreleased, the objects are not released.

View file

@ -50,22 +50,22 @@ typedef struct { void *map; void *node; size_t bucket; } NSHashEnumerator;
/** Callback functions. <br />*/ /** Callback functions. <br />*/
typedef struct _NSHashTableCallBacks typedef struct _NSHashTableCallBacks
{ {
/** hash() ... Hashing function. NOTE: Elements with equal values must have /** hash ... Hashing function. NOTE: Elements with equal values must have
* equal hash function values. <br />*/ * equal hash function values. <br />*/
unsigned int (*hash)(NSHashTable *, const void *); unsigned int (*hash)(NSHashTable *, const void *);
/** isEqual() ... Comparison function. <br />*/ /** isEqual ... Comparison function. <br />*/
BOOL (*isEqual)(NSHashTable *, const void *, const void *); BOOL (*isEqual)(NSHashTable *, const void *, const void *);
/** retain() ... Retaining function called when adding elements /** retain ... Retaining function called when adding elements
* to the table. <br />*/ * to the table. <br />*/
void (*retain)(NSHashTable *, const void *); void (*retain)(NSHashTable *, const void *);
/** release() ... Releasing function called when a data element is /** release ... Releasing function called when a data element is
* removed from the table. <br />*/ * removed from the table. <br />*/
void (*release)(NSHashTable *, void *); void (*release)(NSHashTable *, void *);
/** describe() ... Description function. <br />*/ /** describe ... Description function. <br />*/
NSString *(*describe)(NSHashTable *, const void *); NSString *(*describe)(NSHashTable *, const void *);
} NSHashTableCallBacks; } NSHashTableCallBacks;

View file

@ -22,6 +22,7 @@
AutogsdocSource: NSPort.m AutogsdocSource: NSPort.m
AutogsdocSource: NSSocketPort.m AutogsdocSource: NSSocketPort.m
AutogsdocSource: NSMessagePort.m
*/ */
#ifndef __NSPort_h_GNUSTEP_BASE_INCLUDE #ifndef __NSPort_h_GNUSTEP_BASE_INCLUDE
@ -115,9 +116,9 @@ typedef SOCKET NSSocketNativeHandle;
} }
+ (NSSocketPort*) existingPortWithNumber: (gsu16)number + (NSSocketPort*) existingPortWithNumber: (gsu16)number
onHost: (NSHost*)host; onHost: (NSHost*)aHost;
+ (NSSocketPort*) portWithNumber: (gsu16)number + (NSSocketPort*) portWithNumber: (gsu16)number
onHost: (NSHost*)host onHost: (NSHost*)aHost
forceAddress: (NSString*)addr forceAddress: (NSString*)addr
listener: (BOOL)shouldListen; listener: (BOOL)shouldListen;
@ -129,7 +130,7 @@ typedef SOCKET NSSocketNativeHandle;
- (void) handlePortMessage: (NSPortMessage*)m; - (void) handlePortMessage: (NSPortMessage*)m;
- (NSHost*) host; - (NSHost*) host;
- (gsu16) portNumber; - (gsu16) portNumber;
- (void) removeHandle: (GSTcpHandle*)h; - (void) removeHandle: (GSTcpHandle*)handle;
/* /*
{ {
@ -178,7 +179,7 @@ typedef SOCKET NSSocketNativeHandle;
- (int) _listener; - (int) _listener;
- (const unsigned char *) _name; - (const unsigned char *) _name;
+ (NSMessagePort*) _portWithName: (const unsigned char *)name + (NSMessagePort*) _portWithName: (const unsigned char *)socketName
listener: (BOOL)shouldListen; listener: (BOOL)shouldListen;
- (void) addHandle: (GSMessageHandle*)handle forSend: (BOOL)send; - (void) addHandle: (GSMessageHandle*)handle forSend: (BOOL)send;

View file

@ -1,5 +1,5 @@
/* Interface of NSPortNameServer class for Distributed Objects /** Interface of NSPortNameServer class for Distributed Objects
Copyright (C) 1998,1999 Free Software Foundation, Inc. Copyright (C) 1998,1999,2003 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Created: October 1998 Created: October 1998
@ -19,6 +19,11 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
AutogsdocSource: NSPortNameServer.m
AutogsdocSource: NSSocketPortNameServer.m
AutogsdocSource: NSMessagePortNameServer.m
*/ */
#ifndef __NSPortNameServer_h_GNUSTEP_BASE_INCLUDE #ifndef __NSPortNameServer_h_GNUSTEP_BASE_INCLUDE
@ -58,6 +63,13 @@
NSMapTable *_nameMap; /* Registered names information. */ NSMapTable *_nameMap; /* Registered names information. */
} }
+ (id) sharedInstance; + (id) sharedInstance;
+ (id) systemDefaultPortNameServer;
- (NSPort*) portForName: (NSString*)name;
- (NSPort*) portForName: (NSString*)name
onHost: (NSString*)host;
- (BOOL) registerPort: (NSPort*)port
forName: (NSString*)name;
- (BOOL) removePortForName: (NSString*)name;
@end @end

View file

@ -85,6 +85,7 @@ NSProxy.h \
NSRange.h \ NSRange.h \
NSRunLoop.h \ NSRunLoop.h \
NSScanner.h \ NSScanner.h \
NSSerialization.h \
NSSet.h \ NSSet.h \
NSString.h \ NSString.h \
NSTask.h \ NSTask.h \

View file

@ -644,7 +644,7 @@ GSDebugAllocationRemove(Class c, id o)
* containing all the allocated objects of a certain class * containing all the allocated objects of a certain class
* which have been recorded ... to start the recording, you need * which have been recorded ... to start the recording, you need
* to invoke GSDebugAllocationActiveRecordingObjects(). * to invoke GSDebugAllocationActiveRecordingObjects().
* Presumably, you will immediately call -description on them * Presumably, you will immediately call [NSObject-description] on them
* to find out the objects you are leaking. The objects are * to find out the objects you are leaking. The objects are
* returned in an array, so until the array is autoreleased, * returned in an array, so until the array is autoreleased,
* the objects are not released. * the objects are not released.

View file

@ -215,8 +215,8 @@ NSLog (NSString* format, ...)
* perform actual output. Locking is performed around the call to * perform actual output. Locking is performed around the call to
* the function actually writing the message out, to ensure that * the function actually writing the message out, to ensure that
* logging is thread-safe. However, the actual creation of the * logging is thread-safe. However, the actual creation of the
* message written is only as safe as the -description methods of * message written is only as safe as the [NSObject-description] methods
* the arguments you supply. * of the arguments you supply.
* </p> * </p>
* <p> * <p>
* The function to write the data is pointed to by * The function to write the data is pointed to by

View file

@ -74,16 +74,12 @@ static void clean_up_names(void)
{ {
if (defaultServer == nil) if (defaultServer == nil)
{ {
NSMessagePortNameServer *s;
[serverLock lock]; [serverLock lock];
if (defaultServer) if (defaultServer == nil)
{ {
[serverLock unlock]; defaultServer = (NSMessagePortNameServer *)NSAllocateObject(self,
return defaultServer; 0, NSDefaultMallocZone());
} }
s = (NSMessagePortNameServer *)NSAllocateObject(self, 0, NSDefaultMallocZone());
defaultServer = s;
[serverLock unlock]; [serverLock unlock];
} }
return defaultServer; return defaultServer;
@ -92,8 +88,8 @@ static void clean_up_names(void)
+ (NSString *) _pathForName: (NSString *)name + (NSString *) _pathForName: (NSString *)name
{ {
NSString *path;
static NSString *base_path = nil; static NSString *base_path = nil;
NSString *path;
[serverLock lock]; [serverLock lock];
if (!base_path) if (!base_path)
@ -156,7 +152,7 @@ static NSString *base_path = nil;
NSDebugLLog(@"NSMessagePort", @"not live, no such process (%m)"); NSDebugLLog(@"NSMessagePort", @"not live, no such process (%m)");
return NO; return NO;
} }
else
{ {
struct sockaddr_un sockAddr; struct sockaddr_un sockAddr;
int desc; int desc;
@ -169,7 +165,8 @@ static NSString *base_path = nil;
{ {
unlink([path fileSystemRepresentation]); unlink([path fileSystemRepresentation]);
unlink(socket_path); unlink(socket_path);
NSDebugLLog(@"NSMessagePort", @"couldn't create socket, assuming not live (%m)"); NSDebugLLog(@"NSMessagePort",
@"couldn't create socket, assuming not live (%m)");
return NO; return NO;
} }
if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0) if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0)
@ -180,12 +177,10 @@ static NSString *base_path = nil;
return NO; return NO;
} }
close(desc); close(desc);
}
NSDebugLLog(@"NSMessagePort", @"port is live"); NSDebugLLog(@"NSMessagePort", @"port is live");
return YES; return YES;
} }
}
- (NSPort*) portForName: (NSString *)name - (NSPort*) portForName: (NSString *)name
@ -203,8 +198,8 @@ static NSString *base_path = nil;
return nil; return nil;
} }
path = [isa _pathForName: name]; path = [[self class] _pathForName: name];
if (![isa _livePort: path]) if (![[self class] _livePort: path])
{ {
NSDebugLLog(@"NSMessagePort", @"not a live port"); NSDebugLLog(@"NSMessagePort", @"not a live port");
return nil; return nil;
@ -234,18 +229,20 @@ static NSString *base_path = nil;
unsigned char buf[32]; unsigned char buf[32];
NSString *path; NSString *path;
const unsigned char *socket_name; const unsigned char *socket_name;
NSMutableArray *a;
NSDebugLLog(@"NSMessagePort", @"register %@ as %@\n", port, name); NSDebugLLog(@"NSMessagePort", @"register %@ as %@\n", port, name);
if (![port isKindOfClass: [NSMessagePort class]]) if ([port isKindOfClass: [NSMessagePort class]] == NO)
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Attempted to register a non-NSMessagePort with NSMessagePortNameServer"]; format: @"Attempted to register a non-NSMessagePort (%@)",
port];
return NO; return NO;
} }
path=[isa _pathForName: name]; path = [[self class] _pathForName: name];
if ([isa _livePort: path]) if ([[self class] _livePort: path])
{ {
NSDebugLLog(@"NSMessagePort", @"fail, is a live port"); NSDebugLLog(@"NSMessagePort", @"fail, is a live port");
return NO; return NO;
@ -267,9 +264,6 @@ static NSString *base_path = nil;
close(fd); close(fd);
{
NSMutableArray *a;
[serverLock lock]; [serverLock lock];
a = NSMapGet(portToNamesMap, port); a = NSMapGet(portToNamesMap, port);
if (!a) if (!a)
@ -281,7 +275,6 @@ static NSString *base_path = nil;
[a addObject: [name copy]]; [a addObject: [name copy]];
[serverLock unlock]; [serverLock unlock];
}
return YES; return YES;
} }
@ -291,7 +284,7 @@ static NSString *base_path = nil;
NSString *path; NSString *path;
NSDebugLLog(@"NSMessagePort", @"removePortForName: %@", name); NSDebugLLog(@"NSMessagePort", @"removePortForName: %@", name);
path=[isa _pathForName: name]; path = [[self class] _pathForName: name];
unlink([path fileSystemRepresentation]); unlink([path fileSystemRepresentation]);
return YES; return YES;
} }
@ -299,6 +292,7 @@ static NSString *base_path = nil;
- (NSArray *) namesForPort: (NSPort *)port - (NSArray *) namesForPort: (NSPort *)port
{ {
NSMutableArray *a; NSMutableArray *a;
[serverLock lock]; [serverLock lock];
a = NSMapGet(portToNamesMap, port); a = NSMapGet(portToNamesMap, port);
a = [a copy]; a = [a copy];
@ -336,7 +330,7 @@ static NSString *base_path = nil;
NSDebugLLog(@"NSMessagePort", @"removePort: %@ forName: %@", port, name); NSDebugLLog(@"NSMessagePort", @"removePort: %@ forName: %@", port, name);
path = [isa _pathForName: name]; path = [[self class] _pathForName: name];
f = fopen([path fileSystemRepresentation], "rt"); f = fopen([path fileSystemRepresentation], "rt");
if (!f) if (!f)

View file

@ -26,41 +26,16 @@
#include "config.h" #include "config.h"
#include "Foundation/NSString.h" #include "Foundation/NSString.h"
#include "Foundation/NSByteOrder.h"
#include "Foundation/NSException.h" #include "Foundation/NSException.h"
#include "Foundation/NSAutoreleasePool.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSFileHandle.h"
#include "Foundation/NSRunLoop.h"
#include "Foundation/NSNotificationQueue.h"
#include "Foundation/NSPort.h"
#include "Foundation/NSMapTable.h"
#include "Foundation/NSSet.h"
#include "Foundation/NSHost.h"
#include "Foundation/NSTask.h"
#include "Foundation/NSDate.h"
#include "Foundation/NSTimer.h"
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSPortNameServer.h" #include "Foundation/NSPortNameServer.h"
#include "Foundation/NSDebug.h" #include "Foundation/NSDebug.h"
#ifdef __MINGW__
#include <winsock2.h>
#include <wininet.h>
#else
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
/*
* Protocol definition stuff for talking to gdomap process.
*/
#include "../Tools/gdomap.h"
#define stringify_it(X) #X
#define make_gdomap_port(X) stringify_it(X)
/**
* The abstract port name server class. This defines an API for
* working with port name servers ... objects used to manage access
* to ports in the distributed objects system (see [NSConnection]).
*/
@implementation NSPortNameServer @implementation NSPortNameServer
+ (id) allocWithZone: (NSZone*)aZone + (id) allocWithZone: (NSZone*)aZone
@ -77,6 +52,14 @@
} }
} }
/**
* Returns the default port name server for the process.<br />
* The MacOS-X documentation says that this is a nameserver
* dealing with NSMessagePort objects, but that is incompatible
* with OpenStep/OPENSTEP/NeXTstep behavior, so GNUstep returns
* a name server which deals with NSSocketPort objects capable
* of being used for inter-host communications.
*/
+ (id) systemDefaultPortNameServer + (id) systemDefaultPortNameServer
{ {
return [NSSocketPortNameServer sharedInstance]; return [NSSocketPortNameServer sharedInstance];
@ -89,11 +72,29 @@
format: @"attempt to deallocate default port name server"]; format: @"attempt to deallocate default port name server"];
} }
/**
* Looks up the port with the specified name on the local host and
* returns it or nil if no port is found with that name.<br />
* Different nameservers have different namespaces appropriate to the
* type of port they deal with, so failing to find a named port with one
* nameserver does not guarantee that a port does with that name does
* not exist.<br />
* This is a convenience method calling -portForName:onHost: with a nil
* host argument.
*/
- (NSPort*) portForName: (NSString*)name - (NSPort*) portForName: (NSString*)name
{ {
return [self portForName: name onHost: nil]; return [self portForName: name onHost: nil];
} }
/** <override-subclass />
* Looks up the port with the specified name on host and returns it
* or nil if no port is found with that name.<br />
* Different nameservers have different namespaces appropriate to the
* type of port they deal with, so failing to find a named port with one
* nameserver does not guarantee that a port does with that name does
* not exist.
*/
- (NSPort*) portForName: (NSString*)name - (NSPort*) portForName: (NSString*)name
onHost: (NSString*)host onHost: (NSString*)host
{ {
@ -101,6 +102,15 @@
return nil; return nil;
} }
/** <override-subclass />
* Registers port with the supplied name, so that other processes can
* look it up to contact it. A port may be registered with more than
* one name by making multiple calls to this method.<br />
* Returns YES on success, NO otherwise.<br />
* The common cause for failure is that another port is already registered
* with the name.
* Raises NSInvalidArgumentException if given bad arguments.
*/
- (BOOL) registerPort: (NSPort*)port - (BOOL) registerPort: (NSPort*)port
forName: (NSString*)name forName: (NSString*)name
{ {
@ -108,6 +118,13 @@
return NO; return NO;
} }
/** <override-subclass />
* Removes any port registration for the supplied name (whether
* registered in the current process or another).<br />
* The common cause for failure is that no port is registered
* with the name.<br />
* Raises NSInvalidArgumentException if given bad arguments.
*/
- (BOOL) removePortForName: (NSString*)name - (BOOL) removePortForName: (NSString*)name
{ {
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
@ -119,7 +136,8 @@
* Some extensions to make cleaning up port names easier. * Some extensions to make cleaning up port names easier.
*/ */
@implementation NSPortNameServer (GNUstep) @implementation NSPortNameServer (GNUstep)
/** Return all names for port /** <override-subclass />
* Return all names that have been registered with the receiver for port.
*/ */
- (NSArray*) namesForPort: (NSPort*)port - (NSArray*) namesForPort: (NSPort*)port
{ {
@ -128,8 +146,8 @@
} }
/** /**
* Remove all names for port. Probably inefficient ... subclasses * Remove all names registered with the receiver for port.
* should override this. * Probably inefficient ... subclasses might want to override this.
*/ */
- (BOOL) removePort: (NSPort*)port - (BOOL) removePort: (NSPort*)port
{ {
@ -147,8 +165,9 @@
return removed; return removed;
} }
/** /** <override-subclass />
* Remove the name if and only if it is registered by the given port. * Remove the name if and only if it is registered with the receiver
* for the given port.
*/ */
- (BOOL) removePort: (NSPort*)port forName: (NSString*)name - (BOOL) removePort: (NSPort*)port forName: (NSString*)name
{ {

View file

@ -171,7 +171,8 @@ typedef enum {
e = [userInfo objectForKey: GSFileHandleNotificationError]; e = [userInfo objectForKey: GSFileHandleNotificationError];
if (e != nil) if (e != nil)
{ {
NSDebugMLLog(@"NSSocketPortNameServer", @"failed connect to gdomap on %@ - %@", NSDebugMLLog(@"NSSocketPortNameServer",
@"failed connect to gdomap on %@ - %@",
[[notification object] socketAddress], e); [[notification object] socketAddress], e);
/* /*
* Remove our file handle, then either retry or fail. * Remove our file handle, then either retry or fail.
@ -527,6 +528,12 @@ typedef enum {
/**
* This is the nameserver handling ports used for distributed objects
* communications (see [NSConnection]) between hosts.<br />
* Use the +sharedInstance method to get a nameserver, rather than
* allocating and initialising one.
*/
@implementation NSSocketPortNameServer @implementation NSSocketPortNameServer
+ (id) allocWithZone: (NSZone*)aZone + (id) allocWithZone: (NSZone*)aZone
@ -550,6 +557,9 @@ typedef enum {
} }
} }
/**
* Returns the shared name server object for the process.
*/
+ (id) sharedInstance + (id) sharedInstance
{ {
if (defaultServer == nil) if (defaultServer == nil)
@ -562,7 +572,8 @@ typedef enum {
[serverLock unlock]; [serverLock unlock];
return defaultServer; return defaultServer;
} }
s = (NSSocketPortNameServer*)NSAllocateObject(self, 0, NSDefaultMallocZone()); s = (NSSocketPortNameServer*)NSAllocateObject(self, 0,
NSDefaultMallocZone());
s->_portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, s->_portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
NSObjectMapValueCallBacks, 0); NSObjectMapValueCallBacks, 0);
s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks, s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
@ -674,11 +685,12 @@ typedef enum {
NS_HANDLER NS_HANDLER
{ {
/* /*
* If we had a problem - unlock before continueing. * If we had a problem - unlock before continuing.
*/ */
RELEASE(com); RELEASE(com);
[serverLock unlock]; [serverLock unlock];
[localException raise]; NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException);
return NO;
} }
NS_ENDHANDLER NS_ENDHANDLER
[serverLock unlock]; [serverLock unlock];
@ -778,10 +790,11 @@ typedef enum {
NS_HANDLER NS_HANDLER
{ {
/* /*
* If we had a problem - unlock before continueing. * If we had a problem - unlock before continuing.
*/ */
[serverLock unlock]; [serverLock unlock];
[localException raise]; NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException);
return NO;
} }
NS_ENDHANDLER NS_ENDHANDLER
[serverLock unlock]; [serverLock unlock];
@ -848,6 +861,11 @@ typedef enum {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"attempt to register nil port"]; format: @"attempt to register nil port"];
} }
if ([port isKindOfClass: [NSSocketPort class]] == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to register non-NSSocketPort (%@)", port];
}
len = [name cStringLength]; len = [name cStringLength];
if (len == 0) if (len == 0)
{ {
@ -890,7 +908,8 @@ typedef enum {
if ([known count] == 0) if ([known count] == 0)
{ {
com = [GSPortCom new]; com = [GSPortCom new];
[com startPortUnregistration: [(NSSocketPort *)port portNumber] withName: nil]; [com startPortUnregistration: [(NSSocketPort*)port portNumber]
withName: nil];
while ([limit timeIntervalSinceNow] > 0 && [com isActive] == YES) while ([limit timeIntervalSinceNow] > 0 && [com isActive] == YES)
{ {
[loop runMode: mode [loop runMode: mode
@ -906,7 +925,8 @@ typedef enum {
} }
com = [GSPortCom new]; com = [GSPortCom new];
[com startPortRegistration: [(NSSocketPort *)port portNumber] withName: name]; [com startPortRegistration: [(NSSocketPort*)port portNumber]
withName: name];
while ([limit timeIntervalSinceNow] > 0 && [com isActive] == YES) while ([limit timeIntervalSinceNow] > 0 && [com isActive] == YES)
{ {
[loop runMode: mode beforeDate: limit]; [loop runMode: mode beforeDate: limit];
@ -987,11 +1007,12 @@ typedef enum {
NS_HANDLER NS_HANDLER
{ {
/* /*
* If we had a problem - close and unlock before continueing. * If we had a problem - close and unlock before continuing.
*/ */
DESTROY(com); DESTROY(com);
[serverLock unlock]; [serverLock unlock];
[localException raise]; NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException);
return NO;
} }
NS_ENDHANDLER NS_ENDHANDLER
[serverLock unlock]; [serverLock unlock];
@ -1090,11 +1111,11 @@ typedef enum {
NS_HANDLER NS_HANDLER
{ {
/* /*
* If we had a problem - unlock before continueing. * If we had a problem - unlock before continuing.
*/ */
RELEASE(com); RELEASE(com);
[serverLock unlock]; NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException);
[localException raise]; val = NO;
} }
NS_ENDHANDLER NS_ENDHANDLER
[serverLock unlock]; [serverLock unlock];
@ -1159,7 +1180,8 @@ typedef enum {
NS_HANDLER NS_HANDLER
{ {
[serverLock unlock]; [serverLock unlock];
[localException raise]; NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException);
return NO;
} }
NS_ENDHANDLER NS_ENDHANDLER
[serverLock unlock]; [serverLock unlock];

View file

@ -1,4 +1,4 @@
/** Implementatikon for <NSUndoManager> for GNUStep /** Implementation for NSUndoManager for GNUStep
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk> Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
@ -254,7 +254,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
* Returns whether the receiver has any action groupings * Returns whether the receiver has any action groupings
* on the stack to undo. It does not imply, that the * on the stack to undo. It does not imply, that the
* receiver is currently in a state to service an undo * receiver is currently in a state to service an undo
* request. Make sure [-endEndGrouping] is invoked before * request. Make sure [-endUndoGrouping] is invoked before
* requesting either an [-undo] or an [-undoNestedGroup]. * requesting either an [-undo] or an [-undoNestedGroup].
*/ */
- (BOOL) canUndo - (BOOL) canUndo
@ -397,7 +397,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
* NSInternalInconsistencyException. <br /> * NSInternalInconsistencyException. <br />
* Unless this method is invoked as part of a [-undo] or [-undoNestedGroup] * Unless this method is invoked as part of a [-undo] or [-undoNestedGroup]
* processing, the redo stack is cleared.<br /> * processing, the redo stack is cleared.<br />
* If the reciever [-groupsByEvents] and this is the first call to this * If the reciever [-groupsByEvent] and this is the first call to this
* method since the last run loop processing, this method sets up * method since the last run loop processing, this method sets up
* the reciever to process the [-endUndoGrouping] at the * the reciever to process the [-endUndoGrouping] at the
* end of the event loop. * end of the event loop.
@ -576,7 +576,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
* on the redo stack, the top object is poped of the stack and invoked * on the redo stack, the top object is poped of the stack and invoked
* within a nested [-beginUndoGrouping]/[-endUndoGrouping]. During this * within a nested [-beginUndoGrouping]/[-endUndoGrouping]. During this
* pocessing, the operations registered for undo are recorded on the undo * pocessing, the operations registered for undo are recorded on the undo
* stack again.<br\> * stack again.<br />
*/ */
- (void) redo - (void) redo
{ {
@ -637,7 +637,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
/** /**
* Returns the full localized title of the actions to be displayed * Returns the full localized title of the actions to be displayed
* as a menu item. This method first invokes [-redoActionName] and * as a menu item. This method first invokes [-redoActionName] and
* passes it to [-redoMenuTitelForUndoActionName:] and returns the result. * passes it to [-redoMenuTitleForUndoActionName:] and returns the result.
*/ */
- (NSString*) redoMenuItemTitle - (NSString*) redoMenuItemTitle
{ {
@ -647,7 +647,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
/** /**
* Returns the localized title of the actions to be displayed * Returns the localized title of the actions to be displayed
* as a menu item identified by actionName, by appending a * as a menu item identified by actionName, by appending a
* localized command string like @"Redo <localized(actionName)>". * localized command string like @"Redo &lt;localized(actionName)&gt;".
*/ */
- (NSString*) redoMenuTitleForUndoActionName: (NSString*)actionName - (NSString*) redoMenuTitleForUndoActionName: (NSString*)actionName
{ {
@ -688,7 +688,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
* NSInternalInconsistencyException. <br /> * NSInternalInconsistencyException. <br />
* Unless this method is invoked as part of a [-undo] or [-undoNestedGroup] * Unless this method is invoked as part of a [-undo] or [-undoNestedGroup]
* processing, the redo stack is cleared.<br /> * processing, the redo stack is cleared.<br />
* If the reciever [-groupsByEvents] and this is the first call to this * If the reciever [-groupsByEvent] and this is the first call to this
* method since the last run loop processing, this method sets up * method since the last run loop processing, this method sets up
* the reciever to process the [-endUndoGrouping] at the * the reciever to process the [-endUndoGrouping] at the
* end of the event loop. * end of the event loop.
@ -792,7 +792,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
/** /**
* Returns the run loop modes in which the receiver registers * Returns the run loop modes in which the receiver registers
* the [-endUndoGroup] processing when it [-groupsByEvent]. * the [-endUndoGrouping] processing when it [-groupsByEvent].
*/ */
- (NSArray*) runLoopModes - (NSArray*) runLoopModes
{ {
@ -854,7 +854,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
/** /**
* Sets the modes in which the reciever registers the calls * Sets the modes in which the reciever registers the calls
* with the current run loop to invoke * with the current run loop to invoke
* [-endUndoGroup] when it [-groupsByEvents]. This method * [-endUndoGrouping] when it [-groupsByEvent]. This method
* first cancels any pending registrations in the old modes and * first cancels any pending registrations in the old modes and
* registers the invokation in the new modes. * registers the invokation in the new modes.
*/ */
@ -914,7 +914,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
/** /**
* Returns the full localized title of the actions to be displayed * Returns the full localized title of the actions to be displayed
* as a menu item. This method first invokes [-undoActionName] and * as a menu item. This method first invokes [-undoActionName] and
* passes it to [-undoMenuTitelForUndoActionName:] and returns the result. * passes it to [-undoMenuTitleForUndoActionName:] and returns the result.
*/ */
- (NSString*) undoMenuItemTitle - (NSString*) undoMenuItemTitle
{ {
@ -924,7 +924,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
/** /**
* Returns the localized title of the actions to be displayed * Returns the localized title of the actions to be displayed
* as a menu item identified by actionName, by appending a * as a menu item identified by actionName, by appending a
* localized command string like @"Undo <localized(actionName)>". * localized command string like @"Undo &lt;localized(actionName)&gt;".
*/ */
- (NSString*) undoMenuTitleForUndoActionName: (NSString*)actionName - (NSString*) undoMenuTitleForUndoActionName: (NSString*)actionName
{ {
@ -955,7 +955,7 @@ NSString *NSUndoManagerWillUndoChangeNotification =
* on the undo stack, the top object is poped of the stack and invoked * on the undo stack, the top object is poped of the stack and invoked
* within a nested beginUndoGrouping/endUndoGrouping. During this * within a nested beginUndoGrouping/endUndoGrouping. During this
* pocessing, the undo operations registered for undo are recorded on the redo * pocessing, the undo operations registered for undo are recorded on the redo
* stack.<br\> * stack.<br />
*/ */
- (void) undoNestedGroup - (void) undoNestedGroup
{ {