mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
Placeholder class used in strings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7999 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b470126721
commit
a4530c1a88
11 changed files with 822 additions and 315 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2000-11-03 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSString.m: Update for placeholder class.
|
||||||
|
* Source/GSString.m: Updates for optimisations using placeholder class.
|
||||||
|
|
||||||
2000-11-01 Richard Frith-Macdonald <rfm@gnu.org>
|
2000-11-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GSXML.m: External entity loader revisions completed.
|
* Source/GSXML.m: External entity loader revisions completed.
|
||||||
|
|
|
@ -326,31 +326,6 @@ enum {
|
||||||
}
|
}
|
||||||
@end
|
@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 free: 1; // Should free memory?
|
|
||||||
unsigned int unused: 2;
|
|
||||||
unsigned int hash: 28;
|
|
||||||
} _flags;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_GNUSTEP
|
#ifndef NO_GNUSTEP
|
||||||
@interface NSString (GSString)
|
@interface NSString (GSString)
|
||||||
|
|
|
@ -173,8 +173,172 @@ encodeBase64(NSData *source)
|
||||||
static NSString*
|
static NSString*
|
||||||
XMLString(NSString* obj)
|
XMLString(NSString* obj)
|
||||||
{
|
{
|
||||||
/* Should substitute in entities */
|
static NSCharacterSet *quotables = nil;
|
||||||
return obj;
|
static char *hexdigits = "0123456789ABCDEF";
|
||||||
|
unsigned end;
|
||||||
|
|
||||||
|
end = [obj length];
|
||||||
|
if (end == 0)
|
||||||
|
{
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quotables == nil)
|
||||||
|
{
|
||||||
|
// setupQuotables();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([obj rangeOfCharacterFromSet: quotables].length > 0)
|
||||||
|
{
|
||||||
|
unichar *base;
|
||||||
|
unichar *map;
|
||||||
|
unichar c;
|
||||||
|
unsigned len;
|
||||||
|
unsigned rpos;
|
||||||
|
unsigned wpos;
|
||||||
|
|
||||||
|
base = NSZoneMalloc(NSDefaultMallocZone(), end * sizeof(unichar));
|
||||||
|
[obj getCharacters: base];
|
||||||
|
for (len = rpos = 0; rpos < end; rpos++)
|
||||||
|
{
|
||||||
|
c = base[rpos];
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '&':
|
||||||
|
len += 5;
|
||||||
|
break;
|
||||||
|
case '<':
|
||||||
|
case '>':
|
||||||
|
len += 4;
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
case '"':
|
||||||
|
len += 5;
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
len += 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (c < 0x20)
|
||||||
|
{
|
||||||
|
if (c == 0x09 || c == 0x0A || c == 0x0D)
|
||||||
|
{
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c > 0xD7FF && c < 0xE000)
|
||||||
|
{
|
||||||
|
len += 6;
|
||||||
|
}
|
||||||
|
else if (c > 0xFFFD)
|
||||||
|
{
|
||||||
|
len += 6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map = NSZoneMalloc(NSDefaultMallocZone(), len * sizeof(unichar));
|
||||||
|
for (wpos = rpos = 0; rpos < end; rpos++)
|
||||||
|
{
|
||||||
|
c = base[rpos];
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '&':
|
||||||
|
map[wpos++] = '&';
|
||||||
|
map[wpos++] = 'a';
|
||||||
|
map[wpos++] = 'm';
|
||||||
|
map[wpos++] = 'p';
|
||||||
|
map[wpos++] = ';';
|
||||||
|
break;
|
||||||
|
case '<':
|
||||||
|
map[wpos++] = '&';
|
||||||
|
map[wpos++] = 'l';
|
||||||
|
map[wpos++] = 't';
|
||||||
|
map[wpos++] = ';';
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
map[wpos++] = '&';
|
||||||
|
map[wpos++] = 'g';
|
||||||
|
map[wpos++] = 't';
|
||||||
|
map[wpos++] = ';';
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
map[wpos++] = '&';
|
||||||
|
map[wpos++] = 'a';
|
||||||
|
map[wpos++] = 'p';
|
||||||
|
map[wpos++] = 'o';
|
||||||
|
map[wpos++] = 's';
|
||||||
|
map[wpos++] = ';';
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
map[wpos++] = '&';
|
||||||
|
map[wpos++] = 'q';
|
||||||
|
map[wpos++] = 'u';
|
||||||
|
map[wpos++] = 'o';
|
||||||
|
map[wpos++] = 't';
|
||||||
|
map[wpos++] = ';';
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (c < 0x20)
|
||||||
|
{
|
||||||
|
if (c == 0x09 || c == 0x0A || c == 0x0D)
|
||||||
|
{
|
||||||
|
map[wpos++] = c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
map[wpos++] = hexdigits[(c>>4) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[c & 0xff];
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c > 0xD7FF && c < 0xE000)
|
||||||
|
{
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
map[wpos++] = hexdigits[(c>>12) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[(c>>8) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[(c>>4) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[c & 0xff];
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
}
|
||||||
|
else if (c > 0xFFFD)
|
||||||
|
{
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
map[wpos++] = hexdigits[(c>>12) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[(c>>8) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[(c>>4) & 0xff];
|
||||||
|
map[wpos++] = hexdigits[c & 0xff];
|
||||||
|
map[wpos++] = '\\';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map[wpos++] = c;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NSZoneFree(NSDefaultMallocZone(), base);
|
||||||
|
return [NSString stringWithCharacters: map length: len];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSString *indentStrings[] = {
|
static NSString *indentStrings[] = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* Implementation for GNUStep of NSString concrete subclasses
|
/* Implementation for GNUStep of NSString concrete subclasses
|
||||||
Copyright (C) 1997,1998,2000 Free Software Foundation, Inc.
|
Copyright (C) 1997,1998,2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by Stevo Crvenkovski <stevo@btinternet.com>
|
Base on code written by Stevo Crvenkovski <stevo@btinternet.com>
|
||||||
Date: February 1997
|
Date: February 1997
|
||||||
|
|
||||||
Based on NSGCString and NSString
|
Based on NSGCString and NSString
|
||||||
|
@ -49,6 +49,37 @@
|
||||||
|
|
||||||
#include <base/Unicode.h>
|
#include <base/Unicode.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GSPlaceholderString - placeholder class for objects awaiting intialisation.
|
||||||
|
*/
|
||||||
|
@interface GSPlaceholderString : NSString
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 NXConstantString (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 free: 1; // Should free memory?
|
||||||
|
unsigned int unused: 2;
|
||||||
|
unsigned int hash: 28;
|
||||||
|
} _flags;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSCString - concrete class for strings using 8-bit character sets.
|
* GSCString - concrete class for strings using 8-bit character sets.
|
||||||
*/
|
*/
|
||||||
|
@ -78,38 +109,47 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSUString - concrete class for strings using 16-bit character sets.
|
* GSCEmptyString - concrete class for empty string
|
||||||
*/
|
*/
|
||||||
@interface GSUString : GSString
|
@interface GSCEmptyString : GSCString
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSUInlineString - concrete subclass of GSUString, that expects the
|
* GSUnicodeString - concrete class for strings using 16-bit character sets.
|
||||||
* characterData to appear in memory immediately after the object itsself.
|
|
||||||
*/
|
*/
|
||||||
@interface GSUInlineString : GSUString
|
@interface GSUnicodeString : GSString
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSUSubString - concrete subclass of GSUString, that relys on the
|
* GSUnicodeInlineString - concrete subclass of GSUnicodeString, that
|
||||||
* data stored in a GSUString object.
|
* expects the characterData to appear in memory immediately after the
|
||||||
|
* object itsself.
|
||||||
*/
|
*/
|
||||||
@interface GSUSubString : GSUString
|
@interface GSUnicodeInlineString : GSUnicodeString
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GSUnicodeSubString - concrete subclass of GSUnicodeString, that
|
||||||
|
* relies on data stored in a GSUnicodeString object.
|
||||||
|
*/
|
||||||
|
@interface GSUnicodeSubString : GSUnicodeString
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
GSUString *_parent;
|
GSUnicodeString *_parent;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSMString - concrete mutable string, capable of changing its storage
|
* GSMutableString - concrete mutable string, capable of changing its storage
|
||||||
* from holding 8-bit to 16-bit character set.
|
* from holding 8-bit to 16-bit character set.
|
||||||
*/
|
*/
|
||||||
@interface GSMString : NSMutableString
|
@interface GSMutableString : NSMutableString
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
unichar *u;
|
unichar *u;
|
||||||
|
@ -131,7 +171,7 @@
|
||||||
* Typedef for access to internals of concrete string objects.
|
* Typedef for access to internals of concrete string objects.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@defs(GSMString)
|
@defs(GSMutableString)
|
||||||
} *ivars;
|
} *ivars;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -180,10 +220,10 @@ static Class GSStringClass = 0;
|
||||||
static Class GSCStringClass = 0;
|
static Class GSCStringClass = 0;
|
||||||
static Class GSCInlineStringClass = 0;
|
static Class GSCInlineStringClass = 0;
|
||||||
static Class GSCSubStringClass = 0;
|
static Class GSCSubStringClass = 0;
|
||||||
static Class GSUStringClass = 0;
|
static Class GSUnicodeStringClass = 0;
|
||||||
static Class GSUSubStringClass = 0;
|
static Class GSUnicodeSubStringClass = 0;
|
||||||
static Class GSUInlineStringClass = 0;
|
static Class GSUnicodeInlineStringClass = 0;
|
||||||
static Class GSMStringClass = 0;
|
static Class GSMutableStringClass = 0;
|
||||||
static Class NXConstantStringClass = 0;
|
static Class NXConstantStringClass = 0;
|
||||||
|
|
||||||
static SEL convertSel;
|
static SEL convertSel;
|
||||||
|
@ -208,18 +248,27 @@ setup()
|
||||||
{
|
{
|
||||||
beenHere = YES;
|
beenHere = YES;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cache pointers to classes to work round misfeature in
|
||||||
|
* GNU compiler/runtime system where class lookup is very slow.
|
||||||
|
*/
|
||||||
NSDataClass = [NSData class];
|
NSDataClass = [NSData class];
|
||||||
NSStringClass = [NSString class];
|
NSStringClass = [NSString class];
|
||||||
GSStringClass = [GSString class];
|
GSStringClass = [GSString class];
|
||||||
GSCStringClass = [GSCString class];
|
GSCStringClass = [GSCString class];
|
||||||
GSUStringClass = [GSUString class];
|
GSUnicodeStringClass = [GSUnicodeString class];
|
||||||
GSCInlineStringClass = [GSCInlineString class];
|
GSCInlineStringClass = [GSCInlineString class];
|
||||||
GSUInlineStringClass = [GSUInlineString class];
|
GSUnicodeInlineStringClass = [GSUnicodeInlineString class];
|
||||||
GSCSubStringClass = [GSCSubString class];
|
GSCSubStringClass = [GSCSubString class];
|
||||||
GSUSubStringClass = [GSUSubString class];
|
GSUnicodeSubStringClass = [GSUnicodeSubString class];
|
||||||
GSMStringClass = [GSMString class];
|
GSMutableStringClass = [GSMutableString class];
|
||||||
NXConstantStringClass = [NXConstantString class];
|
NXConstantStringClass = [NXConstantString class];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cache some selectors and method implementations for
|
||||||
|
* cases where we want to use the implementation
|
||||||
|
* provided in the abstract rolot cllass of the cluster.
|
||||||
|
*/
|
||||||
convertSel = @selector(canBeConvertedToEncoding:);
|
convertSel = @selector(canBeConvertedToEncoding:);
|
||||||
convertImp = (BOOL (*)(id, SEL, NSStringEncoding))
|
convertImp = (BOOL (*)(id, SEL, NSStringEncoding))
|
||||||
[NSStringClass instanceMethodForSelector: convertSel];
|
[NSStringClass instanceMethodForSelector: convertSel];
|
||||||
|
@ -230,21 +279,208 @@ setup()
|
||||||
hashImp = (unsigned (*)(id, SEL))
|
hashImp = (unsigned (*)(id, SEL))
|
||||||
[NSStringClass instanceMethodForSelector: hashSel];
|
[NSStringClass instanceMethodForSelector: hashSel];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cache the default string encoding.
|
||||||
|
*/
|
||||||
defEnc = [NSString defaultCStringEncoding];
|
defEnc = [NSString defaultCStringEncoding];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The GSPlaceholderString class is used by the abstract cluster root
|
||||||
|
* class to provide temporary objects that will be replaced as soon
|
||||||
|
* as the objects are initialised. This object tries to replace
|
||||||
|
* itsself with an appropriate object whose type may vary depending
|
||||||
|
* on the initialisation method used.
|
||||||
|
*/
|
||||||
|
@implementation GSPlaceholderString
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
setup();
|
||||||
|
}
|
||||||
|
- (id) autorelease
|
||||||
|
{
|
||||||
|
return self; // placeholders never get released.
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unichar) characterAtIndex: (unsigned)index
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"attempt to use uninitialised string"];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
return; // placeholders never get deallocated.
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace self with an inline unicode string
|
||||||
|
*/
|
||||||
|
- (id) initWithCharacters: (const unichar*)chars
|
||||||
|
length: (unsigned)length
|
||||||
|
{
|
||||||
|
ivars me;
|
||||||
|
|
||||||
|
me = (ivars)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||||
|
length*sizeof(unichar), GSObjCZone(self));
|
||||||
|
me->_contents.u = (unichar*)&((GSUnicodeInlineString*)me)[1];
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 0;
|
||||||
|
memcpy(me->_contents.u, chars, length*sizeof(unichar));
|
||||||
|
return (id)me;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace self with a simple unicode string
|
||||||
|
*/
|
||||||
|
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||||
|
length: (unsigned)length
|
||||||
|
freeWhenDone: (BOOL)flag
|
||||||
|
{
|
||||||
|
ivars me;
|
||||||
|
|
||||||
|
me = (ivars)NSAllocateObject(GSUnicodeStringClass, 0, GSObjCZone(self));
|
||||||
|
me->_contents.u = chars;
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 0;
|
||||||
|
if (flag == YES)
|
||||||
|
me->_flags.free = 1;
|
||||||
|
return (id)me;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace self with an inline 'C' string
|
||||||
|
*/
|
||||||
|
- (id) initWithCString: (const char*)chars
|
||||||
|
length: (unsigned)length
|
||||||
|
{
|
||||||
|
ivars me;
|
||||||
|
|
||||||
|
me = (ivars)NSAllocateObject(GSCInlineStringClass, length, GSObjCZone(self));
|
||||||
|
me->_contents.c = (char*)&((GSCInlineString*)me)[1];
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 0;
|
||||||
|
memcpy(me->_contents.c, chars, length);
|
||||||
|
return (id)me;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace self with a simple 'C' string
|
||||||
|
*/
|
||||||
|
- (id) initWithCStringNoCopy: (char*)chars
|
||||||
|
length: (unsigned)length
|
||||||
|
freeWhenDone: (BOOL)flag
|
||||||
|
{
|
||||||
|
ivars me;
|
||||||
|
|
||||||
|
me = (ivars)NSAllocateObject(GSCStringClass, 0, GSObjCZone(self));
|
||||||
|
me->_contents.c = chars;
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 0;
|
||||||
|
if (flag == YES)
|
||||||
|
me->_flags.free = 1;
|
||||||
|
return (id)me;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace self with an inline string matching the sort of information
|
||||||
|
* given.
|
||||||
|
*/
|
||||||
|
- (id) initWithString: (NSString*)string
|
||||||
|
{
|
||||||
|
unsigned length;
|
||||||
|
Class c;
|
||||||
|
ivars me;
|
||||||
|
|
||||||
|
if (string == nil)
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"-initWithString: given nil string"];
|
||||||
|
c = GSObjCClass(string);
|
||||||
|
if (GSObjCIsKindOf(c, NSStringClass) == NO)
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"-initWithString: given non-string object"];
|
||||||
|
|
||||||
|
length = [string length];
|
||||||
|
if (GSObjCIsKindOf(c, GSCStringClass) == YES || c == NXConstantStringClass
|
||||||
|
|| (GSObjCIsKindOf(c, GSMutableStringClass) == YES
|
||||||
|
&& ((ivars)string)->_flags.wide == 0))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* For a GSCString subclass, and NXConstantString, or an 8-bit
|
||||||
|
* GSMutableString, we can copy the bytes directly into a GSCString.
|
||||||
|
*/
|
||||||
|
me = (ivars)NSAllocateObject(GSCInlineStringClass,
|
||||||
|
length, GSObjCZone(self));
|
||||||
|
me->_contents.c = (char*)&((GSCInlineString*)me)[1];
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 0;
|
||||||
|
memcpy(me->_contents.c, ((ivars)string)->_contents.c, length);
|
||||||
|
}
|
||||||
|
else if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||||
|
|| GSObjCIsKindOf(c, GSMutableStringClass) == YES)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* For a GSUnicodeString subclass, or a 16-bit GSMutableString,
|
||||||
|
* we can copy the bytes directly into a GSUnicodeString.
|
||||||
|
*/
|
||||||
|
me = (ivars)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||||
|
length*sizeof(unichar), GSObjCZone(self));
|
||||||
|
me->_contents.u = (unichar*)&((GSUnicodeInlineString*)me)[1];
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 1;
|
||||||
|
memcpy(me->_contents.u, ((ivars)string)->_contents.u,
|
||||||
|
length*sizeof(unichar));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* For a string with an unknown class, we can initialise by
|
||||||
|
* having the string copy its content directly into our buffer.
|
||||||
|
*/
|
||||||
|
me = (ivars)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||||
|
length*sizeof(unichar), GSObjCZone(self));
|
||||||
|
me->_contents.u = (unichar*)&((GSUnicodeInlineString*)me)[1];
|
||||||
|
me->_count = length;
|
||||||
|
me->_flags.wide = 1;
|
||||||
|
[string getCharacters: me->_contents.u];
|
||||||
|
}
|
||||||
|
return (id)me;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned) length
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"attempt to use uninitialised string"];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) release
|
||||||
|
{
|
||||||
|
return; // placeholders never get released.
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) retain
|
||||||
|
{
|
||||||
|
return self; // placeholders never get retained.
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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 NXConstant inherit methods from GSCString.
|
||||||
* GSUString uses the functions with the _u suffix.
|
* GSUnicodeString uses the functions with the _u suffix.
|
||||||
* GSUSubString inherits methods from GSUString.
|
* GSUnicodeSubString inherits methods from GSUnicodeString.
|
||||||
* GSMString uses all the functions, selecting the _c or _u versions
|
* GSMutableString uses all the functions, selecting the _c or _u versions
|
||||||
* depending on whether its storage is 8-bit or 16-bit.
|
* depending on whether its storage is 8-bit or 16-bit.
|
||||||
* In addition, GSMString uses a few functions without a suffix that are
|
* In addition, GSMutableString uses a few functions without a suffix that are
|
||||||
* peculiar to its memory management (shrinking, growing, and converting).
|
* peculiar to its memory management (shrinking, growing, and converting).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -360,12 +596,12 @@ compare_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
return strCompCsNs((id)self, aString, mask, aRange);
|
return strCompCsNs((id)self, aString, mask, aRange);
|
||||||
|
|
||||||
c = GSObjCClass(aString);
|
c = GSObjCClass(aString);
|
||||||
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||||
|| (c == GSMStringClass && ((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 == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && ((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
|
||||||
return strCompCsNs((id)self, aString, mask, aRange);
|
return strCompCsNs((id)self, aString, mask, aRange);
|
||||||
|
@ -382,12 +618,12 @@ compare_u(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
return strCompUsNs((id)self, aString, mask, aRange);
|
return strCompUsNs((id)self, aString, mask, aRange);
|
||||||
|
|
||||||
c = GSObjCClass(aString);
|
c = GSObjCClass(aString);
|
||||||
if (GSObjCIsKindOf(c, GSUStringClass)
|
if (GSObjCIsKindOf(c, GSUnicodeStringClass)
|
||||||
|| (c == GSMStringClass && ((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 == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && ((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
|
||||||
return strCompUsNs((id)self, aString, mask, aRange);
|
return strCompUsNs((id)self, aString, mask, aRange);
|
||||||
|
@ -950,7 +1186,7 @@ makeHole(ivars self, int index, int size)
|
||||||
#if GS_WITH_GC
|
#if GS_WITH_GC
|
||||||
self->_zone = GSAtomicMallocZone();
|
self->_zone = GSAtomicMallocZone();
|
||||||
#else
|
#else
|
||||||
self->_zone = GSObjCZone((NSObject*)self);
|
self->_zone = GSObjCZone((NSString*)self);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (self->_flags.wide == 1)
|
if (self->_flags.wide == 1)
|
||||||
|
@ -1058,12 +1294,12 @@ rangeOfString_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
return strRangeCsNs((id)self, aString, mask, aRange);
|
return strRangeCsNs((id)self, aString, mask, aRange);
|
||||||
|
|
||||||
c = GSObjCClass(aString);
|
c = GSObjCClass(aString);
|
||||||
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||||
|| (c == GSMStringClass && ((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 == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && ((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
|
||||||
return strRangeCsNs((id)self, aString, mask, aRange);
|
return strRangeCsNs((id)self, aString, mask, aRange);
|
||||||
|
@ -1080,12 +1316,12 @@ rangeOfString_u(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
||||||
return strRangeUsNs((id)self, aString, mask, aRange);
|
return strRangeUsNs((id)self, aString, mask, aRange);
|
||||||
|
|
||||||
c = GSObjCClass(aString);
|
c = GSObjCClass(aString);
|
||||||
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||||
|| (c == GSMStringClass && ((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 == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && ((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
|
||||||
return strRangeUsNs((id)self, aString, mask, aRange);
|
return strRangeUsNs((id)self, aString, mask, aRange);
|
||||||
|
@ -1096,7 +1332,8 @@ substring_c(ivars self, NSRange aRange)
|
||||||
{
|
{
|
||||||
GSCSubString *sub;
|
GSCSubString *sub;
|
||||||
|
|
||||||
sub = [GSCSubStringClass allocWithZone: NSDefaultMallocZone()];
|
sub = (GSCSubString*)NSAllocateObject(GSCSubStringClass, 0,
|
||||||
|
NSDefaultMallocZone());
|
||||||
sub = [sub initWithCStringNoCopy: self->_contents.c + aRange.location
|
sub = [sub initWithCStringNoCopy: self->_contents.c + aRange.location
|
||||||
length: aRange.length
|
length: aRange.length
|
||||||
freeWhenDone: NO];
|
freeWhenDone: NO];
|
||||||
|
@ -1111,9 +1348,10 @@ substring_c(ivars self, NSRange aRange)
|
||||||
static inline NSString*
|
static inline NSString*
|
||||||
substring_u(ivars self, NSRange aRange)
|
substring_u(ivars self, NSRange aRange)
|
||||||
{
|
{
|
||||||
GSUSubString *sub;
|
GSUnicodeSubString *sub;
|
||||||
|
|
||||||
sub = [GSUSubStringClass allocWithZone: NSDefaultMallocZone()];
|
sub = (GSUnicodeSubString*)NSAllocateObject(GSUnicodeSubStringClass, 0,
|
||||||
|
NSDefaultMallocZone());
|
||||||
sub = [sub initWithCharactersNoCopy: self->_contents.u + aRange.location
|
sub = [sub initWithCharactersNoCopy: self->_contents.u + aRange.location
|
||||||
length: aRange.length
|
length: aRange.length
|
||||||
freeWhenDone: NO];
|
freeWhenDone: NO];
|
||||||
|
@ -1150,8 +1388,8 @@ transmute(ivars self, NSString *aString)
|
||||||
* string whose ivars we can access directly.
|
* string whose ivars we can access directly.
|
||||||
*/
|
*/
|
||||||
transmute = NO;
|
transmute = NO;
|
||||||
if ((c != GSMStringClass || other->_flags.wide != 1)
|
if ((c != GSMutableStringClass || other->_flags.wide != 1)
|
||||||
&& c != GSUStringClass)
|
&& c != GSUnicodeStringClass)
|
||||||
{
|
{
|
||||||
other = 0;
|
other = 0;
|
||||||
}
|
}
|
||||||
|
@ -1159,7 +1397,7 @@ transmute(ivars self, NSString *aString)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (c == GSCStringClass || c == NXConstantStringClass
|
if (c == GSCStringClass || c == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && other->_flags.wide == 0))
|
|| (c == GSMutableStringClass && other->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is a C string, but the other string is also a C string
|
* This is a C string, but the other string is also a C string
|
||||||
|
@ -1177,8 +1415,8 @@ transmute(ivars self, NSString *aString)
|
||||||
transmute = NO;
|
transmute = NO;
|
||||||
other = 0;
|
other = 0;
|
||||||
}
|
}
|
||||||
else if ((c == GSMStringClass && other->_flags.wide == 1)
|
else if ((c == GSMutableStringClass && other->_flags.wide == 1)
|
||||||
|| c == GSUStringClass)
|
|| c == GSUnicodeStringClass)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is a C string, and the other string can not be converted
|
* This is a C string, and the other string can not be converted
|
||||||
|
@ -1201,9 +1439,10 @@ transmute(ivars self, NSString *aString)
|
||||||
if (transmute == YES)
|
if (transmute == YES)
|
||||||
{
|
{
|
||||||
unichar *tmp;
|
unichar *tmp;
|
||||||
|
int len;
|
||||||
|
|
||||||
tmp = NSZoneMalloc(self->_zone, self->_capacity * sizeof(unichar));
|
tmp = NSZoneMalloc(self->_zone, self->_capacity * sizeof(unichar));
|
||||||
encode_strtoustr(tmp, self->_contents.c, self->_count, defEnc);
|
len = encode_strtoustr(tmp, self->_contents.c, self->_count, defEnc);
|
||||||
if (self->_flags.free == 1)
|
if (self->_flags.free == 1)
|
||||||
{
|
{
|
||||||
NSZoneFree(self->_zone, self->_contents.c);
|
NSZoneFree(self->_zone, self->_contents.c);
|
||||||
|
@ -1214,6 +1453,7 @@ transmute(ivars self, NSString *aString)
|
||||||
}
|
}
|
||||||
self->_contents.u = tmp;
|
self->_contents.u = tmp;
|
||||||
self->_flags.wide = 1;
|
self->_flags.wide = 1;
|
||||||
|
self->_count = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return other;
|
return other;
|
||||||
|
@ -1221,6 +1461,13 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The GSString class is actually only provided to provide a common ivar
|
||||||
|
* layout for all subclasses, so that they can all share the same code.
|
||||||
|
* We don't expect this class to ever be instantiated, but we do provide
|
||||||
|
* a common deallocation method, and standard initialisation methods that
|
||||||
|
* will try to convert an instance to a type we can really use if necessary.
|
||||||
|
*/
|
||||||
@implementation GSString
|
@implementation GSString
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
@ -1232,45 +1479,67 @@ transmute(ivars self, NSString *aString)
|
||||||
NSDeallocateObject(self);
|
NSDeallocateObject(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to initialise a unicode string.
|
||||||
|
*/
|
||||||
- (id) initWithCharactersNoCopy: (unichar*)chars
|
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||||
length: (unsigned int)length
|
length: (unsigned int)length
|
||||||
freeWhenDone: (BOOL)flag
|
freeWhenDone: (BOOL)flag
|
||||||
{
|
{
|
||||||
isa = GSUStringClass;
|
if (isa == GSStringClass)
|
||||||
|
{
|
||||||
|
isa = GSUnicodeStringClass;
|
||||||
|
}
|
||||||
|
else if (_contents.u != 0)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"re-initialisation of string"];
|
||||||
|
}
|
||||||
_count = length;
|
_count = length;
|
||||||
_contents.u = chars;
|
_contents.u = chars;
|
||||||
_flags.wide = 1;
|
_flags.wide = 1;
|
||||||
if (flag == YES)
|
if (flag == YES)
|
||||||
_flags.free = 1;
|
{
|
||||||
|
_flags.free = 1;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to initialise a 'C' string.
|
||||||
|
*/
|
||||||
- (id) initWithCStringNoCopy: (char*)chars
|
- (id) initWithCStringNoCopy: (char*)chars
|
||||||
length: (unsigned int)length
|
length: (unsigned int)length
|
||||||
freeWhenDone: (BOOL)flag
|
freeWhenDone: (BOOL)flag
|
||||||
{
|
{
|
||||||
isa = GSCStringClass;
|
if (isa == GSStringClass)
|
||||||
|
{
|
||||||
|
isa = GSCStringClass;
|
||||||
|
}
|
||||||
|
else if (_contents.c != 0)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"re-initialisation of string"];
|
||||||
|
}
|
||||||
_count = length;
|
_count = length;
|
||||||
_contents.c = chars;
|
_contents.c = chars;
|
||||||
_flags.wide = 0;
|
_flags.wide = 0;
|
||||||
if (flag == YES)
|
if (flag == YES)
|
||||||
_flags.free = 1;
|
{
|
||||||
|
_flags.free = 1;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The GSCString class is the basic implementation of a concrete
|
||||||
|
* 8-bit string class, storing immutable data in a single buffer.
|
||||||
|
*/
|
||||||
@implementation GSCString
|
@implementation GSCString
|
||||||
|
|
||||||
+ (id) alloc
|
|
||||||
{
|
|
||||||
return NSAllocateObject (self, 0, NSDefaultMallocZone());
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
|
||||||
{
|
|
||||||
return NSAllocateObject (self, 0, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
|
@ -1448,16 +1717,19 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
- (id) mutableCopy
|
- (id) mutableCopy
|
||||||
{
|
{
|
||||||
GSMString *obj = [GSMStringClass allocWithZone: NSDefaultMallocZone()];
|
GSMutableString *obj;
|
||||||
|
|
||||||
|
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
|
||||||
|
NSDefaultMallocZone());
|
||||||
obj = [obj initWithCString: _contents.c length: _count];
|
obj = [obj initWithCString: _contents.c length: _count];
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)z
|
- (id) mutableCopyWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
GSMString *obj = [GSMStringClass allocWithZone: z];
|
GSMutableString *obj;
|
||||||
|
|
||||||
|
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
|
||||||
obj = [obj initWithCString: _contents.c length: _count];
|
obj = [obj initWithCString: _contents.c length: _count];
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -1501,12 +1773,22 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The GSCInlineString class is a GSCString subclass that stores data
|
||||||
|
* in memory immediately after the object.
|
||||||
|
*/
|
||||||
@implementation GSCInlineString
|
@implementation GSCInlineString
|
||||||
- (id) initWithCString: (const char*)chars length: (unsigned)length
|
- (id) initWithCString: (const char*)chars length: (unsigned)length
|
||||||
{
|
{
|
||||||
|
if (_contents.c != 0)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"re-initialisation of string"];
|
||||||
|
}
|
||||||
_count = length;
|
_count = length;
|
||||||
_contents.c = (unsigned char*)&self[1];
|
_contents.c = (unsigned char*)&self[1];
|
||||||
memcpy(_contents.c, chars, length);
|
if (_count > 0)
|
||||||
|
memcpy(_contents.c, chars, length);
|
||||||
_flags.wide = 0;
|
_flags.wide = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -1516,6 +1798,12 @@ transmute(ivars self, NSString *aString)
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The GSCSubString class is a GSCString subclass that points into
|
||||||
|
* a section of a parent constant string class.
|
||||||
|
*/
|
||||||
@implementation GSCSubString
|
@implementation GSCSubString
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
@ -1526,17 +1814,7 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation GSUString
|
@implementation GSUnicodeString
|
||||||
|
|
||||||
+ (id) alloc
|
|
||||||
{
|
|
||||||
return NSAllocateObject (self, 0, NSDefaultMallocZone());
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
|
||||||
{
|
|
||||||
return NSAllocateObject (self, 0, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
|
@ -1569,9 +1847,9 @@ transmute(ivars self, NSString *aString)
|
||||||
{
|
{
|
||||||
if (NSShouldRetainWithZone(self, NSDefaultMallocZone()) == NO)
|
if (NSShouldRetainWithZone(self, NSDefaultMallocZone()) == NO)
|
||||||
{
|
{
|
||||||
GSUString *obj;
|
GSUnicodeString *obj;
|
||||||
|
|
||||||
obj = (GSUString*)NSCopyObject(self, 0, NSDefaultMallocZone());
|
obj = (GSUnicodeString*)NSCopyObject(self, 0, NSDefaultMallocZone());
|
||||||
if (_contents.u != 0)
|
if (_contents.u != 0)
|
||||||
{
|
{
|
||||||
unichar *tmp;
|
unichar *tmp;
|
||||||
|
@ -1594,7 +1872,8 @@ transmute(ivars self, NSString *aString)
|
||||||
{
|
{
|
||||||
NSString *obj;
|
NSString *obj;
|
||||||
|
|
||||||
obj = (NSString*)NSAllocateObject(GSUInlineStringClass, _count*2, z);
|
obj = (NSString*)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||||
|
_count*2, z);
|
||||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -1718,16 +1997,19 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
- (id) mutableCopy
|
- (id) mutableCopy
|
||||||
{
|
{
|
||||||
GSMString *obj = [GSMStringClass allocWithZone: NSDefaultMallocZone()];
|
GSMutableString *obj;
|
||||||
|
|
||||||
|
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
|
||||||
|
NSDefaultMallocZone());
|
||||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)z
|
- (id) mutableCopyWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
GSMString *obj = [GSMStringClass allocWithZone: z];
|
GSMutableString *obj;
|
||||||
|
|
||||||
|
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
|
||||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -1777,12 +2059,18 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation GSUInlineString
|
@implementation GSUnicodeInlineString
|
||||||
- (id) initWithCharacters: (const unichar*)chars length: (unsigned)length
|
- (id) initWithCharacters: (const unichar*)chars length: (unsigned)length
|
||||||
{
|
{
|
||||||
|
if (_contents.u != 0)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"re-initialisation of string"];
|
||||||
|
}
|
||||||
_count = length;
|
_count = length;
|
||||||
_contents.u = (unichar*)&self[1];
|
_contents.u = (unichar*)&self[1];
|
||||||
memcpy(_contents.u, chars, length*sizeof(unichar));
|
if (_count > 0)
|
||||||
|
memcpy(_contents.u, chars, length*sizeof(unichar));
|
||||||
_flags.wide = 1;
|
_flags.wide = 1;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -1792,7 +2080,13 @@ transmute(ivars self, NSString *aString)
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GSUSubString
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The GSUnicodeSubString class is a GSUnicodeString subclass that points
|
||||||
|
* into a section of a parent constant string class.
|
||||||
|
*/
|
||||||
|
@implementation GSUnicodeSubString
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
RELEASE(_parent);
|
RELEASE(_parent);
|
||||||
|
@ -1802,17 +2096,15 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation GSMString
|
/*
|
||||||
|
* The GSMutableStrinc class shares a common initial ivar layout with
|
||||||
+ (id) alloc
|
* the GSString class, but adds a few of its own. It uses _flags.wide
|
||||||
{
|
* to determine whether it should use 8-bit or 16-bit characters and
|
||||||
return NSAllocateObject (self, 0, NSDefaultMallocZone());
|
* is caapable of changing that flag (and its underlying storage) to
|
||||||
}
|
* move from an 8-bit to a 16-bit representation is that should be
|
||||||
|
* necessary because wide characters have been placed in the string.
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
*/
|
||||||
{
|
@implementation GSMutableString
|
||||||
return NSAllocateObject (self, 0, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
|
@ -1859,12 +2151,14 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
{
|
{
|
||||||
copy = [GSUStringClass allocWithZone: NSDefaultMallocZone()];
|
copy = NSAllocateObject(GSUnicodeInlineStringClass,
|
||||||
|
_count*sizeof(unichar), NSDefaultMallocZone());
|
||||||
copy = [copy initWithCharacters: _contents.u length: _count];
|
copy = [copy initWithCharacters: _contents.u length: _count];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
copy = [GSCStringClass allocWithZone: NSDefaultMallocZone()];
|
copy = NSAllocateObject(GSCInlineStringClass,
|
||||||
|
_count, NSDefaultMallocZone());
|
||||||
copy = [copy initWithCString: _contents.c length: _count];
|
copy = [copy initWithCString: _contents.c length: _count];
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
|
@ -1876,7 +2170,7 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
{
|
{
|
||||||
copy = (NSString*)NSAllocateObject(GSUInlineStringClass,
|
copy = (NSString*)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||||
_count*sizeof(unichar), z);
|
_count*sizeof(unichar), z);
|
||||||
copy = [copy initWithCharacters: _contents.u length: _count];
|
copy = [copy initWithCharacters: _contents.u length: _count];
|
||||||
}
|
}
|
||||||
|
@ -2157,7 +2451,10 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
- (id) mutableCopy
|
- (id) mutableCopy
|
||||||
{
|
{
|
||||||
GSMString *obj = [GSMStringClass allocWithZone: NSDefaultMallocZone()];
|
GSMutableString *obj;
|
||||||
|
|
||||||
|
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
|
||||||
|
NSDefaultMallocZone());
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||||
|
@ -2168,7 +2465,9 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)z
|
- (id) mutableCopyWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
GSMString *obj = [GSMStringClass allocWithZone: z];
|
GSMutableString *obj;
|
||||||
|
|
||||||
|
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||||
|
@ -2346,7 +2645,7 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
{
|
{
|
||||||
return [GSUStringClass stringWithCharacters:
|
return [GSUnicodeStringClass stringWithCharacters:
|
||||||
self->_contents.u + aRange.location length: aRange.length];
|
self->_contents.u + aRange.location length: aRange.length];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2362,7 +2661,7 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
{
|
{
|
||||||
return [GSUStringClass stringWithCharacters:
|
return [GSUnicodeStringClass stringWithCharacters:
|
||||||
self->_contents.u + aRange.location length: aRange.length];
|
self->_contents.u + aRange.location length: aRange.length];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2393,22 +2692,16 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The NXConstantString class is used by the compiler for constant
|
||||||
|
* strings, as such its ivar layout is determined by the compiler
|
||||||
|
* and consists of a pointer (_contents.c) and a character count
|
||||||
|
* (_count). So, while this class inherits GSCString behavior,
|
||||||
|
* the code must make sure not to use any other GSCString ivars
|
||||||
|
* when accesssing an NXConstantString.
|
||||||
|
*/
|
||||||
@implementation NXConstantString
|
@implementation NXConstantString
|
||||||
|
|
||||||
+ (id) alloc
|
|
||||||
{
|
|
||||||
[NSException raise: NSGenericException
|
|
||||||
format: @"Attempt to allocate an NXConstantString"];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
|
||||||
{
|
|
||||||
[NSException raise: NSGenericException
|
|
||||||
format: @"Attempt to allocate an NXConstantString"];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NXConstantString class])
|
if (self == [NXConstantString class])
|
||||||
|
@ -2550,7 +2843,7 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && ((ivars)anObject)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
ivars other = (ivars)anObject;
|
ivars other = (ivars)anObject;
|
||||||
|
|
||||||
|
@ -2560,8 +2853,8 @@ transmute(ivars self, NSString *aString)
|
||||||
return NO;
|
return NO;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
else if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
else if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||||
|| c == GSMStringClass)
|
|| c == GSMutableStringClass)
|
||||||
{
|
{
|
||||||
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
|
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
|
||||||
return YES;
|
return YES;
|
||||||
|
@ -2597,7 +2890,7 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||||
|| c == NXConstantStringClass
|
|| c == NXConstantStringClass
|
||||||
|| (c == GSMStringClass && ((ivars)anObject)->_flags.wide == 0))
|
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||||
{
|
{
|
||||||
ivars other = (ivars)anObject;
|
ivars other = (ivars)anObject;
|
||||||
|
|
||||||
|
@ -2607,8 +2900,8 @@ transmute(ivars self, NSString *aString)
|
||||||
return NO;
|
return NO;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
else if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
else if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||||
|| c == GSMStringClass)
|
|| c == GSMutableStringClass)
|
||||||
{
|
{
|
||||||
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
|
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
|
||||||
return YES;
|
return YES;
|
||||||
|
@ -2668,7 +2961,7 @@ transmute(ivars self, NSString *aString)
|
||||||
unsigned count;
|
unsigned count;
|
||||||
|
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
self = [GSMString alloc];
|
self = [GSMutableString alloc];
|
||||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
@ -2698,7 +2991,7 @@ transmute(ivars self, NSString *aString)
|
||||||
unsigned count;
|
unsigned count;
|
||||||
|
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
self = [GSUString alloc];
|
self = [GSUnicodeString alloc];
|
||||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
@ -2728,7 +3021,7 @@ transmute(ivars self, NSString *aString)
|
||||||
unsigned count;
|
unsigned count;
|
||||||
|
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
self = [GSMString alloc];
|
self = [GSMutableString alloc];
|
||||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ GSNumberInfoFromObject(NSNumber *o)
|
||||||
GSNumberInfo *info;
|
GSNumberInfo *info;
|
||||||
|
|
||||||
if (o == nil)
|
if (o == nil)
|
||||||
return nil;
|
return 0;
|
||||||
c = GSObjCClass(o);
|
c = GSObjCClass(o);
|
||||||
info = (GSNumberInfo*)NSMapGet (numberMap, (void*)c);
|
info = (GSNumberInfo*)NSMapGet (numberMap, (void*)c);
|
||||||
if (info == 0)
|
if (info == 0)
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <GSConfig.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSSet.h>
|
#include <Foundation/NSSet.h>
|
||||||
|
|
|
@ -35,14 +35,16 @@
|
||||||
@implementation NSScanner
|
@implementation NSScanner
|
||||||
|
|
||||||
@class GSCString;
|
@class GSCString;
|
||||||
@class GSUString;
|
@class GSUnicodeString;
|
||||||
@class GSMString;
|
@class GSMutableString;
|
||||||
|
@class GSPlaceholderString;
|
||||||
|
|
||||||
static Class NSString_class;
|
static Class NSStringClass;
|
||||||
static Class GSCString_class;
|
static Class GSCStringClass;
|
||||||
static Class GSUString_class;
|
static Class GSUnicodeStringClass;
|
||||||
static Class GSMString_class;
|
static Class GSMutableStringClass;
|
||||||
static Class NXConstantString_class;
|
static Class GSPlaceholderStringClass;
|
||||||
|
static Class NXConstantStringClass;
|
||||||
static NSCharacterSet *defaultSkipSet;
|
static NSCharacterSet *defaultSkipSet;
|
||||||
static SEL memSel;
|
static SEL memSel;
|
||||||
|
|
||||||
|
@ -77,11 +79,12 @@ typedef struct {
|
||||||
memSel = @selector(characterIsMember:);
|
memSel = @selector(characterIsMember:);
|
||||||
defaultSkipSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
defaultSkipSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
IF_NO_GC(RETAIN(defaultSkipSet));
|
IF_NO_GC(RETAIN(defaultSkipSet));
|
||||||
NSString_class = [NSString class];
|
NSStringClass = [NSString class];
|
||||||
GSCString_class = [GSCString class];
|
GSCStringClass = [GSCString class];
|
||||||
GSUString_class = [GSUString class];
|
GSUnicodeStringClass = [GSUnicodeString class];
|
||||||
GSMString_class = [GSMString class];
|
GSMutableStringClass = [GSMutableString class];
|
||||||
NXConstantString_class = [NXConstantString class];
|
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||||
|
NXConstantStringClass = [NXConstantString class];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,42 +130,42 @@ typedef struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
c = GSObjCClass(aString);
|
c = GSObjCClass(aString);
|
||||||
if (c == GSUString_class)
|
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES)
|
||||||
{
|
{
|
||||||
_isUnicode = YES;
|
_isUnicode = YES;
|
||||||
_string = RETAIN(aString);
|
_string = RETAIN(aString);
|
||||||
}
|
}
|
||||||
else if (c == GSCString_class)
|
else if (GSObjCIsKindOf(c, GSCStringClass) == YES)
|
||||||
{
|
{
|
||||||
_isUnicode = NO;
|
_isUnicode = NO;
|
||||||
_string = RETAIN(aString);
|
_string = RETAIN(aString);
|
||||||
}
|
}
|
||||||
else if (c == GSMString_class)
|
else if (GSObjCIsKindOf(c, GSMutableStringClass) == YES)
|
||||||
{
|
{
|
||||||
|
_string = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0);
|
||||||
if (((ivars)aString)->_flags.wide == 1)
|
if (((ivars)aString)->_flags.wide == 1)
|
||||||
{
|
{
|
||||||
_isUnicode = YES;
|
_isUnicode = YES;
|
||||||
_string = [GSUString_class allocWithZone: NSDefaultMallocZone()];
|
|
||||||
_string = [_string initWithCharacters: ((ivars)aString)->_contents.u
|
_string = [_string initWithCharacters: ((ivars)aString)->_contents.u
|
||||||
length: ((ivars)aString)->_count];
|
length: ((ivars)aString)->_count];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_isUnicode = NO;
|
_isUnicode = NO;
|
||||||
_string = [GSCString_class allocWithZone: NSDefaultMallocZone()];
|
|
||||||
_string = [_string initWithCString: ((ivars)aString)->_contents.c
|
_string = [_string initWithCString: ((ivars)aString)->_contents.c
|
||||||
length: ((ivars)aString)->_count];
|
length: ((ivars)aString)->_count];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == NXConstantString_class)
|
else if (c == NXConstantStringClass)
|
||||||
{
|
{
|
||||||
_isUnicode = NO;
|
_isUnicode = NO;
|
||||||
_string = RETAIN(aString);
|
_string = RETAIN(aString);
|
||||||
}
|
}
|
||||||
else if ([aString isKindOfClass: NSString_class])
|
else if ([aString isKindOfClass: NSStringClass])
|
||||||
{
|
{
|
||||||
_isUnicode = YES;
|
_isUnicode = YES;
|
||||||
_string = [[GSUString_class alloc] initWithString: aString];
|
_string = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0);
|
||||||
|
_string = [_string initWithString: aString];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
@class NSGMutableDictionary;
|
@class NSGMutableDictionary;
|
||||||
@class NSDataMalloc;
|
@class NSDataMalloc;
|
||||||
@class GSCString;
|
@class GSCString;
|
||||||
@class GSUString;
|
@class GSUnicodeString;
|
||||||
@class GSMString;
|
@class GSMutableString;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup for inline operation of string map tables.
|
* Setup for inline operation of string map tables.
|
||||||
|
@ -313,7 +313,7 @@ static BOOL shouldBeCompact = NO;
|
||||||
MutableDictionaryClass = [NSMutableDictionary class];
|
MutableDictionaryClass = [NSMutableDictionary class];
|
||||||
StringClass = [NSString class];
|
StringClass = [NSString class];
|
||||||
CStringClass = [GSCString class];
|
CStringClass = [GSCString class];
|
||||||
MStringClass = [GSMString class];
|
MStringClass = [GSMutableString class];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,8 +444,9 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
||||||
case ST_CSTRING:
|
case ST_CSTRING:
|
||||||
{
|
{
|
||||||
GSCString *s;
|
GSCString *s;
|
||||||
char *b = NSZoneMalloc(NSDefaultMallocZone(), size);
|
char *b;
|
||||||
|
|
||||||
|
b = NSZoneMalloc(NSDefaultMallocZone(), size);
|
||||||
(*info->debImp)(info->data, debSel, b, size, info->cursor);
|
(*info->debImp)(info->data, debSel, b, size, info->cursor);
|
||||||
s = (GSCString*)NSAllocateObject(CSCls, 0, NSDefaultMallocZone());
|
s = (GSCString*)NSAllocateObject(CSCls, 0, NSDefaultMallocZone());
|
||||||
s = (*csInitImp)(s, csInitSel, b, size-1, YES);
|
s = (*csInitImp)(s, csInitSel, b, size-1, YES);
|
||||||
|
@ -467,11 +468,14 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
||||||
|
|
||||||
case ST_STRING:
|
case ST_STRING:
|
||||||
{
|
{
|
||||||
GSUString *s;
|
GSUnicodeString *s;
|
||||||
unichar *b = NSZoneMalloc(NSDefaultMallocZone(), size*2);
|
unichar *b;
|
||||||
|
|
||||||
(*info->debImp)(info->data, debSel, b, size*2, info->cursor);
|
b = NSZoneMalloc(NSDefaultMallocZone(), size*sizeof(unichar));
|
||||||
s = (GSUString*)NSAllocateObject(USCls, 0, NSDefaultMallocZone());
|
(*info->debImp)(info->data, debSel, b, size*sizeof(unichar),
|
||||||
|
info->cursor);
|
||||||
|
s = (GSUnicodeString*)NSAllocateObject(USCls,
|
||||||
|
0, NSDefaultMallocZone());
|
||||||
s = (*usInitImp)(s, usInitSel, b, size, YES);
|
s = (*usInitImp)(s, usInitSel, b, size, YES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -695,7 +699,7 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
||||||
DCls = [NSDataMalloc class];
|
DCls = [NSDataMalloc class];
|
||||||
IDCls = [NSGDictionary class];
|
IDCls = [NSGDictionary class];
|
||||||
MDCls = [NSGMutableDictionary class];
|
MDCls = [NSGMutableDictionary class];
|
||||||
USCls = [GSUString class];
|
USCls = [GSUnicodeString class];
|
||||||
CSCls = [GSCString class];
|
CSCls = [GSCString class];
|
||||||
csInitImp = [CSCls instanceMethodForSelector: csInitSel];
|
csInitImp = [CSCls instanceMethodForSelector: csInitSel];
|
||||||
usInitImp = [USCls instanceMethodForSelector: usInitSel];
|
usInitImp = [USCls instanceMethodForSelector: usInitSel];
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
#include <Foundation/NSBundle.h>
|
#include <Foundation/NSBundle.h>
|
||||||
#include <Foundation/NSURL.h>
|
#include <Foundation/NSURL.h>
|
||||||
|
#include <Foundation/NSMapTable.h>
|
||||||
|
#include <Foundation/NSLock.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h> // for strstr()
|
#include <string.h> // for strstr()
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -71,10 +73,8 @@
|
||||||
#include <base/Unicode.h>
|
#include <base/Unicode.h>
|
||||||
|
|
||||||
@class GSString;
|
@class GSString;
|
||||||
@class GSMString;
|
@class GSMutableString;
|
||||||
@class GSUString;
|
@class GSPlaceholderString;
|
||||||
@class GSCInlineString;
|
|
||||||
@class GSUInlineString;
|
|
||||||
@class NSGMutableArray;
|
@class NSGMutableArray;
|
||||||
@class NSGMutableDictionary;
|
@class NSGMutableDictionary;
|
||||||
|
|
||||||
|
@ -87,10 +87,12 @@ static Class NSStringClass;
|
||||||
static Class NSMutableStringClass;
|
static Class NSMutableStringClass;
|
||||||
|
|
||||||
static Class GSStringClass;
|
static Class GSStringClass;
|
||||||
static Class GSMStringClass;
|
static Class GSMutableStringClass;
|
||||||
static Class GSUStringClass;
|
static Class GSPlaceholderStringClass;
|
||||||
static Class GSCInlineStringClass;
|
|
||||||
static Class GSUInlineStringClass;
|
static GSPlaceholderString *defaultPlaceholderString;
|
||||||
|
static NSMapTable *placeholderMap;
|
||||||
|
static NSLock *placeholderLock;
|
||||||
|
|
||||||
static Class plArray;
|
static Class plArray;
|
||||||
static id (*plAdd)(id, SEL, id) = 0;
|
static id (*plAdd)(id, SEL, id) = 0;
|
||||||
|
@ -184,7 +186,7 @@ static NSString *rootPath = @"/";
|
||||||
static BOOL (*sepMember)(NSCharacterSet*, SEL, unichar) = 0;
|
static BOOL (*sepMember)(NSCharacterSet*, SEL, unichar) = 0;
|
||||||
static NSCharacterSet *myPathSeps = nil;
|
static NSCharacterSet *myPathSeps = nil;
|
||||||
/*
|
/*
|
||||||
* We can't have a 'pathSeps' variable initialized in the +initialize
|
* We can't have a 'pathSeps' variable initialized in the +initialize
|
||||||
* method 'cos that would cause recursion.
|
* method 'cos that would cause recursion.
|
||||||
*/
|
*/
|
||||||
static NSCharacterSet*
|
static NSCharacterSet*
|
||||||
|
@ -289,11 +291,18 @@ handle_printf_atsign (FILE *stream,
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
NSMutableStringClass = [NSMutableString class];
|
NSMutableStringClass = [NSMutableString class];
|
||||||
NSDataClass = [NSData class];
|
NSDataClass = [NSData class];
|
||||||
|
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||||
GSStringClass = [GSString class];
|
GSStringClass = [GSString class];
|
||||||
GSMStringClass = [GSMString class];
|
GSMutableStringClass = [GSMutableString class];
|
||||||
GSUStringClass = [GSUString class];
|
|
||||||
GSCInlineStringClass = [GSCInlineString class];
|
/*
|
||||||
GSUInlineStringClass = [GSUInlineString class];
|
* Set up infrastructure for placeholder strings.
|
||||||
|
*/
|
||||||
|
defaultPlaceholderString = (GSPlaceholderString*)
|
||||||
|
NSAllocateObject(GSPlaceholderStringClass, 0, NSDefaultMallocZone());
|
||||||
|
placeholderMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||||
|
NSNonRetainedObjectMapValueCallBacks, 0);
|
||||||
|
placeholderLock = [NSLock new];
|
||||||
|
|
||||||
#if HAVE_REGISTER_PRINTF_FUNCTION
|
#if HAVE_REGISTER_PRINTF_FUNCTION
|
||||||
if (register_printf_function ('@',
|
if (register_printf_function ('@',
|
||||||
|
@ -313,10 +322,55 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
if (self == NSStringClass)
|
if (self == NSStringClass)
|
||||||
{
|
{
|
||||||
return NSAllocateObject (GSStringClass, 0, z);
|
/*
|
||||||
|
* For a constant string, we return a placeholder object that can
|
||||||
|
* be converted to a real object when its initialisation method
|
||||||
|
* is called.
|
||||||
|
*/
|
||||||
|
if (z == NSDefaultMallocZone() || z == 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* As a special case, we can return a placeholder for a string
|
||||||
|
* in the default malloc zone extremely efficiently.
|
||||||
|
*/
|
||||||
|
return defaultPlaceholderString;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
id obj;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For anything other than the default zone, we need to
|
||||||
|
* locate the correct placeholder in the (lock protected)
|
||||||
|
* table of placeholders.
|
||||||
|
*/
|
||||||
|
[placeholderLock lock];
|
||||||
|
obj = (id)NSMapGet(placeholderMap, (void*)z);
|
||||||
|
if (obj == nil)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* There is no placeholder object for this zone, so we
|
||||||
|
* create a new one and use that.
|
||||||
|
*/
|
||||||
|
obj = (id)NSAllocateObject(GSPlaceholderStringClass, 0, z);
|
||||||
|
NSMapInsert(placeholderMap, (void*)z, (void*)obj);
|
||||||
|
}
|
||||||
|
[placeholderLock unlock];
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (GSObjCIsKindOf(self, GSStringClass) == YES)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"Called +allocWithZone: on private string class"];
|
||||||
|
return nil; /* NOT REACHED */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* For user provided strings, we simply allocate an object of
|
||||||
|
* the given class.
|
||||||
|
*/
|
||||||
return NSAllocateObject (self, 0, z);
|
return NSAllocateObject (self, 0, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,8 +384,11 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
+ (id) stringWithString: (NSString*)aString
|
+ (id) stringWithString: (NSString*)aString
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
NSString *obj;
|
||||||
initWithString: aString]);
|
|
||||||
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
|
obj = [obj initWithString: aString];
|
||||||
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) stringWithCharacters: (const unichar*)chars
|
+ (id) stringWithCharacters: (const unichar*)chars
|
||||||
|
@ -339,8 +396,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
NSString *obj;
|
NSString *obj;
|
||||||
|
|
||||||
obj = (NSString*)NSAllocateObject(GSUInlineStringClass, length*2,
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
NSDefaultMallocZone());
|
|
||||||
obj = [obj initWithCharacters: chars length: length];
|
obj = [obj initWithCharacters: chars length: length];
|
||||||
return AUTORELEASE(obj);
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
@ -350,8 +406,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
NSString *obj;
|
NSString *obj;
|
||||||
unsigned length = strlen(byteString);
|
unsigned length = strlen(byteString);
|
||||||
|
|
||||||
obj = (NSString*)NSAllocateObject(GSCInlineStringClass, length,
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
NSDefaultMallocZone());
|
|
||||||
obj = [obj initWithCString: byteString length: length];
|
obj = [obj initWithCString: byteString length: length];
|
||||||
return AUTORELEASE(obj);
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
@ -361,28 +416,36 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
NSString *obj;
|
NSString *obj;
|
||||||
|
|
||||||
obj = (NSString*)NSAllocateObject(GSCInlineStringClass, length,
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
NSDefaultMallocZone());
|
|
||||||
obj = [obj initWithCString: byteString length: length];
|
obj = [obj initWithCString: byteString length: length];
|
||||||
return AUTORELEASE(obj);
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) stringWithUTF8String: (const char *)bytes
|
+ (id) stringWithUTF8String: (const char *)bytes
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
NSString *obj;
|
||||||
initWithUTF8String: bytes]);
|
|
||||||
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
|
obj = [obj initWithUTF8String: bytes];
|
||||||
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) stringWithContentsOfFile: (NSString *)path
|
+ (id) stringWithContentsOfFile: (NSString *)path
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
NSString *obj;
|
||||||
initWithContentsOfFile: path]);
|
|
||||||
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
|
obj = [obj initWithContentsOfFile: path];
|
||||||
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) stringWithContentsOfURL: (NSURL *)url
|
+ (id) stringWithContentsOfURL: (NSURL *)url
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
NSString *obj;
|
||||||
initWithContentsOfURL: url]);
|
|
||||||
|
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
|
obj = [obj initWithContentsOfURL: url];
|
||||||
|
return AUTORELEASE(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) stringWithFormat: (NSString*)format,...
|
+ (id) stringWithFormat: (NSString*)format,...
|
||||||
|
@ -1097,7 +1160,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
[self getCharacters: s];
|
[self getCharacters: s];
|
||||||
[aString getCharacters: s + len];
|
[aString getCharacters: s + len];
|
||||||
tmp = [[GSStringClass allocWithZone: z] initWithCharactersNoCopy: s
|
tmp = [[NSStringClass allocWithZone: z] initWithCharactersNoCopy: s
|
||||||
length: len + otherLength freeWhenDone: YES];
|
length: len + otherLength freeWhenDone: YES];
|
||||||
return AUTORELEASE(tmp);
|
return AUTORELEASE(tmp);
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1224,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
return @"";
|
return @"";
|
||||||
buf = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*aRange.length);
|
buf = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*aRange.length);
|
||||||
[self getCharacters: buf range: aRange];
|
[self getCharacters: buf range: aRange];
|
||||||
ret = [[GSStringClass allocWithZone: NSDefaultMallocZone()]
|
ret = [[NSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||||
initWithCharactersNoCopy: buf length: aRange.length freeWhenDone: YES];
|
initWithCharactersNoCopy: buf length: aRange.length freeWhenDone: YES];
|
||||||
return AUTORELEASE(ret);
|
return AUTORELEASE(ret);
|
||||||
}
|
}
|
||||||
|
@ -1739,7 +1802,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
s[count] = uni_tolower((*caiImp)(self, caiSel, count));
|
s[count] = uni_tolower((*caiImp)(self, caiSel, count));
|
||||||
}
|
}
|
||||||
return AUTORELEASE([[GSStringClass allocWithZone: NSDefaultMallocZone()]
|
return AUTORELEASE([[NSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||||
initWithCharactersNoCopy: s length: len freeWhenDone: YES]);
|
initWithCharactersNoCopy: s length: len freeWhenDone: YES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1760,7 +1823,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
s[count] = uni_toupper((*caiImp)(self, caiSel, count));
|
s[count] = uni_toupper((*caiImp)(self, caiSel, count));
|
||||||
}
|
}
|
||||||
return AUTORELEASE([[GSStringClass allocWithZone: NSDefaultMallocZone()]
|
return AUTORELEASE([[NSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||||
initWithCharactersNoCopy: s length: len freeWhenDone: YES]);
|
initWithCharactersNoCopy: s length: len freeWhenDone: YES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2859,14 +2922,14 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
if ([self isKindOfClass: [NSMutableString class]] ||
|
if ([self isKindOfClass: [NSMutableString class]] ||
|
||||||
NSShouldRetainWithZone(self, zone) == NO)
|
NSShouldRetainWithZone(self, zone) == NO)
|
||||||
return [[GSStringClass allocWithZone: zone] initWithString: self];
|
return [[NSStringClass allocWithZone: zone] initWithString: self];
|
||||||
else
|
else
|
||||||
return RETAIN(self);
|
return RETAIN(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)zone
|
- (id) mutableCopyWithZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
return [[GSMStringClass allocWithZone: zone] initWithString: self];
|
return [[GSMutableStringClass allocWithZone: zone] initWithString: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NSCoding Protocol */
|
/* NSCoding Protocol */
|
||||||
|
@ -2998,7 +3061,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
if (self == NSMutableStringClass)
|
if (self == NSMutableStringClass)
|
||||||
{
|
{
|
||||||
return NSAllocateObject(GSMStringClass, 0, z);
|
return NSAllocateObject(GSMutableStringClass, 0, z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3010,13 +3073,13 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
+ (NSMutableString*) string
|
+ (NSMutableString*) string
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||||
NSDefaultMallocZone()] initWithCapacity: 0]);
|
NSDefaultMallocZone()] initWithCapacity: 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSMutableString*) stringWithCapacity: (unsigned)capacity
|
+ (NSMutableString*) stringWithCapacity: (unsigned)capacity
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||||
NSDefaultMallocZone()] initWithCapacity: capacity]);
|
NSDefaultMallocZone()] initWithCapacity: capacity]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3024,26 +3087,26 @@ handle_printf_atsign (FILE *stream,
|
||||||
+ (NSString*) stringWithCharacters: (const unichar*)characters
|
+ (NSString*) stringWithCharacters: (const unichar*)characters
|
||||||
length: (unsigned)length
|
length: (unsigned)length
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||||
NSDefaultMallocZone()] initWithCharacters: characters length: length]);
|
NSDefaultMallocZone()] initWithCharacters: characters length: length]);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) stringWithContentsOfFile: (NSString *)path
|
+ (id) stringWithContentsOfFile: (NSString *)path
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||||
NSDefaultMallocZone()] initWithContentsOfFile: path]);
|
NSDefaultMallocZone()] initWithContentsOfFile: path]);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString*) stringWithCString: (const char*)byteString
|
+ (NSString*) stringWithCString: (const char*)byteString
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||||
NSDefaultMallocZone()] initWithCString: byteString]);
|
NSDefaultMallocZone()] initWithCString: byteString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString*) stringWithCString: (const char*)byteString
|
+ (NSString*) stringWithCString: (const char*)byteString
|
||||||
length: (unsigned)length
|
length: (unsigned)length
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||||
NSDefaultMallocZone()] initWithCString: byteString length: length]);
|
NSDefaultMallocZone()] initWithCString: byteString length: length]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
184
Source/externs.m
184
Source/externs.m
|
@ -31,8 +31,6 @@
|
||||||
#include "NSCallBacks.h"
|
#include "NSCallBacks.h"
|
||||||
#include <Foundation/NSHashTable.h>
|
#include <Foundation/NSHashTable.h>
|
||||||
|
|
||||||
@class GSCString;
|
|
||||||
|
|
||||||
/* Global lock to be used by classes when operating on any global
|
/* Global lock to be used by classes when operating on any global
|
||||||
data that invoke other methods which also access global; thus,
|
data that invoke other methods which also access global; thus,
|
||||||
creating the potential for deadlock. */
|
creating the potential for deadlock. */
|
||||||
|
@ -279,200 +277,200 @@ NSString *NSConnectionProxyCount;
|
||||||
void
|
void
|
||||||
GSBuildStrings()
|
GSBuildStrings()
|
||||||
{
|
{
|
||||||
static BOOL beenHere = NO;
|
static Class SClass = 0;
|
||||||
|
|
||||||
if (beenHere == NO)
|
if (SClass == 0)
|
||||||
{
|
{
|
||||||
beenHere = YES;
|
SClass = [NSString class];
|
||||||
InPortAcceptedClientNotification
|
InPortAcceptedClientNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"InPortAcceptedClientNotification"];
|
"InPortAcceptedClientNotification"];
|
||||||
InPortClientBecameInvalidNotification
|
InPortClientBecameInvalidNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"InPortClientBecameInvalidNotification"];
|
"InPortClientBecameInvalidNotification"];
|
||||||
NSAMPMDesignation
|
NSAMPMDesignation
|
||||||
= [[GSCString alloc] initWithCString: "NSAMPMDesignation"];
|
= [[SClass alloc] initWithCString: "NSAMPMDesignation"];
|
||||||
NSArgumentDomain
|
NSArgumentDomain
|
||||||
= [[GSCString alloc] initWithCString: "NSArgumentDomain"];
|
= [[SClass alloc] initWithCString: "NSArgumentDomain"];
|
||||||
NSBundleDidLoadNotification
|
NSBundleDidLoadNotification
|
||||||
= [[GSCString alloc] initWithCString: "NSBundleDidLoadNotification"];
|
= [[SClass alloc] initWithCString: "NSBundleDidLoadNotification"];
|
||||||
*(NSString**)&NSCharacterConversionException
|
*(NSString**)&NSCharacterConversionException
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSCharacterConversionException"];
|
"NSCharacterConversionException"];
|
||||||
NSConnectionDidDieNotification
|
NSConnectionDidDieNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSConnectionDidDieNotification"];
|
"NSConnectionDidDieNotification"];
|
||||||
NSConnectionDidInitializeNotification
|
NSConnectionDidInitializeNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSConnectionDidInitializeNotification"];
|
"NSConnectionDidInitializeNotification"];
|
||||||
NSConnectionLocalCount
|
NSConnectionLocalCount
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionLocalCount"];
|
= [[SClass alloc] initWithCString: "NSConnectionLocalCount"];
|
||||||
NSConnectionProxyCount
|
NSConnectionProxyCount
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionProxyCount"];
|
= [[SClass alloc] initWithCString: "NSConnectionProxyCount"];
|
||||||
NSConnectionRepliesReceived
|
NSConnectionRepliesReceived
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionRepliesReceived"];
|
= [[SClass alloc] initWithCString: "NSConnectionRepliesReceived"];
|
||||||
NSConnectionRepliesSent
|
NSConnectionRepliesSent
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionRepliesSent"];
|
= [[SClass alloc] initWithCString: "NSConnectionRepliesSent"];
|
||||||
NSConnectionReplyMode
|
NSConnectionReplyMode
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionReplyMode"];
|
= [[SClass alloc] initWithCString: "NSConnectionReplyMode"];
|
||||||
NSConnectionRequestsReceived
|
NSConnectionRequestsReceived
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionRequestsReceived"];
|
= [[SClass alloc] initWithCString: "NSConnectionRequestsReceived"];
|
||||||
NSConnectionRequestsSent
|
NSConnectionRequestsSent
|
||||||
= [[GSCString alloc] initWithCString: "NSConnectionRequestsSent"];
|
= [[SClass alloc] initWithCString: "NSConnectionRequestsSent"];
|
||||||
NSCurrencyString
|
NSCurrencyString
|
||||||
= [[GSCString alloc] initWithCString: "NSCurrencyString"];
|
= [[SClass alloc] initWithCString: "NSCurrencyString"];
|
||||||
NSCurrencySymbol
|
NSCurrencySymbol
|
||||||
= [[GSCString alloc] initWithCString: "NSCurrencySymbol"];
|
= [[SClass alloc] initWithCString: "NSCurrencySymbol"];
|
||||||
NSDateFormatString
|
NSDateFormatString
|
||||||
= [[GSCString alloc] initWithCString: "NSDateFormatString"];
|
= [[SClass alloc] initWithCString: "NSDateFormatString"];
|
||||||
NSDateTimeOrdering
|
NSDateTimeOrdering
|
||||||
= [[GSCString alloc] initWithCString: "NSDateTimeOrdering"];
|
= [[SClass alloc] initWithCString: "NSDateTimeOrdering"];
|
||||||
NSDecimalDigits
|
NSDecimalDigits
|
||||||
= [[GSCString alloc] initWithCString: "NSDecimalDigits"];
|
= [[SClass alloc] initWithCString: "NSDecimalDigits"];
|
||||||
NSDecimalSeparator
|
NSDecimalSeparator
|
||||||
= [[GSCString alloc] initWithCString: "NSDecimalSeparator"];
|
= [[SClass alloc] initWithCString: "NSDecimalSeparator"];
|
||||||
NSDefaultRunLoopMode
|
NSDefaultRunLoopMode
|
||||||
= [[GSCString alloc] initWithCString: "NSDefaultRunLoopMode"];
|
= [[SClass alloc] initWithCString: "NSDefaultRunLoopMode"];
|
||||||
NSEarlierTimeDesignations
|
NSEarlierTimeDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSEarlierTimeDesignations"];
|
= [[SClass alloc] initWithCString: "NSEarlierTimeDesignations"];
|
||||||
NSFailedAuthenticationException
|
NSFailedAuthenticationException
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSFailedAuthenticationException"];
|
"NSFailedAuthenticationException"];
|
||||||
NSFileDeviceIdentifier
|
NSFileDeviceIdentifier
|
||||||
= [[GSCString alloc] initWithCString: "NSFileDeviceIdentifier"];
|
= [[SClass alloc] initWithCString: "NSFileDeviceIdentifier"];
|
||||||
NSFileGroupOwnerAccountName
|
NSFileGroupOwnerAccountName
|
||||||
= [[GSCString alloc] initWithCString: "NSFileGroupOwnerAccountName"];
|
= [[SClass alloc] initWithCString: "NSFileGroupOwnerAccountName"];
|
||||||
NSFileGroupOwnerAccountNumber
|
NSFileGroupOwnerAccountNumber
|
||||||
= [[GSCString alloc] initWithCString: "NSFileGroupOwnerAccountNumber"];
|
= [[SClass alloc] initWithCString: "NSFileGroupOwnerAccountNumber"];
|
||||||
NSFileModificationDate
|
NSFileModificationDate
|
||||||
= [[GSCString alloc] initWithCString: "NSFileModificationDate"];
|
= [[SClass alloc] initWithCString: "NSFileModificationDate"];
|
||||||
NSFileOwnerAccountName
|
NSFileOwnerAccountName
|
||||||
= [[GSCString alloc] initWithCString: "NSFileOwnerAccountName"];
|
= [[SClass alloc] initWithCString: "NSFileOwnerAccountName"];
|
||||||
NSFileOwnerAccountNumber
|
NSFileOwnerAccountNumber
|
||||||
= [[GSCString alloc] initWithCString: "NSFileOwnerAccountNumber"];
|
= [[SClass alloc] initWithCString: "NSFileOwnerAccountNumber"];
|
||||||
NSFilePosixPermissions
|
NSFilePosixPermissions
|
||||||
= [[GSCString alloc] initWithCString: "NSFilePosixPermissions"];
|
= [[SClass alloc] initWithCString: "NSFilePosixPermissions"];
|
||||||
NSFileReferenceCount
|
NSFileReferenceCount
|
||||||
= [[GSCString alloc] initWithCString: "NSFileReferenceCount"];
|
= [[SClass alloc] initWithCString: "NSFileReferenceCount"];
|
||||||
NSFileSize
|
NSFileSize
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSize"];
|
= [[SClass alloc] initWithCString: "NSFileSize"];
|
||||||
NSFileSystemFileNumber
|
NSFileSystemFileNumber
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSystemFileNumber"];
|
= [[SClass alloc] initWithCString: "NSFileSystemFileNumber"];
|
||||||
NSFileSystemFreeNodes
|
NSFileSystemFreeNodes
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSystemFreeNodes"];
|
= [[SClass alloc] initWithCString: "NSFileSystemFreeNodes"];
|
||||||
NSFileSystemFreeSize
|
NSFileSystemFreeSize
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSystemFreeSize"];
|
= [[SClass alloc] initWithCString: "NSFileSystemFreeSize"];
|
||||||
NSFileSystemNodes
|
NSFileSystemNodes
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSystemNodes"];
|
= [[SClass alloc] initWithCString: "NSFileSystemNodes"];
|
||||||
NSFileSystemNumber
|
NSFileSystemNumber
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSystemNumber"];
|
= [[SClass alloc] initWithCString: "NSFileSystemNumber"];
|
||||||
NSFileSystemSize
|
NSFileSystemSize
|
||||||
= [[GSCString alloc] initWithCString: "NSFileSystemSize"];
|
= [[SClass alloc] initWithCString: "NSFileSystemSize"];
|
||||||
NSFileType
|
NSFileType
|
||||||
= [[GSCString alloc] initWithCString: "NSFileType"];
|
= [[SClass alloc] initWithCString: "NSFileType"];
|
||||||
NSFileTypeBlockSpecial
|
NSFileTypeBlockSpecial
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeBlockSpecial"];
|
= [[SClass alloc] initWithCString: "NSFileTypeBlockSpecial"];
|
||||||
NSFileTypeCharacterSpecial
|
NSFileTypeCharacterSpecial
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeCharacterSpecial"];
|
= [[SClass alloc] initWithCString: "NSFileTypeCharacterSpecial"];
|
||||||
NSFileTypeDirectory
|
NSFileTypeDirectory
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeDirectory"];
|
= [[SClass alloc] initWithCString: "NSFileTypeDirectory"];
|
||||||
NSFileTypeFifo
|
NSFileTypeFifo
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeFifo"];
|
= [[SClass alloc] initWithCString: "NSFileTypeFifo"];
|
||||||
NSFileTypeRegular
|
NSFileTypeRegular
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeRegular"];
|
= [[SClass alloc] initWithCString: "NSFileTypeRegular"];
|
||||||
NSFileTypeSocket
|
NSFileTypeSocket
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeSocket"];
|
= [[SClass alloc] initWithCString: "NSFileTypeSocket"];
|
||||||
NSFileTypeSymbolicLink
|
NSFileTypeSymbolicLink
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeSymbolicLink"];
|
= [[SClass alloc] initWithCString: "NSFileTypeSymbolicLink"];
|
||||||
NSFileTypeUnknown
|
NSFileTypeUnknown
|
||||||
= [[GSCString alloc] initWithCString: "NSFileTypeUnknown"];
|
= [[SClass alloc] initWithCString: "NSFileTypeUnknown"];
|
||||||
NSFormalName
|
NSFormalName
|
||||||
= [[GSCString alloc] initWithCString: "NSFormalName"];
|
= [[SClass alloc] initWithCString: "NSFormalName"];
|
||||||
*(NSString**)&NSGenericException
|
*(NSString**)&NSGenericException
|
||||||
= [[GSCString alloc] initWithCString: "NSGenericException"];
|
= [[SClass alloc] initWithCString: "NSGenericException"];
|
||||||
NSGlobalDomain
|
NSGlobalDomain
|
||||||
= [[GSCString alloc] initWithCString: "NSGlobalDomain"];
|
= [[SClass alloc] initWithCString: "NSGlobalDomain"];
|
||||||
NSHourNameDesignations
|
NSHourNameDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSHourNameDesignations"];
|
= [[SClass alloc] initWithCString: "NSHourNameDesignations"];
|
||||||
NSInconsistentArchiveException
|
NSInconsistentArchiveException
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSInconsistentArchiveException"];
|
"NSInconsistentArchiveException"];
|
||||||
*(NSString**)&NSInternalInconsistencyException
|
*(NSString**)&NSInternalInconsistencyException
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSInternalInconsistencyException"];
|
"NSInternalInconsistencyException"];
|
||||||
NSInternationalCurrencyString
|
NSInternationalCurrencyString
|
||||||
= [[GSCString alloc] initWithCString: "NSInternationalCurrencyString"];
|
= [[SClass alloc] initWithCString: "NSInternationalCurrencyString"];
|
||||||
*(NSString**)&NSInvalidArgumentException
|
*(NSString**)&NSInvalidArgumentException
|
||||||
= [[GSCString alloc] initWithCString: "NSInvalidArgumentException"];
|
= [[SClass alloc] initWithCString: "NSInvalidArgumentException"];
|
||||||
NSLanguageCode
|
NSLanguageCode
|
||||||
= [[GSCString alloc] initWithCString: "NSLanguageCode"];
|
= [[SClass alloc] initWithCString: "NSLanguageCode"];
|
||||||
NSLanguageName
|
NSLanguageName
|
||||||
= [[GSCString alloc] initWithCString: "NSLanguageName"];
|
= [[SClass alloc] initWithCString: "NSLanguageName"];
|
||||||
NSLaterTimeDesignations
|
NSLaterTimeDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSLaterTimeDesignations"];
|
= [[SClass alloc] initWithCString: "NSLaterTimeDesignations"];
|
||||||
NSLoadedClasses
|
NSLoadedClasses
|
||||||
= [[GSCString alloc] initWithCString: "NSLoadedClasses"];
|
= [[SClass alloc] initWithCString: "NSLoadedClasses"];
|
||||||
NSLocale
|
NSLocale
|
||||||
= [[GSCString alloc] initWithCString: "NSLocale"];
|
= [[SClass alloc] initWithCString: "NSLocale"];
|
||||||
*(NSString**)&NSMallocException
|
*(NSString**)&NSMallocException
|
||||||
= [[GSCString alloc] initWithCString: "NSMallocException"];
|
= [[SClass alloc] initWithCString: "NSMallocException"];
|
||||||
NSMonthNameArray
|
NSMonthNameArray
|
||||||
= [[GSCString alloc] initWithCString: "NSMonthNameArray"];
|
= [[SClass alloc] initWithCString: "NSMonthNameArray"];
|
||||||
NSNegativeCurrencyFormatString
|
NSNegativeCurrencyFormatString
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSNegativeCurrencyFormatString"];
|
"NSNegativeCurrencyFormatString"];
|
||||||
NSNextDayDesignations
|
NSNextDayDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSNextDayDesignations"];
|
= [[SClass alloc] initWithCString: "NSNextDayDesignations"];
|
||||||
NSNextNextDayDesignations
|
NSNextNextDayDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSNextNextDayDesignations"];
|
= [[SClass alloc] initWithCString: "NSNextNextDayDesignations"];
|
||||||
NSPortDidBecomeInvalidNotification
|
NSPortDidBecomeInvalidNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSPortDidBecomeInvalidNotification"];
|
"NSPortDidBecomeInvalidNotification"];
|
||||||
NSPortTimeoutException
|
NSPortTimeoutException
|
||||||
= [[GSCString alloc] initWithCString: "NSPortTimeoutException"];
|
= [[SClass alloc] initWithCString: "NSPortTimeoutException"];
|
||||||
NSPositiveCurrencyFormatString
|
NSPositiveCurrencyFormatString
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSPositiveCurrencyFormatString"];
|
"NSPositiveCurrencyFormatString"];
|
||||||
NSPriorDayDesignations
|
NSPriorDayDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSPriorDayDesignations"];
|
= [[SClass alloc] initWithCString: "NSPriorDayDesignations"];
|
||||||
*(NSString**)&NSRangeException
|
*(NSString**)&NSRangeException
|
||||||
= [[GSCString alloc] initWithCString: "NSRangeException"];
|
= [[SClass alloc] initWithCString: "NSRangeException"];
|
||||||
NSRegistrationDomain
|
NSRegistrationDomain
|
||||||
= [[GSCString alloc] initWithCString: "NSRegistrationDomain"];
|
= [[SClass alloc] initWithCString: "NSRegistrationDomain"];
|
||||||
NSShortDateFormatString
|
NSShortDateFormatString
|
||||||
= [[GSCString alloc] initWithCString: "NSShortDateFormatString"];
|
= [[SClass alloc] initWithCString: "NSShortDateFormatString"];
|
||||||
NSShortMonthNameArray
|
NSShortMonthNameArray
|
||||||
= [[GSCString alloc] initWithCString: "NSShortMonthNameArray"];
|
= [[SClass alloc] initWithCString: "NSShortMonthNameArray"];
|
||||||
NSShortTimeDateFormatString
|
NSShortTimeDateFormatString
|
||||||
= [[GSCString alloc] initWithCString: "NSShortTimeDateFormatString"];
|
= [[SClass alloc] initWithCString: "NSShortTimeDateFormatString"];
|
||||||
NSShortWeekDayNameArray
|
NSShortWeekDayNameArray
|
||||||
= [[GSCString alloc] initWithCString: "NSShortWeekDayNameArray"];
|
= [[SClass alloc] initWithCString: "NSShortWeekDayNameArray"];
|
||||||
NSShowNonLocalizedStrings
|
NSShowNonLocalizedStrings
|
||||||
= [[GSCString alloc] initWithCString: "NSShowNonLocalizedStrings"];
|
= [[SClass alloc] initWithCString: "NSShowNonLocalizedStrings"];
|
||||||
NSThisDayDesignations
|
NSThisDayDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSThisDayDesignations"];
|
= [[SClass alloc] initWithCString: "NSThisDayDesignations"];
|
||||||
NSThousandsSeparator
|
NSThousandsSeparator
|
||||||
= [[GSCString alloc] initWithCString: "NSThousandsSeparator"];
|
= [[SClass alloc] initWithCString: "NSThousandsSeparator"];
|
||||||
NSThreadWillExitNotification
|
NSThreadWillExitNotification
|
||||||
= [[GSCString alloc] initWithCString: "NSThreadWillExitNotification"];
|
= [[SClass alloc] initWithCString: "NSThreadWillExitNotification"];
|
||||||
NSTimeDateFormatString
|
NSTimeDateFormatString
|
||||||
= [[GSCString alloc] initWithCString: "NSTimeDateFormatString"];
|
= [[SClass alloc] initWithCString: "NSTimeDateFormatString"];
|
||||||
NSTimeFormatString
|
NSTimeFormatString
|
||||||
= [[GSCString alloc] initWithCString: "NSTimeFormatString"];
|
= [[SClass alloc] initWithCString: "NSTimeFormatString"];
|
||||||
NSUserDefaultsDidChangeNotification
|
NSUserDefaultsDidChangeNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSUserDefaultsDidChangeNotification"];
|
"NSUserDefaultsDidChangeNotification"];
|
||||||
NSWeekDayNameArray
|
NSWeekDayNameArray
|
||||||
= [[GSCString alloc] initWithCString: "NSWeekDayNameArray"];
|
= [[SClass alloc] initWithCString: "NSWeekDayNameArray"];
|
||||||
NSWillBecomeMultiThreadedNotification
|
NSWillBecomeMultiThreadedNotification
|
||||||
= [[GSCString alloc] initWithCString:
|
= [[SClass alloc] initWithCString:
|
||||||
"NSWillBecomeMultiThreadedNotification"];
|
"NSWillBecomeMultiThreadedNotification"];
|
||||||
NSYearMonthWeekDesignations
|
NSYearMonthWeekDesignations
|
||||||
= [[GSCString alloc] initWithCString: "NSYearMonthWeekDesignations"];
|
= [[SClass alloc] initWithCString: "NSYearMonthWeekDesignations"];
|
||||||
PortBecameInvalidNotification
|
PortBecameInvalidNotification
|
||||||
= [[GSCString alloc] initWithCString: "PortBecameInvalidNotification"];
|
= [[SClass alloc] initWithCString: "PortBecameInvalidNotification"];
|
||||||
StreamException
|
StreamException
|
||||||
= [[GSCString alloc] initWithCString: "StreamException"];
|
= [[SClass alloc] initWithCString: "StreamException"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <base/preface.h>
|
#include <base/preface.h>
|
||||||
|
#include <Foundation/NSObject.h>
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
|
Loading…
Reference in a new issue