From 1ba4b76c034c2a8a431cabcfc74376788cfdff64 Mon Sep 17 00:00:00 2001 From: CaS Date: Tue, 22 Jul 2003 08:52:37 +0000 Subject: [PATCH] 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 --- ChangeLog | 12 ++ Headers/gnustep/base/NSDebug.h | 2 +- Headers/gnustep/base/NSHashTable.h | 10 +- Headers/gnustep/base/NSPort.h | 9 +- Headers/gnustep/base/NSPortNameServer.h | 16 ++- Source/DocMakefile | 1 + Source/NSDebug.m | 2 +- Source/NSLog.m | 4 +- Source/NSMessagePortNameServer.m | 158 ++++++++++++------------ Source/NSPortNameServer.m | 89 +++++++------ Source/NSSocketPortNameServer.m | 50 +++++--- Source/NSUndoManager.m | 46 +++---- 12 files changed, 230 insertions(+), 169 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2e9af5c4..dd2ed1716 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,18 @@ * Source/NSUser.m: Use HOMEPATH in preference to USERPROFILE for OPENSTEP compatibility and because USERPROFILE generally doesn't 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 diff --git a/Headers/gnustep/base/NSDebug.h b/Headers/gnustep/base/NSDebug.h index 064141720..8779031ac 100644 --- a/Headers/gnustep/base/NSDebug.h +++ b/Headers/gnustep/base/NSDebug.h @@ -125,7 +125,7 @@ GS_EXPORT void GSDebugAllocationActiveRecordingObjects(Class c); /** * Returns an array containing all the allocated objects * 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. * Warning - the objects are put in an array, so until * the array is autoreleased, the objects are not released. diff --git a/Headers/gnustep/base/NSHashTable.h b/Headers/gnustep/base/NSHashTable.h index 8e8928a6c..2a612c0c8 100644 --- a/Headers/gnustep/base/NSHashTable.h +++ b/Headers/gnustep/base/NSHashTable.h @@ -50,22 +50,22 @@ typedef struct { void *map; void *node; size_t bucket; } NSHashEnumerator; /** Callback functions.
*/ 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.
*/ unsigned int (*hash)(NSHashTable *, const void *); - /** isEqual() ... Comparison function.
*/ + /** isEqual ... Comparison function.
*/ BOOL (*isEqual)(NSHashTable *, const void *, const void *); - /** retain() ... Retaining function called when adding elements + /** retain ... Retaining function called when adding elements * to the table.
*/ 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.
*/ void (*release)(NSHashTable *, void *); - /** describe() ... Description function.
*/ + /** describe ... Description function.
*/ NSString *(*describe)(NSHashTable *, const void *); } NSHashTableCallBacks; diff --git a/Headers/gnustep/base/NSPort.h b/Headers/gnustep/base/NSPort.h index 83f90e83f..f8b581938 100644 --- a/Headers/gnustep/base/NSPort.h +++ b/Headers/gnustep/base/NSPort.h @@ -22,6 +22,7 @@ AutogsdocSource: NSPort.m AutogsdocSource: NSSocketPort.m + AutogsdocSource: NSMessagePort.m */ #ifndef __NSPort_h_GNUSTEP_BASE_INCLUDE @@ -115,9 +116,9 @@ typedef SOCKET NSSocketNativeHandle; } + (NSSocketPort*) existingPortWithNumber: (gsu16)number - onHost: (NSHost*)host; + onHost: (NSHost*)aHost; + (NSSocketPort*) portWithNumber: (gsu16)number - onHost: (NSHost*)host + onHost: (NSHost*)aHost forceAddress: (NSString*)addr listener: (BOOL)shouldListen; @@ -129,7 +130,7 @@ typedef SOCKET NSSocketNativeHandle; - (void) handlePortMessage: (NSPortMessage*)m; - (NSHost*) host; - (gsu16) portNumber; -- (void) removeHandle: (GSTcpHandle*)h; +- (void) removeHandle: (GSTcpHandle*)handle; /* { @@ -178,7 +179,7 @@ typedef SOCKET NSSocketNativeHandle; - (int) _listener; - (const unsigned char *) _name; -+ (NSMessagePort*) _portWithName: (const unsigned char *)name ++ (NSMessagePort*) _portWithName: (const unsigned char *)socketName listener: (BOOL)shouldListen; - (void) addHandle: (GSMessageHandle*)handle forSend: (BOOL)send; diff --git a/Headers/gnustep/base/NSPortNameServer.h b/Headers/gnustep/base/NSPortNameServer.h index 81d879290..5ac64f686 100644 --- a/Headers/gnustep/base/NSPortNameServer.h +++ b/Headers/gnustep/base/NSPortNameServer.h @@ -1,5 +1,5 @@ -/* Interface of NSPortNameServer class for Distributed Objects - Copyright (C) 1998,1999 Free Software Foundation, Inc. +/** Interface of NSPortNameServer class for Distributed Objects + Copyright (C) 1998,1999,2003 Free Software Foundation, Inc. Written by: Richard Frith-Macdonald Created: October 1998 @@ -19,6 +19,11 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. + + AutogsdocSource: NSPortNameServer.m + AutogsdocSource: NSSocketPortNameServer.m + AutogsdocSource: NSMessagePortNameServer.m + */ #ifndef __NSPortNameServer_h_GNUSTEP_BASE_INCLUDE @@ -58,6 +63,13 @@ NSMapTable *_nameMap; /* Registered names information. */ } + (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 diff --git a/Source/DocMakefile b/Source/DocMakefile index 43cbb916b..32fdc001a 100644 --- a/Source/DocMakefile +++ b/Source/DocMakefile @@ -85,6 +85,7 @@ NSProxy.h \ NSRange.h \ NSRunLoop.h \ NSScanner.h \ +NSSerialization.h \ NSSet.h \ NSString.h \ NSTask.h \ diff --git a/Source/NSDebug.m b/Source/NSDebug.m index f02c76ef6..40d75417b 100644 --- a/Source/NSDebug.m +++ b/Source/NSDebug.m @@ -644,7 +644,7 @@ GSDebugAllocationRemove(Class c, id o) * containing all the allocated objects of a certain class * which have been recorded ... to start the recording, you need * 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 * returned in an array, so until the array is autoreleased, * the objects are not released. diff --git a/Source/NSLog.m b/Source/NSLog.m index b67aeb4ac..a830c54c6 100644 --- a/Source/NSLog.m +++ b/Source/NSLog.m @@ -215,8 +215,8 @@ NSLog (NSString* format, ...) * perform actual output. Locking is performed around the call to * the function actually writing the message out, to ensure that * logging is thread-safe. However, the actual creation of the - * message written is only as safe as the -description methods of - * the arguments you supply. + * message written is only as safe as the [NSObject-description] methods + * of the arguments you supply. *

