diff --git a/ChangeLog b/ChangeLog index c6d0dbd60..5cad54edc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ Sat May 3 12:28:48 1997 Andrew McCallum + * src/Makefile.in (GNUSTEP_HEADERS): Added include/NSHost.h. + (GNUSTEP_MFILES): Added NSHost.m. + + * src/NSCharacterSet.m ([NSCharacterSet +_bitmapForSet:number:]): + Use NSBundle's pathForResource:ofType:inDirectory method properly. + (Reported by Stevo Crvenkovski .) + +Tue Jan 21 17:09:09 CST 1997 Jeremy Bettis + + * src/NSGCString.m: Add -appendString:. + + * src/include/NSString.h: Add +string. + + * src/NSString.m: (handle_printf_atsign) Take the description of + the object before the cStringNoCopy. + ([NSString +allocWithZone:],[NSMutableString +allocWithZone:]) + Only return the concrete class if [self class] == NSString to + allow subclassing. + Tue Mar 4 10:51:22 1997 Andrew McCallum * src/NSConnection.m: New file. diff --git a/Headers/gnustep/base/NSString.h b/Headers/gnustep/base/NSString.h index 939284aed..a05ca1872 100644 --- a/Headers/gnustep/base/NSString.h +++ b/Headers/gnustep/base/NSString.h @@ -61,6 +61,7 @@ typedef enum _NSStringEncoding @protocol NSString // Creating Temporary Strings ++ (NSString*) string; + (NSString*) stringWithCharacters: (const unichar*)chars length: (unsigned int)length; + (NSString*) stringWithCString: (const char*)byteString diff --git a/Source/NSGCString.m b/Source/NSGCString.m index bb73d2af3..429693be8 100644 --- a/Source/NSGCString.m +++ b/Source/NSGCString.m @@ -222,6 +222,19 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self, _contents_chars[_count] = '\0'; } +- (void) appendString: (NSString*)aString +{ + unsigned c = [aString cStringLength]; + if (_count + c >= _capacity) + { + _capacity = MAX(_capacity*2, _count+c); + OBJC_REALLOC(_contents_chars, char, _capacity); + } + memcpy(_contents_chars + _count, [aString cStringNoCopy], c); + _count += c; + _contents_chars[_count] = '\0'; +} + /* xxx This method may be removed in future. */ - (void) setCString: (const char *)byteString length: (unsigned)length { diff --git a/Source/NSString.m b/Source/NSString.m index 7020bb0b8..e6a616b41 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -156,7 +156,7 @@ handle_printf_atsign (FILE *stream, #endif len = fprintf(stream, "%*s", (info->left ? - info->width : info->width), - [string_object cStringNoCopy]); + [[string_object description] cStringNoCopy]); return len; } #endif /* HAVE_REGISTER_PRINTF_FUNCTION */ @@ -186,7 +186,9 @@ handle_printf_atsign (FILE *stream, + allocWithZone: (NSZone*)z { - return NSAllocateObject ([self _concreteClass], 0, z); + if ([self class] == [NSString class]) + return NSAllocateObject ([self _concreteClass], 0, z); + return [super allocWithZone:z]; } // Creating Temporary Strings @@ -197,6 +199,11 @@ handle_printf_atsign (FILE *stream, return self; } ++ (NSString*) string +{ + return [[[self alloc] init] autorelease]; +} + + (NSString*) stringWithCString: (const char*) byteString { return [[[self alloc] initWithCString:byteString] @@ -1419,7 +1426,9 @@ handle_printf_atsign (FILE *stream, + allocWithZone: (NSZone*)z { - return NSAllocateObject([self _mutableConcreteClass], 0, z); + if ([self class] == [NSMutableString class]) + return NSAllocateObject([self _mutableConcreteClass], 0, z); + return [super allocWithZone:z]; } /* xxx This method may be removed in future. */