Minor modification for Apple runtime

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7933 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-10-30 18:00:27 +00:00
parent e6c8161b8a
commit e6573102f8
23 changed files with 294 additions and 111 deletions

View file

@ -3,6 +3,30 @@
* Headers/gnustep/base/NSInvocation.h: Removed non-standard macros
* Headers/gnustep/base/behavior.h: Removed unused macro
CALL_METHOD_IN_CLASS()
* Source/GSString.m:
* Source/GSXML.m:
* Source/NSArchiver.m:
* Source/NSArray.m:
* Source/NSAttributedString.m:
* Source/NSData.m:
* Source/NSDictionary.m:
* Source/NSGArray.m:
* Source/NSGAttributedString.m:
* Source/NSGCString.m:
* Source/NSGDictionary.m:
* Source/NSGeometry.m:
* Source/NSObject.m:
* Source/NSPortCoder.m:
* Source/NSProcessInfo.m:
* Source/NSRange.m:
* Source/NSRunLoop.m:
* Source/NSScanner.m:
* Source/NSSerializer.m:
* Source/NSString.m:
* Source/NSUnarchiver.m:
* Source/NSUserDefaults.m:
Updated to move static SEL variable initialisation to +initialize
methods so that it should (I think) work with the Apple runtime.
2000-10-29 Adam Fedor <fedor@gnu.org>

View file

@ -186,12 +186,12 @@ static Class GSUInlineStringClass = 0;
static Class GSMStringClass = 0;
static Class NXConstantStringClass = 0;
static SEL convertSel = @selector(canBeConvertedToEncoding:);
static BOOL (*convertImp)(id, SEL, NSStringEncoding) = 0;
static SEL equalSel = @selector(isEqualToString:);
static BOOL (*equalImp)(id, SEL, id) = 0;
static SEL hashSel = @selector(hash);
static unsigned (*hashImp)(id, SEL) = 0;
static SEL convertSel;
static BOOL (*convertImp)(id, SEL, NSStringEncoding);
static SEL equalSel;
static BOOL (*equalImp)(id, SEL, id);
static SEL hashSel;
static unsigned (*hashImp)(id, SEL);
static NSStringEncoding defEnc = 0;
@ -220,10 +220,13 @@ setup()
GSMStringClass = [GSMString class];
NXConstantStringClass = [NXConstantString class];
convertSel = @selector(canBeConvertedToEncoding:);
convertImp = (BOOL (*)(id, SEL, NSStringEncoding))
[NSStringClass instanceMethodForSelector: convertSel];
equalSel = @selector(isEqualToString:);
equalImp = (BOOL (*)(id, SEL, id))
[NSStringClass instanceMethodForSelector: equalSel];
hashSel = @selector(hash);
hashImp = (unsigned (*)(id, SEL))
[NSStringClass instanceMethodForSelector: hashSel];

View file

@ -48,7 +48,7 @@ extern int xmlGetWarningsDefaultValue;
*/
static Class NSString_class;
static IMP usImp;
static SEL usSel = @selector(stringWithUTF8String:);
static SEL usSel;
inline static NSString*
UTF8Str(const char *bytes)
@ -78,6 +78,7 @@ setupCache()
{
cacheDone = YES;
NSString_class = [NSString class];
usSel = @selector(stringWithUTF8String:);
usImp = [NSString_class methodForSelector: usSel];
}
}

View file