*

* The function to write the data is pointed to by diff --git a/Source/NSMessagePortNameServer.m b/Source/NSMessagePortNameServer.m index 8bf4109f0..f4d1f6b64 100644 --- a/Source/NSMessagePortNameServer.m +++ b/Source/NSMessagePortNameServer.m @@ -74,31 +74,27 @@ static void clean_up_names(void) { if (defaultServer == nil) { - NSMessagePortNameServer *s; - [serverLock lock]; - if (defaultServer) + if (defaultServer == nil) { - [serverLock unlock]; - return defaultServer; + defaultServer = (NSMessagePortNameServer *)NSAllocateObject(self, + 0, NSDefaultMallocZone()); } - s = (NSMessagePortNameServer *)NSAllocateObject(self, 0, NSDefaultMallocZone()); - defaultServer = s; [serverLock unlock]; } return defaultServer; } -+(NSString *) _pathForName: (NSString *)name ++ (NSString *) _pathForName: (NSString *)name { - NSString *path; -static NSString *base_path = nil; + static NSString *base_path = nil; + NSString *path; [serverLock lock]; if (!base_path) { - path=NSTemporaryDirectory(); + path = NSTemporaryDirectory(); path = [path stringByAppendingPathComponent: @"NSMessagePort"]; mkdir([path fileSystemRepresentation], 0700); @@ -119,11 +115,11 @@ static NSString *base_path = nil; } -+(BOOL) _livePort: (NSString *)path ++ (BOOL) _livePort: (NSString *)path { - FILE *f; - char socket_path[512]; - int pid; + FILE *f; + char socket_path[512]; + int pid; struct stat sb; NSDebugLLog(@"NSMessagePort", @"_livePort: %@", path); @@ -142,58 +138,57 @@ static NSString *base_path = nil; fclose(f); - if (stat(socket_path,&sb)<0) + if (stat(socket_path, &sb) < 0) { unlink([path fileSystemRepresentation]); NSDebugLLog(@"NSMessagePort", @"not live, couldn't stat socket (%m)"); return NO; } - if (kill(pid,0)<0) + if (kill(pid, 0) < 0) { unlink([path fileSystemRepresentation]); unlink(socket_path); NSDebugLLog(@"NSMessagePort", @"not live, no such process (%m)"); return NO; } + else + { + struct sockaddr_un sockAddr; + int desc; - { - struct sockaddr_un sockAddr; - int desc; + memset(&sockAddr, '\0', sizeof(sockAddr)); + sockAddr.sun_family = AF_LOCAL; + strncpy(sockAddr.sun_path, socket_path, sizeof(sockAddr.sun_path)); - memset(&sockAddr, '\0', sizeof(sockAddr)); - sockAddr.sun_family = AF_LOCAL; - strncpy(sockAddr.sun_path, socket_path, sizeof(sockAddr.sun_path)); - - if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0) - { - unlink([path fileSystemRepresentation]); - unlink(socket_path); - NSDebugLLog(@"NSMessagePort", @"couldn't create socket, assuming not live (%m)"); - return NO; - } - if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0) - { - unlink([path fileSystemRepresentation]); - unlink(socket_path); - NSDebugLLog(@"NSMessagePort", @"not live, can't connect (%m)"); - return NO; - } - close(desc); - } - - - NSDebugLLog(@"NSMessagePort", @"port is live"); - return YES; + if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0) + { + unlink([path fileSystemRepresentation]); + unlink(socket_path); + NSDebugLLog(@"NSMessagePort", + @"couldn't create socket, assuming not live (%m)"); + return NO; + } + if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0) + { + unlink([path fileSystemRepresentation]); + unlink(socket_path); + NSDebugLLog(@"NSMessagePort", @"not live, can't connect (%m)"); + return NO; + } + close(desc); + NSDebugLLog(@"NSMessagePort", @"port is live"); + return YES; + } } -- (NSPort *) portForName: (NSString *)name +- (NSPort*) portForName: (NSString *)name onHost: (NSString *)host { - NSString *path; - FILE *f; - char socket_path[512]; + NSString *path; + FILE *f; + char socket_path[512]; NSDebugLLog(@"NSMessagePort", @"portForName: %@ host: %@", name, host); @@ -203,8 +198,8 @@ static NSString *base_path = nil; return nil; } - path = [isa _pathForName: name]; - if (![isa _livePort: path]) + path = [[self class] _pathForName: name]; + if (![[self class] _livePort: path]) { NSDebugLLog(@"NSMessagePort", @"not a live port"); return nil; @@ -228,24 +223,26 @@ static NSString *base_path = nil; } - (BOOL) registerPort: (NSPort *)port - forName: (NSString *)name + forName: (NSString *)name { - int fd; - unsigned char buf[32]; - NSString *path; - const unsigned char *socket_name; + int fd; + unsigned char buf[32]; + NSString *path; + const unsigned char *socket_name; + NSMutableArray *a; NSDebugLLog(@"NSMessagePort", @"register %@ as %@\n", port, name); - if (![port isKindOfClass: [NSMessagePort class]]) + if ([port isKindOfClass: [NSMessagePort class]] == NO) { [NSException raise: NSInvalidArgumentException - format: @"Attempted to register a non-NSMessagePort with NSMessagePortNameServer"]; + format: @"Attempted to register a non-NSMessagePort (%@)", + port]; 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"); return NO; @@ -267,38 +264,35 @@ static NSString *base_path = nil; close(fd); - { - NSMutableArray *a; + [serverLock lock]; + a = NSMapGet(portToNamesMap, port); + if (!a) + { + a = [[NSMutableArray alloc] init]; + NSMapInsert(portToNamesMap, port, a); + RELEASE(a); + } - [serverLock lock]; - a = NSMapGet(portToNamesMap, port); - if (!a) - { - a = [[NSMutableArray alloc] init]; - NSMapInsert(portToNamesMap, port, a); - RELEASE(a); - } - - [a addObject: [name copy]]; - [serverLock unlock]; - } + [a addObject: [name copy]]; + [serverLock unlock]; return YES; } - (BOOL) removePortForName: (NSString *)name { - NSString *path; + NSString *path; NSDebugLLog(@"NSMessagePort", @"removePortForName: %@", name); - path=[isa _pathForName: name]; + path = [[self class] _pathForName: name]; unlink([path fileSystemRepresentation]); return YES; } - (NSArray *) namesForPort: (NSPort *)port { - NSMutableArray *a; + NSMutableArray *a; + [serverLock lock]; a = NSMapGet(portToNamesMap, port); a = [a copy]; @@ -309,7 +303,7 @@ static NSString *base_path = nil; - (BOOL) removePort: (NSPort *)port { NSMutableArray *a; - int i; + int i; NSDebugLLog(@"NSMessagePort", @"removePort: %@", port); @@ -329,14 +323,14 @@ static NSString *base_path = nil; - (BOOL) removePort: (NSPort*)port forName: (NSString*)name { - FILE *f; - char socket_path[512]; - NSString *path; - const unsigned char *port_path; + FILE *f; + char socket_path[512]; + NSString *path; + const unsigned char *port_path; NSDebugLLog(@"NSMessagePort", @"removePort: %@ forName: %@", port, name); - path = [isa _pathForName: name]; + path = [[self class] _pathForName: name]; f = fopen([path fileSystemRepresentation], "rt"); if (!f) diff --git a/Source/NSPortNameServer.m b/Source/NSPortNameServer.m index 877d0324e..7b3530126 100644 --- a/Source/NSPortNameServer.m +++ b/Source/NSPortNameServer.m @@ -26,41 +26,16 @@ #include "config.h" #include "Foundation/NSString.h" -#include "Foundation/NSByteOrder.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/NSDebug.h" -#ifdef __MINGW__ -#include -#include -#else -#include -#include -#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 + (id) allocWithZone: (NSZone*)aZone @@ -77,6 +52,14 @@ } } +/** + * Returns the default port name server for the process.
+ * 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 { return [NSSocketPortNameServer sharedInstance]; @@ -89,11 +72,29 @@ 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.
+ * 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.
+ * This is a convenience method calling -portForName:onHost: with a nil + * host argument. + */ - (NSPort*) portForName: (NSString*)name { return [self portForName: name onHost: nil]; } +/** + * Looks up the port with the specified name on host and returns it + * or nil if no port is found with that name.
+ * 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 onHost: (NSString*)host { @@ -101,6 +102,15 @@ return nil; } +/** + * 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.
+ * Returns YES on success, NO otherwise.
+ * 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 forName: (NSString*)name { @@ -108,6 +118,13 @@ return NO; } +/** + * Removes any port registration for the supplied name (whether + * registered in the current process or another).
+ * The common cause for failure is that no port is registered + * with the name.
+ * Raises NSInvalidArgumentException if given bad arguments. + */ - (BOOL) removePortForName: (NSString*)name { [self subclassResponsibility: _cmd]; @@ -119,7 +136,8 @@ * Some extensions to make cleaning up port names easier. */ @implementation NSPortNameServer (GNUstep) -/** Return all names for port +/** + * Return all names that have been registered with the receiver for port. */ - (NSArray*) namesForPort: (NSPort*)port { @@ -128,8 +146,8 @@ } /** - * Remove all names for port. Probably inefficient ... subclasses - * should override this. + * Remove all names registered with the receiver for port. + * Probably inefficient ... subclasses might want to override this. */ - (BOOL) removePort: (NSPort*)port { @@ -147,8 +165,9 @@ return removed; } -/** - * 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 { diff --git a/Source/NSSocketPortNameServer.m b/Source/NSSocketPortNameServer.m index 0437a3250..ac80b3e95 100644 --- a/Source/NSSocketPortNameServer.m +++ b/Source/NSSocketPortNameServer.m @@ -171,7 +171,8 @@ typedef enum { e = [userInfo objectForKey: GSFileHandleNotificationError]; if (e != nil) { - NSDebugMLLog(@"NSSocketPortNameServer", @"failed connect to gdomap on %@ - %@", + NSDebugMLLog(@"NSSocketPortNameServer", + @"failed connect to gdomap on %@ - %@", [[notification object] socketAddress], e); /* * 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.
+ * Use the +sharedInstance method to get a nameserver, rather than + * allocating and initialising one. + */ @implementation NSSocketPortNameServer + (id) allocWithZone: (NSZone*)aZone @@ -550,6 +557,9 @@ typedef enum { } } +/** + * Returns the shared name server object for the process. + */ + (id) sharedInstance { if (defaultServer == nil) @@ -562,7 +572,8 @@ typedef enum { [serverLock unlock]; return defaultServer; } - s = (NSSocketPortNameServer*)NSAllocateObject(self, 0, NSDefaultMallocZone()); + s = (NSSocketPortNameServer*)NSAllocateObject(self, 0, + NSDefaultMallocZone()); s->_portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 0); s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks, @@ -674,11 +685,12 @@ typedef enum { NS_HANDLER { /* - * If we had a problem - unlock before continueing. + * If we had a problem - unlock before continuing. */ RELEASE(com); [serverLock unlock]; - [localException raise]; + NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException); + return NO; } NS_ENDHANDLER [serverLock unlock]; @@ -778,10 +790,11 @@ typedef enum { NS_HANDLER { /* - * If we had a problem - unlock before continueing. + * If we had a problem - unlock before continuing. */ [serverLock unlock]; - [localException raise]; + NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException); + return NO; } NS_ENDHANDLER [serverLock unlock]; @@ -848,6 +861,11 @@ typedef enum { [NSException raise: NSInvalidArgumentException 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]; if (len == 0) { @@ -890,7 +908,8 @@ typedef enum { if ([known count] == 0) { com = [GSPortCom new]; - [com startPortUnregistration: [(NSSocketPort *)port portNumber] withName: nil]; + [com startPortUnregistration: [(NSSocketPort*)port portNumber] + withName: nil]; while ([limit timeIntervalSinceNow] > 0 && [com isActive] == YES) { [loop runMode: mode @@ -906,7 +925,8 @@ typedef enum { } com = [GSPortCom new]; - [com startPortRegistration: [(NSSocketPort *)port portNumber] withName: name]; + [com startPortRegistration: [(NSSocketPort*)port portNumber] + withName: name]; while ([limit timeIntervalSinceNow] > 0 && [com isActive] == YES) { [loop runMode: mode beforeDate: limit]; @@ -987,11 +1007,12 @@ typedef enum { NS_HANDLER { /* - * If we had a problem - close and unlock before continueing. + * If we had a problem - close and unlock before continuing. */ DESTROY(com); [serverLock unlock]; - [localException raise]; + NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException); + return NO; } NS_ENDHANDLER [serverLock unlock]; @@ -1090,11 +1111,11 @@ typedef enum { NS_HANDLER { /* - * If we had a problem - unlock before continueing. + * If we had a problem - unlock before continuing. */ RELEASE(com); - [serverLock unlock]; - [localException raise]; + NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException); + val = NO; } NS_ENDHANDLER [serverLock unlock]; @@ -1159,7 +1180,8 @@ typedef enum { NS_HANDLER { [serverLock unlock]; - [localException raise]; + NSDebugMLLog(@"NSSocketPortNameServer", @"%@", localException); + return NO; } NS_ENDHANDLER [serverLock unlock]; diff --git a/Source/NSUndoManager.m b/Source/NSUndoManager.m index c69c32f45..5341659ee 100644 --- a/Source/NSUndoManager.m +++ b/Source/NSUndoManager.m @@ -1,4 +1,4 @@ -/** Implementatikon for for GNUStep +/** Implementation for NSUndoManager for GNUStep Copyright (C) 1998 Free Software Foundation, Inc. Written by: Richard Frith-Macdonald @@ -254,7 +254,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = * Returns whether the receiver has any action groupings * on the stack to undo. It does not imply, that the * 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]. */ - (BOOL) canUndo @@ -380,7 +380,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = * Registers the invocation with the current undo grouping. * This method is part of the NSInvocation-based undo registration * as opposed to the simpler [-registerUndoWithTarget:selector:object:] - * technique.
+ * technique.
* You generally never invoke this method directly. * Instead invoke [-prepareWithInvocationTarget:] with the target of the * undo action and then invoke the targets method to undo the action @@ -388,16 +388,16 @@ NSString *NSUndoManagerWillUndoChangeNotification = * which actually is the undo manager. * The runtime will then fallback to -forwardInvocation: to do the actual * registration of the invocation. - * The invocation will added to the current grouping.
+ * The invocation will added to the current grouping.
* If the registrations have been disabled through [-disableUndoRegistration], - * this method does nothing.
+ * this method does nothing.
* Unless the reciever implicitly * groups operations by event, the this method must have been preceeded * with a [-beginUndoGrouping] message. Otherwise it will raise an - * NSInternalInconsistencyException.
+ * NSInternalInconsistencyException.
* Unless this method is invoked as part of a [-undo] or [-undoNestedGroup] - * processing, the redo stack is cleared.
- * If the reciever [-groupsByEvents] and this is the first call to this + * processing, the redo stack is cleared.
+ * If the reciever [-groupsByEvent] and this is the first call to this * method since the last run loop processing, this method sets up * the reciever to process the [-endUndoGrouping] at the * end of the event loop. @@ -554,7 +554,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = * Prepares the receiver to registers an invocation-based undo operation. * This method is part of the NSInvocation-based undo registration * as opposed to the simpler [-registerUndoWithTarget:selector:object:] - * technique.
+ * technique.
* You invoke this method with the target of the * undo action and then invoke the targets method to undo the action * on the return value of this invocation @@ -576,7 +576,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = * on the redo stack, the top object is poped of the stack and invoked * within a nested [-beginUndoGrouping]/[-endUndoGrouping]. During this * pocessing, the operations registered for undo are recorded on the undo - * stack again. + * stack again.
*/ - (void) redo { @@ -637,7 +637,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = /** * Returns the full localized title of the actions to be displayed * 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 { @@ -647,7 +647,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = /** * Returns the localized title of the actions to be displayed * as a menu item identified by actionName, by appending a - * localized command string like @"Redo ". + * localized command string like @"Redo <localized(actionName)>". */ - (NSString*) redoMenuTitleForUndoActionName: (NSString*)actionName { @@ -674,21 +674,21 @@ NSString *NSUndoManagerWillUndoChangeNotification = * Registers an undo operation. * This method is the simple target-action-based undo registration * as opposed to the sophisticated [-forwardInvocation:] - * mechanism.
+ * mechanism.
* You invoke this method with the target of the * undo action providing the selector which can perform the undo with * the provided object. The object is often a dictionary of the * identifying the attribute and thier values before the change. - * The invocation will added to the current grouping.
+ * The invocation will added to the current grouping.
* If the registrations have been disabled through [-disableUndoRegistration], - * this method does nothing.
+ * this method does nothing.
* Unless the reciever implicitly * groups operations by event, the this method must have been preceeded * with a [-beginUndoGrouping] message. Otherwise it will raise an - * NSInternalInconsistencyException.
+ * NSInternalInconsistencyException.
* Unless this method is invoked as part of a [-undo] or [-undoNestedGroup] - * processing, the redo stack is cleared.
- * If the reciever [-groupsByEvents] and this is the first call to this + * processing, the redo stack is cleared.
+ * If the reciever [-groupsByEvent] and this is the first call to this * method since the last run loop processing, this method sets up * the reciever to process the [-endUndoGrouping] at the * end of the event loop. @@ -792,7 +792,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = /** * Returns the run loop modes in which the receiver registers - * the [-endUndoGroup] processing when it [-groupsByEvent]. + * the [-endUndoGrouping] processing when it [-groupsByEvent]. */ - (NSArray*) runLoopModes { @@ -854,7 +854,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = /** * Sets the modes in which the reciever registers the calls * 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 * registers the invokation in the new modes. */ @@ -914,7 +914,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = /** * Returns the full localized title of the actions to be displayed * 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 { @@ -924,7 +924,7 @@ NSString *NSUndoManagerWillUndoChangeNotification = /** * Returns the localized title of the actions to be displayed * as a menu item identified by actionName, by appending a - * localized command string like @"Undo ". + * localized command string like @"Undo <localized(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 * within a nested beginUndoGrouping/endUndoGrouping. During this * pocessing, the undo operations registered for undo are recorded on the redo - * stack. + * stack.
*/ - (void) undoNestedGroup {