From f491e64f1bdf3d14af790f59fbaea7801cb07cc0 Mon Sep 17 00:00:00 2001 From: mccallum Date: Tue, 26 Mar 1996 20:59:42 +0000 Subject: [PATCH] Fix typos. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1276 72102866-910b-0410-8b05-ffd578937521 --- .../gnustep/base/IndexedCollectionPrivate.h | 22 +++---- Source/BinaryCStream.m | 3 +- Source/Connection.m | 1 + Source/Decoder.m | 4 +- Source/Encoder.m | 1 + Source/NSAutoreleasePool.m | 5 +- Source/NSObject.m | 60 ++++++++++++------- Source/NSString.m | 4 +- Source/TextCStream.m | 25 +++++--- Source/objects/IndexedCollectionPrivate.h | 22 +++---- 10 files changed, 82 insertions(+), 65 deletions(-) diff --git a/Headers/gnustep/base/IndexedCollectionPrivate.h b/Headers/gnustep/base/IndexedCollectionPrivate.h index 02bf8044a..d3412d26d 100644 --- a/Headers/gnustep/base/IndexedCollectionPrivate.h +++ b/Headers/gnustep/base/IndexedCollectionPrivate.h @@ -1,8 +1,8 @@ /* IndexedCollection definitions for the use of subclass implementations only - Copyright (C) 1993,1994 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. Written by: R. Andrew McCallum - Date: May 1993 + Created: May 1993 This file is part of the GNU Objective C Class Library. @@ -26,22 +26,16 @@ #include #include +#include +#include /* To be used inside a method for making sure that index is not above range. */ #define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \ -({if (INDEX >= OVER) \ - [self error:"in %s, index out of range", sel_get_name(_cmd)];}) - - -/* For use with subclasses of IndexedCollections that allow elements to - be added, but not added at particular indices---the collection itself - determines the order. -*/ -#define INSERTION_ERROR() \ -([self error:"in %s, this collection does not allow insertions", \ - sel_get_name(aSel)];) - +if (INDEX >= OVER) \ + [NSException raise: NSRangeException \ + format: @"in %s, index %d is out of range", \ + sel_get_name (_cmd), INDEX] #endif /* __IndexedCollectionPrivate_h_INCLUDE_GNU */ diff --git a/Source/BinaryCStream.m b/Source/BinaryCStream.m index 8fceb0f5d..54c2fbf8b 100644 --- a/Source/BinaryCStream.m +++ b/Source/BinaryCStream.m @@ -26,6 +26,7 @@ #include #include #include +#include #define DEFAULT_FORMAT_VERSION 0 @@ -276,7 +277,7 @@ static BOOL debug_binary_coder; && !((encoded_type=='c' || encoded_type=='C') && (*type=='c' || *type=='C'))) [NSException raise: NSGenericException - format @"Expected type \"%c\", got type \"%c\"", + format: @"Expected type \"%c\", got type \"%c\"", *type, encoded_type]; switch (encoded_type) diff --git a/Source/Connection.m b/Source/Connection.m index 25b5f0b5a..04636d153 100644 --- a/Source/Connection.m +++ b/Source/Connection.m @@ -45,6 +45,7 @@ #include #include #include +#include #include @interface Connection (GettingCoderInterface) diff --git a/Source/Decoder.m b/Source/Decoder.m index 56b028548..e3663ec59 100644 --- a/Source/Decoder.m +++ b/Source/Decoder.m @@ -578,7 +578,7 @@ [NSException raise: NSGenericException format: @"can't decode forward reference when not decoding " - "a root object"]; + @"a root object"]; [self decodeValueOfCType: @encode(unsigned) at: &fref withName: NULL]; @@ -653,7 +653,7 @@ if (!*anObjPtr) [NSException raise: NSGenericException - format: @ "repeated object cross-reference number %u not found", + format: @"repeated object cross-reference number %u not found", xref]; break; } diff --git a/Source/Encoder.m b/Source/Encoder.m index dade4872a..9ab8c56a2 100644 --- a/Source/Encoder.m +++ b/Source/Encoder.m @@ -28,6 +28,7 @@ #include #include #include +#include static int default_format_version; static id default_stream_class; diff --git a/Source/NSAutoreleasePool.m b/Source/NSAutoreleasePool.m index 869d9ae13..110c6445b 100644 --- a/Source/NSAutoreleasePool.m +++ b/Source/NSAutoreleasePool.m @@ -24,6 +24,7 @@ #include #include #include +#include #include /* Doesn't handle multi-threaded stuff. @@ -102,7 +103,7 @@ static unsigned pool_count_warning_threshhold = UINT_MAX; if (released_count >= pool_count_warning_threshhold) [NSException raise: NSGenericException -format: @"AutoreleasePool count threshhold exceeded."]; + format: @"AutoreleasePool count threshhold exceeded."]; if (released_count == released_size) { @@ -126,7 +127,7 @@ format: @"AutoreleasePool count threshhold exceeded."]; - (id) retain { [NSException raise: NSGenericException -format: @"Don't call `-retain' on a NSAutoreleasePool"]; + format: @"Don't call `-retain' on a NSAutoreleasePool"]; return self; } diff --git a/Source/NSObject.m b/Source/NSObject.m index ee750b994..96ddcc09c 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -31,6 +31,7 @@ #include #include #include +#include #include extern void (*_objc_error)(id object, const char *format, va_list); @@ -304,7 +305,7 @@ BOOL NSDecrementExtraRefCountWasZero (id anObject) [NSException raise: NSGenericException format: @"Autorelease would release object too many times.\n" - "%d release(s) versus %d retain(s)", release_count, retain_count]; + @"%d release(s) versus %d retain(s)", release_count, retain_count]; } [autorelease_class addObject:self]; @@ -355,9 +356,12 @@ BOOL NSDecrementExtraRefCountWasZero (id anObject) { IMP msg = objc_msg_lookup(self, aSelector); if (!msg) - return [NSException - raise: NSGenericException - format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + { + [NSException + raise: NSGenericException + format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + return nil; + } return (*msg)(self, aSelector); } @@ -365,9 +369,12 @@ BOOL NSDecrementExtraRefCountWasZero (id anObject) { IMP msg = objc_msg_lookup(self, aSelector); if (!msg) - return [NSException - raise: NSGenericException - format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + { + [NSException + raise: NSGenericException + format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + return nil; + } return (*msg)(self, aSelector, anObject); } @@ -375,9 +382,12 @@ BOOL NSDecrementExtraRefCountWasZero (id anObject) { IMP msg = objc_msg_lookup(self, aSelector); if (!msg) - return [NSException - raise: NSGenericException - format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + { + [NSException + raise: NSGenericException + format: @"invalid selector passed to %s", sel_get_name(_cmd)]; + return nil; + } return (*msg)(self, aSelector, object1, object2); } @@ -545,16 +555,18 @@ BOOL NSDecrementExtraRefCountWasZero (id anObject) - notImplemented:(SEL)aSel { - return [NSException - raise: NSGenericException - format: @"method %s not implemented", sel_get_name(aSel)]; + [NSException + raise: NSGenericException + format: @"method %s not implemented", sel_get_name(aSel)]; + return nil; } - doesNotRecognize:(SEL)aSel { - return [NSException raise: NSGenericException - format: @"%s does not recognize %s", - object_get_class_name(self), sel_get_name(aSel)]; + [NSException raise: NSGenericException + format: @"%s does not recognize %s", + object_get_class_name(self), sel_get_name(aSel)]; + return nil; } - perform: (SEL)sel with: anObject @@ -651,17 +663,19 @@ BOOL NSDecrementExtraRefCountWasZero (id anObject) - subclassResponsibility:(SEL)aSel { - return [NSException - raise: NSGenericException - format: @"subclass should override %s", sel_get_name(aSel)]; + [NSException + raise: NSGenericException + format: @"subclass should override %s", sel_get_name(aSel)]; + return nil; } - shouldNotImplement:(SEL)aSel { - return [NSException - raise: NSGenericException - format: @"%s should not implement %s", - object_get_class_name(self), sel_get_name(aSel)]; + [NSException + raise: NSGenericException + format: @"%s should not implement %s", + object_get_class_name(self), sel_get_name(aSel)]; + return nil; } + (int)streamVersion: (TypedStream*)aStream diff --git a/Source/NSString.m b/Source/NSString.m index 1e1e22ecc..d08b0b90b 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -966,7 +966,9 @@ handle_printf_atsign (FILE *stream, } @end -@implementation NSString (GNU) +/* We don't actually implement (GNU) Category, in order to avoid warning + about "unimplemented methods"; they come from the behavior. */ +@implementation NSString (GNUCollection) - objectAtIndex: (unsigned)index { diff --git a/Source/TextCStream.m b/Source/TextCStream.m index 94649cf97..925e4bf99 100644 --- a/Source/TextCStream.m +++ b/Source/TextCStream.m @@ -25,6 +25,7 @@ #include #include #include +#include #define DEFAULT_FORMAT_VERSION 0 @@ -147,21 +148,24 @@ static BOOL debug_textcoder = NO; break; } case _C_PTR: - [self error:"Cannot encode pointers"]; + [NSException raise: NSGenericException + format: @"Cannot encode pointers"]; break; #if 0 /* No, don't know how far to recurse */ [self encodeValueOfObjCType:type+1 at:*(char**)d withName:name]; break; #endif default: - [self error:"type %s not implemented", type]; + [NSException raise: NSGenericException + format: @"type %s not implemented", type]; } } #define DECODER_FORMAT(TYPE, CONVERSION) \ @" <%a[^>]> (" ATXSTR(TYPE) @") = %" ATXSTR(CONVERSION) @" \n" -#define DECODE_ERROR(TYPE) [self error:"bad format decoding " XSTR(TYPE)] +#define DECODE_ERROR(TYPE) [NSException raise: NSGenericException \ +format: @"bad format decoding " ATXSTR(TYPE)] #define DECODE_DEBUG(TYPE, CONVERSION) \ if (debug_textcoder) \ @@ -299,7 +303,8 @@ if (debug_textcoder) \ break; } case _C_PTR: - [self error:"Cannot decode pointers"]; + [NSException raise: NSGenericException + format: @"Cannot decode pointers"]; break; #if 0 /* No, don't know how far to recurse */ OBJC_MALLOC(*(void**)d, void*, 1); @@ -307,7 +312,8 @@ if (debug_textcoder) \ break; #endif default: - [self error:"type %s not yet implemented", type]; + [NSException raise: NSGenericException + format: @"type %s not yet implemented", type]; } if (namePtr) *namePtr = [NSString stringWithCStringNoCopy: tmpname]; @@ -339,7 +345,8 @@ if (debug_textcoder) \ lp = [line cStringNoCopy]; while (*lp == ' ') lp++; if (*lp != '{') - [self error:"bad indent format, got \"%s\"", line]; + [NSException raise: NSGenericException + format: @"bad indent format, got \"%s\"", line]; } - (void) decodeUnindent @@ -351,7 +358,8 @@ if (debug_textcoder) \ lp = [line cStringNoCopy]; while (*lp == ' ') lp++; if (*lp != '}') - [self error:"bad unindent format, got \"%s\"", line]; + [NSException raise: NSGenericException + format: @"bad unindent format, got \"%s\"", line]; } - (void) encodeName: (id ) n @@ -368,7 +376,8 @@ if (debug_textcoder) \ if (name) { if ([stream readFormat: @" <%a[^>]> \n", &n] != 1) - [self error:"bad format"]; + [NSException raise: NSGenericException + format: @"bad format"]; *name = [NSString stringWithCStringNoCopy: n freeWhenDone: YES]; if (debug_textcoder) diff --git a/Source/objects/IndexedCollectionPrivate.h b/Source/objects/IndexedCollectionPrivate.h index 02bf8044a..d3412d26d 100644 --- a/Source/objects/IndexedCollectionPrivate.h +++ b/Source/objects/IndexedCollectionPrivate.h @@ -1,8 +1,8 @@ /* IndexedCollection definitions for the use of subclass implementations only - Copyright (C) 1993,1994 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. Written by: R. Andrew McCallum - Date: May 1993 + Created: May 1993 This file is part of the GNU Objective C Class Library. @@ -26,22 +26,16 @@ #include #include +#include +#include /* To be used inside a method for making sure that index is not above range. */ #define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \ -({if (INDEX >= OVER) \ - [self error:"in %s, index out of range", sel_get_name(_cmd)];}) - - -/* For use with subclasses of IndexedCollections that allow elements to - be added, but not added at particular indices---the collection itself - determines the order. -*/ -#define INSERTION_ERROR() \ -([self error:"in %s, this collection does not allow insertions", \ - sel_get_name(aSel)];) - +if (INDEX >= OVER) \ + [NSException raise: NSRangeException \ + format: @"in %s, index %d is out of range", \ + sel_get_name (_cmd), INDEX] #endif /* __IndexedCollectionPrivate_h_INCLUDE_GNU */