@ -52,14 +52,26 @@ typedef unsigned char uchar;
#define PREFIX "GNUstep archive"
static SEL serSel = @selector(serializeDataAt:ofObjCType:context:);
static SEL tagSel = @selector(serializeTypeTag:);
static SEL xRefSel = @selector(serializeTypeTag:andCrossRef:);
static SEL eObjSel = @selector(encodeObject:);
static SEL eValSel = @selector(encodeValueOfObjCType:at:);
@implementation NSArchiver
static SEL serSel;
static SEL tagSel;
static SEL xRefSel;
static SEL eObjSel;
static SEL eValSel;
+ (void) initialize
{
if (self == [NSArchiver class])
{
serSel = @selector(serializeDataAt:ofObjCType:context:);
tagSel = @selector(serializeTypeTag:);
xRefSel = @selector(serializeTypeTag:andCrossRef:);
eObjSel = @selector(encodeObject:);
eValSel = @selector(encodeValueOfObjCType:at:);
}
}
- (id) init
{
NSMutableData *d;

View file

@ -50,31 +50,46 @@
@interface NSMutableArrayNonCore : NSMutableArray
@end
@class NSGInlineArray;
static Class NSArray_abstract_class;
static Class NSArray_concrete_class;
static Class NSMutableArray_abstract_class;
static Class NSMutableArray_concrete_class;
static SEL addSel = @selector(addObject:);
static SEL appSel = @selector(appendString:);
static SEL countSel = @selector(count);
static SEL eqSel = @selector(isEqual:);
static SEL oaiSel = @selector(objectAtIndex:);
static SEL remSel = @selector(removeObjectAtIndex:);
static SEL rlSel = @selector(removeLastObject);
static Class NSGInlineArrayClass;
@implementation NSArray
static SEL addSel;
static SEL appSel;
static SEL countSel;
static SEL eqSel;
static SEL oaiSel;
static SEL remSel;
static SEL rlSel;
+ (void) initialize
{
if (self == [NSArray class])
{
[self setVersion: 1];
addSel = @selector(addObject:);
appSel = @selector(appendString:);
countSel = @selector(count);
eqSel = @selector(isEqual:);
oaiSel = @selector(objectAtIndex:);
remSel = @selector(removeObjectAtIndex:);
rlSel = @selector(removeLastObject);
NSArray_abstract_class = [NSArray class];
behavior_class_add_class (self, [NSArrayNonCore class]);
NSMutableArray_abstract_class = [NSMutableArray class];
NSArray_concrete_class = [NSGArray class];
NSMutableArray_concrete_class = [NSGMutableArray class];
behavior_class_add_class (self, [NSArrayNonCore class]);
NSMutableArray_concrete_class = [NSGMutableArray class];
NSGInlineArrayClass = [NSGInlineArray class];
}
}
@ -107,13 +122,16 @@ static SEL rlSel = @selector(removeLastObject);
initWithContentsOfFile: file]);
}
+ (id) arrayWithObject: anObject
+ (id) arrayWithObject: (id)anObject
{
id o;
if (anObject == nil)
[NSException raise: NSInvalidArgumentException
format: @"Tried to add nil"];
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
initWithObjects: &anObject count: 1]);
o = NSAllocateObject(NSGInlineArrayClass, sizeof(id), NSDefaultMallocZone());
o = [o initWithObjects: &anObject count: 1];
return AUTORELEASE(o);
}
/* This is the designated initializer for NSArray. */
@ -807,6 +825,14 @@ static NSString *indentStrings[] = {
}
}
+ (id) arrayWithObject: (id)anObject
{
NSMutableArray *obj = [self allocWithZone: NSDefaultMallocZone()];
obj = [obj initWithObjects: &anObject count: 1];
return AUTORELEASE(self);
}
- (Class) classForCoder
{
return NSMutableArray_abstract_class;

View file

@ -55,18 +55,19 @@
#include <Foundation/NSPortCoder.h>
#include <Foundation/NSRange.h>
static SEL eqSel = @selector(isEqual:);
static SEL setSel = @selector(setAttributes:range:);
static SEL getSel = @selector(attributesAtIndex:effectiveRange:);
static SEL addDictSel = @selector(addEntriesFromDictionary:);
static SEL setDictSel = @selector(setObject:forKey:);
static SEL relDictSel = @selector(release);
static SEL remDictSel = @selector(removeObjectForKey:);
@class NSGMutableDictionary;
static Class dictionaryClass = 0;
static SEL allocDictSel = @selector(allocWithZone:);
static SEL initDictSel = @selector(initWithDictionary:);
static SEL eqSel;
static SEL setSel;
static SEL getSel;
static SEL allocDictSel;
static SEL initDictSel;
static SEL addDictSel;
static SEL setDictSel;
static SEL relDictSel;
static SEL remDictSel;
static IMP allocDictImp;
static IMP initDictImp;
static IMP addDictImp;
@ -100,6 +101,17 @@ static Class NSMutableAttributedString_concrete_class;
NSMutableAttributedString_concrete_class
= [NSGMutableAttributedString class];
dictionaryClass = [NSGMutableDictionary class];
eqSel = @selector(isEqual:);
setSel = @selector(setAttributes:range:);
getSel = @selector(attributesAtIndex:effectiveRange:);
allocDictSel = @selector(allocWithZone:);
initDictSel = @selector(initWithDictionary:);
addDictSel = @selector(addEntriesFromDictionary:);
setDictSel = @selector(setObject:forKey:);
relDictSel = @selector(release);
remDictSel = @selector(removeObjectForKey:);
allocDictImp = [dictionaryClass methodForSelector: allocDictSel];
initDictImp = [dictionaryClass instanceMethodForSelector: initDictSel];
addDictImp = [dictionaryClass instanceMethodForSelector: addDictSel];

View file

@ -107,12 +107,13 @@
* Some static variables to cache classes and methods for quick access -
* these are set up at process startup or in [NSData +initialize]
*/
static SEL appendSel = @selector(appendBytes:length:);
static SEL appendSel;
static Class dataStatic;
static Class dataMalloc;
static Class mutableDataMalloc;
static Class NSDataAbstract;
static Class NSMutableDataAbstract;
static SEL appendSel;
static IMP appendImp;
static BOOL
@ -334,6 +335,7 @@ failure:
dataMalloc = [NSDataMalloc class];
dataStatic = [NSDataStatic class];
mutableDataMalloc = [NSMutableDataMalloc class];
appendSel = @selector(appendBytes:length:);
appendImp = [mutableDataMalloc instanceMethodForSelector: appendSel];
}
}

