mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Support for GCC 3.0
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10085 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
17b2315e80
commit
ac06ffd150
11 changed files with 691 additions and 549 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2001-06-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
Changes for constant string support with gcc-3.0
|
||||||
|
* configure.in: Just substitute NXCONST
|
||||||
|
* Headers/gnustep/base/GSConfig.h.in: Use NXCONST to redefine
|
||||||
|
NXConstantString
|
||||||
|
* Headers/gnustep/base/NSString.h: new constantStringClass method.
|
||||||
|
* Source/GSString.m: new constantStringClass method.
|
||||||
|
* Source/NSObject.m: Use NSConstantStringClass.
|
||||||
|
* Source/NSScanner.m: Use NSConstantStringClass.
|
||||||
|
* Source/NSString.m: implement constantStringClass method.
|
||||||
|
|
||||||
2001-06-06 Nicola Pero <n.pero@mi.flashnet.it>
|
2001-06-06 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
* Source/mframe.m: Reactivated inling nested functions after
|
* Source/mframe.m: Reactivated inling nested functions after
|
||||||
|
|
|
@ -159,5 +159,10 @@ typedef @GS_ADDR@ gsaddr;
|
||||||
#define GS_GC_UNHIDE(obj) ((id)obj)
|
#define GS_GC_UNHIDE(obj) ((id)obj)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define to say if we use NXConstantString or NSConstantString
|
||||||
|
*/
|
||||||
|
#define NXConstantString @NXCONST@
|
||||||
|
|
||||||
#endif /* included_GSConfig_h */
|
#endif /* included_GSConfig_h */
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,7 @@ enum {
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSString : NSObject <NSString>
|
@interface NSString : NSObject <NSString>
|
||||||
|
+ (Class) constantStringClass;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@class NSMutableString;
|
@class NSMutableString;
|
||||||
|
|
|
@ -319,7 +319,7 @@ static SEL objSel;
|
||||||
{
|
{
|
||||||
if (aKey == nil)
|
if (aKey == nil)
|
||||||
{
|
{
|
||||||
NSWarnMLog(@"attempt to remove nil key", 0);
|
NSWarnMLog(@"attempt to remove nil key");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GSIMapRemoveKey(&map, (GSIMapKey)aKey);
|
GSIMapRemoveKey(&map, (GSIMapKey)aKey);
|
||||||
|
|
|
@ -204,7 +204,7 @@ static Class GSUnicodeStringClass = 0;
|
||||||
static Class GSUnicodeSubStringClass = 0;
|
static Class GSUnicodeSubStringClass = 0;
|
||||||
static Class GSUnicodeInlineStringClass = 0;
|
static Class GSUnicodeInlineStringClass = 0;
|
||||||
static Class GSMutableStringClass = 0;
|
static Class GSMutableStringClass = 0;
|
||||||
static Class NXConstantStringClass = 0;
|
static Class NSConstantStringClass = 0;
|
||||||
|
|
||||||
static SEL convertSel;
|
static SEL convertSel;
|
||||||
static BOOL (*convertImp)(id, SEL, NSStringEncoding);
|
static BOOL (*convertImp)(id, SEL, NSStringEncoding);
|
||||||
|
@ -244,7 +244,7 @@ setup()
|
||||||
GSCSubStringClass = [GSCSubString class];
|
GSCSubStringClass = [GSCSubString class];
|
||||||
GSUnicodeSubStringClass = [GSUnicodeSubString class];
|
GSUnicodeSubStringClass = [GSUnicodeSubString class];
|
||||||
GSMutableStringClass = [GSMutableString class];
|
GSMutableStringClass = [GSMutableString class];
|
||||||
NXConstantStringClass = [NXConstantString class];
|
NSConstantStringClass = [NSString constantStringClass];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cache some selectors and method implementations for
|
* Cache some selectors and method implementations for
|
||||||
|
@ -393,12 +393,12 @@ setup()
|
||||||
format: @"-initWithString: given non-string object"];
|
format: @"-initWithString: given non-string object"];
|
||||||
|
|
||||||
length = [string length];
|
length = [string length];
|
||||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES || c == NXConstantStringClass
|
if (GSObjCIsKindOf(c, GSCStringClass) == YES || c == NSConstantStringClass
|
||||||
|| (GSObjCIsKindOf(c, GSMutableStringClass) == YES
|
|| (GSObjCIsKindOf(c, GSMutableStringClass) == YES
|
||||||
&& ((ivars)string)->_flags.wide == 0))
|
&& ((ivars)string)->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* For a GSCString subclass, and NXConstantString, or an 8-bit
|
* For a GSCString subclass, and ??ConstantString, or an 8-bit
|
||||||
* GSMutableString, we can copy the bytes directly into a GSCString.
|
* GSMutableString, we can copy the bytes directly into a GSCString.
|
||||||
*/
|
*/
|
||||||
me = (ivars)NSAllocateObject(GSCInlineStringClass,
|
me = (ivars)NSAllocateObject(GSCInlineStringClass,
|
||||||
|
@ -463,7 +463,7 @@ setup()
|
||||||
* The following inline functions are used by the concrete string classes
|
* The following inline functions are used by the concrete string classes
|
||||||
* to implement their core functionality.
|
* to implement their core functionality.
|
||||||
* GSCString uses the functions with the _c suffix.
|
* GSCString uses the functions with the _c suffix.
|
||||||
* GSCSubString and NXConstant inherit methods from GSCString.
|
* GSCSubString and ??ConstantString inherit methods from GSCString.
|
||||||
* GSUnicodeString uses the functions with the _u suffix.
|
* GSUnicodeString uses the functions with the _u suffix.
|
||||||
* GSUnicodeSubString inherits methods from GSUnicodeString.
|
* GSUnicodeSubString inherits methods from GSUnicodeString.
|
||||||
* GSMutableString uses all the functions, selecting the _c or _u versions
|
* GSMutableString uses all the functions, selecting the _c or _u versions
|
||||||
|
@ -588,7 +588,7 @@ compare_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||||
return strCompCsUs((id)self, aString, mask, aRange);
|
return strCompCsUs((id)self, aString, mask, aRange);
|
||||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||||
return strCompCsCs((id)self, aString, mask, aRange);
|
return strCompCsCs((id)self, aString, mask, aRange);
|
||||||
else
|
else
|
||||||
|
@ -610,7 +610,7 @@ compare_u(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||||
return strCompUsUs((id)self, aString, mask, aRange);
|
return strCompUsUs((id)self, aString, mask, aRange);
|
||||||
else if (GSObjCIsKindOf(c, GSCStringClass)
|
else if (GSObjCIsKindOf(c, GSCStringClass)
|
||||||
|| c == NXConstantStringClass
|
|| c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||||
return strCompUsCs((id)self, aString, mask, aRange);
|
return strCompUsCs((id)self, aString, mask, aRange);
|
||||||
else
|
else
|
||||||
|
@ -1001,7 +1001,7 @@ isEqual_c(ivars self, id anObject)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
c = GSObjCClass(anObject);
|
c = GSObjCClass(anObject);
|
||||||
if (c == NXConstantStringClass)
|
if (c == NSConstantStringClass)
|
||||||
{
|
{
|
||||||
ivars other = (ivars)anObject;
|
ivars other = (ivars)anObject;
|
||||||
NSRange r = {0, self->_count};
|
NSRange r = {0, self->_count};
|
||||||
|
@ -1068,7 +1068,7 @@ isEqual_u(ivars self, id anObject)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
c = GSObjCClass(anObject);
|
c = GSObjCClass(anObject);
|
||||||
if (c == NXConstantStringClass)
|
if (c == NSConstantStringClass)
|
||||||
{
|
{
|
||||||
ivars other = (ivars)anObject;
|
ivars other = (ivars)anObject;
|
||||||
NSRange r = {0, self->_count};
|
NSRange r = {0, self->_count};
|
||||||
|
@ -1292,7 +1292,7 @@ rangeOfString_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||||
return strRangeCsUs((id)self, aString, mask, aRange);
|
return strRangeCsUs((id)self, aString, mask, aRange);
|
||||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||||
return strRangeCsCs((id)self, aString, mask, aRange);
|
return strRangeCsCs((id)self, aString, mask, aRange);
|
||||||
else
|
else
|
||||||
|
@ -1314,7 +1314,7 @@ rangeOfString_u(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||||
return strRangeUsUs((id)self, aString, mask, aRange);
|
return strRangeUsUs((id)self, aString, mask, aRange);
|
||||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||||
return strRangeUsCs((id)self, aString, mask, aRange);
|
return strRangeUsCs((id)self, aString, mask, aRange);
|
||||||
else
|
else
|
||||||
|
@ -1390,7 +1390,7 @@ transmute(ivars self, NSString *aString)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GSObjCIsKindOf(c, GSCStringClass) || c == NXConstantStringClass
|
if (GSObjCIsKindOf(c, GSCStringClass) || c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && other->_flags.wide == 0))
|
|| (c == GSMutableStringClass && other->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -2956,7 +2956,7 @@ transmute(ivars self, NSString *aString)
|
||||||
c = GSObjCClass(anObject);
|
c = GSObjCClass(anObject);
|
||||||
|
|
||||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
ivars other = (ivars)anObject;
|
ivars other = (ivars)anObject;
|
||||||
|
@ -3003,7 +3003,7 @@ transmute(ivars self, NSString *aString)
|
||||||
c = GSObjCClass(anObject);
|
c = GSObjCClass(anObject);
|
||||||
|
|
||||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NSConstantStringClass
|
||||||
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
ivars other = (ivars)anObject;
|
ivars other = (ivars)anObject;
|
||||||
|
|
|
@ -48,7 +48,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
||||||
static Class fastMallocClass;
|
static Class fastMallocClass;
|
||||||
static unsigned fastMallocOffset;
|
static unsigned fastMallocOffset;
|
||||||
|
|
||||||
static Class NXConstantStringClass;
|
static Class NSConstantStringClass;
|
||||||
|
|
||||||
@class NSDataMalloc;
|
@class NSDataMalloc;
|
||||||
@class NSMutableDataMalloc;
|
@class NSMutableDataMalloc;
|
||||||
|
@ -407,7 +407,7 @@ NSDeallocateObject(NSObject *anObject)
|
||||||
inline NSZone *
|
inline NSZone *
|
||||||
GSObjCZone(NSObject *object)
|
GSObjCZone(NSObject *object)
|
||||||
{
|
{
|
||||||
if (GSObjCClass(object) == NXConstantStringClass)
|
if (GSObjCClass(object) == NSConstantStringClass)
|
||||||
return NSDefaultMallocZone();
|
return NSDefaultMallocZone();
|
||||||
return ((obj)object)[-1].zone;
|
return ((obj)object)[-1].zone;
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ GSObjCZone(NSObject *object)
|
||||||
inline NSZone *
|
inline NSZone *
|
||||||
GSObjCZone(NSObject *object)
|
GSObjCZone(NSObject *object)
|
||||||
{
|
{
|
||||||
if (GSObjCClass(object) == NXConstantStringClass)
|
if (GSObjCClass(object) == NSConstantStringClass)
|
||||||
return NSDefaultMallocZone();
|
return NSDefaultMallocZone();
|
||||||
return NSZoneFromPointer(&((obj)object)[-1]);
|
return NSZoneFromPointer(&((obj)object)[-1]);
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ NSDeallocateObject(NSObject *anObject)
|
||||||
inline NSZone *
|
inline NSZone *
|
||||||
GSObjCZone(NSObject *object)
|
GSObjCZone(NSObject *object)
|
||||||
{
|
{
|
||||||
if (GSObjCClass(object) == NXConstantStringClass)
|
if (GSObjCClass(object) == NSConstantStringClass)
|
||||||
return NSDefaultMallocZone();
|
return NSDefaultMallocZone();
|
||||||
return NSZoneFromPointer(object);
|
return NSZoneFromPointer(object);
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ static BOOL double_release_check_enabled = NO;
|
||||||
#else
|
#else
|
||||||
fastMallocOffset = 0;
|
fastMallocOffset = 0;
|
||||||
#endif
|
#endif
|
||||||
NXConstantStringClass = [NXConstantString class];
|
NSConstantStringClass = [NSString constantStringClass];
|
||||||
GSBuildStrings();
|
GSBuildStrings();
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserver: self
|
addObserver: self
|
||||||
|
|
|
@ -44,7 +44,7 @@ static Class GSCStringClass;
|
||||||
static Class GSUnicodeStringClass;
|
static Class GSUnicodeStringClass;
|
||||||
static Class GSMutableStringClass;
|
static Class GSMutableStringClass;
|
||||||
static Class GSPlaceholderStringClass;
|
static Class GSPlaceholderStringClass;
|
||||||
static Class NXConstantStringClass;
|
static Class NSConstantStringClass;
|
||||||
static NSCharacterSet *defaultSkipSet;
|
static NSCharacterSet *defaultSkipSet;
|
||||||
static SEL memSel;
|
static SEL memSel;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ typedef struct {
|
||||||
GSUnicodeStringClass = [GSUnicodeString class];
|
GSUnicodeStringClass = [GSUnicodeString class];
|
||||||
GSMutableStringClass = [GSMutableString class];
|
GSMutableStringClass = [GSMutableString class];
|
||||||
GSPlaceholderStringClass = [GSPlaceholderString class];
|
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||||
NXConstantStringClass = [NXConstantString class];
|
NSConstantStringClass = [NSString constantStringClass];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ typedef struct {
|
||||||
length: ((ivars)aString)->_count];
|
length: ((ivars)aString)->_count];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == NXConstantStringClass)
|
else if (c == NSConstantStringClass)
|
||||||
{
|
{
|
||||||
_isUnicode = NO;
|
_isUnicode = NO;
|
||||||
_string = RETAIN(aString);
|
_string = RETAIN(aString);
|
||||||
|
|
|
@ -87,6 +87,7 @@
|
||||||
static Class NSDataClass;
|
static Class NSDataClass;
|
||||||
static Class NSStringClass;
|
static Class NSStringClass;
|
||||||
static Class NSMutableStringClass;
|
static Class NSMutableStringClass;
|
||||||
|
static Class NSConstantStringClass;
|
||||||
|
|
||||||
static Class GSStringClass;
|
static Class GSStringClass;
|
||||||
static Class GSMutableStringClass;
|
static Class GSMutableStringClass;
|
||||||
|
@ -338,6 +339,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
NSStringClass = self;
|
NSStringClass = self;
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
NSMutableStringClass = [NSMutableString class];
|
NSMutableStringClass = [NSMutableString class];
|
||||||
|
NSConstantStringClass = [NXConstantString class];
|
||||||
NSDataClass = [NSData class];
|
NSDataClass = [NSData class];
|
||||||
GSPlaceholderStringClass = [GSPlaceholderString class];
|
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||||
GSStringClass = [GSString class];
|
GSStringClass = [GSString class];
|
||||||
|
@ -423,6 +425,11 @@ handle_printf_atsign (FILE *stream,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (Class) constantStringClass
|
||||||
|
{
|
||||||
|
return NSConstantStringClass;
|
||||||
|
}
|
||||||
|
|
||||||
// Creating Temporary Strings
|
// Creating Temporary Strings
|
||||||
|
|
||||||
+ (id) string
|
+ (id) string
|
||||||
|
|
|
@ -296,7 +296,7 @@ NSString *NSClassDescriptionNeededForClassNotification;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup function called when NSString is initialised.
|
* Setup function called when NSString is initialised.
|
||||||
* We make all the constant strings not be NXConstantString so they can
|
* We make all the constant strings not be constant strings so they can
|
||||||
* cache their hash values and be used much more efficiently as keys in
|
* cache their hash values and be used much more efficiently as keys in
|
||||||
* dictionaries etc.
|
* dictionaries etc.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -891,6 +891,12 @@ AC_SUBST(MINOR_VERSION)
|
||||||
AC_SUBST(SUBMINOR_VERSION)
|
AC_SUBST(SUBMINOR_VERSION)
|
||||||
AC_SUBST(GCC_VERSION)
|
AC_SUBST(GCC_VERSION)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Set the constant string class support.
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
NXCONST=NXConstantString
|
||||||
|
AC_SUBST(NXCONST)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Write the Makefiles
|
# Write the Makefiles
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue