diff --git a/Headers/gnustep/base/NSObjCRuntime.h b/Headers/gnustep/base/NSObjCRuntime.h index 8c607e241..13eb91aa0 100644 --- a/Headers/gnustep/base/NSObjCRuntime.h +++ b/Headers/gnustep/base/NSObjCRuntime.h @@ -42,6 +42,13 @@ extern NSLog_printf_handler *_NSLog_printf_handler; extern void NSLog (NSString* format, ...); extern void NSLogv (NSString* format, va_list args); +/* Debug logging which can be enabled/disabled */ +#ifdef DEBUGLOG +#define NSDebugLog(format, args...) NSLog(format, ## args) +#else +#define NSDebugLog(format, args...) +#endif + #ifndef YES #define YES 1 #endif YES diff --git a/Headers/gnustep/base/NSString.h b/Headers/gnustep/base/NSString.h index a05ca1872..090174782 100644 --- a/Headers/gnustep/base/NSString.h +++ b/Headers/gnustep/base/NSString.h @@ -68,6 +68,7 @@ typedef enum _NSStringEncoding length: (unsigned int)length; + (NSString*) stringWithCString: (const char*) byteString; + (NSString*) stringWithFormat: (NSString*)format,...; ++ (NSString*) stringWithContentsOfFile:(NSString *)path; // Initializing Newly Allocated Strings - (id) initWithCharactersNoCopy: (unichar*)chars diff --git a/Headers/gnustep/base/preface.h.in b/Headers/gnustep/base/preface.h.in index 5ddd13399..7e02ce5c1 100644 --- a/Headers/gnustep/base/preface.h.in +++ b/Headers/gnustep/base/preface.h.in @@ -58,7 +58,7 @@ #endif #include -@class String; +#include /* The following group of lines maintained by the gstep-base src/Makefile */ #define @VERSION@ diff --git a/Source/NSBundle.m b/Source/NSBundle.m index d06c65005..2e8b8e56b 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -112,12 +112,6 @@ static NSString* platform = #else nil; #endif -static NSString* gnustep_libdir = -#ifdef GNUSTEP_INSTALL_LIBDIR - @GNUSTEP_INSTALL_LIBDIR; -#else - nil; -#endif /* Declaration from find_exec.c */ extern char *objc_find_executable(const char *name); @@ -502,17 +496,6 @@ _bundle_load_callback(Class theClass, Category *theCategory) while ((language = [enumerate nextObject])) [array addObject: _bundle_resource_path(primary, bundlePath, language)]; - if (gnustep_libdir) - { - primary = [NSString stringWithCString: [gnustep_libdir cString]]; - [array addObject: _bundle_resource_path(primary, bundlePath, nil)]; - enumerate = [languages objectEnumerator]; - while ((language = [enumerate nextObject])) - [array addObject: - _bundle_resource_path(primary, bundlePath, language)]; - } - - return array; } diff --git a/Source/NSCharacterSet.m b/Source/NSCharacterSet.m index 342998918..4f8762690 100644 --- a/Source/NSCharacterSet.m +++ b/Source/NSCharacterSet.m @@ -28,6 +28,12 @@ #include static NSString* NSCharacterSet_PATH = @"NSCharacterSets"; +static NSString* gnustep_libdir = +#ifdef GNUSTEP_INSTALL_LIBDIR + @GNUSTEP_INSTALL_LIBDIR; +#else + nil; +#endif /* A simple array for caching standard bitmap sets */ #define MAX_STANDARD_SETS 12 @@ -61,6 +67,7 @@ static NSLock* cache_lock = nil; { NSCharacterSet* set; NSString *path; + NSBundle *gstep_base_bundle = [NSBundle bundleWithPath: gnustep_libdir]; if (!cache_lock) cache_lock = [NSLock new]; @@ -70,15 +77,15 @@ static NSLock* cache_lock = nil; if (cache_set[number] == nil) { NS_DURING - path = [NSBundle pathForResource:setname - ofType:@"dat" - inDirectory:NSCharacterSet_PATH]; + path = [gstep_base_bundle pathForResource:setname + ofType:@"dat" + inDirectory:NSCharacterSet_PATH]; /* This is for testing purposes */ if (path == nil || [path length] == 0) { - path = [NSBundle pathForResource:setname - ofType:@"dat" - inDirectory:@"../NSCharacterSets"]; + path = [gstep_base_bundle pathForResource:setname + ofType:@"dat" + inDirectory:@"../NSCharacterSets"]; } if (path == nil || [path length] == 0) diff --git a/Source/NSString.m b/Source/NSString.m index 23a40a2dc..2ae5a2865 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -1230,7 +1230,7 @@ handle_printf_atsign (FILE *stream, NSString *newstring; range = [self rangeOfString:@"/" options:NSBackwardsSearch]; - if (range.length == 0 && range.location != [self length] - 1) + if (range.location != ([self length] - 1)) newstring = [self stringByAppendingString:@"/"]; else newstring = self; @@ -1248,7 +1248,7 @@ handle_printf_atsign (FILE *stream, NSString *newstring; range = [self rangeOfString:@"." options:NSBackwardsSearch]; - if ((range.length == 0) && (range.location != ([self length] - 1))) + if (range.location != ([self length] - 1)) newstring = [self stringByAppendingString:@"."]; else newstring = self;