View file

@ -52,11 +52,12 @@ static Class NSMutableDictionary_abstract_class;
static Class NSDictionary_concrete_class;
static Class NSMutableDictionary_concrete_class;
static SEL nxtSel = @selector(nextObject);
static SEL objSel = @selector(objectForKey:);
static SEL remSel = @selector(removeObjectForKey:);
static SEL setSel = @selector(setObject:forKey:);
static SEL appSel = @selector(appendString:);
static SEL eqSel;
static SEL nxtSel;
static SEL objSel;
static SEL remSel;
static SEL setSel;
static SEL appSel;
+ (void) initialize
{
@ -68,6 +69,13 @@ static SEL appSel = @selector(appendString:);
NSMutableDictionary_abstract_class = [NSMutableDictionary class];
NSDictionary_concrete_class = [NSGDictionary class];
NSMutableDictionary_concrete_class = [NSGMutableDictionary class];
eqSel = @selector(isEqual:);
nxtSel = @selector(nextObject);
objSel = @selector(objectForKey:);
remSel = @selector(removeObjectForKey:);
setSel = @selector(setObject:forKey:);
appSel = @selector(appendString:);
}
}
@ -543,7 +551,6 @@ static SEL appSel = @selector(appendString:);
}
else
{
static SEL eqSel = @selector(isEqual:);
NSEnumerator *e = [self keyEnumerator];
IMP nxtObj = [e methodForSelector: nxtSel];
IMP myObj = [self methodForSelector: objSel];

View file

@ -30,7 +30,7 @@
#include <Foundation/NSPortCoder.h>
#include <Foundation/NSDebug.h>
static SEL eqSel = @selector(isEqual:);
static SEL eqSel;
@class NSGArrayEnumerator;
@class NSGArrayEnumeratorReverse;
@ -43,6 +43,11 @@ static SEL eqSel = @selector(isEqual:);
}
@end
@interface NSGInlineArray : NSGArray
{
}
@end
@interface NSGMutableArray : NSMutableArray
{
@public
@ -62,6 +67,7 @@ static SEL eqSel = @selector(isEqual:);
if (self == [NSGArray class])
{
[self setVersion: 1];
eqSel = @selector(isEqual:);
behavior_class_add_class(self, [NSArrayNonCore class]);
}
}
@ -87,7 +93,7 @@ static SEL eqSel = @selector(isEqual:);
#endif
NSZoneFree([self zone], _contents_array);
}
[super dealloc];
NSDeallocateObject(self);
}
/* This is the designated initializer for NSArray. */
@ -271,6 +277,45 @@ static SEL eqSel = @selector(isEqual:);
@end
@implementation NSGInlineArray
- (void) dealloc
{
if (_contents_array)
{
#if !GS_WITH_GC
unsigned i;
for (i = 0; i < _count; i++)
{
[_contents_array[i] release];
}
#endif
}
NSDeallocateObject(self);
}
- (id) initWithObjects: (id*)objects count: (unsigned)count
{
_contents_array = (id*)&self[1];
if (count > 0)
{
unsigned i;
for (i = 0; i < count; i++)
{
if ((_contents_array[i] = RETAIN(objects[i])) == nil)
{
_count = i;
RELEASE(self);
[NSException raise: NSInvalidArgumentException
format: @"Tried to add nil"];
}
}
_count = count;
}
return self;
}
@end
@class NSMutableArrayNonCore;
@implementation NSGMutableArray
@ -659,7 +704,7 @@ static SEL eqSel = @selector(isEqual:);
- (void) dealloc
{
RELEASE(array);
[super dealloc];
NSDeallocateObject(self);
}
@end

