mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +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>
|
||||
|
||||
* Source/GSXML.m: External entity loader revisions completed.
|
||||
|
|
|
@ -326,31 +326,6 @@ enum {
|
|||
}
|
||||
@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
|
||||
@interface NSString (GSString)
|
||||
|
|
|
@ -173,8 +173,172 @@ encodeBase64(NSData *source)
|
|||
static NSString*
|
||||
XMLString(NSString* obj)
|
||||
{
|
||||
/* Should substitute in entities */
|
||||
return obj;
|
||||
static NSCharacterSet *quotables = nil;
|
||||
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[] = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Implementation for GNUStep of NSString concrete subclasses
|
||||
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
|
||||
|
||||
Based on NSGCString and NSString
|
||||
|
@ -49,6 +49,37 @@
|
|||
|
||||
#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.
|
||||
*/
|
||||
|
@ -78,38 +109,47 @@
|
|||
@end
|
||||
|
||||
/*
|
||||
* GSUString - concrete class for strings using 16-bit character sets.
|
||||
* GSCEmptyString - concrete class for empty string
|
||||
*/
|
||||
@interface GSUString : GSString
|
||||
@interface GSCEmptyString : GSCString
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
* GSUInlineString - concrete subclass of GSUString, that expects the
|
||||
* characterData to appear in memory immediately after the object itsself.
|
||||
* GSUnicodeString - concrete class for strings using 16-bit character sets.
|
||||
*/
|
||||
@interface GSUInlineString : GSUString
|
||||
@interface GSUnicodeString : GSString
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
* GSUSubString - concrete subclass of GSUString, that relys on the
|
||||
* data stored in a GSUString object.
|
||||
* GSUnicodeInlineString - concrete subclass of GSUnicodeString, that
|
||||
* 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
|
||||
GSUString *_parent;
|
||||
GSUnicodeString *_parent;
|
||||
}
|
||||
@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.
|
||||
*/
|
||||
@interface GSMString : NSMutableString
|
||||
@interface GSMutableString : NSMutableString
|
||||
{
|
||||
union {
|
||||
unichar *u;
|
||||
|
@ -131,7 +171,7 @@
|
|||
* Typedef for access to internals of concrete string objects.
|
||||
*/
|
||||
typedef struct {
|
||||
@defs(GSMString)
|
||||
@defs(GSMutableString)
|
||||
} *ivars;
|
||||
|
||||
/*
|
||||
|
@ -180,10 +220,10 @@ static Class GSStringClass = 0;
|
|||
static Class GSCStringClass = 0;
|
||||
static Class GSCInlineStringClass = 0;
|
||||
static Class GSCSubStringClass = 0;
|
||||
static Class GSUStringClass = 0;
|
||||
static Class GSUSubStringClass = 0;
|
||||
static Class GSUInlineStringClass = 0;
|
||||
static Class GSMStringClass = 0;
|
||||
static Class GSUnicodeStringClass = 0;
|
||||
static Class GSUnicodeSubStringClass = 0;
|
||||
static Class GSUnicodeInlineStringClass = 0;
|
||||
static Class GSMutableStringClass = 0;
|
||||
static Class NXConstantStringClass = 0;
|
||||
|
||||
static SEL convertSel;
|
||||
|
@ -208,18 +248,27 @@ setup()
|
|||
{
|
||||
beenHere = YES;
|
||||
|
||||
/*
|
||||
* Cache pointers to classes to work round misfeature in
|
||||
* GNU compiler/runtime system where class lookup is very slow.
|
||||
*/
|
||||
NSDataClass = [NSData class];
|
||||
NSStringClass = [NSString class];
|
||||
GSStringClass = [GSString class];
|
||||
GSCStringClass = [GSCString class];
|
||||
GSUStringClass = [GSUString class];
|
||||
GSUnicodeStringClass = [GSUnicodeString class];
|
||||
GSCInlineStringClass = [GSCInlineString class];
|
||||
GSUInlineStringClass = [GSUInlineString class];
|
||||
GSUnicodeInlineStringClass = [GSUnicodeInlineString class];
|
||||
GSCSubStringClass = [GSCSubString class];
|
||||
GSUSubStringClass = [GSUSubString class];
|
||||
GSMStringClass = [GSMString class];
|
||||
GSUnicodeSubStringClass = [GSUnicodeSubString class];
|
||||
GSMutableStringClass = [GSMutableString 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:);
|
||||
convertImp = (BOOL (*)(id, SEL, NSStringEncoding))
|
||||
[NSStringClass instanceMethodForSelector: convertSel];
|
||||
|
@ -230,21 +279,208 @@ setup()
|
|||
hashImp = (unsigned (*)(id, SEL))
|
||||
[NSStringClass instanceMethodForSelector: hashSel];
|
||||
|
||||
/*
|
||||
* Cache the default string encoding.
|
||||
*/
|
||||
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
|
||||
* to implement their core functionality.
|
||||
* GSCString uses the functions with the _c suffix.
|
||||
* GSCSubString and NXConstant inherit methods from GSCString.
|
||||
* GSUString uses the functions with the _u suffix.
|
||||
* GSUSubString inherits methods from GSUString.
|
||||
* GSMString uses all the functions, selecting the _c or _u versions
|
||||
* GSUnicodeString uses the functions with the _u suffix.
|
||||
* GSUnicodeSubString inherits methods from GSUnicodeString.
|
||||
* GSMutableString uses all the functions, selecting the _c or _u versions
|
||||
* 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).
|
||||
*/
|
||||
|
||||
|
@ -360,12 +596,12 @@ compare_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
|
|||
return strCompCsNs((id)self, aString, mask, aRange);
|
||||
|
||||
c = GSObjCClass(aString);
|
||||
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
return strCompCsUs((id)self, aString, mask, aRange);
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NXConstantStringClass
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
return strCompCsCs((id)self, aString, mask, aRange);
|
||||
else
|
||||
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);
|
||||
|
||||
c = GSObjCClass(aString);
|
||||
if (GSObjCIsKindOf(c, GSUStringClass)
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass)
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
return strCompUsUs((id)self, aString, mask, aRange);
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass)
|
||||
|| c == NXConstantStringClass
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
return strCompUsCs((id)self, aString, mask, aRange);
|
||||
else
|
||||
return strCompUsNs((id)self, aString, mask, aRange);
|
||||
|
@ -950,7 +1186,7 @@ makeHole(ivars self, int index, int size)
|
|||
#if GS_WITH_GC
|
||||
self->_zone = GSAtomicMallocZone();
|
||||
#else
|
||||
self->_zone = GSObjCZone((NSObject*)self);
|
||||
self->_zone = GSObjCZone((NSString*)self);
|
||||
#endif
|
||||
}
|
||||
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);
|
||||
|
||||
c = GSObjCClass(aString);
|
||||
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
return strRangeCsUs((id)self, aString, mask, aRange);
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NXConstantStringClass
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
return strRangeCsCs((id)self, aString, mask, aRange);
|
||||
else
|
||||
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);
|
||||
|
||||
c = GSObjCClass(aString);
|
||||
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 1))
|
||||
return strRangeUsUs((id)self, aString, mask, aRange);
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NXConstantStringClass
|
||||
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
|| (c == GSMutableStringClass && ((ivars)aString)->_flags.wide == 0))
|
||||
return strRangeUsCs((id)self, aString, mask, aRange);
|
||||
else
|
||||
return strRangeUsNs((id)self, aString, mask, aRange);
|
||||
|
@ -1096,7 +1332,8 @@ substring_c(ivars self, NSRange aRange)
|
|||
{
|
||||
GSCSubString *sub;
|
||||
|
||||
sub = [GSCSubStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
sub = (GSCSubString*)NSAllocateObject(GSCSubStringClass, 0,
|
||||
NSDefaultMallocZone());
|
||||
sub = [sub initWithCStringNoCopy: self->_contents.c + aRange.location
|
||||
length: aRange.length
|
||||
freeWhenDone: NO];
|
||||
|
@ -1111,9 +1348,10 @@ substring_c(ivars self, NSRange aRange)
|
|||
static inline NSString*
|
||||
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
|
||||
length: aRange.length
|
||||
freeWhenDone: NO];
|
||||
|
@ -1150,8 +1388,8 @@ transmute(ivars self, NSString *aString)
|
|||
* string whose ivars we can access directly.
|
||||
*/
|
||||
transmute = NO;
|
||||
if ((c != GSMStringClass || other->_flags.wide != 1)
|
||||
&& c != GSUStringClass)
|
||||
if ((c != GSMutableStringClass || other->_flags.wide != 1)
|
||||
&& c != GSUnicodeStringClass)
|
||||
{
|
||||
other = 0;
|
||||
}
|
||||
|
@ -1159,7 +1397,7 @@ transmute(ivars self, NSString *aString)
|
|||
else
|
||||
{
|
||||
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
|
||||
|
@ -1177,8 +1415,8 @@ transmute(ivars self, NSString *aString)
|
|||
transmute = NO;
|
||||
other = 0;
|
||||
}
|
||||
else if ((c == GSMStringClass && other->_flags.wide == 1)
|
||||
|| c == GSUStringClass)
|
||||
else if ((c == GSMutableStringClass && other->_flags.wide == 1)
|
||||
|| c == GSUnicodeStringClass)
|
||||
{
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
unichar *tmp;
|
||||
int len;
|
||||
|
||||
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)
|
||||
{
|
||||
NSZoneFree(self->_zone, self->_contents.c);
|
||||
|
@ -1214,6 +1453,7 @@ transmute(ivars self, NSString *aString)
|
|||
}
|
||||
self->_contents.u = tmp;
|
||||
self->_flags.wide = 1;
|
||||
self->_count = len;
|
||||
}
|
||||
|
||||
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
|
||||
- (void) dealloc
|
||||
{
|
||||
|
@ -1232,45 +1479,67 @@ transmute(ivars self, NSString *aString)
|
|||
NSDeallocateObject(self);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to initialise a unicode string.
|
||||
*/
|
||||
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||
length: (unsigned int)length
|
||||
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;
|
||||
_contents.u = chars;
|
||||
_flags.wide = 1;
|
||||
if (flag == YES)
|
||||
_flags.free = 1;
|
||||
{
|
||||
_flags.free = 1;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to initialise a 'C' string.
|
||||
*/
|
||||
- (id) initWithCStringNoCopy: (char*)chars
|
||||
length: (unsigned int)length
|
||||
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;
|
||||
_contents.c = chars;
|
||||
_flags.wide = 0;
|
||||
if (flag == YES)
|
||||
_flags.free = 1;
|
||||
{
|
||||
_flags.free = 1;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The GSCString class is the basic implementation of a concrete
|
||||
* 8-bit string class, storing immutable data in a single buffer.
|
||||
*/
|
||||
@implementation GSCString
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
return NSAllocateObject (self, 0, NSDefaultMallocZone());
|
||||
}
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
return NSAllocateObject (self, 0, z);
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
setup();
|
||||
|
@ -1448,16 +1717,19 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
- (id) mutableCopy
|
||||
{
|
||||
GSMString *obj = [GSMStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
GSMutableString *obj;
|
||||
|
||||
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
|
||||
NSDefaultMallocZone());
|
||||
obj = [obj initWithCString: _contents.c length: _count];
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (id) mutableCopyWithZone: (NSZone*)z
|
||||
{
|
||||
GSMString *obj = [GSMStringClass allocWithZone: z];
|
||||
GSMutableString *obj;
|
||||
|
||||
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
|
||||
obj = [obj initWithCString: _contents.c length: _count];
|
||||
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
|
||||
- (id) initWithCString: (const char*)chars length: (unsigned)length
|
||||
{
|
||||
if (_contents.c != 0)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"re-initialisation of string"];
|
||||
}
|
||||
_count = length;
|
||||
_contents.c = (unsigned char*)&self[1];
|
||||
memcpy(_contents.c, chars, length);
|
||||
if (_count > 0)
|
||||
memcpy(_contents.c, chars, length);
|
||||
_flags.wide = 0;
|
||||
return self;
|
||||
}
|
||||
|
@ -1516,6 +1798,12 @@ transmute(ivars self, NSString *aString)
|
|||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The GSCSubString class is a GSCString subclass that points into
|
||||
* a section of a parent constant string class.
|
||||
*/
|
||||
@implementation GSCSubString
|
||||
- (void) dealloc
|
||||
{
|
||||
|
@ -1526,17 +1814,7 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
|
||||
|
||||
@implementation GSUString
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
return NSAllocateObject (self, 0, NSDefaultMallocZone());
|
||||
}
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
return NSAllocateObject (self, 0, z);
|
||||
}
|
||||
@implementation GSUnicodeString
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
|
@ -1569,9 +1847,9 @@ transmute(ivars self, NSString *aString)
|
|||
{
|
||||
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)
|
||||
{
|
||||
unichar *tmp;
|
||||
|
@ -1594,7 +1872,8 @@ transmute(ivars self, NSString *aString)
|
|||
{
|
||||
NSString *obj;
|
||||
|
||||
obj = (NSString*)NSAllocateObject(GSUInlineStringClass, _count*2, z);
|
||||
obj = (NSString*)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||
_count*2, z);
|
||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||
return obj;
|
||||
}
|
||||
|
@ -1718,16 +1997,19 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
- (id) mutableCopy
|
||||
{
|
||||
GSMString *obj = [GSMStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
GSMutableString *obj;
|
||||
|
||||
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
|
||||
NSDefaultMallocZone());
|
||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (id) mutableCopyWithZone: (NSZone*)z
|
||||
{
|
||||
GSMString *obj = [GSMStringClass allocWithZone: z];
|
||||
GSMutableString *obj;
|
||||
|
||||
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
|
||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||
return obj;
|
||||
}
|
||||
|
@ -1777,12 +2059,18 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
|
||||
|
||||
@implementation GSUInlineString
|
||||
@implementation GSUnicodeInlineString
|
||||
- (id) initWithCharacters: (const unichar*)chars length: (unsigned)length
|
||||
{
|
||||
if (_contents.u != 0)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"re-initialisation of string"];
|
||||
}
|
||||
_count = length;
|
||||
_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;
|
||||
return self;
|
||||
}
|
||||
|
@ -1792,7 +2080,13 @@ transmute(ivars self, NSString *aString)
|
|||
}
|
||||
@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
|
||||
{
|
||||
RELEASE(_parent);
|
||||
|
@ -1802,17 +2096,15 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
|
||||
|
||||
@implementation GSMString
|
||||
|
||||
+ (id) alloc
|
||||
{
|
||||
return NSAllocateObject (self, 0, NSDefaultMallocZone());
|
||||
}
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
return NSAllocateObject (self, 0, z);
|
||||
}
|
||||
/*
|
||||
* The GSMutableStrinc class shares a common initial ivar layout with
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
@implementation GSMutableString
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
|
@ -1859,12 +2151,14 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
copy = [GSUStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
copy = NSAllocateObject(GSUnicodeInlineStringClass,
|
||||
_count*sizeof(unichar), NSDefaultMallocZone());
|
||||
copy = [copy initWithCharacters: _contents.u length: _count];
|
||||
}
|
||||
else
|
||||
{
|
||||
copy = [GSCStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
copy = NSAllocateObject(GSCInlineStringClass,
|
||||
_count, NSDefaultMallocZone());
|
||||
copy = [copy initWithCString: _contents.c length: _count];
|
||||
}
|
||||
return copy;
|
||||
|
@ -1876,7 +2170,7 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
copy = (NSString*)NSAllocateObject(GSUInlineStringClass,
|
||||
copy = (NSString*)NSAllocateObject(GSUnicodeInlineStringClass,
|
||||
_count*sizeof(unichar), z);
|
||||
copy = [copy initWithCharacters: _contents.u length: _count];
|
||||
}
|
||||
|
@ -2157,7 +2451,10 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
- (id) mutableCopy
|
||||
{
|
||||
GSMString *obj = [GSMStringClass allocWithZone: NSDefaultMallocZone()];
|
||||
GSMutableString *obj;
|
||||
|
||||
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
|
||||
NSDefaultMallocZone());
|
||||
|
||||
if (_flags.wide == 1)
|
||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||
|
@ -2168,7 +2465,9 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
- (id) mutableCopyWithZone: (NSZone*)z
|
||||
{
|
||||
GSMString *obj = [GSMStringClass allocWithZone: z];
|
||||
GSMutableString *obj;
|
||||
|
||||
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
|
||||
|
||||
if (_flags.wide == 1)
|
||||
obj = [obj initWithCharacters: _contents.u length: _count];
|
||||
|
@ -2346,7 +2645,7 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
return [GSUStringClass stringWithCharacters:
|
||||
return [GSUnicodeStringClass stringWithCharacters:
|
||||
self->_contents.u + aRange.location length: aRange.length];
|
||||
}
|
||||
else
|
||||
|
@ -2362,7 +2661,7 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
return [GSUStringClass stringWithCharacters:
|
||||
return [GSUnicodeStringClass stringWithCharacters:
|
||||
self->_contents.u + aRange.location length: aRange.length];
|
||||
}
|
||||
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
|
||||
|
||||
+ (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
|
||||
{
|
||||
if (self == [NXConstantString class])
|
||||
|
@ -2550,7 +2843,7 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NXConstantStringClass
|
||||
|| (c == GSMStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||
{
|
||||
ivars other = (ivars)anObject;
|
||||
|
||||
|
@ -2560,8 +2853,8 @@ transmute(ivars self, NSString *aString)
|
|||
return NO;
|
||||
return YES;
|
||||
}
|
||||
else if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
||||
|| c == GSMStringClass)
|
||||
else if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| c == GSMutableStringClass)
|
||||
{
|
||||
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
|
||||
return YES;
|
||||
|
@ -2597,7 +2890,7 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NXConstantStringClass
|
||||
|| (c == GSMStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||
|| (c == GSMutableStringClass && ((ivars)anObject)->_flags.wide == 0))
|
||||
{
|
||||
ivars other = (ivars)anObject;
|
||||
|
||||
|
@ -2607,8 +2900,8 @@ transmute(ivars self, NSString *aString)
|
|||
return NO;
|
||||
return YES;
|
||||
}
|
||||
else if (GSObjCIsKindOf(c, GSUStringClass) == YES
|
||||
|| c == GSMStringClass)
|
||||
else if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| c == GSMutableStringClass)
|
||||
{
|
||||
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
|
||||
return YES;
|
||||
|
@ -2668,7 +2961,7 @@ transmute(ivars self, NSString *aString)
|
|||
unsigned count;
|
||||
|
||||
RELEASE(self);
|
||||
self = [GSMString alloc];
|
||||
self = [GSMutableString alloc];
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -2698,7 +2991,7 @@ transmute(ivars self, NSString *aString)
|
|||
unsigned count;
|
||||
|
||||
RELEASE(self);
|
||||
self = [GSUString alloc];
|
||||
self = [GSUnicodeString alloc];
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -2728,7 +3021,7 @@ transmute(ivars self, NSString *aString)
|
|||
unsigned count;
|
||||
|
||||
RELEASE(self);
|
||||
self = [GSMString alloc];
|
||||
self = [GSMutableString alloc];
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
if (count > 0)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ GSNumberInfoFromObject(NSNumber *o)
|
|||
GSNumberInfo *info;
|
||||
|
||||
if (o == nil)
|
||||
return nil;
|
||||
return 0;
|
||||
c = GSObjCClass(o);
|
||||
info = (GSNumberInfo*)NSMapGet (numberMap, (void*)c);
|
||||
if (info == 0)
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GSConfig.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSSet.h>
|
||||
|
|
|
@ -35,14 +35,16 @@
|
|||
@implementation NSScanner
|
||||
|
||||
@class GSCString;
|
||||
@class GSUString;
|
||||
@class GSMString;
|
||||
@class GSUnicodeString;
|
||||
@class GSMutableString;
|
||||
@class GSPlaceholderString;
|
||||
|
||||
static Class NSString_class;
|
||||
static Class GSCString_class;
|
||||
static Class GSUString_class;
|
||||
static Class GSMString_class;
|
||||
static Class NXConstantString_class;
|
||||
static Class NSStringClass;
|
||||
static Class GSCStringClass;
|
||||
static Class GSUnicodeStringClass;
|
||||
static Class GSMutableStringClass;
|
||||
static Class GSPlaceholderStringClass;
|
||||
static Class NXConstantStringClass;
|
||||
static NSCharacterSet *defaultSkipSet;
|
||||
static SEL memSel;
|
||||
|
||||
|
@ -77,11 +79,12 @@ typedef struct {
|
|||
memSel = @selector(characterIsMember:);
|
||||
defaultSkipSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
IF_NO_GC(RETAIN(defaultSkipSet));
|
||||
NSString_class = [NSString class];
|
||||
GSCString_class = [GSCString class];
|
||||
GSUString_class = [GSUString class];
|
||||
GSMString_class = [GSMString class];
|
||||
NXConstantString_class = [NXConstantString class];
|
||||
NSStringClass = [NSString class];
|
||||
GSCStringClass = [GSCString class];
|
||||
GSUnicodeStringClass = [GSUnicodeString class];
|
||||
GSMutableStringClass = [GSMutableString class];
|
||||
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||
NXConstantStringClass = [NXConstantString class];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,42 +130,42 @@ typedef struct {
|
|||
}
|
||||
|
||||
c = GSObjCClass(aString);
|
||||
if (c == GSUString_class)
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = RETAIN(aString);
|
||||
}
|
||||
else if (c == GSCString_class)
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES)
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_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)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = [GSUString_class allocWithZone: NSDefaultMallocZone()];
|
||||
_string = [_string initWithCharacters: ((ivars)aString)->_contents.u
|
||||
length: ((ivars)aString)->_count];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = [GSCString_class allocWithZone: NSDefaultMallocZone()];
|
||||
_string = [_string initWithCString: ((ivars)aString)->_contents.c
|
||||
length: ((ivars)aString)->_count];
|
||||
}
|
||||
}
|
||||
else if (c == NXConstantString_class)
|
||||
else if (c == NXConstantStringClass)
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = RETAIN(aString);
|
||||
}
|
||||
else if ([aString isKindOfClass: NSString_class])
|
||||
else if ([aString isKindOfClass: NSStringClass])
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = [[GSUString_class alloc] initWithString: aString];
|
||||
_string = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0);
|
||||
_string = [_string initWithString: aString];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
@class NSGMutableDictionary;
|
||||
@class NSDataMalloc;
|
||||
@class GSCString;
|
||||
@class GSUString;
|
||||
@class GSMString;
|
||||
@class GSUnicodeString;
|
||||
@class GSMutableString;
|
||||
|
||||
/*
|
||||
* Setup for inline operation of string map tables.
|
||||
|
@ -313,7 +313,7 @@ static BOOL shouldBeCompact = NO;
|
|||
MutableDictionaryClass = [NSMutableDictionary class];
|
||||
StringClass = [NSString class];
|
||||
CStringClass = [GSCString class];
|
||||
MStringClass = [GSMString class];
|
||||
MStringClass = [GSMutableString class];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,8 +444,9 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
case ST_CSTRING:
|
||||
{
|
||||
GSCString *s;
|
||||
char *b = NSZoneMalloc(NSDefaultMallocZone(), size);
|
||||
char *b;
|
||||
|
||||
b = NSZoneMalloc(NSDefaultMallocZone(), size);
|
||||
(*info->debImp)(info->data, debSel, b, size, info->cursor);
|
||||
s = (GSCString*)NSAllocateObject(CSCls, 0, NSDefaultMallocZone());
|
||||
s = (*csInitImp)(s, csInitSel, b, size-1, YES);
|
||||
|
@ -467,11 +468,14 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
|
||||
case ST_STRING:
|
||||
{
|
||||
GSUString *s;
|
||||
unichar *b = NSZoneMalloc(NSDefaultMallocZone(), size*2);
|
||||
GSUnicodeString *s;
|
||||
unichar *b;
|
||||
|
||||
(*info->debImp)(info->data, debSel, b, size*2, info->cursor);
|
||||
s = (GSUString*)NSAllocateObject(USCls, 0, NSDefaultMallocZone());
|
||||
b = NSZoneMalloc(NSDefaultMallocZone(), size*sizeof(unichar));
|
||||
(*info->debImp)(info->data, debSel, b, size*sizeof(unichar),
|
||||
info->cursor);
|
||||
s = (GSUnicodeString*)NSAllocateObject(USCls,
|
||||
0, NSDefaultMallocZone());
|
||||
s = (*usInitImp)(s, usInitSel, b, size, YES);
|
||||
|
||||
/*
|
||||
|
@ -695,7 +699,7 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
DCls = [NSDataMalloc class];
|
||||
IDCls = [NSGDictionary class];
|
||||
MDCls = [NSGMutableDictionary class];
|
||||
USCls = [GSUString class];
|
||||
USCls = [GSUnicodeString class];
|
||||
CSCls = [GSCString class];
|
||||
csInitImp = [CSCls instanceMethodForSelector: csInitSel];
|
||||
usInitImp = [USCls instanceMethodForSelector: usInitSel];
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
#include <Foundation/NSMapTable.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
#include <limits.h>
|
||||
#include <string.h> // for strstr()
|
||||
#include <sys/stat.h>
|
||||
|
@ -71,10 +73,8 @@
|
|||
#include <base/Unicode.h>
|
||||
|
||||
@class GSString;
|
||||
@class GSMString;
|
||||
@class GSUString;
|
||||
@class GSCInlineString;
|
||||
@class GSUInlineString;
|
||||
@class GSMutableString;
|
||||
@class GSPlaceholderString;
|
||||
@class NSGMutableArray;
|
||||
@class NSGMutableDictionary;
|
||||
|
||||
|
@ -87,10 +87,12 @@ static Class NSStringClass;
|
|||
static Class NSMutableStringClass;
|
||||
|
||||
static Class GSStringClass;
|
||||
static Class GSMStringClass;
|
||||
static Class GSUStringClass;
|
||||
static Class GSCInlineStringClass;
|
||||
static Class GSUInlineStringClass;
|
||||
static Class GSMutableStringClass;
|
||||
static Class GSPlaceholderStringClass;
|
||||
|
||||
static GSPlaceholderString *defaultPlaceholderString;
|
||||
static NSMapTable *placeholderMap;
|
||||
static NSLock *placeholderLock;
|
||||
|
||||
static Class plArray;
|
||||
static id (*plAdd)(id, SEL, id) = 0;
|
||||
|
@ -184,7 +186,7 @@ static NSString *rootPath = @"/";
|
|||
static BOOL (*sepMember)(NSCharacterSet*, SEL, unichar) = 0;
|
||||
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.
|
||||
*/
|
||||
static NSCharacterSet*
|
||||
|
@ -289,11 +291,18 @@ handle_printf_atsign (FILE *stream,
|
|||
[self setVersion: 1];
|
||||
NSMutableStringClass = [NSMutableString class];
|
||||
NSDataClass = [NSData class];
|
||||
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||
GSStringClass = [GSString class];
|
||||
GSMStringClass = [GSMString class];
|
||||
GSUStringClass = [GSUString class];
|
||||
GSCInlineStringClass = [GSCInlineString class];
|
||||
GSUInlineStringClass = [GSUInlineString class];
|
||||
GSMutableStringClass = [GSMutableString 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 (register_printf_function ('@',
|
||||
|
@ -313,10 +322,55 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
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
|
||||
{
|
||||
/*
|
||||
* For user provided strings, we simply allocate an object of
|
||||
* the given class.
|
||||
*/
|
||||
return NSAllocateObject (self, 0, z);
|
||||
}
|
||||
}
|
||||
|
@ -330,8 +384,11 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
+ (id) stringWithString: (NSString*)aString
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: aString]);
|
||||
NSString *obj;
|
||||
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithString: aString];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
||||
+ (id) stringWithCharacters: (const unichar*)chars
|
||||
|
@ -339,8 +396,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
NSString *obj;
|
||||
|
||||
obj = (NSString*)NSAllocateObject(GSUInlineStringClass, length*2,
|
||||
NSDefaultMallocZone());
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithCharacters: chars length: length];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
@ -350,8 +406,7 @@ handle_printf_atsign (FILE *stream,
|
|||
NSString *obj;
|
||||
unsigned length = strlen(byteString);
|
||||
|
||||
obj = (NSString*)NSAllocateObject(GSCInlineStringClass, length,
|
||||
NSDefaultMallocZone());
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithCString: byteString length: length];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
@ -361,28 +416,36 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
NSString *obj;
|
||||
|
||||
obj = (NSString*)NSAllocateObject(GSCInlineStringClass, length,
|
||||
NSDefaultMallocZone());
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithCString: byteString length: length];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
||||
+ (id) stringWithUTF8String: (const char *)bytes
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithUTF8String: bytes]);
|
||||
NSString *obj;
|
||||
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithUTF8String: bytes];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
||||
+ (id) stringWithContentsOfFile: (NSString *)path
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path]);
|
||||
NSString *obj;
|
||||
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithContentsOfFile: path];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
||||
+ (id) stringWithContentsOfURL: (NSURL *)url
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfURL: url]);
|
||||
NSString *obj;
|
||||
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
obj = [obj initWithContentsOfURL: url];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
||||
+ (id) stringWithFormat: (NSString*)format,...
|
||||
|
@ -1097,7 +1160,7 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
[self getCharacters: s];
|
||||
[aString getCharacters: s + len];
|
||||
tmp = [[GSStringClass allocWithZone: z] initWithCharactersNoCopy: s
|
||||
tmp = [[NSStringClass allocWithZone: z] initWithCharactersNoCopy: s
|
||||
length: len + otherLength freeWhenDone: YES];
|
||||
return AUTORELEASE(tmp);
|
||||
}
|
||||
|
@ -1161,7 +1224,7 @@ handle_printf_atsign (FILE *stream,
|
|||
return @"";
|
||||
buf = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*aRange.length);
|
||||
[self getCharacters: buf range: aRange];
|
||||
ret = [[GSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
ret = [[NSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharactersNoCopy: buf length: aRange.length freeWhenDone: YES];
|
||||
return AUTORELEASE(ret);
|
||||
}
|
||||
|
@ -1739,7 +1802,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
s[count] = uni_tolower((*caiImp)(self, caiSel, count));
|
||||
}
|
||||
return AUTORELEASE([[GSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
return AUTORELEASE([[NSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharactersNoCopy: s length: len freeWhenDone: YES]);
|
||||
}
|
||||
|
||||
|
@ -1760,7 +1823,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
s[count] = uni_toupper((*caiImp)(self, caiSel, count));
|
||||
}
|
||||
return AUTORELEASE([[GSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
return AUTORELEASE([[NSStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharactersNoCopy: s length: len freeWhenDone: YES]);
|
||||
}
|
||||
|
||||
|
@ -2859,14 +2922,14 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
if ([self isKindOfClass: [NSMutableString class]] ||
|
||||
NSShouldRetainWithZone(self, zone) == NO)
|
||||
return [[GSStringClass allocWithZone: zone] initWithString: self];
|
||||
return [[NSStringClass allocWithZone: zone] initWithString: self];
|
||||
else
|
||||
return RETAIN(self);
|
||||
}
|
||||
|
||||
- (id) mutableCopyWithZone: (NSZone*)zone
|
||||
{
|
||||
return [[GSMStringClass allocWithZone: zone] initWithString: self];
|
||||
return [[GSMutableStringClass allocWithZone: zone] initWithString: self];
|
||||
}
|
||||
|
||||
/* NSCoding Protocol */
|
||||
|
@ -2998,7 +3061,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
if (self == NSMutableStringClass)
|
||||
{
|
||||
return NSAllocateObject(GSMStringClass, 0, z);
|
||||
return NSAllocateObject(GSMutableStringClass, 0, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3010,13 +3073,13 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
+ (NSMutableString*) string
|
||||
{
|
||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
||||
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCapacity: 0]);
|
||||
}
|
||||
|
||||
+ (NSMutableString*) stringWithCapacity: (unsigned)capacity
|
||||
{
|
||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
||||
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCapacity: capacity]);
|
||||
}
|
||||
|
||||
|
@ -3024,26 +3087,26 @@ handle_printf_atsign (FILE *stream,
|
|||
+ (NSString*) stringWithCharacters: (const unichar*)characters
|
||||
length: (unsigned)length
|
||||
{
|
||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
||||
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCharacters: characters length: length]);
|
||||
}
|
||||
|
||||
+ (id) stringWithContentsOfFile: (NSString *)path
|
||||
{
|
||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
||||
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithContentsOfFile: path]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithCString: (const char*)byteString
|
||||
{
|
||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
||||
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCString: byteString]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithCString: (const char*)byteString
|
||||
length: (unsigned)length
|
||||
{
|
||||
return AUTORELEASE([[GSMStringClass allocWithZone:
|
||||
return AUTORELEASE([[GSMutableStringClass allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCString: byteString length: length]);
|
||||
}
|
||||
|
||||
|
|
184
Source/externs.m
184
Source/externs.m
|
@ -31,8 +31,6 @@
|
|||
#include "NSCallBacks.h"
|
||||
#include <Foundation/NSHashTable.h>
|
||||
|
||||
@class GSCString;
|
||||
|
||||
/* Global lock to be used by classes when operating on any global
|
||||
data that invoke other methods which also access global; thus,
|
||||
creating the potential for deadlock. */
|
||||
|
@ -279,200 +277,200 @@ NSString *NSConnectionProxyCount;
|
|||
void
|
||||
GSBuildStrings()
|
||||
{
|
||||
static BOOL beenHere = NO;
|
||||
static Class SClass = 0;
|
||||
|
||||
if (beenHere == NO)
|
||||
if (SClass == 0)
|
||||
{
|
||||
beenHere = YES;
|
||||
SClass = [NSString class];
|
||||
InPortAcceptedClientNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"InPortAcceptedClientNotification"];
|
||||
InPortClientBecameInvalidNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"InPortClientBecameInvalidNotification"];
|
||||
NSAMPMDesignation
|
||||
= [[GSCString alloc] initWithCString: "NSAMPMDesignation"];
|
||||
= [[SClass alloc] initWithCString: "NSAMPMDesignation"];
|
||||
NSArgumentDomain
|
||||
= [[GSCString alloc] initWithCString: "NSArgumentDomain"];
|
||||
= [[SClass alloc] initWithCString: "NSArgumentDomain"];
|
||||
NSBundleDidLoadNotification
|
||||
= [[GSCString alloc] initWithCString: "NSBundleDidLoadNotification"];
|
||||
= [[SClass alloc] initWithCString: "NSBundleDidLoadNotification"];
|
||||
*(NSString**)&NSCharacterConversionException
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSCharacterConversionException"];
|
||||
NSConnectionDidDieNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSConnectionDidDieNotification"];
|
||||
NSConnectionDidInitializeNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSConnectionDidInitializeNotification"];
|
||||
NSConnectionLocalCount
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionLocalCount"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionLocalCount"];
|
||||
NSConnectionProxyCount
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionProxyCount"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionProxyCount"];
|
||||
NSConnectionRepliesReceived
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRepliesReceived"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionRepliesReceived"];
|
||||
NSConnectionRepliesSent
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRepliesSent"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionRepliesSent"];
|
||||
NSConnectionReplyMode
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionReplyMode"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionReplyMode"];
|
||||
NSConnectionRequestsReceived
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRequestsReceived"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionRequestsReceived"];
|
||||
NSConnectionRequestsSent
|
||||
= [[GSCString alloc] initWithCString: "NSConnectionRequestsSent"];
|
||||
= [[SClass alloc] initWithCString: "NSConnectionRequestsSent"];
|
||||
NSCurrencyString
|
||||
= [[GSCString alloc] initWithCString: "NSCurrencyString"];
|
||||
= [[SClass alloc] initWithCString: "NSCurrencyString"];
|
||||
NSCurrencySymbol
|
||||
= [[GSCString alloc] initWithCString: "NSCurrencySymbol"];
|
||||
= [[SClass alloc] initWithCString: "NSCurrencySymbol"];
|
||||
NSDateFormatString
|
||||
= [[GSCString alloc] initWithCString: "NSDateFormatString"];
|
||||
= [[SClass alloc] initWithCString: "NSDateFormatString"];
|
||||
NSDateTimeOrdering
|
||||
= [[GSCString alloc] initWithCString: "NSDateTimeOrdering"];
|
||||
= [[SClass alloc] initWithCString: "NSDateTimeOrdering"];
|
||||
NSDecimalDigits
|
||||
= [[GSCString alloc] initWithCString: "NSDecimalDigits"];
|
||||
= [[SClass alloc] initWithCString: "NSDecimalDigits"];
|
||||
NSDecimalSeparator
|
||||
= [[GSCString alloc] initWithCString: "NSDecimalSeparator"];
|
||||
= [[SClass alloc] initWithCString: "NSDecimalSeparator"];
|
||||
NSDefaultRunLoopMode
|
||||
= [[GSCString alloc] initWithCString: "NSDefaultRunLoopMode"];
|
||||
= [[SClass alloc] initWithCString: "NSDefaultRunLoopMode"];
|
||||
NSEarlierTimeDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSEarlierTimeDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSEarlierTimeDesignations"];
|
||||
NSFailedAuthenticationException
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSFailedAuthenticationException"];
|
||||
NSFileDeviceIdentifier
|
||||
= [[GSCString alloc] initWithCString: "NSFileDeviceIdentifier"];
|
||||
= [[SClass alloc] initWithCString: "NSFileDeviceIdentifier"];
|
||||
NSFileGroupOwnerAccountName
|
||||
= [[GSCString alloc] initWithCString: "NSFileGroupOwnerAccountName"];
|
||||
= [[SClass alloc] initWithCString: "NSFileGroupOwnerAccountName"];
|
||||
NSFileGroupOwnerAccountNumber
|
||||
= [[GSCString alloc] initWithCString: "NSFileGroupOwnerAccountNumber"];
|
||||
= [[SClass alloc] initWithCString: "NSFileGroupOwnerAccountNumber"];
|
||||
NSFileModificationDate
|
||||
= [[GSCString alloc] initWithCString: "NSFileModificationDate"];
|
||||
= [[SClass alloc] initWithCString: "NSFileModificationDate"];
|
||||
NSFileOwnerAccountName
|
||||
= [[GSCString alloc] initWithCString: "NSFileOwnerAccountName"];
|
||||
= [[SClass alloc] initWithCString: "NSFileOwnerAccountName"];
|
||||
NSFileOwnerAccountNumber
|
||||
= [[GSCString alloc] initWithCString: "NSFileOwnerAccountNumber"];
|
||||
= [[SClass alloc] initWithCString: "NSFileOwnerAccountNumber"];
|
||||
NSFilePosixPermissions
|
||||
= [[GSCString alloc] initWithCString: "NSFilePosixPermissions"];
|
||||
= [[SClass alloc] initWithCString: "NSFilePosixPermissions"];
|
||||
NSFileReferenceCount
|
||||
= [[GSCString alloc] initWithCString: "NSFileReferenceCount"];
|
||||
= [[SClass alloc] initWithCString: "NSFileReferenceCount"];
|
||||
NSFileSize
|
||||
= [[GSCString alloc] initWithCString: "NSFileSize"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSize"];
|
||||
NSFileSystemFileNumber
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemFileNumber"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSystemFileNumber"];
|
||||
NSFileSystemFreeNodes
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemFreeNodes"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSystemFreeNodes"];
|
||||
NSFileSystemFreeSize
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemFreeSize"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSystemFreeSize"];
|
||||
NSFileSystemNodes
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemNodes"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSystemNodes"];
|
||||
NSFileSystemNumber
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemNumber"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSystemNumber"];
|
||||
NSFileSystemSize
|
||||
= [[GSCString alloc] initWithCString: "NSFileSystemSize"];
|
||||
= [[SClass alloc] initWithCString: "NSFileSystemSize"];
|
||||
NSFileType
|
||||
= [[GSCString alloc] initWithCString: "NSFileType"];
|
||||
= [[SClass alloc] initWithCString: "NSFileType"];
|
||||
NSFileTypeBlockSpecial
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeBlockSpecial"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeBlockSpecial"];
|
||||
NSFileTypeCharacterSpecial
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeCharacterSpecial"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeCharacterSpecial"];
|
||||
NSFileTypeDirectory
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeDirectory"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeDirectory"];
|
||||
NSFileTypeFifo
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeFifo"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeFifo"];
|
||||
NSFileTypeRegular
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeRegular"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeRegular"];
|
||||
NSFileTypeSocket
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeSocket"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeSocket"];
|
||||
NSFileTypeSymbolicLink
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeSymbolicLink"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeSymbolicLink"];
|
||||
NSFileTypeUnknown
|
||||
= [[GSCString alloc] initWithCString: "NSFileTypeUnknown"];
|
||||
= [[SClass alloc] initWithCString: "NSFileTypeUnknown"];
|
||||
NSFormalName
|
||||
= [[GSCString alloc] initWithCString: "NSFormalName"];
|
||||
= [[SClass alloc] initWithCString: "NSFormalName"];
|
||||
*(NSString**)&NSGenericException
|
||||
= [[GSCString alloc] initWithCString: "NSGenericException"];
|
||||
= [[SClass alloc] initWithCString: "NSGenericException"];
|
||||
NSGlobalDomain
|
||||
= [[GSCString alloc] initWithCString: "NSGlobalDomain"];
|
||||
= [[SClass alloc] initWithCString: "NSGlobalDomain"];
|
||||
NSHourNameDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSHourNameDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSHourNameDesignations"];
|
||||
NSInconsistentArchiveException
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSInconsistentArchiveException"];
|
||||
*(NSString**)&NSInternalInconsistencyException
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSInternalInconsistencyException"];
|
||||
NSInternationalCurrencyString
|
||||
= [[GSCString alloc] initWithCString: "NSInternationalCurrencyString"];
|
||||
= [[SClass alloc] initWithCString: "NSInternationalCurrencyString"];
|
||||
*(NSString**)&NSInvalidArgumentException
|
||||
= [[GSCString alloc] initWithCString: "NSInvalidArgumentException"];
|
||||
= [[SClass alloc] initWithCString: "NSInvalidArgumentException"];
|
||||
NSLanguageCode
|
||||
= [[GSCString alloc] initWithCString: "NSLanguageCode"];
|
||||
= [[SClass alloc] initWithCString: "NSLanguageCode"];
|
||||
NSLanguageName
|
||||
= [[GSCString alloc] initWithCString: "NSLanguageName"];
|
||||
= [[SClass alloc] initWithCString: "NSLanguageName"];
|
||||
NSLaterTimeDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSLaterTimeDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSLaterTimeDesignations"];
|
||||
NSLoadedClasses
|
||||
= [[GSCString alloc] initWithCString: "NSLoadedClasses"];
|
||||
= [[SClass alloc] initWithCString: "NSLoadedClasses"];
|
||||
NSLocale
|
||||
= [[GSCString alloc] initWithCString: "NSLocale"];
|
||||
= [[SClass alloc] initWithCString: "NSLocale"];
|
||||
*(NSString**)&NSMallocException
|
||||
= [[GSCString alloc] initWithCString: "NSMallocException"];
|
||||
= [[SClass alloc] initWithCString: "NSMallocException"];
|
||||
NSMonthNameArray
|
||||
= [[GSCString alloc] initWithCString: "NSMonthNameArray"];
|
||||
= [[SClass alloc] initWithCString: "NSMonthNameArray"];
|
||||
NSNegativeCurrencyFormatString
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSNegativeCurrencyFormatString"];
|
||||
NSNextDayDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSNextDayDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSNextDayDesignations"];
|
||||
NSNextNextDayDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSNextNextDayDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSNextNextDayDesignations"];
|
||||
NSPortDidBecomeInvalidNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSPortDidBecomeInvalidNotification"];
|
||||
NSPortTimeoutException
|
||||
= [[GSCString alloc] initWithCString: "NSPortTimeoutException"];
|
||||
= [[SClass alloc] initWithCString: "NSPortTimeoutException"];
|
||||
NSPositiveCurrencyFormatString
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSPositiveCurrencyFormatString"];
|
||||
NSPriorDayDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSPriorDayDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSPriorDayDesignations"];
|
||||
*(NSString**)&NSRangeException
|
||||
= [[GSCString alloc] initWithCString: "NSRangeException"];
|
||||
= [[SClass alloc] initWithCString: "NSRangeException"];
|
||||
NSRegistrationDomain
|
||||
= [[GSCString alloc] initWithCString: "NSRegistrationDomain"];
|
||||
= [[SClass alloc] initWithCString: "NSRegistrationDomain"];
|
||||
NSShortDateFormatString
|
||||
= [[GSCString alloc] initWithCString: "NSShortDateFormatString"];
|
||||
= [[SClass alloc] initWithCString: "NSShortDateFormatString"];
|
||||
NSShortMonthNameArray
|
||||
= [[GSCString alloc] initWithCString: "NSShortMonthNameArray"];
|
||||
= [[SClass alloc] initWithCString: "NSShortMonthNameArray"];
|
||||
NSShortTimeDateFormatString
|
||||
= [[GSCString alloc] initWithCString: "NSShortTimeDateFormatString"];
|
||||
= [[SClass alloc] initWithCString: "NSShortTimeDateFormatString"];
|
||||
NSShortWeekDayNameArray
|
||||
= [[GSCString alloc] initWithCString: "NSShortWeekDayNameArray"];
|
||||
= [[SClass alloc] initWithCString: "NSShortWeekDayNameArray"];
|
||||
NSShowNonLocalizedStrings
|
||||
= [[GSCString alloc] initWithCString: "NSShowNonLocalizedStrings"];
|
||||
= [[SClass alloc] initWithCString: "NSShowNonLocalizedStrings"];
|
||||
NSThisDayDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSThisDayDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSThisDayDesignations"];
|
||||
NSThousandsSeparator
|
||||
= [[GSCString alloc] initWithCString: "NSThousandsSeparator"];
|
||||
= [[SClass alloc] initWithCString: "NSThousandsSeparator"];
|
||||
NSThreadWillExitNotification
|
||||
= [[GSCString alloc] initWithCString: "NSThreadWillExitNotification"];
|
||||
= [[SClass alloc] initWithCString: "NSThreadWillExitNotification"];
|
||||
NSTimeDateFormatString
|
||||
= [[GSCString alloc] initWithCString: "NSTimeDateFormatString"];
|
||||
= [[SClass alloc] initWithCString: "NSTimeDateFormatString"];
|
||||
NSTimeFormatString
|
||||
= [[GSCString alloc] initWithCString: "NSTimeFormatString"];
|
||||
= [[SClass alloc] initWithCString: "NSTimeFormatString"];
|
||||
NSUserDefaultsDidChangeNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSUserDefaultsDidChangeNotification"];
|
||||
NSWeekDayNameArray
|
||||
= [[GSCString alloc] initWithCString: "NSWeekDayNameArray"];
|
||||
= [[SClass alloc] initWithCString: "NSWeekDayNameArray"];
|
||||
NSWillBecomeMultiThreadedNotification
|
||||
= [[GSCString alloc] initWithCString:
|
||||
= [[SClass alloc] initWithCString:
|
||||
"NSWillBecomeMultiThreadedNotification"];
|
||||
NSYearMonthWeekDesignations
|
||||
= [[GSCString alloc] initWithCString: "NSYearMonthWeekDesignations"];
|
||||
= [[SClass alloc] initWithCString: "NSYearMonthWeekDesignations"];
|
||||
PortBecameInvalidNotification
|
||||
= [[GSCString alloc] initWithCString: "PortBecameInvalidNotification"];
|
||||
= [[SClass alloc] initWithCString: "PortBecameInvalidNotification"];
|
||||
StreamException
|
||||
= [[GSCString alloc] initWithCString: "StreamException"];
|
||||
= [[SClass alloc] initWithCString: "StreamException"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "config.h"
|
||||
#include <string.h>
|
||||
#include <base/preface.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
|
Loading…
Reference in a new issue