mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
NSString rewrite/reorganisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7769 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9882ff6686
commit
b1d5d768fb
21 changed files with 451 additions and 438 deletions
62
ChangeLog
62
ChangeLog
|
@ -1,3 +1,65 @@
|
|||
2000-10-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
Major rewrite of NSString.
|
||||
There was a fundamental architectural problem in the old
|
||||
implementation ... if you had an NSGMutableCString object,
|
||||
and used any method that appends (or replaces) characters in
|
||||
that string, there was a problem in that the characters being
|
||||
added may not be representable in the default character set.
|
||||
|
||||
This means that we needed the concrete mutable strring class to
|
||||
be able to mutate itsself from an 8-bit string to a 16-bit string
|
||||
when necessary (we can't just allocate a new object, because we
|
||||
have no way of returning it to the caller).
|
||||
|
||||
We could not handle this simply by changing the class pointer in
|
||||
the instance (and reallocating and modifying the memory actually
|
||||
storing the characters of course). The problem with this is that
|
||||
the method implementations of the object may have been cached in
|
||||
the user code (quite likely if you want high performance from a
|
||||
mutable string) - and subsequent use of those cached implementations
|
||||
would still try to treat the contents of the string as 8-bit characters.
|
||||
|
||||
The solution adopted was to make the standard mutable string class
|
||||
contain a flag to adjust its behavior so that each method treats
|
||||
the char data as either 8 or 16 bit.
|
||||
This makes for ugly code, partially tidied by use of inline functions.
|
||||
|
||||
For most of the methods implemented for the constant strings
|
||||
(rather than being inherited from the abstract class) we now
|
||||
have two inline functions for 8-bit and 16-bit implementations.
|
||||
The GSUString and GSCString objects have method implementations
|
||||
that simply called the appropriate function. The GSMString
|
||||
implementation of each method tests the flag and calls the
|
||||
appropriate inline function.
|
||||
|
||||
* Headers/gnustep/base/NSString.h: Remove NSGCString, NSGString,
|
||||
NSGMutableCStrng and NSGMutableString. Add GSString interface and
|
||||
new version of NXConstantString interface.
|
||||
* Headers/gnustep/base/fast.x: Remove string caching information.
|
||||
* Source/GNUmakefile: Don't build old concrete strings or install
|
||||
their headers. Do build new concrete string (GSString.m)
|
||||
* Source/GSCompatibility.m: Don't use private concrete strings.
|
||||
* Source/GSeq.h: Various modifications for new string classes.
|
||||
* Source/NSArray.m: Don't use private concrete strings.
|
||||
* Source/NSData.m: Don't use private concrete strings.
|
||||
* Source/NSDictionary.m: Don't use private concrete strings.
|
||||
* Source/NSGAttributedString.m: Don't use private concrete strings.
|
||||
* Source/NSGCString.m: No longer used.
|
||||
* Source/NSGDictionary.m: Don't use private concrete strings.
|
||||
* Source/NSGString.m: No longer used.
|
||||
* Source/NSNotificationCenter.m: Don't use private concrete strings.
|
||||
* Source/NSObjCRuntime.m: Don't use private concrete strings.
|
||||
* Source/NSObject.m: Don't cache string information.
|
||||
* Source/NSScanner.m: Modified to use new concrete strings.
|
||||
* Source/NSSerializer.m: Modified to use new concrete strings.
|
||||
* Source/NSString.m: Modified to use new concrete strings. Rewrote
|
||||
various methods to work in terms of the primitive string methods.
|
||||
Implemented encoding and decoding at this level so we don't encode
|
||||
concrete string classes in archives.
|
||||
* Source/externs.m: Modified to use new concrete strings.
|
||||
* Source/propList.h: Modified to use new concrete strings.
|
||||
|
||||
2000-10-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Makefile.preamble (ADDITIONAL_CPPFLAGS): Replace
|
||||
|
|
|
@ -314,18 +314,44 @@ enum {
|
|||
@end
|
||||
|
||||
/*
|
||||
* Because the compiler thinks that @".." strings are NXConstantString's.
|
||||
* NB. An NXConstantString has a length and a pointer to char as it's ivars
|
||||
* but an NSGCString also has a hash value - the code has to be careful not
|
||||
* to use the _hash ivar if the class is actually an NXConstantString.
|
||||
* If you modify and NSGCString method to use the _hash ivar, you must
|
||||
* override that method in NXConstantString, to avoid using the ivar.
|
||||
* Information for NXConstantString
|
||||
*/
|
||||
#include <Foundation/NSGString.h>
|
||||
#include <Foundation/NSGCString.h>
|
||||
@interface NXConstantString : NSGCString
|
||||
@interface NXConstantString : NSString
|
||||
{
|
||||
union {
|
||||
unichar *u;
|
||||
unsigned char *c;
|
||||
} _contents;
|
||||
unsigned int _count;
|
||||
}
|
||||
@end
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
/*
|
||||
* Private concrete string classes.
|
||||
* NB. All these concrete string classes MUST have the same initial ivar
|
||||
* layout so that we can swap between them as necessary.
|
||||
* The initial layout must also match that of NXConstnatString (which is
|
||||
* determined by the compiler).
|
||||
*/
|
||||
@interface GSString : NSString
|
||||
{
|
||||
union {
|
||||
unichar *u;
|
||||
unsigned char *c;
|
||||
} _contents;
|
||||
unsigned int _count;
|
||||
struct {
|
||||
unsigned int wide: 1; // 16-bit characters in string?
|
||||
unsigned int ascii: 1; // String contains only ascii?
|
||||
unsigned int free: 1; // Should free memory?
|
||||
unsigned int hash: 30;
|
||||
} _flags;
|
||||
}
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
@interface NSString (GSString)
|
||||
- (NSString*) stringWithoutSuffix: (NSString*)_suffix;
|
||||
|
|
|
@ -76,35 +76,11 @@ typedef struct {
|
|||
Class _NSMutableArray;
|
||||
Class _NSDictionary;
|
||||
Class _NSMutableDictionary;
|
||||
Class _NSString;
|
||||
Class _NSMutableString;
|
||||
Class _NSGString;
|
||||
Class _NSGMutableString;
|
||||
Class _NSGCString;
|
||||
Class _NSGMutableCString;
|
||||
Class _NXConstantString;
|
||||
Class _NSDataMalloc;
|
||||
Class _NSMutableDataMalloc;
|
||||
} fastCls;
|
||||
GS_EXPORT fastCls _fastCls; /* Populated by _fastBuildCache() */
|
||||
|
||||
/*
|
||||
* Structure to cache method implementation information.
|
||||
* By convention, the name of the structure element consists of an
|
||||
* underscore followed by the name of the class, another underscore, and
|
||||
* the name of the method (with colons replaced by underscores).
|
||||
*/
|
||||
typedef struct {
|
||||
/*
|
||||
* String implementations.
|
||||
*/
|
||||
unsigned (*_NSString_hash)();
|
||||
BOOL (*_NSString_isEqualToString_)();
|
||||
BOOL (*_NSGString_isEqual_)();
|
||||
BOOL (*_NSGCString_isEqual_)();
|
||||
} fastImp;
|
||||
GS_EXPORT fastImp _fastImp; /* Populated by _fastBuildCache() */
|
||||
|
||||
/*
|
||||
* The '_fastBuildCache()' function is called to populate the cache
|
||||
* structures. This is (at present) called in [NSObject +initialize]
|
||||
|
|
|
@ -143,6 +143,7 @@ preface.h
|
|||
# GNUStep source files
|
||||
|
||||
BASE_MFILES = \
|
||||
GSString.m \
|
||||
NSAttributedString.m \
|
||||
NSArchiver.m \
|
||||
NSArray.m \
|
||||
|
@ -177,10 +178,8 @@ NSGeometry.m \
|
|||
NSGArray.m \
|
||||
NSGAttributedString.m \
|
||||
NSGCountedSet.m \
|
||||
NSGCString.m \
|
||||
NSGDictionary.m \
|
||||
NSGSet.m \
|
||||
NSGString.m \
|
||||
NSHashTable.m \
|
||||
NSHost.m \
|
||||
NSInvocation.m \
|
||||
|
@ -217,14 +216,14 @@ NSTimer.m \
|
|||
NSTimeZone.m \
|
||||
NSUnarchiver.m \
|
||||
NSUndoManager.m \
|
||||
NSURL.m \
|
||||
NSURLHandle.m \
|
||||
NSUser.m \
|
||||
NSUserDefaults.m \
|
||||
NSValue.m \
|
||||
NSZone.m \
|
||||
externs.m \
|
||||
objc-load.m \
|
||||
NSURL.m \
|
||||
NSURLHandle.m
|
||||
objc-load.m
|
||||
|
||||
ifeq ($(HAVE_LIBXML),1)
|
||||
BASE_MFILES += GSXML.m
|
||||
|
@ -283,9 +282,7 @@ NSFormatter.h \
|
|||
NSGeometry.h \
|
||||
NSGArray.h \
|
||||
NSGAttributedString.h \
|
||||
NSGCString.h \
|
||||
NSGSet.h \
|
||||
NSGString.h \
|
||||
NSHashTable.h \
|
||||
NSHost.h \
|
||||
NSInvocation.h \
|
||||
|
|
|
@ -119,7 +119,6 @@ return NO;
|
|||
#include <math.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSGCString.h>
|
||||
|
||||
static char base64[]
|
||||
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
@ -167,7 +166,7 @@ encodeBase64(NSData *source)
|
|||
dBuf[dIndex + 3] = '=';
|
||||
}
|
||||
|
||||
return [[NSGCString allocWithZone: NSDefaultMallocZone()]
|
||||
return [[NSString allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCStringNoCopy: dBuf length: destlen-1 freeWhenDone: YES];
|
||||
}
|
||||
|
||||
|
|
|
@ -217,23 +217,12 @@ static inline void GSeq_uppercase(GSeq seq)
|
|||
}
|
||||
|
||||
/*
|
||||
* Specify NSString, NSGString or NSGCString
|
||||
* Specify NSString, GSUString or GSCString
|
||||
*/
|
||||
#define GSEQ_NS 0
|
||||
#define GSEQ_US 1
|
||||
#define GSEQ_CS 2
|
||||
|
||||
/*
|
||||
* Structures to access NSGString and NSGCString ivars.
|
||||
*/
|
||||
typedef struct {
|
||||
@defs(NSGString)
|
||||
} NSGStringStruct;
|
||||
|
||||
typedef struct {
|
||||
@defs(NSGCString)
|
||||
} NSGCStringStruct;
|
||||
|
||||
/*
|
||||
* Definitions for bitmask of search options. These MUST match the
|
||||
* enumeration in NSString.h
|
||||
|
@ -261,21 +250,21 @@ typedef struct {
|
|||
* Set up macros for dealing with 'self' on the basis of GSQ_S
|
||||
*/
|
||||
#if GSEQ_S == GSEQ_US
|
||||
#define GSEQ_ST NSGStringStruct*
|
||||
#define GSEQ_ST ivars
|
||||
#define GSEQ_SLEN s->_count
|
||||
#define GSEQ_SGETC(I) s->_contents_chars[I]
|
||||
#define GSEQ_SGETR(B,R) memcpy(B, &s->_contents_chars[R.location], 2*(R).length)
|
||||
#define GSEQ_SGETC(I) s->_contents.u[I]
|
||||
#define GSEQ_SGETR(B,R) memcpy(B, &s->_contents.u[R.location], 2*(R).length)
|
||||
#define GSEQ_SRANGE(I) (*srImp)((id)s, ranSel, I)
|
||||
#else
|
||||
#if GSEQ_S == GSEQ_CS
|
||||
#define GSEQ_ST NSGCStringStruct*
|
||||
#define GSEQ_ST ivars
|
||||
#define GSEQ_SLEN s->_count
|
||||
#define GSEQ_SGETC(I) (unichar)s->_contents_chars[I]
|
||||
#define GSEQ_SGETC(I) (unichar)s->_contents.c[I]
|
||||
#define GSEQ_SGETR(B,R) ( { \
|
||||
unsigned _lcount = 0; \
|
||||
while (_lcount < (R).length) \
|
||||
{ \
|
||||
(B)[_lcount] = (unichar)(unsigned char)s->_contents_chars[(R).location + _lcount]; \
|
||||
(B)[_lcount] = (unichar)s->_contents.c[(R).location + _lcount]; \
|
||||
_lcount++; \
|
||||
} \
|
||||
} )
|
||||
|
@ -293,21 +282,21 @@ typedef struct {
|
|||
* Set up macros for dealing with 'other' string on the basis of GSQ_O
|
||||
*/
|
||||
#if GSEQ_O == GSEQ_US
|
||||
#define GSEQ_OT NSGStringStruct*
|
||||
#define GSEQ_OT ivars
|
||||
#define GSEQ_OLEN o->_count
|
||||
#define GSEQ_OGETC(I) o->_contents_chars[I]
|
||||
#define GSEQ_OGETR(B,R) memcpy(B, &o->_contents_chars[R.location], 2*(R).length)
|
||||
#define GSEQ_OGETC(I) o->_contents.u[I]
|
||||
#define GSEQ_OGETR(B,R) memcpy(B, &o->_contents.u[R.location], 2*(R).length)
|
||||
#define GSEQ_ORANGE(I) (*orImp)((id)o, ranSel, I)
|
||||
#else
|
||||
#if GSEQ_O == GSEQ_CS
|
||||
#define GSEQ_OT NSGCStringStruct*
|
||||
#define GSEQ_OT ivars
|
||||
#define GSEQ_OLEN o->_count
|
||||
#define GSEQ_OGETC(I) (unichar)o->_contents_chars[I]
|
||||
#define GSEQ_OGETC(I) (unichar)o->_contents.c[I]
|
||||
#define GSEQ_OGETR(B,R) ( { \
|
||||
unsigned _lcount = 0; \
|
||||
while (_lcount < (R).length) \
|
||||
{ \
|
||||
(B)[_lcount] = (unichar)(unsigned char)o->_contents_chars[(R).location + _lcount]; \
|
||||
(B)[_lcount] = (unichar)o->_contents.c[(R).location + _lcount]; \
|
||||
_lcount++; \
|
||||
} \
|
||||
} )
|
||||
|
@ -383,13 +372,21 @@ GSEQ_STRCOMP(NSString *ss, NSString *os, unsigned mask, NSRange aRange)
|
|||
sgImp = (void (*)())[(id)s methodForSelector: gcrSel];
|
||||
GSEQ_SGETR(sBuf, aRange);
|
||||
#else
|
||||
sBuf = &s->_contents_chars[aRange.location];
|
||||
#if GSEQ_S == GSEQ_CS
|
||||
sBuf = &s->_contents.c[aRange.location];
|
||||
#else
|
||||
sBuf = &s->_contents.u[aRange.location];
|
||||
#endif
|
||||
#endif
|
||||
#if GSEQ_O == GSEQ_NS
|
||||
ogImp = (void (*)())[(id)o methodForSelector: gcrSel];
|
||||
GSEQ_OGETR(oBuf, NSMakeRange(0, oLen));
|
||||
#else
|
||||
oBuf = o->_contents_chars;
|
||||
#if GSEQ_O == GSEQ_CS
|
||||
oBuf = o->_contents.c;
|
||||
#else
|
||||
oBuf = o->_contents.u;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (oLen < sLen)
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
|
||||
#include <base/fast.x>
|
||||
|
||||
@class NSGMutableCString;
|
||||
|
||||
@class NSArrayEnumerator;
|
||||
@class NSArrayEnumeratorReverse;
|
||||
|
||||
|
@ -668,7 +666,7 @@ static SEL rlSel = @selector(removeLastObject);
|
|||
{
|
||||
NSMutableString *result;
|
||||
|
||||
result = [[NSGMutableCString alloc] initWithCapacity: 20*[self count]];
|
||||
result = [[NSMutableString alloc] initWithCapacity: 20*[self count]];
|
||||
result = AUTORELEASE(result);
|
||||
[self descriptionWithLocale: locale
|
||||
indent: level
|
||||
|
|
|
@ -436,9 +436,13 @@ failure:
|
|||
- (id) initWithBytes: (const void*)aBuffer
|
||||
length: (unsigned)bufferSize
|
||||
{
|
||||
void *ptr = NSZoneMalloc(NSDefaultMallocZone(), bufferSize);
|
||||
void *ptr = 0;
|
||||
|
||||
memcpy(ptr, aBuffer, bufferSize);
|
||||
if (bufferSize > 0)
|
||||
{
|
||||
ptr = NSZoneMalloc(NSDefaultMallocZone(), bufferSize);
|
||||
memcpy(ptr, aBuffer, bufferSize);
|
||||
}
|
||||
return [self initWithBytesNoCopy: ptr length: bufferSize];
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
|
||||
@implementation NSDictionary
|
||||
|
||||
@class NSGMutableCString;
|
||||
|
||||
@class NSGDictionary;
|
||||
@class NSGMutableDictionary;
|
||||
|
||||
|
@ -597,7 +595,7 @@ compareIt(id o1, id o2, void* context)
|
|||
IMP appImp;
|
||||
id key;
|
||||
|
||||
result = AUTORELEASE([[NSGMutableCString alloc] initWithCapacity: 1024]);
|
||||
result = AUTORELEASE([[NSMutableString alloc] initWithCapacity: 1024]);
|
||||
appImp = [(NSObject*)result methodForSelector: appSel];
|
||||
while ((key = (*nxtObj)(enumerator, nxtSel)) != nil)
|
||||
{
|
||||
|
@ -639,7 +637,7 @@ compareIt(id o1, id o2, void* context)
|
|||
{
|
||||
NSMutableString *result;
|
||||
|
||||
result = AUTORELEASE([[NSGMutableCString alloc] initWithCapacity:
|
||||
result = AUTORELEASE([[NSMutableString alloc] initWithCapacity:
|
||||
20*[self count]]);
|
||||
[self descriptionWithLocale: locale
|
||||
indent: level
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <base/NSGArray.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSZone.h>
|
||||
#include <base/fast.x>
|
||||
|
||||
#define SANITY_CHECKS 0
|
||||
|
@ -147,15 +148,19 @@ static void _setup()
|
|||
{
|
||||
if (infCls == 0)
|
||||
{
|
||||
Class c = [NSGMutableArray class];
|
||||
NSMutableArray *a;
|
||||
|
||||
infCls = [GSAttrInfo class];
|
||||
infImp = [infCls methodForSelector: infSel];
|
||||
addImp = (void (*)())[c instanceMethodForSelector: addSel];
|
||||
cntImp = (unsigned (*)())[c instanceMethodForSelector: cntSel];
|
||||
insImp = (void (*)())[c instanceMethodForSelector: insSel];
|
||||
oatImp = [c instanceMethodForSelector: oatSel];
|
||||
remImp = (void (*)())[c instanceMethodForSelector: remSel];
|
||||
|
||||
a = [NSMutableArray allocWithZone: NSDefaultMallocZone()];
|
||||
a = [a initWithCapacity: 1];
|
||||
addImp = (void (*)())[a methodForSelector: addSel];
|
||||
cntImp = (unsigned (*)())[a methodForSelector: cntSel];
|
||||
insImp = (void (*)())[a methodForSelector: insSel];
|
||||
oatImp = [a methodForSelector: oatSel];
|
||||
remImp = (void (*)())[a methodForSelector: remSel];
|
||||
RELEASE(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,7 +317,7 @@ _attributesAtIndexEffectiveRange(
|
|||
{
|
||||
NSZone *z = fastZone(self);
|
||||
|
||||
_infoArray = [[NSGMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
||||
{
|
||||
NSAttributedString *as = (NSAttributedString*)aString;
|
||||
|
@ -419,7 +424,7 @@ _attributesAtIndexEffectiveRange(
|
|||
{
|
||||
NSZone *z = fastZone(self);
|
||||
|
||||
_infoArray = [[NSGMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
||||
{
|
||||
NSAttributedString *as = (NSAttributedString*)aString;
|
||||
|
@ -437,7 +442,7 @@ SANITY();
|
|||
RELEASE(info);
|
||||
}
|
||||
if (aString == nil)
|
||||
_textChars = [[NSGMutableString allocWithZone: z] init];
|
||||
_textChars = [[NSMutableString allocWithZone: z] init];
|
||||
else
|
||||
_textChars = [aString mutableCopyWithZone: z];
|
||||
return self;
|
||||
|
|
|
@ -114,7 +114,7 @@ static IMP msInitImp; /* designated initialiser for mutable */
|
|||
- (unsigned) hash
|
||||
{
|
||||
if (_hash == 0)
|
||||
_hash = _fastImp._NSString_hash(self, @selector(hash));
|
||||
_hash = [super hash];
|
||||
return _hash;
|
||||
}
|
||||
|
||||
|
@ -483,10 +483,8 @@ static IMP msInitImp; /* designated initialiser for mutable */
|
|||
if (_count != other->_count)
|
||||
return NO;
|
||||
if (_hash == 0)
|
||||
_hash = _fastImp._NSString_hash(self, @selector(hash));
|
||||
if (other->_hash == 0)
|
||||
other->_hash = _fastImp._NSString_hash(other, @selector(hash));
|
||||
if (_hash != other->_hash)
|
||||
_hash = [super hash];
|
||||
if (_hash != [other hash])
|
||||
return NO;
|
||||
if (memcmp(_contents_chars, other->_contents_chars, _count) != 0)
|
||||
return NO;
|
||||
|
@ -511,8 +509,7 @@ static IMP msInitImp; /* designated initialiser for mutable */
|
|||
else if (c == nil)
|
||||
return NO;
|
||||
else if (fastClassIsKindOfClass(c, _fastCls._NSString))
|
||||
return _fastImp._NSString_isEqualToString_(self,
|
||||
@selector(isEqualToString:), anObject);
|
||||
return [super isEqualtoString: anObject];
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
@ -533,10 +530,8 @@ static IMP msInitImp; /* designated initialiser for mutable */
|
|||
if (_count != other->_count)
|
||||
return NO;
|
||||
if (_hash == 0)
|
||||
_hash = _fastImp._NSString_hash(self, @selector(hash));
|
||||
if (other->_hash == 0)
|
||||
other->_hash = _fastImp._NSString_hash(other, @selector(hash));
|
||||
if (_hash != other->_hash)
|
||||
_hash = [super hash];
|
||||
if (_hash != [other hash])
|
||||
return NO;
|
||||
if (memcmp(_contents_chars, other->_contents_chars, _count) != 0)
|
||||
return NO;
|
||||
|
@ -561,8 +556,7 @@ static IMP msInitImp; /* designated initialiser for mutable */
|
|||
else if (c == nil)
|
||||
return NO;
|
||||
else if (fastClassIsKindOfClass(c, _fastCls._NSString))
|
||||
return _fastImp._NSString_isEqualToString_(self,
|
||||
@selector(isEqualToString:), aString);
|
||||
return [super isEqualToString: aString];
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
@ -1432,8 +1426,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
|||
}
|
||||
else if (fastClassIsKindOfClass(c, _fastCls._NSString))
|
||||
{
|
||||
return _fastImp._NSString_isEqualToString_(self,
|
||||
@selector(isEqualToString:), anObject);
|
||||
return [anObject isEqualToString: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1477,8 +1470,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
|||
}
|
||||
else if (fastClassIsKindOfClass(c, _fastCls._NSString))
|
||||
{
|
||||
return _fastImp._NSString_isEqualToString_(self,
|
||||
@selector(isEqualToString:), aString);
|
||||
return [anObject isEqualToString: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -34,84 +34,14 @@
|
|||
#include <base/behavior.h>
|
||||
#include <base/fast.x>
|
||||
|
||||
/*
|
||||
* Evil hack - this structure MUST correspond to the layout of all
|
||||
* instances of the string classes we know about!
|
||||
*/
|
||||
typedef struct {
|
||||
@defs(NSGCString)
|
||||
} *dictAccessToStringHack;
|
||||
|
||||
static inline unsigned
|
||||
myHash(id obj)
|
||||
{
|
||||
if (fastIsInstance(obj))
|
||||
{
|
||||
Class c = fastClass(obj);
|
||||
|
||||
if (c == _fastCls._NSGCString ||
|
||||
c == _fastCls._NSGMutableCString ||
|
||||
c == _fastCls._NSGString ||
|
||||
c == _fastCls._NSGMutableString)
|
||||
{
|
||||
if (((dictAccessToStringHack)obj)->_hash == 0)
|
||||
{
|
||||
((dictAccessToStringHack)obj)->_hash =
|
||||
_fastImp._NSString_hash(obj, @selector(hash));
|
||||
}
|
||||
return ((dictAccessToStringHack)obj)->_hash;
|
||||
}
|
||||
else if (c == _fastCls._NXConstantString)
|
||||
{
|
||||
static unsigned (*myImp)(id,SEL) = 0;
|
||||
|
||||
if (myImp == 0)
|
||||
{
|
||||
myImp = (unsigned (*)(id,SEL))
|
||||
[obj methodForSelector: @selector(hash)];
|
||||
}
|
||||
return (*myImp)(obj, @selector(hash));
|
||||
}
|
||||
}
|
||||
return [obj hash];
|
||||
}
|
||||
|
||||
static inline BOOL
|
||||
myEqual(id self, id other)
|
||||
{
|
||||
if (self == other)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
if (fastIsInstance(self))
|
||||
{
|
||||
Class c = fastClass(self);
|
||||
|
||||
if (c == _fastCls._NXConstantString ||
|
||||
c == _fastCls._NSGCString ||
|
||||
c == _fastCls._NSGMutableCString)
|
||||
{
|
||||
return _fastImp._NSGCString_isEqual_(self,
|
||||
@selector(isEqual:), other);
|
||||
}
|
||||
if (c == _fastCls._NSGString ||
|
||||
c == _fastCls._NSGMutableString)
|
||||
{
|
||||
return _fastImp._NSGString_isEqual_(self,
|
||||
@selector(isEqual:), other);
|
||||
}
|
||||
}
|
||||
return [self isEqual: other];
|
||||
}
|
||||
|
||||
/*
|
||||
* The 'Fastmap' stuff provides an inline implementation of a mapping
|
||||
* table - for maximum performance.
|
||||
*/
|
||||
#define GSI_MAP_KTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_HASH(X) myHash(X.obj)
|
||||
#define GSI_MAP_EQUAL(X,Y) myEqual(X.obj,Y.obj)
|
||||
#define GSI_MAP_HASH(X) [X.obj hash]
|
||||
#define GSI_MAP_EQUAL(X,Y) [X.obj isEqual: Y.obj]
|
||||
#define GSI_MAP_RETAIN_KEY(X) ((id)(X).obj) = \
|
||||
[((id)(X).obj) copyWithZone: map->zone]
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
- (unsigned) hash
|
||||
{
|
||||
if (_hash == 0)
|
||||
_hash = _fastImp._NSString_hash(self, @selector(hash));
|
||||
_hash = [super hash];
|
||||
return _hash;
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,8 @@
|
|||
* First see if the has is the same - if not, we can't be equal.
|
||||
*/
|
||||
if (_hash == 0)
|
||||
_hash = _fastImp._NSString_hash(self, @selector(hash));
|
||||
if (other->_hash == 0)
|
||||
other->_hash = _fastImp._NSString_hash(other, @selector(hash));
|
||||
if (_hash != other->_hash)
|
||||
_hash = [super hash];
|
||||
if (_hash != [other hash])
|
||||
return NO;
|
||||
|
||||
/*
|
||||
|
@ -163,8 +161,7 @@
|
|||
}
|
||||
else if (fastClassIsKindOfClass(c, _fastCls._NSString))
|
||||
{
|
||||
return _fastImp._NSString_isEqualToString_(self,
|
||||
@selector(isEqualToString:), anObject);
|
||||
return [super isEqualToString: anObject];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -68,14 +68,6 @@ typedef struct Obs {
|
|||
|
||||
#define ENDOBS ((Observation*)-1)
|
||||
|
||||
static SEL hSel = @selector(hash);
|
||||
static SEL eqSel = @selector(isEqualToString:);
|
||||
|
||||
static unsigned (*cHash)(id, SEL);
|
||||
static unsigned (*uHash)(id, SEL);
|
||||
static BOOL (*cEqual)(id, SEL, id);
|
||||
static BOOL (*uEqual)(id, SEL, id);
|
||||
|
||||
static inline unsigned doHash(NSString* key)
|
||||
{
|
||||
if (key == nil)
|
||||
|
@ -88,13 +80,6 @@ static inline unsigned doHash(NSString* key)
|
|||
}
|
||||
else
|
||||
{
|
||||
Class c = fastClassOfInstance(key);
|
||||
|
||||
if (c == _fastCls._NSGCString || c == _fastCls._NSGMutableCString
|
||||
|| c == _fastCls._NXConstantString)
|
||||
return (*cHash)(key, hSel);
|
||||
if (c == _fastCls._NSGString || c == _fastCls._NSGMutableString)
|
||||
return (*uHash)(key, hSel);
|
||||
return [key hash];
|
||||
}
|
||||
}
|
||||
|
@ -111,12 +96,7 @@ static inline BOOL doEqual(NSString* key1, NSString* key2)
|
|||
}
|
||||
else
|
||||
{
|
||||
Class c = fastClassOfInstance(key1);
|
||||
|
||||
if (c == _fastCls._NSGString)
|
||||
return (*uEqual)(key1, eqSel, key2);
|
||||
else
|
||||
return (*cEqual)(key1, eqSel, key2);
|
||||
return [key1 isEqualToString: key2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -497,15 +477,6 @@ static NSNotificationCenter *default_center = nil;
|
|||
{
|
||||
if (self == [NSNotificationCenter class])
|
||||
{
|
||||
cHash = (unsigned (*)(id, SEL))
|
||||
[NSGCString instanceMethodForSelector: hSel];
|
||||
uHash = (unsigned (*)(id, SEL))
|
||||
[NSGString instanceMethodForSelector: hSel];
|
||||
cEqual = (BOOL (*)(id, SEL, id))
|
||||
[NSGCString instanceMethodForSelector: eqSel];
|
||||
uEqual = (BOOL (*)(id, SEL, id))
|
||||
[NSGString instanceMethodForSelector: eqSel];
|
||||
|
||||
/*
|
||||
* Do alloc and init separately so the default center can refer to
|
||||
* the 'default_center' variable during initialisation.
|
||||
|
@ -645,24 +616,12 @@ static NSNotificationCenter *default_center = nil;
|
|||
n = GSIMapNodeForKey(NAMED, (GSIMapKey)name);
|
||||
if (n == 0)
|
||||
{
|
||||
Class c;
|
||||
|
||||
m = mapNew(TABLE);
|
||||
/*
|
||||
* As this is the first observation for the given name, we take a
|
||||
* copy of the name so it cannot be mutated while in the map.
|
||||
* Also ensure the copy is one of our well-known string types so
|
||||
* we can optimise it's hash and isEqualToString:.
|
||||
*/
|
||||
name = [name copyWithZone: NSDefaultMallocZone()];
|
||||
c = fastClassOfInstance(name);
|
||||
if (c != _fastCls._NSGString && c != _fastCls._NSGCString
|
||||
&& c != _fastCls._NXConstantString)
|
||||
{
|
||||
id n = [[NSGString alloc] initWithString: name];
|
||||
RELEASE(name);
|
||||
name = n;
|
||||
}
|
||||
GSIMapAddPair(NAMED, (GSIMapKey)name, (GSIMapVal)(void*)m);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -32,8 +32,7 @@ NSString *
|
|||
NSStringFromSelector(SEL aSelector)
|
||||
{
|
||||
if (aSelector != (SEL)0)
|
||||
return [_fastCls._NSGCString stringWithCString:
|
||||
(char*)sel_get_name(aSelector)];
|
||||
return [NSString stringWithCString: (char*)sel_get_name(aSelector)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -57,7 +56,7 @@ NSString *
|
|||
NSStringFromClass(Class aClass)
|
||||
{
|
||||
if (aClass != (Class)0)
|
||||
return [_fastCls._NSGCString stringWithCString: fastClassName(aClass)];
|
||||
return [NSString stringWithCString: (char*)fastClassName(aClass)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,12 +47,13 @@
|
|||
extern BOOL __objc_responds_to(id, SEL);
|
||||
|
||||
fastCls _fastCls; /* Structure to cache classes. */
|
||||
fastImp _fastImp; /* Structure to cache methods. */
|
||||
|
||||
@class _FastMallocBuffer;
|
||||
static Class fastMallocClass;
|
||||
static unsigned fastMallocOffset;
|
||||
|
||||
static Class NXConstantStringClass;
|
||||
|
||||
@class NSDataMalloc;
|
||||
@class NSMutableDataMalloc;
|
||||
|
||||
|
@ -66,28 +67,8 @@ void _fastBuildCache()
|
|||
_fastCls._NSMutableArray = [NSMutableArray class];
|
||||
_fastCls._NSDictionary = [NSDictionary class];
|
||||
_fastCls._NSMutableDictionary = [NSMutableDictionary class];
|
||||
_fastCls._NSString = [NSString class];
|
||||
_fastCls._NSMutableString = [NSMutableString class];
|
||||
_fastCls._NSGString = [NSGString class];
|
||||
_fastCls._NSGMutableString = [NSGMutableString class];
|
||||
_fastCls._NSGCString = [NSGCString class];
|
||||
_fastCls._NSGMutableCString = [NSGMutableCString class];
|
||||
_fastCls._NXConstantString = [NXConstantString class];
|
||||
_fastCls._NSDataMalloc = [NSDataMalloc class];
|
||||
_fastCls._NSMutableDataMalloc = [NSMutableDataMalloc class];
|
||||
|
||||
/*
|
||||
* Cache some method implementations for quick access later.
|
||||
*/
|
||||
|
||||
_fastImp._NSString_hash = (unsigned (*)())[_fastCls._NSString
|
||||
instanceMethodForSelector: @selector(hash)];
|
||||
_fastImp._NSString_isEqualToString_ = (BOOL (*)())[_fastCls._NSString
|
||||
instanceMethodForSelector: @selector(isEqualToString:)];
|
||||
_fastImp._NSGString_isEqual_ = (BOOL (*)())[_fastCls._NSGString
|
||||
instanceMethodForSelector: @selector(isEqual:)];
|
||||
_fastImp._NSGCString_isEqual_ = (BOOL (*)())[_fastCls._NSGCString
|
||||
instanceMethodForSelector: @selector(isEqual:)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -443,7 +424,7 @@ NSDeallocateObject(NSObject *anObject)
|
|||
inline NSZone *
|
||||
fastZone(NSObject *object)
|
||||
{
|
||||
if (fastClass(object) == _fastCls._NXConstantString)
|
||||
if (fastClass(object) == NXConstantStringClass)
|
||||
return NSDefaultMallocZone();
|
||||
return ((obj)object)[-1].zone;
|
||||
}
|
||||
|
@ -453,7 +434,7 @@ fastZone(NSObject *object)
|
|||
inline NSZone *
|
||||
fastZone(NSObject *object)
|
||||
{
|
||||
if (fastClass(object) == _fastCls._NXConstantString)
|
||||
if (fastClass(object) == NXConstantStringClass)
|
||||
return NSDefaultMallocZone();
|
||||
return NSZoneFromPointer(&((obj)object)[-1]);
|
||||
}
|
||||
|
@ -514,9 +495,9 @@ NSDeallocateObject(NSObject *anObject)
|
|||
inline NSZone *
|
||||
fastZone(NSObject *object)
|
||||
{
|
||||
if (fastClass(object) == _fastCls._NXConstantString)
|
||||
return NSDefaultMallocZone();
|
||||
return NSZoneFromPointer(object);
|
||||
if (fastClass(object) == NXConstantStringClass)
|
||||
return NSDefaultMallocZone();
|
||||
return NSZoneFromPointer(object);
|
||||
}
|
||||
|
||||
inline NSObject *
|
||||
|
@ -632,6 +613,7 @@ static BOOL double_release_check_enabled = NO;
|
|||
#else
|
||||
fastMallocOffset = 0;
|
||||
#endif
|
||||
NXConstantStringClass = [NXConstantString class];
|
||||
_fastBuildCache();
|
||||
GSBuildStrings();
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include <base/Unicode.h>
|
||||
#include <Foundation/NSScanner.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSGString.h>
|
||||
#include <Foundation/NSGCString.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
|
@ -36,25 +34,27 @@
|
|||
|
||||
@implementation NSScanner
|
||||
|
||||
@class GSCString;
|
||||
@class GSUString;
|
||||
@class GSMString;
|
||||
|
||||
static Class NSString_class;
|
||||
static Class NSGString_class;
|
||||
static Class NSGCString_class;
|
||||
static Class GSCString_class;
|
||||
static Class GSUString_class;
|
||||
static Class GSMString_class;
|
||||
static Class NXConstantString_class;
|
||||
static NSCharacterSet *defaultSkipSet;
|
||||
static SEL memSel = @selector(characterIsMember:);
|
||||
|
||||
/*
|
||||
* Hack for direct access to internals of an NSGString object.
|
||||
* NB. layout of NSGString and NSGCString must be the same as far as _count
|
||||
* Hack for direct access to internals of an concrete string object.
|
||||
*/
|
||||
typedef struct {
|
||||
@defs(NSGString)
|
||||
} *stringDefs;
|
||||
typedef struct {
|
||||
@defs(NSGCString)
|
||||
} *cStringDefs;
|
||||
#define myLength() (((stringDefs)_string)->_count)
|
||||
#define myUnicode(I) (((stringDefs)_string)->_contents_chars[I])
|
||||
#define myChar(I) chartouni((((cStringDefs)_string)->_contents_chars[I]))
|
||||
@defs(GSString)
|
||||
} *ivars;
|
||||
#define myLength() (((ivars)_string)->_count)
|
||||
#define myUnicode(I) (((ivars)_string)->_contents.u[I])
|
||||
#define myChar(I) chartouni((((ivars)_string)->_contents.c[I]))
|
||||
#define myCharacter(I) (_isUnicode ? myUnicode(I) : myChar(I))
|
||||
|
||||
/*
|
||||
|
@ -77,8 +77,10 @@ typedef struct {
|
|||
defaultSkipSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
IF_NO_GC(RETAIN(defaultSkipSet));
|
||||
NSString_class = [NSString class];
|
||||
NSGString_class = [NSGString class];
|
||||
NSGCString_class = [NSGCString class];
|
||||
GSCString_class = [GSCString class];
|
||||
GSUString_class = [GSUString class];
|
||||
GSMString_class = [GSMString class];
|
||||
NXConstantString_class = [NXConstantString class];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,10 +112,12 @@ typedef struct {
|
|||
*/
|
||||
- (id) initWithString: (NSString *)aString
|
||||
{
|
||||
Class c;
|
||||
|
||||
if ((self = [super init]) == nil)
|
||||
return nil;
|
||||
/*
|
||||
* Ensure that we have an NSGString so we can access its internals directly.
|
||||
* Ensure that we have a known string so we can access its internals directly.
|
||||
*/
|
||||
if (aString == nil)
|
||||
{
|
||||
|
@ -121,12 +125,35 @@ typedef struct {
|
|||
aString = @"";
|
||||
}
|
||||
|
||||
if (fastClass(aString) == NSGString_class)
|
||||
c = fastClass(aString);
|
||||
if (c == GSUString_class)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = RETAIN(aString);
|
||||
}
|
||||
else if (fastClass(aString) == NSGCString_class)
|
||||
else if (c == GSCString_class)
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = RETAIN(aString);
|
||||
}
|
||||
else if (c == GSMString_class)
|
||||
{
|
||||
if (((ivars)aString)->_flags.wide == 1)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = [GSUString_class allocWithZone: NSDefaultMallocZone()];
|
||||
_string = [_string initWithCharacters: ((ivars)aString)->_contents.u
|
||||
length: ((ivars)aString)->_count];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = [GSCString_class allocWithZone: NSDefaultMallocZone()];
|
||||
_string = [_string initWithCString: ((ivars)aString)->_contents.u
|
||||
length: ((ivars)aString)->_count];
|
||||
}
|
||||
}
|
||||
else if (c == NXConstantString_class)
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = RETAIN(aString);
|
||||
|
@ -134,7 +161,7 @@ typedef struct {
|
|||
else if ([aString isKindOfClass: NSString_class])
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = [[NSGString_class alloc] initWithString: aString];
|
||||
_string = [[GSUString_class alloc] initWithString: aString];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -36,12 +36,13 @@
|
|||
#include <Foundation/NSNotificationQueue.h>
|
||||
|
||||
#include <base/NSGArray.h>
|
||||
#include <base/NSGCString.h>
|
||||
#include <base/NSGString.h>
|
||||
|
||||
@class NSGDictionary;
|
||||
@class NSGMutableDictionary;
|
||||
@class NSDataMalloc;
|
||||
@class GSCString;
|
||||
@class GSUString;
|
||||
@class GSMString;
|
||||
|
||||
/*
|
||||
* Setup for inline operation of string map tables.
|
||||
|
@ -103,6 +104,13 @@ static Class MutableArrayClass = 0;
|
|||
static Class DataClass = 0;
|
||||
static Class DictionaryClass = 0;
|
||||
static Class MutableDictionaryClass = 0;
|
||||
static Class CStringClass = 0;
|
||||
static Class MStringClass = 0;
|
||||
static Class StringClass = 0;
|
||||
|
||||
typedef struct {
|
||||
@defs(GSString)
|
||||
} *ivars;
|
||||
|
||||
typedef struct {
|
||||
NSMutableData *data;
|
||||
|
@ -160,8 +168,8 @@ serializeToInfo(id object, _NSSerializerInfo* info)
|
|||
format: @"Class (%@) in property list - expected instance",
|
||||
[c description]];
|
||||
}
|
||||
if (c == _fastCls._NSGCString || c == _fastCls._NSGMutableCString ||
|
||||
c == _fastCls._NXConstantString)
|
||||
if (fastClassIsKindOfClass(c, CStringClass)
|
||||
|| (c == MStringClass && ((ivars)object)->_flags.wide == 0))
|
||||
{
|
||||
GSIMapNode node;
|
||||
|
||||
|
@ -190,7 +198,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
|
|||
(*info->serImp)(info->data, serSel, node->value.uint);
|
||||
}
|
||||
}
|
||||
else if (fastClassIsKindOfClass(c, _fastCls._NSString))
|
||||
else if (fastClassIsKindOfClass(c, StringClass))
|
||||
{
|
||||
GSIMapNode node;
|
||||
|
||||
|
@ -296,6 +304,9 @@ static BOOL shouldBeCompact = NO;
|
|||
DataClass = [NSData class];
|
||||
DictionaryClass = [NSDictionary class];
|
||||
MutableDictionaryClass = [NSMutableDictionary class];
|
||||
StringClass = [NSString class];
|
||||
CStringClass = [GSCString class];
|
||||
MStringClass = [GSMString class];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,6 +350,7 @@ static BOOL shouldBeCompact = NO;
|
|||
serializeToInfo(propertyList, &info);
|
||||
endSerializerInfo(&info);
|
||||
}
|
||||
|
||||
+ (void) shouldBeCompact: (BOOL)flag
|
||||
{
|
||||
shouldBeCompact = flag;
|
||||
|
@ -424,11 +436,11 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
|
||||
case ST_CSTRING:
|
||||
{
|
||||
NSGCString *s;
|
||||
GSCString *s;
|
||||
char *b = NSZoneMalloc(NSDefaultMallocZone(), size);
|
||||
|
||||
(*info->debImp)(info->data, debSel, b, size, info->cursor);
|
||||
s = (NSGCString*)NSAllocateObject(CSCls, 0, NSDefaultMallocZone());
|
||||
s = (GSCString*)NSAllocateObject(CSCls, 0, NSDefaultMallocZone());
|
||||
s = (*csInitImp)(s, csInitSel, b, size-1, YES);
|
||||
|
||||
/*
|
||||
|
@ -448,11 +460,11 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
|
||||
case ST_STRING:
|
||||
{
|
||||
NSGString *s;
|
||||
GSUString *s;
|
||||
unichar *b = NSZoneMalloc(NSDefaultMallocZone(), size*2);
|
||||
|
||||
(*info->debImp)(info->data, debSel, b, size*2, info->cursor);
|
||||
s = (NSGString*)NSAllocateObject(USCls, 0, NSDefaultMallocZone());
|
||||
s = (GSUString*)NSAllocateObject(USCls, 0, NSDefaultMallocZone());
|
||||
s = (*usInitImp)(s, usInitSel, b, size, YES);
|
||||
|
||||
/*
|
||||
|
@ -667,8 +679,8 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
DCls = [NSDataMalloc class];
|
||||
IDCls = [NSGDictionary class];
|
||||
MDCls = [NSGMutableDictionary class];
|
||||
USCls = [NSGString class];
|
||||
CSCls = [NSGCString class];
|
||||
USCls = [GSUString class];
|
||||
CSCls = [GSCString class];
|
||||
csInitImp = [CSCls instanceMethodForSelector: csInitSel];
|
||||
usInitImp = [USCls instanceMethodForSelector: usInitSel];
|
||||
dInitImp = [DCls instanceMethodForSelector: dInitSel];
|
||||
|
|
|
@ -69,11 +69,12 @@
|
|||
#include <base/behavior.h>
|
||||
|
||||
#include <base/Unicode.h>
|
||||
#include <base/NSGString.h>
|
||||
#include <base/NSGCString.h>
|
||||
|
||||
#include <base/fast.x>
|
||||
|
||||
@class GSCString;
|
||||
@class GSMString;
|
||||
@class GSUString;
|
||||
|
||||
/*
|
||||
* Cache classes for speed.
|
||||
|
@ -213,24 +214,6 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
|
||||
|
||||
static NSRange
|
||||
rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
||||
unsigned index)
|
||||
{
|
||||
unsigned count = [self length];
|
||||
unsigned start;
|
||||
unsigned end;
|
||||
|
||||
start = index;
|
||||
while (uni_isnonsp((*caiImp)(self, caiSel, start)) && start > 0)
|
||||
start--;
|
||||
end = start + 1;
|
||||
if (end < count)
|
||||
while ((end < count) && (uni_isnonsp((*caiImp)(self, caiSel, end))))
|
||||
end++;
|
||||
return (NSRange){start, end-start};
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSString class])
|
||||
|
@ -239,10 +222,10 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
NSString_class = self;
|
||||
NSMutableString_class = [NSMutableString class];
|
||||
NSData_class = [NSData class];
|
||||
NSString_concrete_class = [NSGString class];
|
||||
NSString_c_concrete_class = [NSGCString class];
|
||||
NSMutableString_concrete_class = [NSGMutableString class];
|
||||
NSMutableString_c_concrete_class = [NSGMutableCString class];
|
||||
NSString_concrete_class = [GSUString class];
|
||||
NSString_c_concrete_class = [GSCString class];
|
||||
NSMutableString_concrete_class = [GSMString class];
|
||||
NSMutableString_c_concrete_class = [GSMString class];
|
||||
|
||||
#if HAVE_REGISTER_PRINTF_FUNCTION
|
||||
if (register_printf_function ('@',
|
||||
|
@ -960,26 +943,11 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
unsigned l = [self length];
|
||||
unsigned i;
|
||||
unichar (*caiImp)(NSString*, SEL, unsigned);
|
||||
NSRange boundary;
|
||||
|
||||
GS_RANGE_CHECK(aRange, l);
|
||||
|
||||
caiImp = (unichar (*)())[self methodForSelector: caiSel];
|
||||
|
||||
/*
|
||||
* Handle composed character sequences.
|
||||
*/
|
||||
if (aRange.location > 0)
|
||||
{
|
||||
boundary = rangeOfSequence(self, caiImp, aRange.location);
|
||||
aRange.location = boundary.location;
|
||||
}
|
||||
if (NSMaxRange(aRange) < l)
|
||||
{
|
||||
boundary = rangeOfSequence(self, caiImp, NSMaxRange(aRange));
|
||||
aRange.length = NSMaxRange(boundary) - aRange.location;
|
||||
}
|
||||
|
||||
for (i = 0; i < aRange.length; i++)
|
||||
{
|
||||
buffer[i] = (*caiImp)(self, caiSel, aRange.location + i);
|
||||
|
@ -1753,27 +1721,12 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
unsigned len;
|
||||
unsigned count;
|
||||
unichar (*caiImp)(NSString*, SEL, unsigned);
|
||||
NSRange boundary;
|
||||
|
||||
len = [self cStringLength];
|
||||
GS_RANGE_CHECK(aRange, len);
|
||||
|
||||
caiImp = (unichar (*)())[self methodForSelector: caiSel];
|
||||
|
||||
/*
|
||||
* Handle composed character sequences.
|
||||
*/
|
||||
if (aRange.location > 0)
|
||||
{
|
||||
boundary = rangeOfSequence(self, caiImp, aRange.location);
|
||||
aRange.location = boundary.location;
|
||||
}
|
||||
if (NSMaxRange(aRange) < [self length])
|
||||
{
|
||||
boundary = rangeOfSequence(self, caiImp, NSMaxRange(aRange));
|
||||
aRange.length = NSMaxRange(boundary) - aRange.location;
|
||||
}
|
||||
|
||||
if (maxLength < aRange.length)
|
||||
{
|
||||
len = maxLength;
|
||||
|
@ -2775,30 +2728,115 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
|
||||
/* NSCoding Protocol */
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)anEncoder
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
unsigned count = [self length];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
if (count > 0)
|
||||
{
|
||||
NSStringEncoding enc = NSUnicodeStringEncoding;
|
||||
unichar *chars;
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(NSStringEncoding) at: &enc];
|
||||
|
||||
chars = NSZoneMalloc(NSDefaultMallocZone(), count*sizeof(unichar));
|
||||
[self getCharacters: chars];
|
||||
[aCoder encodeArrayOfObjCType: @encode(unichar)
|
||||
count: count
|
||||
at: chars];
|
||||
NSZoneFree(NSDefaultMallocZone(), chars);
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
unsigned count;
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
if (count > 0)
|
||||
{
|
||||
NSStringEncoding enc;
|
||||
NSZone *zone;
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(NSStringEncoding) at: &enc];
|
||||
#if GS_WITH_GC
|
||||
zone = GSAtomicMallocZone();
|
||||
#else
|
||||
zone = fastZone(self);
|
||||
#endif
|
||||
|
||||
if (enc == NSUnicodeStringEncoding)
|
||||
{
|
||||
unichar *chars;
|
||||
|
||||
chars = NSZoneMalloc(zone, count*sizeof(unichar));
|
||||
[aCoder decodeArrayOfObjCType: @encode(unichar)
|
||||
count: count
|
||||
at: chars];
|
||||
self = [self initWithCharactersNoCopy: chars
|
||||
length: count
|
||||
freeWhenDone: YES];
|
||||
}
|
||||
else if (enc == NSASCIIStringEncoding || enc == _DefaultStringEncoding)
|
||||
{
|
||||
unsigned char *chars;
|
||||
|
||||
chars = NSZoneMalloc(zone, count+1);
|
||||
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: count
|
||||
at: chars];
|
||||
self = [self initWithCStringNoCopy: chars
|
||||
length: count
|
||||
freeWhenDone: YES];
|
||||
}
|
||||
else if (enc == NSUTF8StringEncoding)
|
||||
{
|
||||
unsigned char *chars;
|
||||
|
||||
chars = NSZoneMalloc(zone, count+1);
|
||||
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: count
|
||||
at: chars];
|
||||
chars[count] = '\0';
|
||||
self = [self initWithUTF8String: chars];
|
||||
NSZoneFree(zone, chars);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char *chars;
|
||||
NSData *data;
|
||||
|
||||
chars = NSZoneMalloc(zone, count);
|
||||
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: count
|
||||
at: chars];
|
||||
data = [NSData_class allocWithZone: zone];
|
||||
data = [data initWithBytesNoCopy: chars length: count];
|
||||
self = [self initWithData: data encoding: enc];
|
||||
RELEASE(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self = [self initWithCharactersNoCopy: 0 length: 0 freeWhenDone: NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (Class) classForArchiver
|
||||
{
|
||||
return [self class];
|
||||
return NSString_class;
|
||||
}
|
||||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return [self class];
|
||||
return NSString_class;
|
||||
}
|
||||
|
||||
- (Class) classForPortCoder
|
||||
{
|
||||
return [self class];
|
||||
return NSString_class;
|
||||
}
|
||||
|
||||
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
|
||||
|
@ -2823,7 +2861,7 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
|
||||
[self getCharacters: chars];
|
||||
if (plInit == 0)
|
||||
setupPl([NSGString class]);
|
||||
setupPl([GSUString class]);
|
||||
|
||||
result = parsePl(&data);
|
||||
|
||||
|
@ -2850,7 +2888,7 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
|
||||
[self getCharacters: chars];
|
||||
if (plInit == 0)
|
||||
setupPl([NSGString class]);
|
||||
setupPl([GSUString class]);
|
||||
|
||||
result = parseSfItem(&data);
|
||||
if (result == nil && data.err != nil)
|
||||
|
@ -2961,6 +2999,21 @@ rangeOfSequence(NSString *self, unichar (*caiImp)(NSString*, SEL, unsigned),
|
|||
RELEASE(tmp);
|
||||
}
|
||||
|
||||
- (Class) classForArchiver
|
||||
{
|
||||
return NSMutableString_class;
|
||||
}
|
||||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return NSMutableString_class;
|
||||
}
|
||||
|
||||
- (Class) classForPortCoder
|
||||
{
|
||||
return NSMutableString_class;
|
||||
}
|
||||
|
||||
- (void) deleteCharactersInRange: (NSRange)range
|
||||
{
|
||||
[self replaceCharactersInRange: range withString: nil];
|
||||
|
|
176
Source/externs.m
176
Source/externs.m
|
@ -31,7 +31,7 @@
|
|||
#include "NSCallBacks.h"
|
||||
#include <Foundation/NSHashTable.h>
|
||||
|
||||
@class NSGCString;
|
||||
@class GSCString;
|
||||
|
||||
/* Global lock to be used by classes when operating on any global
|
||||
data that invoke other methods which also access global; thus,
|
||||
|
@ -282,192 +282,192 @@ GSBuildStrings()
|
|||
{
|
||||
beenHere = YES;
|
||||
InPortAcceptedClientNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"InPortAcceptedClientNotification"];
|
||||
InPortClientBecameInvalidNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"InPortClientBecameInvalidNotification"];
|
||||
NSAMPMDesignation
|
||||
= [[NSGCString alloc] initWithCString: "NSAMPMDesignation"];
|
||||
= [[GSCString alloc] initWithCString: "NSAMPMDesignation"];
|
||||
NSArgumentDomain
|
||||
= [[NSGCString alloc] initWithCString: "NSArgumentDomain"];
|
||||
= [[GSCString alloc] initWithCString: "NSArgumentDomain"];
|
||||
NSBundleDidLoadNotification
|
||||
= [[NSGCString alloc] initWithCString: "NSBundleDidLoadNotification"];
|
||||
= [[GSCString alloc] initWithCString: "NSBundleDidLoadNotification"];
|
||||
*(NSString**)&NSCharacterConversionException
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSCharacterConversionException"];
|
||||
NSConnectionDidDieNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSConnectionDidDieNotification"];
|
||||
NSConnectionDidInitializeNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSConnectionDidInitializeNotification"];
|
||||
NSConnectionLocalCount
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionLocalCount"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionLocalCount"];
|
||||
NSConnectionProxyCount
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionProxyCount"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionProxyCount"];
|
||||
NSConnectionRepliesReceived
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionRepliesReceived"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRepliesReceived"];
|
||||
NSConnectionRepliesSent
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionRepliesSent"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRepliesSent"];
|
||||
NSConnectionReplyMode
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionReplyMode"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionReplyMode"];
|
||||
NSConnectionRequestsReceived
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionRequestsReceived"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRequestsReceived"];
|
||||
NSConnectionRequestsSent
|
||||
= [[NSGCString alloc] initWithCString: "NSConnectionRequestsSent"];
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRequestsSent"];
|
||||
NSCurrencyString
|
||||
= [[NSGCString alloc] initWithCString: "NSCurrencyString"];
|
||||
= [[GSCString alloc] initWithCString: "NSCurrencyString"];
|
||||
NSCurrencySymbol
|
||||
= [[NSGCString alloc] initWithCString: "NSCurrencySymbol"];
|
||||
= [[GSCString alloc] initWithCString: "NSCurrencySymbol"];
|
||||
NSDateFormatString
|
||||
= [[NSGCString alloc] initWithCString: "NSDateFormatString"];
|
||||
= [[GSCString alloc] initWithCString: "NSDateFormatString"];
|
||||
NSDateTimeOrdering
|
||||
= [[NSGCString alloc] initWithCString: "NSDateTimeOrdering"];
|
||||
= [[GSCString alloc] initWithCString: "NSDateTimeOrdering"];
|
||||
NSDecimalDigits
|
||||
= [[NSGCString alloc] initWithCString: "NSDecimalDigits"];
|
||||
= [[GSCString alloc] initWithCString: "NSDecimalDigits"];
|
||||
NSDecimalSeparator
|
||||
= [[NSGCString alloc] initWithCString: "NSDecimalSeparator"];
|
||||
= [[GSCString alloc] initWithCString: "NSDecimalSeparator"];
|
||||
NSDefaultRunLoopMode
|
||||
= [[NSGCString alloc] initWithCString: "NSDefaultRunLoopMode"];
|
||||
= [[GSCString alloc] initWithCString: "NSDefaultRunLoopMode"];
|
||||
NSEarlierTimeDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSEarlierTimeDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSEarlierTimeDesignations"];
|
||||
NSFailedAuthenticationException
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSFailedAuthenticationException"];
|
||||
NSFileDeviceIdentifier
|
||||
= [[NSGCString alloc] initWithCString: "NSFileDeviceIdentifier"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileDeviceIdentifier"];
|
||||
NSFileGroupOwnerAccountName
|
||||
= [[NSGCString alloc] initWithCString: "NSFileGroupOwnerAccountName"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileGroupOwnerAccountName"];
|
||||
NSFileGroupOwnerAccountNumber
|
||||
= [[NSGCString alloc] initWithCString: "NSFileGroupOwnerAccountNumber"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileGroupOwnerAccountNumber"];
|
||||
NSFileModificationDate
|
||||
= [[NSGCString alloc] initWithCString: "NSFileModificationDate"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileModificationDate"];
|
||||
NSFileOwnerAccountName
|
||||
= [[NSGCString alloc] initWithCString: "NSFileOwnerAccountName"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileOwnerAccountName"];
|
||||
NSFileOwnerAccountNumber
|
||||
= [[NSGCString alloc] initWithCString: "NSFileOwnerAccountNumber"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileOwnerAccountNumber"];
|
||||
NSFilePosixPermissions
|
||||
= [[NSGCString alloc] initWithCString: "NSFilePosixPermissions"];
|
||||
= [[GSCString alloc] initWithCString: "NSFilePosixPermissions"];
|
||||
NSFileReferenceCount
|
||||
= [[NSGCString alloc] initWithCString: "NSFileReferenceCount"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileReferenceCount"];
|
||||
NSFileSize
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSize"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSize"];
|
||||
NSFileSystemFileNumber
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSystemFileNumber"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemFileNumber"];
|
||||
NSFileSystemFreeNodes
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSystemFreeNodes"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemFreeNodes"];
|
||||
NSFileSystemFreeSize
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSystemFreeSize"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemFreeSize"];
|
||||
NSFileSystemNodes
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSystemNodes"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemNodes"];
|
||||
NSFileSystemNumber
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSystemNumber"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemNumber"];
|
||||
NSFileSystemSize
|
||||
= [[NSGCString alloc] initWithCString: "NSFileSystemSize"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemSize"];
|
||||
NSFileType
|
||||
= [[NSGCString alloc] initWithCString: "NSFileType"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileType"];
|
||||
NSFileTypeBlockSpecial
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeBlockSpecial"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeBlockSpecial"];
|
||||
NSFileTypeCharacterSpecial
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeCharacterSpecial"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeCharacterSpecial"];
|
||||
NSFileTypeDirectory
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeDirectory"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeDirectory"];
|
||||
NSFileTypeFifo
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeFifo"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeFifo"];
|
||||
NSFileTypeRegular
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeRegular"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeRegular"];
|
||||
NSFileTypeSocket
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeSocket"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeSocket"];
|
||||
NSFileTypeSymbolicLink
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeSymbolicLink"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeSymbolicLink"];
|
||||
NSFileTypeUnknown
|
||||
= [[NSGCString alloc] initWithCString: "NSFileTypeUnknown"];
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeUnknown"];
|
||||
NSFormalName
|
||||
= [[NSGCString alloc] initWithCString: "NSFormalName"];
|
||||
= [[GSCString alloc] initWithCString: "NSFormalName"];
|
||||
*(NSString**)&NSGenericException
|
||||
= [[NSGCString alloc] initWithCString: "NSGenericException"];
|
||||
= [[GSCString alloc] initWithCString: "NSGenericException"];
|
||||
NSGlobalDomain
|
||||
= [[NSGCString alloc] initWithCString: "NSGlobalDomain"];
|
||||
= [[GSCString alloc] initWithCString: "NSGlobalDomain"];
|
||||
NSHourNameDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSHourNameDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSHourNameDesignations"];
|
||||
NSInconsistentArchiveException
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSInconsistentArchiveException"];
|
||||
*(NSString**)&NSInternalInconsistencyException
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSInternalInconsistencyException"];
|
||||
NSInternationalCurrencyString
|
||||
= [[NSGCString alloc] initWithCString: "NSInternationalCurrencyString"];
|
||||
= [[GSCString alloc] initWithCString: "NSInternationalCurrencyString"];
|
||||
*(NSString**)&NSInvalidArgumentException
|
||||
= [[NSGCString alloc] initWithCString: "NSInvalidArgumentException"];
|
||||
= [[GSCString alloc] initWithCString: "NSInvalidArgumentException"];
|
||||
NSLanguageCode
|
||||
= [[NSGCString alloc] initWithCString: "NSLanguageCode"];
|
||||
= [[GSCString alloc] initWithCString: "NSLanguageCode"];
|
||||
NSLanguageName
|
||||
= [[NSGCString alloc] initWithCString: "NSLanguageName"];
|
||||
= [[GSCString alloc] initWithCString: "NSLanguageName"];
|
||||
NSLaterTimeDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSLaterTimeDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSLaterTimeDesignations"];
|
||||
NSLoadedClasses
|
||||
= [[NSGCString alloc] initWithCString: "NSLoadedClasses"];
|
||||
= [[GSCString alloc] initWithCString: "NSLoadedClasses"];
|
||||
*(NSString**)&NSMallocException
|
||||
= [[NSGCString alloc] initWithCString: "NSMallocException"];
|
||||
= [[GSCString alloc] initWithCString: "NSMallocException"];
|
||||
NSMonthNameArray
|
||||
= [[NSGCString alloc] initWithCString: "NSMonthNameArray"];
|
||||
= [[GSCString alloc] initWithCString: "NSMonthNameArray"];
|
||||
NSNegativeCurrencyFormatString
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSNegativeCurrencyFormatString"];
|
||||
NSNextDayDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSNextDayDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSNextDayDesignations"];
|
||||
NSNextNextDayDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSNextNextDayDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSNextNextDayDesignations"];
|
||||
NSPortDidBecomeInvalidNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSPortDidBecomeInvalidNotification"];
|
||||
NSPortTimeoutException
|
||||
= [[NSGCString alloc] initWithCString: "NSPortTimeoutException"];
|
||||
= [[GSCString alloc] initWithCString: "NSPortTimeoutException"];
|
||||
NSPositiveCurrencyFormatString
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSPositiveCurrencyFormatString"];
|
||||
NSPriorDayDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSPriorDayDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSPriorDayDesignations"];
|
||||
*(NSString**)&NSRangeException
|
||||
= [[NSGCString alloc] initWithCString: "NSRangeException"];
|
||||
= [[GSCString alloc] initWithCString: "NSRangeException"];
|
||||
NSRegistrationDomain
|
||||
= [[NSGCString alloc] initWithCString: "NSRegistrationDomain"];
|
||||
= [[GSCString alloc] initWithCString: "NSRegistrationDomain"];
|
||||
NSShortDateFormatString
|
||||
= [[NSGCString alloc] initWithCString: "NSShortDateFormatString"];
|
||||
= [[GSCString alloc] initWithCString: "NSShortDateFormatString"];
|
||||
NSShortMonthNameArray
|
||||
= [[NSGCString alloc] initWithCString: "NSShortMonthNameArray"];
|
||||
= [[GSCString alloc] initWithCString: "NSShortMonthNameArray"];
|
||||
NSShortTimeDateFormatString
|
||||
= [[NSGCString alloc] initWithCString: "NSShortTimeDateFormatString"];
|
||||
= [[GSCString alloc] initWithCString: "NSShortTimeDateFormatString"];
|
||||
NSShortWeekDayNameArray
|
||||
= [[NSGCString alloc] initWithCString: "NSShortWeekDayNameArray"];
|
||||
= [[GSCString alloc] initWithCString: "NSShortWeekDayNameArray"];
|
||||
NSShowNonLocalizedStrings
|
||||
= [[NSGCString alloc] initWithCString: "NSShowNonLocalizedStrings"];
|
||||
= [[GSCString alloc] initWithCString: "NSShowNonLocalizedStrings"];
|
||||
NSThisDayDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSThisDayDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSThisDayDesignations"];
|
||||
NSThousandsSeparator
|
||||
= [[NSGCString alloc] initWithCString: "NSThousandsSeparator"];
|
||||
= [[GSCString alloc] initWithCString: "NSThousandsSeparator"];
|
||||
NSThreadWillExitNotification
|
||||
= [[NSGCString alloc] initWithCString: "NSThreadWillExitNotification"];
|
||||
= [[GSCString alloc] initWithCString: "NSThreadWillExitNotification"];
|
||||
NSTimeDateFormatString
|
||||
= [[NSGCString alloc] initWithCString: "NSTimeDateFormatString"];
|
||||
= [[GSCString alloc] initWithCString: "NSTimeDateFormatString"];
|
||||
NSTimeFormatString
|
||||
= [[NSGCString alloc] initWithCString: "NSTimeFormatString"];
|
||||
= [[GSCString alloc] initWithCString: "NSTimeFormatString"];
|
||||
NSUserDefaultsDidChangeNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSUserDefaultsDidChangeNotification"];
|
||||
NSWeekDayNameArray
|
||||
= [[NSGCString alloc] initWithCString: "NSWeekDayNameArray"];
|
||||
= [[GSCString alloc] initWithCString: "NSWeekDayNameArray"];
|
||||
NSWillBecomeMultiThreadedNotification
|
||||
= [[NSGCString alloc] initWithCString:
|
||||
= [[GSCString alloc] initWithCString:
|
||||
"NSWillBecomeMultiThreadedNotification"];
|
||||
NSYearMonthWeekDesignations
|
||||
= [[NSGCString alloc] initWithCString: "NSYearMonthWeekDesignations"];
|
||||
= [[GSCString alloc] initWithCString: "NSYearMonthWeekDesignations"];
|
||||
PortBecameInvalidNotification
|
||||
= [[NSGCString alloc] initWithCString: "PortBecameInvalidNotification"];
|
||||
= [[GSCString alloc] initWithCString: "PortBecameInvalidNotification"];
|
||||
StreamException
|
||||
= [[NSGCString alloc] initWithCString: "StreamException"];
|
||||
= [[GSCString alloc] initWithCString: "StreamException"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Text Property-List parsing code for NSString.m and NSGCString.m
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998,2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: October 1998
|
||||
|
@ -86,7 +86,7 @@ static void setupHexdigits()
|
|||
if (hexdigits == nil)
|
||||
{
|
||||
hexdigits = [NSCharacterSet characterSetWithCharactersInString:
|
||||
@"0123456789abcdef"];
|
||||
@"0123456789abcdefABCDEF"];
|
||||
IF_NO_GC(RETAIN(hexdigits));
|
||||
hexdigitsImp =
|
||||
(BOOL(*)(id,SEL,unichar)) [hexdigits methodForSelector: cMemberSel];
|
||||
|
|
Loading…
Reference in a new issue