View file

@ -97,23 +97,19 @@
static Class infCls = 0;
static SEL infSel = @selector(newWithZone:value:at:);
static IMP infImp = 0;
static SEL infSel;
static SEL addSel;
static SEL cntSel;
static SEL insSel;
static SEL oatSel;
static SEL remSel;
static SEL addSel = @selector(addObject:);
static void (*addImp)() = 0;
static SEL cntSel = @selector(count);
static unsigned (*cntImp)() = 0;
static SEL insSel = @selector(insertObject:atIndex:);
static void (*insImp)() = 0;
static SEL oatSel = @selector(objectAtIndex:);
static IMP oatImp = 0;
static SEL remSel = @selector(removeObjectAtIndex:);
static void (*remImp)() = 0;
static IMP infImp;
static void (*addImp)();
static unsigned (*cntImp)();
static void (*insImp)();
static IMP oatImp;
static void (*remImp)();
#define NEWINFO(Z,O,L) ((*infImp)(infCls, infSel, (Z), (O), (L)))
#define ADDOBJECT(O) ((*addImp)(_infoArray, addSel, (O)))
@ -127,6 +123,13 @@ static void _setup()
{
NSMutableArray *a;
infSel = @selector(newWithZone:value:at:);
addSel = @selector(addObject:);
cntSel = @selector(count);
insSel = @selector(insertObject:atIndex:);
oatSel = @selector(objectAtIndex:);
remSel = @selector(removeObjectAtIndex:);
infCls = [GSAttrInfo class];
infImp = [infCls methodForSelector: infSel];

View file

@ -69,8 +69,8 @@
#define GSPLUNI 0
#include "propList.h"
static SEL csInitSel = @selector(initWithCStringNoCopy:length:freeWhenDone:);
static SEL msInitSel = @selector(initWithCapacity:);
static SEL csInitSel;
static SEL msInitSel;
static IMP csInitImp; /* designated initialiser for cString */
static IMP msInitImp; /* designated initialiser for mutable */
@ -86,6 +86,8 @@ static IMP msInitImp; /* designated initialiser for mutable */
if (!done)
{
done = 1;
csInitSel = @selector(initWithCStringNoCopy:length:freeWhenDone:);
msInitSel = @selector(initWithCapacity:);
csInitImp = [NSGCString instanceMethodForSelector: csInitSel];
msInitImp = [NSGMutableCString instanceMethodForSelector: msInitSel];
}

View file

@ -76,10 +76,15 @@
@implementation NSGDictionary
static SEL nxtSel;
static SEL objSel;
+ (void) initialize
{
if (self == [NSGDictionary class])
{
nxtSel = @selector(nextObject);
objSel = @selector(objectForKey:);
behavior_class_add_class(self, [NSDictionaryNonCore class]);
}
}
@ -189,8 +194,6 @@
if (c > 0)
{
static SEL nxtSel = @selector(nextObject);
static SEL objSel = @selector(objectForKey:);
NSEnumerator *e = [other keyEnumerator];
IMP nxtObj = [e methodForSelector: nxtSel];
IMP otherObj = [other methodForSelector: objSel];

View file

@ -41,9 +41,9 @@ extern BOOL GSMacOSXCompatibleGeometry(); // Compatibility mode
static Class NSStringClass = 0;
static Class NSScannerClass = 0;
static SEL scanFloatSel = @selector(scanFloat:);
static SEL scanStringSel = @selector(scanString:intoString:);
static SEL scannerSel = @selector(scannerWithString:);
static SEL scanFloatSel;
static SEL scanStringSel;
static SEL scannerSel;
static BOOL (*scanFloatImp)(NSScanner*, SEL, float*);
static BOOL (*scanStringImp)(NSScanner*, SEL, NSString*, NSString**);
static id (*scannerImp)(Class, SEL, NSString*);
@ -55,6 +55,9 @@ setupCache()
{
NSStringClass = [NSString class];
NSScannerClass = [NSScanner class];
scanFloatSel = @selector(scanFloat:);
scanStringSel = @selector(scanString:intoString:);
scannerSel = @selector(scannerWithString:);
scanFloatImp = (BOOL (*)(NSScanner*, SEL, float*))
[NSScannerClass instanceMethodForSelector: scanFloatSel];
scanStringImp = (BOOL (*)(NSScanner*, SEL, NSString*, NSString**))

View file

@ -556,8 +556,8 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
need mutex protection, since it is simply a pointer that gets read
and set. */
static id autorelease_class = nil;
static SEL autorelease_sel = @selector(addObject:);
static IMP autorelease_imp = 0;
static SEL autorelease_sel;
static IMP autorelease_imp;
/* When this is `YES', every call to release/autorelease, checks to
make sure isn't being set up to release itself too many times.
@ -609,6 +609,7 @@ static BOOL double_release_check_enabled = NO;
// Create the global lock
gnustep_global_lock = [[NSRecursiveLock alloc] init];
autorelease_class = [NSAutoreleasePool class];
autorelease_sel = @selector(addObject:);
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
fastMallocClass = [_FastMallocBuffer class];
#if GS_WITH_GC == 0

View file

@ -78,14 +78,14 @@ typedef unsigned char uchar;
#define PREFIX "GNUstep DO archive"
static SEL eSerSel = @selector(serializeDataAt:ofObjCType:context:);
static SEL eTagSel = @selector(serializeTypeTag:);
static SEL xRefSel = @selector(serializeTypeTag:andCrossRef:);
static SEL eObjSel = @selector(encodeObject:);
static SEL eValSel = @selector(encodeValueOfObjCType:at:);
static SEL dDesSel = @selector(deserializeDataAt:ofObjCType:atCursor:context:);
static SEL dTagSel = @selector(deserializeTypeTag:andCrossRef:atCursor:);
static SEL dValSel = @selector(decodeValueOfObjCType:at:);
static SEL eSerSel;
static SEL eTagSel;
static SEL xRefSel;
static SEL eObjSel;
static SEL eValSel;
static SEL dDesSel;
static SEL dTagSel;
static SEL dValSel;
@ -311,6 +311,14 @@ static IMP _xRefImp; /* Serialize a crossref. */
connectionClass = [NSConnection class];
mutableArrayClass = [NSMutableArray class];
mutableDataClass = [NSMutableDataMalloc class];
eSerSel = @selector(serializeDataAt:ofObjCType:context:);
eTagSel = @selector(serializeTypeTag:);
xRefSel = @selector(serializeTypeTag:andCrossRef:);
eObjSel = @selector(encodeObject:);
eValSel = @selector(encodeValueOfObjCType:at:);
dDesSel = @selector(deserializeDataAt:ofObjCType:atCursor:context:);
dTagSel = @selector(deserializeTypeTag:andCrossRef:atCursor:);
dValSel = @selector(decodeValueOfObjCType:at:);
_eSerImp = [mutableDataClass instanceMethodForSelector: eSerSel];
_eTagImp = [mutableDataClass instanceMethodForSelector: eTagSel];
_xRefImp = [mutableDataClass instanceMethodForSelector: xRefSel];

View file

@ -618,11 +618,12 @@ int main(int argc, char *argv[], char *env[])
*/
BOOL GSDebugSet(NSString *val)
{
static SEL debugSel = @selector(member:);
static IMP debugImp = 0;
static SEL debugSel;
if (debugImp == 0)
{
debugSel = @selector(member:);
if (_debug_set == nil)
{
[[NSProcessInfo processInfo] debugSet];

View file

@ -14,9 +14,9 @@
static Class NSStringClass = 0;
static Class NSScannerClass = 0;
static SEL scanIntSel = @selector(scanInt:);
static SEL scanStringSel = @selector(scanString:intoString:);
static SEL scannerSel = @selector(scannerWithString:);
static SEL scanIntSel;
static SEL scanStringSel;
static SEL scannerSel;
static BOOL (*scanIntImp)(NSScanner*, SEL, int*);
static BOOL (*scanStringImp)(NSScanner*, SEL, NSString*, NSString**);
static id (*scannerImp)(Class, SEL, NSString*);
@ -28,6 +28,9 @@ setupCache()
{
NSStringClass = [NSString class];
NSScannerClass = [NSScanner class];
scanIntSel = @selector(scanInt:);
scanStringSel = @selector(scanString:intoString:);
scannerSel = @selector(scannerWithString:);
scanIntImp = (BOOL (*)(NSScanner*, SEL, int*))
[NSScannerClass instanceMethodForSelector: scanIntSel];
scanStringImp = (BOOL (*)(NSScanner*, SEL, NSString*, NSString**))

View file

@ -86,7 +86,7 @@ static NSDate *theFuture = nil;
* NB. This class is private to NSRunLoop and must not be subclassed.
*/
static SEL eventSel = @selector(receivedEvent:type:extra:forMode:);
static SEL eventSel; /* Initialized in [NSRunLoop +initialize] */
@interface GSRunLoopWatcher: NSObject
{
@ -641,8 +641,8 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
@implementation NSRunLoop
#if GS_WITH_GC == 0
static SEL wRelSel = @selector(release);
static SEL wRetSel = @selector(retain);
static SEL wRelSel;
static SEL wRetSel;
static IMP wRelImp;
static IMP wRetImp;
@ -695,7 +695,10 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
{
[self currentRunLoop];
theFuture = RETAIN([NSDate distantFuture]);
eventSel = @selector(receivedEvent:type:extra:forMode:);
#if GS_WITH_GC == 0
wRelSel = @selector(release);
wRetSel = @selector(retain);
wRelImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRelSel];
wRetImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRetSel];
#endif

View file

@ -44,7 +44,7 @@ static Class GSUString_class;
static Class GSMString_class;
static Class NXConstantString_class;
static NSCharacterSet *defaultSkipSet;
static SEL memSel = @selector(characterIsMember:);
static SEL memSel;
/*
* Hack for direct access to internals of an concrete string object.
@ -74,6 +74,7 @@ typedef struct {
{
if (self == [NSScanner class])
{
memSel = @selector(characterIsMember:);
defaultSkipSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
IF_NO_GC(RETAIN(defaultSkipSet));
NSString_class = [NSString class];

View file

@ -124,11 +124,11 @@ typedef struct {
BOOL shouldUnique; // Do we do uniquing?
} _NSSerializerInfo;
static SEL appSel = @selector(appendBytes:length:);
static SEL datSel = @selector(mutableBytes);
static SEL lenSel = @selector(length);
static SEL serSel = @selector(serializeInt:);
static SEL setSel = @selector(setLength:);
static SEL appSel;
static SEL datSel;
static SEL lenSel;
static SEL serSel;
static SEL setSel;
static void
initSerializerInfo(_NSSerializerInfo* info, NSMutableData *d, BOOL u)
@ -299,6 +299,11 @@ static BOOL shouldBeCompact = NO;
{
if (self == [NSSerializer class])
{
appSel = @selector(appendBytes:length:);
datSel = @selector(mutableBytes);
lenSel = @selector(length);
serSel = @selector(serializeInt:);
setSel = @selector(setLength:);
ArrayClass = [NSArray class];
MutableArrayClass = [NSMutableArray class];
DataClass = [NSData class];
@ -381,15 +386,15 @@ typedef struct {
GSIArray_t array;
} _NSDeserializerInfo;
static SEL debSel = @selector(deserializeBytes:length:atCursor:);
static SEL deiSel = @selector(deserializeIntAtCursor:);
static SEL csInitSel = @selector(initWithCStringNoCopy:length:freeWhenDone:);
static SEL usInitSel = @selector(initWithCharactersNoCopy:length:freeWhenDone:);
static SEL dInitSel = @selector(initWithBytesNoCopy:length:);
static SEL iaInitSel = @selector(initWithObjects:count:);
static SEL maInitSel = @selector(initWithObjects:count:);
static SEL idInitSel = @selector(initWithObjects:forKeys:count:);
static SEL mdInitSel = @selector(initWithObjects:forKeys:count:);
static SEL debSel;
static SEL deiSel;
static SEL csInitSel;
static SEL usInitSel;
static SEL dInitSel;
static SEL iaInitSel;
static SEL maInitSel;
static SEL idInitSel;
static SEL mdInitSel;
static IMP csInitImp;
static IMP usInitImp;
static IMP dInitImp;
@ -674,6 +679,15 @@ deserializeFromInfo(_NSDeserializerInfo* info)
{
if (self == [NSDeserializer class])
{
debSel = @selector(deserializeBytes:length:atCursor:);
deiSel = @selector(deserializeIntAtCursor:);
csInitSel = @selector(initWithCStringNoCopy:length:freeWhenDone:);
usInitSel = @selector(initWithCharactersNoCopy:length:freeWhenDone:);
dInitSel = @selector(initWithBytesNoCopy:length:);
iaInitSel = @selector(initWithObjects:count:);
maInitSel = @selector(initWithObjects:count:);
idInitSel = @selector(initWithObjects:forKeys:count:);
mdInitSel = @selector(initWithObjects:forKeys:count:);
IACls = [NSGArray class];
MACls = [NSGMutableArray class];
DCls = [NSDataMalloc class];

View file

@ -102,9 +102,9 @@ static id (*plSet)(id, SEL, id, id) = 0;
static id (*plAlloc)(Class, SEL, NSZone*) = 0;
static id (*plInit)(id, SEL, unichar*, unsigned) = 0;
static SEL plSel = @selector(initWithCharacters:length:);
static SEL cMemberSel = @selector(characterIsMember:);
static SEL plSel;
static SEL cMemberSel;
static NSCharacterSet *hexdigits = nil;
static BOOL (*hexdigitsImp)(id, SEL, unichar) = 0;
@ -278,8 +278,11 @@ handle_printf_atsign (FILE *stream,
{
if (self == [NSString class])
{
plSel = @selector(initWithCharacters:length:);
cMemberSel = @selector(characterIsMember:);
_DefaultStringEncoding = GetDefEncoding();
NSStringClass = self;
[self setVersion: 1];
NSMutableStringClass = [NSMutableString class];
NSDataClass = [NSData class];
GSStringClass = [GSString class];

View file

@ -196,9 +196,9 @@ typeCheck(char t1, char t2)
#define PREFIX "GNUstep archive"
static SEL desSel = @selector(deserializeDataAt:ofObjCType:atCursor:context:);
static SEL tagSel = @selector(deserializeTypeTag:andCrossRef:atCursor:);
static SEL dValSel = @selector(decodeValueOfObjCType:at:);
static SEL desSel;
static SEL tagSel;
static SEL dValSel;
@interface NSUnarchiverClassInfo : NSObject
{
@ -298,6 +298,9 @@ mapClassName(NSUnarchiverObjectInfo *info)
{
if ([self class] == [NSUnarchiver class])
{
desSel = @selector(deserializeDataAt:ofObjCType:atCursor:context:);
tagSel = @selector(deserializeTypeTag:andCrossRef:atCursor:);
dValSel = @selector(decodeValueOfObjCType:at:);
clsDict = [[NSMutableDictionary alloc] initWithCapacity: 200];
}
}

View file

@ -48,8 +48,9 @@
/* Wait for access */
#define _MAX_COUNT 5 /* Max 10 sec. */
static SEL nextObjectSel = @selector(nextObject);
static SEL objectForKeySel = @selector(objectForKey:);
static SEL nextObjectSel;
static SEL objectForKeySel;
static SEL addSel;
/* User's Defaults database */
static NSString *GNU_UserDefaultsPrefix = @"GNUstep";
@ -89,6 +90,9 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
{
if (self == [NSUserDefaults class])
{
nextObjectSel = @selector(nextObject);
objectForKeySel = @selector(objectForKey:);
addSel = @selector(addEntriesFromDictionary:);
/*
* Cache class info for more rapid testing of the types of defaults.
*/
@ -954,11 +958,10 @@ static NSString *pathForUser(NSString *user)
NSMutableDictionary *dictRep;
id obj;
id dict;
static SEL aSel = @selector(addEntriesFromDictionary:);
IMP nImp;
IMP pImp;
IMP tImp;
IMP aImp;
IMP addImp;
pImp = [_persDomains methodForSelector: objectForKeySel];
tImp = [_tempDomains methodForSelector: objectForKeySel];
@ -968,13 +971,13 @@ static NSString *pathForUser(NSString *user)
dictRep = [NSMutableDictionaryClass allocWithZone: NSDefaultMallocZone()];
dictRep = [dictRep initWithCapacity: 512];
aImp = [dictRep methodForSelector: aSel];
addImp = [dictRep methodForSelector: addSel];
while ((obj = (*nImp)(enumerator, nextObjectSel)) != nil)
{
if ( (dict = (*pImp)(_persDomains, objectForKeySel, obj)) != nil
|| (dict = (*tImp)(_tempDomains, objectForKeySel, obj)) != nil)
(*aImp)(dictRep, aSel, dict);
(*addImp)(dictRep, addSel, dict);
}
_dictionaryRep = [dictRep copy];
RELEASE(dictRep);