Basic tidyup for start of support for apple runtime

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7949 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-10-31 16:17:33 +00:00
parent d24c4fccc8
commit 42011ceae4
39 changed files with 266 additions and 388 deletions

View file

@ -1,3 +1,12 @@
2000-10-31 Richard Frith-Macdonald <rfm@gnu.org>
Loads of files modified, fast.x removed.
Found it unexpectedly easy to tidy up so that all functions for
accessing the runtime are now in NSObjCRuntime.h.
Now all :-) we need are Apple runtime implementations, configuration
auto-detect for the apple runtime, and loads of updating of any
bits of code that call the runtime directly.
2000-10-31 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/gnustep/base/NSGString.h:

View file

@ -25,6 +25,7 @@
#define __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE
#include <objc/objc.h>
#include <objc/objc-api.h>
#include <stdarg.h>
#if BUILD_libgnustep_base_DLL
@ -36,6 +37,7 @@
#endif
#define GS_DECLARE
@class NSObject;
@class NSString;
GS_EXPORT NSString *NSStringFromSelector(SEL aSelector);
@ -73,15 +75,84 @@ GS_EXPORT BOOL GSGetInstanceVariable(id obj, NSString *name, void* data);
GS_EXPORT BOOL GSSetInstanceVariable(id obj, NSString *name, const void* data);
/*
* GSObjCClassOfInstance() return the class of an instance.
* GSObjCClass() return the class of an instance.
* The argument to this function must NOT be nil.
*/
FOUNDATION_STATIC_INLINE Class
GSObjCClassOfObject(id obj)
GSObjCClass(id obj)
{
return obj->class_pointer;
}
/*
* GSObjCIsInstance() tests to see if an id is an instance.
* The argument to this function must NOT be nil.
*/
FOUNDATION_STATIC_INLINE BOOL
GSObjCIsInstance(id obj)
{
return CLS_ISCLASS(obj->class_pointer);
}
/*
* GSObjCIsKindOf() tests to see if a class inherits from another class
* The argument to this function must NOT be nil.
*/
FOUNDATION_STATIC_INLINE BOOL
GSObjCIsKindOf(Class this, Class other)
{
while (this != Nil)
{
if (this == other)
{
return YES;
}
this = class_get_super_class(this);
}
return NO;
}
FOUNDATION_STATIC_INLINE const char*
GSObjCName(Class this)
{
return this->name;
}
FOUNDATION_STATIC_INLINE const char*
GSObjCSelectorName(SEL this)
{
return sel_get_name(this);
}
FOUNDATION_STATIC_INLINE const char*
GSObjCSelectorTypes(SEL this)
{
return sel_get_type(this);
}
FOUNDATION_STATIC_INLINE Class
GSObjCSuper(Class this)
{
return class_get_super_class(this);
}
FOUNDATION_STATIC_INLINE int
GSObjCVersion(Class this)
{
return this->version;
}
/*
* Return the zone in which an object belongs, without using the zone method
*/
#include <Foundation/NSZone.h>
NSZone *GSObjCZone(NSObject *obj);
/*
* Quickly return autoreleased data.
*/
void *_fastMallocBuffer(unsigned size);
#endif
#endif /* __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE */

View file

@ -23,11 +23,12 @@
#ifndef __NSZone_h_GNUSTEP_BASE_INCLUDE
#define __NSZone_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObjCRuntime.h>
typedef struct _NSZone NSZone;
#include <Foundation/NSObjCRuntime.h>
@class NSString;
typedef struct _NSZone NSZone;
/* The members are the same as the structure mstats which is in the
GNU C library. */

View file

@ -1,149 +0,0 @@
/* Performance enhancing utilities GNUStep
Copyright (C) 1998 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Date: October 1998
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#ifndef fast_x_INCLUDE
#define fast_x_INCLUDE
#include <base/preface.h>
#include <objc/objc-api.h>
#include <Foundation/NSObject.h>
#ifndef INLINE
#define INLINE inline
#endif
/*
* This file is all to do with improving performance by avoiding the
* Objective-C messaging overhead in time-critical code.
*
* THIS STUFF IS GOING AWAY!
*
* The intention is to provide similar functionality in NSObjCRuntime.h
* There will be GNUstep specific (mostly inline) functions added to
* the header to provide direct access to runtime functinality and the
* internals of objects. Hopefully a simple configuration option will
* let us build for either the GNU or the Apple runtime.
*/
/*
* The '_fastMallocBuffer()' function is called to get a chunk of
* memory that will automatically be released when the current
* autorelease pool goes away.
*/
GS_EXPORT void *_fastMallocBuffer(unsigned size);
/*
* Fast access to class info - DON'T pass nil to these!
*/
static INLINE BOOL
fastIsInstance(id obj)
{
return CLS_ISCLASS(obj->class_pointer);
}
static INLINE BOOL
fastIsClass(Class c)
{
return CLS_ISCLASS(c);
}
static INLINE Class
fastClass(NSObject* obj)
{
return ((id)obj)->class_pointer;
}
static INLINE Class
fastClassOfInstance(NSObject* obj)
{
if (fastIsInstance((id)obj))
return fastClass(obj);
return Nil;
}
static INLINE Class
fastSuper(Class cls)
{
return cls->super_class;
}
static INLINE BOOL
fastClassIsKindOfClass(Class c0, Class c1)
{
while (c0 != Nil)
{
if (c0 == c1)
return YES;
c0 = class_get_super_class(c0);
}
return NO;
}
static INLINE BOOL
fastInstanceIsKindOfClass(NSObject *obj, Class c)
{
Class ic = fastClassOfInstance(obj);
if (ic == Nil)
return NO;
return fastClassIsKindOfClass(ic, c);
}
static INLINE const char*
fastClassName(Class c)
{
return c->name;
}
static INLINE int
fastClassVersion(Class c)
{
return c->version;
}
static INLINE const char*
fastSelectorName(SEL s)
{
return sel_get_name(s);
}
static INLINE const char*
fastSelectorTypes(SEL s)
{
return sel_get_type(s);
}
/*
* fastZone(NSObject *obj)
* This function gets the zone that would be returned by the
* [NSObject -zone] instance method. Using this could mess you up in
* the unlikely event that you had an object that had overridden the
* '-zone' method.
* This function DOES know about NXConstantString, so it's pretty safe
* for normal use.
*/
GS_EXPORT NSZone *fastZone(NSObject* obj);
#endif

View file

@ -117,7 +117,6 @@ win32-def.top \
libgnustep-base.def
GNU_HEADERS = \
fast.x \
GSLocale.h \
GSUnion.h \
GSIArray.h \

View file

@ -47,7 +47,6 @@
#include <base/behavior.h>
/* memcpy(), strlen(), strcmp() are gcc builtin's */
#include <base/fast.x>
#include <base/Unicode.h>
/*
@ -357,14 +356,14 @@ compare_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
if (aString == nil)
[NSException raise: NSInvalidArgumentException format: @"compare with nil"];
if (fastIsInstance(aString) == NO)
if (GSObjCIsInstance(aString) == NO)
return strCompCsNs((id)self, aString, mask, aRange);
c = GSObjCClassOfObject(aString);
if (fastClassIsKindOfClass(c, GSUStringClass) == YES
c = GSObjCClass(aString);
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
return strCompCsUs((id)self, aString, mask, aRange);
else if (fastClassIsKindOfClass(c, GSCStringClass) == YES
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|| c == NXConstantStringClass
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
return strCompCsCs((id)self, aString, mask, aRange);
@ -379,14 +378,14 @@ compare_u(ivars self, NSString *aString, unsigned mask, NSRange aRange)
if (aString == nil)
[NSException raise: NSInvalidArgumentException format: @"compare with nil"];
if (fastIsInstance(aString) == NO)
if (GSObjCIsInstance(aString) == NO)
return strCompUsNs((id)self, aString, mask, aRange);
c = GSObjCClassOfObject(aString);
if (fastClassIsKindOfClass(c, GSUStringClass)
c = GSObjCClass(aString);
if (GSObjCIsKindOf(c, GSUStringClass)
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
return strCompUsUs((id)self, aString, mask, aRange);
else if (fastClassIsKindOfClass(c, GSCStringClass)
else if (GSObjCIsKindOf(c, GSCStringClass)
|| c == NXConstantStringClass
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
return strCompUsCs((id)self, aString, mask, aRange);
@ -767,11 +766,11 @@ isEqual_c(ivars self, id anObject)
{
return NO;
}
if (fastIsInstance(anObject) == NO)
if (GSObjCIsInstance(anObject) == NO)
{
return NO;
}
c = fastClassOfInstance(anObject);
c = GSObjCClass(anObject);
if (c == NXConstantStringClass)
{
ivars other = (ivars)anObject;
@ -781,7 +780,7 @@ isEqual_c(ivars self, id anObject)
return YES;
return NO;
}
else if (fastClassIsKindOfClass(c, GSStringClass) == YES)
else if (GSObjCIsKindOf(c, GSStringClass) == YES)
{
ivars other = (ivars)anObject;
NSRange r = {0, self->_count};
@ -811,7 +810,7 @@ isEqual_c(ivars self, id anObject)
}
return NO;
}
else if (fastClassIsKindOfClass(c, NSStringClass))
else if (GSObjCIsKindOf(c, NSStringClass))
{
return (*equalImp)((id)self, equalSel, anObject);
}
@ -834,11 +833,11 @@ isEqual_u(ivars self, id anObject)
{
return NO;
}
if (fastIsInstance(anObject) == NO)
if (GSObjCIsInstance(anObject) == NO)
{
return NO;
}
c = fastClassOfInstance(anObject);
c = GSObjCClass(anObject);
if (c == NXConstantStringClass)
{
ivars other = (ivars)anObject;
@ -848,7 +847,7 @@ isEqual_u(ivars self, id anObject)
return YES;
return NO;
}
else if (fastClassIsKindOfClass(c, GSStringClass) == YES)
else if (GSObjCIsKindOf(c, GSStringClass) == YES)
{
ivars other = (ivars)anObject;
NSRange r = {0, self->_count};
@ -878,7 +877,7 @@ isEqual_u(ivars self, id anObject)
}
return NO;
}
else if (fastClassIsKindOfClass(c, NSStringClass))
else if (GSObjCIsKindOf(c, NSStringClass))
{
return (*equalImp)((id)self, equalSel, anObject);
}
@ -951,7 +950,7 @@ makeHole(ivars self, int index, int size)
#if GS_WITH_GC
self->_zone = GSAtomicMallocZone();
#else
self->_zone = fastZone((NSObject*)self);
self->_zone = GSObjCZone((NSObject*)self);
#endif
}
if (self->_flags.wide == 1)
@ -1055,14 +1054,14 @@ rangeOfString_c(ivars self, NSString *aString, unsigned mask, NSRange aRange)
if (aString == nil)
[NSException raise: NSInvalidArgumentException format: @"range of nil"];
if (fastIsInstance(aString) == NO)
if (GSObjCIsInstance(aString) == NO)
return strRangeCsNs((id)self, aString, mask, aRange);
c = GSObjCClassOfObject(aString);
if (fastClassIsKindOfClass(c, GSUStringClass) == YES
c = GSObjCClass(aString);
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
return strRangeCsUs((id)self, aString, mask, aRange);
else if (fastClassIsKindOfClass(c, GSCStringClass) == YES
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|| c == NXConstantStringClass
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
return strRangeCsCs((id)self, aString, mask, aRange);
@ -1077,14 +1076,14 @@ rangeOfString_u(ivars self, NSString *aString, unsigned mask, NSRange aRange)
if (aString == nil)
[NSException raise: NSInvalidArgumentException format: @"range of nil"];
if (fastIsInstance(aString) == NO)
if (GSObjCIsInstance(aString) == NO)
return strRangeUsNs((id)self, aString, mask, aRange);
c = GSObjCClassOfObject(aString);
if (fastClassIsKindOfClass(c, GSUStringClass) == YES
c = GSObjCClass(aString);
if (GSObjCIsKindOf(c, GSUStringClass) == YES
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 1))
return strRangeUsUs((id)self, aString, mask, aRange);
else if (fastClassIsKindOfClass(c, GSCStringClass) == YES
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|| c == NXConstantStringClass
|| (c == GSMStringClass && ((ivars)aString)->_flags.wide == 0))
return strRangeUsCs((id)self, aString, mask, aRange);
@ -1138,7 +1137,7 @@ transmute(ivars self, NSString *aString)
{
ivars other;
BOOL transmute;
Class c = GSObjCClassOfObject(aString); // NB aString must not be nil
Class c = GSObjCClass(aString); // NB aString must not be nil
other = (ivars)aString;
transmute = YES;
@ -2063,7 +2062,7 @@ transmute(ivars self, NSString *aString)
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = fastZone(self);
_zone = GSObjCZone(self);
#endif
_contents.c = NSZoneMalloc(_zone, capacity + 1);
_flags.wide = 0;
@ -2206,7 +2205,7 @@ transmute(ivars self, NSString *aString)
if (aString == nil)
[NSException raise: NSInvalidArgumentException
format: @"replace characters with nil string"];
if (fastIsInstance(aString) == NO)
if (GSObjCIsInstance(aString) == NO)
[NSException raise: NSInvalidArgumentException
format: @"replace characters with non-string"];
@ -2543,13 +2542,13 @@ transmute(ivars self, NSString *aString)
{
return NO;
}
if (fastIsInstance(anObject) == NO)
if (GSObjCIsInstance(anObject) == NO)
{
return NO;
}
c = fastClassOfInstance(anObject);
c = GSObjCClass(anObject);
if (fastClassIsKindOfClass(c, GSCStringClass) == YES
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|| c == NXConstantStringClass
|| (c == GSMStringClass && ((ivars)anObject)->_flags.wide == 0))
{
@ -2561,14 +2560,14 @@ transmute(ivars self, NSString *aString)
return NO;
return YES;
}
else if (fastClassIsKindOfClass(c, GSUStringClass) == YES
else if (GSObjCIsKindOf(c, GSUStringClass) == YES
|| c == GSMStringClass)
{
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
return YES;
return NO;
}
else if (fastClassIsKindOfClass(c, NSStringClass))
else if (GSObjCIsKindOf(c, NSStringClass))
{
return (*equalImp)(self, equalSel, anObject);
}
@ -2590,13 +2589,13 @@ transmute(ivars self, NSString *aString)
{
return NO;
}
if (fastIsInstance(anObject) == NO)
if (GSObjCIsInstance(anObject) == NO)
{
return NO;
}
c = fastClassOfInstance(anObject);
c = GSObjCClass(anObject);
if (fastClassIsKindOfClass(c, GSCStringClass) == YES
if (GSObjCIsKindOf(c, GSCStringClass) == YES
|| c == NXConstantStringClass
|| (c == GSMStringClass && ((ivars)anObject)->_flags.wide == 0))
{
@ -2608,14 +2607,14 @@ transmute(ivars self, NSString *aString)
return NO;
return YES;
}
else if (fastClassIsKindOfClass(c, GSUStringClass) == YES
else if (GSObjCIsKindOf(c, GSUStringClass) == YES
|| c == GSMStringClass)
{
if (strCompCsUs(self, anObject, 0, (NSRange){0,_count}) == NSOrderedSame)
return YES;
return NO;
}
else if (fastClassIsKindOfClass(c, NSStringClass))
else if (GSObjCIsKindOf(c, NSStringClass))
{
return (*equalImp)(self, equalSel, anObject);
}

View file

@ -228,22 +228,6 @@ $(GNUSTEP_OBJ_DIR)/NSNotificationCenter.o \
$(GNUSTEP_OBJ_DIR)/NSSerializer.o \
: $(HEADER_DIR)/GSIMap.h $(HEADER_DIR)/GSUnion.h
#
# Files that include fast.x will need a rebuild if it is changed.
#
$(GNUSTEP_OBJ_DIR)/GSString.o \
$(GNUSTEP_OBJ_DIR)/NSArchiver.o \
$(GNUSTEP_OBJ_DIR)/NSArray.o \
$(GNUSTEP_OBJ_DIR)/NSData.o \
$(GNUSTEP_OBJ_DIR)/NSGDictionary.o \
$(GNUSTEP_OBJ_DIR)/NSInvocation.o \
$(GNUSTEP_OBJ_DIR)/NSObjCRuntime.o \
$(GNUSTEP_OBJ_DIR)/NSObject.o \
$(GNUSTEP_OBJ_DIR)/NSSerializer.o \
$(GNUSTEP_OBJ_DIR)/NSString.o \
$(GNUSTEP_OBJ_DIR)/NSUnarchiver.o \
: $(HEADER_DIR)/fast.x
#
# Files that include NSObjCRuntime.h will need a rebuild if it is changed.
#

View file

@ -22,7 +22,6 @@
*/
#include <config.h>
#include <objc/objc-api.h>
/*
* Setup for inline operation of pointer map tables.
*/
@ -39,14 +38,13 @@
#include <Foundation/NSArchiver.h>
#undef _IN_NSARCHIVER_M
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
#include <Foundation/NSUtilities.h>
#include <Foundation/NSString.h>
#include <base/fast.x>
typedef unsigned char uchar;
@ -80,7 +78,7 @@ static Class NSMutableDataMallocClass;
{
NSMutableData *d;
d = [[NSMutableDataMallocClass allocWithZone: fastZone(self)] init];
d = [[NSMutableDataMallocClass allocWithZone: GSObjCZone(self)] init];
self = [self initForWritingWithMutableData: d];
RELEASE(d);
return self;
@ -415,9 +413,9 @@ static Class NSMutableDataMallocClass;
}
while (done == NO)
{
int tmp = fastClassVersion(c);
int tmp = GSObjCVersion(c);
unsigned version = tmp;
Class s = fastSuper(c);
Class s = GSObjCSuper(c);
if (tmp < 0)
{
@ -777,7 +775,7 @@ static Class NSMutableDataMallocClass;
}
obj = [anObject replacementObjectForArchiver: self];
if (fastIsInstance(obj) == NO)
if (GSObjCIsInstance(obj) == NO)
{
/*
* If the object we have been given is actually a class,
@ -829,7 +827,7 @@ static Class NSMutableDataMallocClass;
if (node)
{
c = (Class)node->value.ptr;
return [NSString stringWithCString: fastClassName(c)];
return [NSString stringWithCString: GSObjCName(c)];
}
}
return trueName;

View file

@ -40,8 +40,6 @@
#include <Foundation/NSUserDefaults.h>
#include <Foundation/NSDebug.h>
#include <base/fast.x>
@class NSArrayEnumerator;
@class NSArrayEnumeratorReverse;

View file

@ -45,7 +45,6 @@
#include "config.h"
#include <base/preface.h>
#include <base/fast.x>
#include <base/Unicode.h>
#include <Foundation/NSAttributedString.h>

View file

@ -29,7 +29,6 @@
#include <Foundation/NSCoder.h>
#include <Foundation/NSObjCRuntime.h>
#include <base/preface.h>
#include <base/fast.x>
/* This file should be run through a preprocessor with the macro TYPE_ORDER
defined to a number from 0 to 4 cooresponding to each value type */
@ -82,8 +81,8 @@
- (BOOL) isEqual: (id)other
{
if (other != nil
&& fastInstanceIsKindOfClass(other, GSObjCClassOfObject(self)))
if (other != nil && GSObjCIsInstance(other) == YES
&& GSObjCIsKindOf(GSObjCClass(other), GSObjCClass(self)))
{
return [self isEqualToValue: other];
}
@ -94,8 +93,8 @@
{
typedef __typeof__(data) _dt;
if (aValue != nil
&& fastInstanceIsKindOfClass(aValue, GSObjCClassOfObject(self)))
if (aValue != nil && GSObjCIsInstance(aValue) == YES
&& GSObjCIsKindOf(GSObjCClass(aValue), GSObjCClass(self)))
{
_dt val = [aValue TYPE_METHOD];
#if TYPE_ORDER == 0

View file

@ -23,8 +23,7 @@
#include <config.h>
#include <math.h>
#include <objc/objc-api.h>
#include <base/preface.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSString.h>

View file

@ -30,7 +30,6 @@
#include <Foundation/NSZone.h>
#include <Foundation/NSObjCRuntime.h>
#include <base/preface.h>
#include <base/fast.x>
/* This is the real, general purpose value object. I've implemented all the
methods here (like pointValue) even though most likely, other concrete
@ -64,10 +63,10 @@
return nil;
}
data = (void *)NSZoneMalloc(fastZone(self), size);
data = (void *)NSZoneMalloc(GSObjCZone(self), size);
memcpy(data, value, size);
objctype = (char *)NSZoneMalloc(fastZone(self), strlen(type)+1);
objctype = (char *)NSZoneMalloc(GSObjCZone(self), strlen(type)+1);
strcpy(objctype, type);
return self;
}
@ -75,9 +74,9 @@
- (void) dealloc
{
if (objctype)
NSZoneFree(fastZone(self), objctype);
NSZoneFree(GSObjCZone(self), objctype);
if (data)
NSZoneFree(fastZone(self), data);
NSZoneFree(GSObjCZone(self), data);
[super dealloc];
}
@ -105,7 +104,9 @@
- (BOOL) isEqualToValue: (NSValue*)aValue
{
if (GSObjCClassOfObject(aValue) != GSObjCClassOfObject(self))
if (aValue == nil)
return NO;
if (GSObjCClass(aValue) != GSObjCClass(self))
return NO;
if (strcmp(objctype, ((NSConcreteValue*)aValue)->objctype) != 0)
return NO;
@ -178,10 +179,10 @@
unsigned size;
[coder decodeValueOfObjCType: @encode(unsigned) at: &size];
objctype = (void *)NSZoneMalloc(fastZone(self), size);
objctype = (void *)NSZoneMalloc(GSObjCZone(self), size);
[coder decodeArrayOfObjCType: @encode(char) count: size at: objctype];
[coder decodeValueOfObjCType: @encode(unsigned) at: &size];
data = (void *)NSZoneMalloc(fastZone(self), size);
data = (void *)NSZoneMalloc(GSObjCZone(self), size);
[coder decodeArrayOfObjCType: @encode(unsigned char) count: size at: data];
return self;

View file

@ -23,7 +23,6 @@
#include <config.h>
#include <base/behavior.h>
#include <base/fast.x>
#include <Foundation/NSSet.h>
#include <Foundation/NSGSet.h>
#include <Foundation/NSCoder.h>
@ -111,7 +110,7 @@ static Class NSCountedSet_concrete_class;
- (id) initWithCoder: (NSCoder*)aCoder
{
unsigned count;
Class c = GSObjCClassOfObject(self);
Class c = GSObjCClass(self);
if (c == NSCountedSet_abstract_class)
{

View file

@ -61,10 +61,8 @@
*/
#include <config.h>
#include <objc/objc-api.h>
#include <base/preface.h>
#include <base/fast.x>
#include <base/behavior.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSByteOrder.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSData.h>
@ -464,7 +462,7 @@ failure:
#if GS_WITH_GC
zone = GSAtomicMallocZone();
#else
zone = fastZone(self);
zone = GSObjCZone(self);
#endif
if (readContentsOfFile(path, &fileBytes, &fileLength, zone) == NO)
{
@ -482,7 +480,7 @@ failure:
{
#if HAVE_MMAP
RELEASE(self);
self = [NSDataMappedFile allocWithZone: fastZone(self)];
self = [NSDataMappedFile allocWithZone: GSObjCZone(self)];
return [self initWithContentsOfMappedFile: path];
#else
return [self initWithContentsOfFile: path];
@ -1697,7 +1695,7 @@ failure:
}
case _C_CLASS:
{
const char *name = *(Class*)data?fastClassName(*(Class*)data):"";
const char *name = *(Class*)data?GSObjCName(*(Class*)data):"";
gsu16 ln = (gsu16)strlen(name);
gsu16 ni;
@ -1711,9 +1709,9 @@ failure:
}
case _C_SEL:
{
const char *name = *(SEL*)data?fastSelectorName(*(SEL*)data):"";
const char *name = *(SEL*)data?GSObjCSelectorName(*(SEL*)data):"";
gsu16 ln = (name == 0) ? 0 : (gsu16)strlen(name);
const char *types = *(SEL*)data?fastSelectorTypes(*(SEL*)data):"";
const char *types = *(SEL*)data?GSObjCSelectorTypes(*(SEL*)data):"";
gsu16 lt = (types == 0) ? 0 : (gsu16)strlen(types);
gsu16 ni;
@ -2593,7 +2591,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
#if GS_WITH_GC
zone = GSAtomicMallocZone();
#else
zone = fastZone(self);
zone = GSObjCZone(self);
#endif
if (size)
{
@ -2863,7 +2861,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
}
case _C_CLASS:
{
const char *name = *(Class*)data?fastClassName(*(Class*)data):"";
const char *name = *(Class*)data?GSObjCName(*(Class*)data):"";
gsu16 ln = (gsu16)strlen(name);
gsu16 minimum = length + ln + sizeof(gsu16);
gsu16 ni;
@ -2884,9 +2882,9 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
}
case _C_SEL:
{
const char *name = *(SEL*)data?fastSelectorName(*(SEL*)data):"";
const char *name = *(SEL*)data?GSObjCSelectorName(*(SEL*)data):"";
gsu16 ln = (name == 0) ? 0 : (gsu16)strlen(name);
const char *types = *(SEL*)data?fastSelectorTypes(*(SEL*)data):"";
const char *types = *(SEL*)data?GSObjCSelectorTypes(*(SEL*)data):"";
gsu16 lt = (types == 0) ? 0 : (gsu16)strlen(types);
gsu16 minimum = length + ln + lt + 2*sizeof(gsu16);
gsu16 ni;

View file

@ -36,7 +36,6 @@
#include <Foundation/NSObjCRuntime.h>
#include <base/preface.h>
#include <base/behavior.h>
#include <base/fast.x>
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@ -102,9 +101,9 @@ otherTime(NSDate* other)
if (other == nil)
[NSException raise: NSInvalidArgumentException format: @"other time nil"];
if (fastIsInstance(other) == NO)
if (GSObjCIsInstance(other) == NO)
[NSException raise: NSInvalidArgumentException format: @"other time bad"];
c = GSObjCClassOfObject(other);
c = GSObjCClass(other);
if (c == concreteClass || c == calendarClass)
return ((NSGDate*)other)->_seconds_since_ref;
else

View file

@ -24,7 +24,6 @@
#include <config.h>
#include <base/behavior.h>
#include <base/fast.x>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSUtilities.h>
@ -780,14 +779,14 @@ static NSString *indentStrings[] = {
for (i = 0; i < numKeys; i++)
{
if (GSObjCClassOfObject(keys[i]) == lastClass)
if (GSObjCClass(keys[i]) == lastClass)
continue;
if ([keys[i] respondsToSelector: @selector(compare:)] == NO)
{
canCompare = NO;
break;
}
lastClass = GSObjCClassOfObject(keys[i]);
lastClass = GSObjCClass(keys[i]);
}
if (canCompare == YES)
@ -831,7 +830,7 @@ static NSString *indentStrings[] = {
Class x;
NSComparisonResult r;
x = GSObjCClassOfObject(a);
x = GSObjCClass(a);
if (x != lastClass)
{
lastClass = x;

View file

@ -24,7 +24,6 @@
#include <config.h>
#include <base/preface.h>
#include <base/fast.x>
#include <Foundation/DistributedObjects.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSPort.h>
@ -743,7 +742,7 @@ enum
- (IMP) methodForSelector: (SEL)aSelector
{
return get_imp(GSObjCClassOfObject((id)self), aSelector);
return get_imp(GSObjCClass((id)self), aSelector);
}
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector

View file

@ -51,7 +51,6 @@
#include <Foundation/NSDebug.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSZone.h>
#include <base/fast.x>
#define SANITY_CHECKS 0
@ -150,7 +149,7 @@ _setAttributesFrom(
NSRange aRange,
NSMutableArray *_infoArray)
{
NSZone *z = fastZone(_infoArray);
NSZone *z = GSObjCZone(_infoArray);
NSRange range;
NSDictionary *attr;
GSAttrInfo *info;
@ -272,7 +271,7 @@ _attributesAtIndexEffectiveRange(
- (id) initWithString: (NSString*)aString
attributes: (NSDictionary*)attributes
{
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
@ -356,7 +355,7 @@ _attributesAtIndexEffectiveRange(
- (id) initWithString: (NSString*)aString
attributes: (NSDictionary*)attributes
{
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
@ -402,7 +401,7 @@ SANITY();
NSRange effectiveRange;
unsigned afterRangeLoc, beginRangeLoc;
NSDictionary *attrs;
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
GSAttrInfo *info;
if (range.length == 0)
@ -504,7 +503,7 @@ SANITY();
NSDictionary *attrs;
GSAttrInfo *info;
int moveLocations;
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
unsigned start;
SANITY();

View file

@ -32,7 +32,6 @@
#include <Foundation/NSDebug.h>
#include <base/behavior.h>
#include <base/fast.x>
/*
* The 'Fastmap' stuff provides an inline implementation of a mapping
@ -133,7 +132,7 @@ static SEL objSel;
[aCoder decodeValueOfObjCType: @encode(unsigned)
at: &count];
GSIMapInitWithZoneAndCapacity(&map, fastZone(self), count);
GSIMapInitWithZoneAndCapacity(&map, GSObjCZone(self), count);
while (count-- > 0)
{
(*imp)(aCoder, sel, type, &key);
@ -148,7 +147,7 @@ static SEL objSel;
{
int i;
GSIMapInitWithZoneAndCapacity(&map, fastZone(self), c);
GSIMapInitWithZoneAndCapacity(&map, GSObjCZone(self), c);
for (i = 0; i < c; i++)
{
GSIMapNode node;
@ -187,7 +186,7 @@ static SEL objSel;
- (id) initWithDictionary: (NSDictionary*)other
copyItems: (BOOL)shouldCopy
{
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
unsigned c = [other count];
GSIMapInitWithZoneAndCapacity(&map, z, c);
@ -284,7 +283,7 @@ static SEL objSel;
/* Designated initialiser */
- (id) initWithCapacity: (unsigned)cap
{
GSIMapInitWithZoneAndCapacity(&map, fastZone(self), cap);
GSIMapInitWithZoneAndCapacity(&map, GSObjCZone(self), cap);
return self;
}

View file

@ -25,7 +25,6 @@
#include <config.h>
#include <Foundation/NSSet.h>
#include <base/behavior.h>
#include <base/fast.x>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSException.h>
@ -250,7 +249,7 @@ static Class mutableSetClass;
return NO;
// Loop for all members in otherSet
c = GSObjCClassOfObject(otherSet);
c = GSObjCClass(otherSet);
if (c == setClass || c == mutableSetClass)
{
GSIMapNode node = ((NSGSet*)otherSet)->map.firstNode;
@ -320,7 +319,7 @@ static Class mutableSetClass;
}
else
{
Class c = GSObjCClassOfObject(other);
Class c = GSObjCClass(other);
if (c == setClass || c == mutableSetClass)
{

View file

@ -26,7 +26,6 @@
#include <Foundation/NSException.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSInvocation.h>
#include <base/fast.x>
#include <config.h>
#include <mframe.h>

View file

@ -30,7 +30,6 @@
#include <Foundation/NSException.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSThread.h>
#include <base/fast.x>
typedef struct {
@defs(NSNotification)

View file

@ -27,7 +27,6 @@
#include <string.h>
#include <config.h>
#include <base/preface.h>
#include <base/fast.x>
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#include <Foundation/NSNotification.h>
@ -59,7 +58,7 @@ GSNumberInfoFromObject(NSNumber *o)
if (o == nil)
return nil;
c = GSObjCClassOfObject(o);
c = GSObjCClass(o);
info = (GSNumberInfo*)NSMapGet (numberMap, (void*)c);
if (info == 0)
{
@ -667,7 +666,7 @@ static Class doubleNumberClass;
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
{
[NSException raise: NSInternalInconsistencyException
format: @"descriptionWithLocale: for abstract NSNumber"];
@ -728,7 +727,7 @@ static Class doubleNumberClass;
/* All the rest of these methods must be implemented by a subclass */
- (BOOL) boolValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get boolValue from abstract NSNumber"];
else
@ -838,7 +837,7 @@ static Class doubleNumberClass;
- (signed char) charValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get charValue from abstract NSNumber"];
else
@ -948,7 +947,7 @@ static Class doubleNumberClass;
- (double) doubleValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get doubleValue from abstract NSNumber"];
else
@ -1058,7 +1057,7 @@ static Class doubleNumberClass;
- (float) floatValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get floatValue from abstract NSNumber"];
else
@ -1168,7 +1167,7 @@ static Class doubleNumberClass;
- (signed int) intValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get intValue from abstract NSNumber"];
else
@ -1278,7 +1277,7 @@ static Class doubleNumberClass;
- (signed long long) longLongValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get longLongValue from abstract NSNumber"];
else
@ -1388,7 +1387,7 @@ static Class doubleNumberClass;
- (signed long) longValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get longValue from abstract NSNumber"];
else
@ -1498,7 +1497,7 @@ static Class doubleNumberClass;
- (signed short) shortValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get shortValue from abstract NSNumber"];
else
@ -1613,7 +1612,7 @@ static Class doubleNumberClass;
- (unsigned char) unsignedCharValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get unsignedCharrValue from abstract NSNumber"];
else
@ -1723,7 +1722,7 @@ static Class doubleNumberClass;
- (unsigned int) unsignedIntValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get unsignedIntValue from abstract NSNumber"];
else
@ -1833,7 +1832,7 @@ static Class doubleNumberClass;
- (unsigned long long) unsignedLongLongValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get unsignedLongLongValue from abstract NSNumber"];
else
@ -1943,7 +1942,7 @@ static Class doubleNumberClass;
- (unsigned long) unsignedLongValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get unsignedLongValue from abstract NSNumber"];
else
@ -2053,7 +2052,7 @@ static Class doubleNumberClass;
- (unsigned short) unsignedShortValue
{
if (GSObjCClassOfObject(self) == abstractClass)
if (GSObjCClass(self) == abstractClass)
[NSException raise: NSInternalInconsistencyException
format: @"get unsignedShortValue from abstract NSNumber"];
else
@ -2227,7 +2226,8 @@ static Class doubleNumberClass;
{
return NO;
}
else if (fastIsInstance(o) && fastInstanceIsKindOfClass(o, abstractClass))
else if (GSObjCIsInstance(o) == YES
&& GSObjCIsKindOf(GSObjCClass(o), abstractClass))
{
return [self isEqualToNumber: (NSNumber*)o];
}

View file

@ -23,7 +23,6 @@
#include <config.h>
#include <base/preface.h>
#include <base/fast.x>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSString.h>
#include <mframe.h>
@ -32,7 +31,7 @@ NSString *
NSStringFromSelector(SEL aSelector)
{
if (aSelector != (SEL)0)
return [NSString stringWithCString: (char*)sel_get_name(aSelector)];
return [NSString stringWithCString: GSObjCSelectorName(aSelector)];
return nil;
}
@ -56,7 +55,7 @@ NSString *
NSStringFromClass(Class aClass)
{
if (aClass != (Class)0)
return [NSString stringWithCString: (char*)fastClassName(aClass)];
return [NSString stringWithCString: (char*)GSObjCName(aClass)];
return nil;
}

View file

@ -26,7 +26,6 @@
#include <stdarg.h>
#include <Foundation/NSObject.h>
#include <objc/Protocol.h>
#include <objc/objc-api.h>
#include <Foundation/NSMethodSignature.h>
#include <Foundation/NSInvocation.h>
#include <Foundation/NSAutoreleasePool.h>
@ -43,8 +42,6 @@
#include <Foundation/NSObjCRuntime.h>
#include <limits.h>
#include <base/fast.x>
extern BOOL __objc_responds_to(id, SEL);
@class _FastMallocBuffer;
@ -330,7 +327,7 @@ NSExtraRefCount (id anObject)
#include <gc_typed.h>
inline NSZone *
fastZone(NSObject *object)
GSObjCZone(NSObject *object)
{
return 0;
}
@ -363,7 +360,8 @@ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone)
if (gc_type == 0)
{
new = NSZoneMalloc(zone, size);
NSLog(@"No garbage collection information for '%s'", aClass->name);
NSLog(@"No garbage collection information for '%s'",
GSObjCName(aClass));
}
else if ([aClass requiresTypedMemory])
{
@ -407,9 +405,9 @@ NSDeallocateObject(NSObject *anObject)
#if defined(CACHE_ZONE)
inline NSZone *
fastZone(NSObject *object)
GSObjCZone(NSObject *object)
{
if (GSObjCClassOfObject(object) == NXConstantStringClass)
if (GSObjCClass(object) == NXConstantStringClass)
return NSDefaultMallocZone();
return ((obj)object)[-1].zone;
}
@ -417,9 +415,9 @@ fastZone(NSObject *object)
#else /* defined(CACHE_ZONE) */
inline NSZone *
fastZone(NSObject *object)
GSObjCZone(NSObject *object)
{
if (GSObjCClassOfObject(object) == NXConstantStringClass)
if (GSObjCClass(object) == NXConstantStringClass)
return NSDefaultMallocZone();
return NSZoneFromPointer(&((obj)object)[-1]);
}
@ -464,7 +462,7 @@ NSDeallocateObject(NSObject *anObject)
if ((anObject!=nil) && CLS_ISCLASS(((id)anObject)->class_pointer))
{
obj o = &((obj)anObject)[-1];
NSZone *z = fastZone(anObject);
NSZone *z = GSObjCZone(anObject);
#ifndef NDEBUG
GSDebugAllocationRemove(((id)anObject)->class_pointer);
@ -478,9 +476,9 @@ NSDeallocateObject(NSObject *anObject)
#else
inline NSZone *
fastZone(NSObject *object)
GSObjCZone(NSObject *object)
{
if (GSObjCClassOfObject(object) == NXConstantStringClass)
if (GSObjCClass(object) == NXConstantStringClass)
return NSDefaultMallocZone();
return NSZoneFromPointer(object);
}
@ -530,7 +528,7 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
return YES;
#else
return (!requestedZone || requestedZone == NSDefaultMallocZone()
|| fastZone(anObject) == requestedZone);
|| GSObjCZone(anObject) == requestedZone);
#endif
}
@ -738,12 +736,12 @@ static BOOL deallocNotifications = NO;
- (IMP) methodForSelector: (SEL)aSelector
{
/*
* If 'self' is an instance, GSObjCClassOfObject() will get the class,
* If 'self' is an instance, GSObjCClass() will get the class,
* and get_imp() will get the instance method.
* If 'self' is a class, GSObjCClassOfObject() will get the meta-class,
* If 'self' is a class, GSObjCClass() will get the meta-class,
* and get_imp() will get the class method.
*/
return get_imp(GSObjCClassOfObject(self), aSelector);
return get_imp(GSObjCClass(self), aSelector);
}
+ (NSMethodSignature*) instanceMethodSignatureForSelector: (SEL)aSelector
@ -761,9 +759,9 @@ static BOOL deallocNotifications = NO;
{
struct objc_method *mth;
mth = (object_is_instance(self)
? class_get_instance_method(self->isa, aSelector)
: class_get_class_method(self->isa, aSelector));
mth = (GSObjCIsInstance(self)
? class_get_instance_method(GSObjCClass(self), aSelector)
: class_get_class_method(GSObjCClass(self), aSelector));
if (mth == 0)
{
return nil;
@ -894,7 +892,7 @@ static BOOL deallocNotifications = NO;
* use get_imp() because NSDistantObject doesn't implement
* methodForSelector:
*/
proxyImp = get_imp(GSObjCClassOfObject((id)proxyClass),
proxyImp = get_imp(GSObjCClass((id)proxyClass),
@selector(proxyWithLocal:connection:));
}
@ -970,26 +968,19 @@ static BOOL deallocNotifications = NO;
- (BOOL) isKindOfClass: (Class)aClass
{
Class class;
Class class = GSObjCClass(self);
for (class = self->isa;
class != Nil;
class = class_get_super_class (class))
{
if (class == aClass)
return YES;
}
return NO;
return GSObjCIsKindOf(class, aClass);
}
+ (BOOL) isMemberOfClass: (Class)aClass
{
return self == aClass;
return (self == aClass) ? YES : NO;
}
- (BOOL) isMemberOfClass: (Class)aClass
{
return self->isa==aClass;
return (GSObjCClass(self) == aClass) ? YES : NO;
}
- (BOOL) isProxy
@ -1008,7 +999,7 @@ static BOOL deallocNotifications = NO;
return nil;
}
msg = get_imp(GSObjCClassOfObject(self), aSelector);
msg = get_imp(GSObjCClass(self), aSelector);
if (!msg)
{
[NSException raise: NSGenericException
@ -1029,7 +1020,7 @@ static BOOL deallocNotifications = NO;
return nil;
}
msg = get_imp(GSObjCClassOfObject(self), aSelector);
msg = get_imp(GSObjCClass(self), aSelector);
if (!msg)
{
[NSException raise: NSGenericException
@ -1053,7 +1044,7 @@ static BOOL deallocNotifications = NO;
return nil;
}
msg = get_imp(GSObjCClassOfObject(self), aSelector);
msg = get_imp(GSObjCClass(self), aSelector);
if (!msg)
{
[NSException raise: NSGenericException
@ -1095,10 +1086,10 @@ static BOOL deallocNotifications = NO;
- (BOOL) respondsToSelector: (SEL)aSelector
{
#if 0
if (fastIsInstance(self))
return (class_get_instance_method(GSObjCClassOfObject(self), aSelector)!=METHOD_NULL);
if (GSObjCIsInstance(self))
return (class_get_instance_method(GSObjCClass(self), aSelector)!=METHOD_NULL);
else
return (class_get_class_method(GSObjCClassOfObject(self), aSelector)!=METHOD_NULL);
return (class_get_class_method(GSObjCClass(self), aSelector)!=METHOD_NULL);
#else
return __objc_responds_to(self, aSelector);
#endif
@ -1138,7 +1129,7 @@ static BOOL deallocNotifications = NO;
- (NSZone*) zone
{
return fastZone(self);
return GSObjCZone(self);
}
- (void) encodeWithCoder: (NSCoder*)aCoder
@ -1181,7 +1172,7 @@ static BOOL deallocNotifications = NO;
va_list ap;
sprintf(fmt, FMT, object_get_class_name(self),
object_is_instance(self)?"instance":"class",
GSObjCIsInstance(self)?"instance":"class",
(aString!=NULL)?aString:"");
va_start(ap, aString);
/* xxx What should `code' argument be? Current 0. */
@ -1344,13 +1335,13 @@ static BOOL deallocNotifications = NO;
- (BOOL) isInstance
{
return object_is_instance(self);
return GSObjCIsInstance(self);
}
- (BOOL) isMemberOfClassNamed: (const char*)aClassName
{
return ((aClassName!=NULL)
&&!strcmp(class_get_class_name(self->isa), aClassName));
&&!strcmp(GSObjCName(GSObjCClass(self)), aClassName));
}
+ (struct objc_method_description *) descriptionForInstanceMethod: (SEL)aSel
@ -1362,14 +1353,14 @@ static BOOL deallocNotifications = NO;
- (struct objc_method_description *) descriptionForMethod: (SEL)aSel
{
return ((struct objc_method_description *)
(object_is_instance(self)
?class_get_instance_method(self->isa, aSel)
:class_get_class_method(self->isa, aSel)));
(GSObjCIsInstance(self)
?class_get_instance_method(GSObjCClass(self), aSel)
:class_get_class_method(GSObjCClass(self), aSel)));
}
- (Class) transmuteClassTo: (Class)aClassObject
{
if (object_is_instance(self))
if (GSObjCIsInstance(self) == YES)
if (class_is_class(aClassObject))
if (class_get_instance_size(aClassObject)==class_get_instance_size(isa))
if ([self isKindOfClass:aClassObject])

View file

@ -23,6 +23,7 @@
#include <config.h>
#include <base/preface.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSZone.h>
#include <string.h>
#ifdef __WIN32__

View file

@ -31,8 +31,8 @@
#include <config.h>
#include <string.h>
#include <objc/objc-api.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSZone.h>
#include <Foundation/NSException.h>
#include <Foundation/NSByteOrder.h>
@ -43,8 +43,6 @@
#include <Foundation/NSPort.h>
#include <Foundation/NSString.h>
#include <base/fast.x>
/*
* Setup for inline operation of pointer map tables.
*/
@ -1229,7 +1227,7 @@ static IMP _xRefImp; /* Serialize a crossref. */
}
obj = [anObject replacementObjectForPortCoder: self];
if (fastIsInstance(obj) == NO)
if (GSObjCIsInstance(obj) == NO)
{
/*
* If the object we have been given is actually a class,
@ -1456,9 +1454,9 @@ static IMP _xRefImp; /* Serialize a crossref. */
}
while (done == NO)
{
int tmp = fastClassVersion(c);
int tmp = GSObjCVersion(c);
unsigned version = tmp;
Class s = fastSuper(c);
Class s = GSObjCSuper(c);
if (tmp < 0)
{

View file

@ -22,11 +22,11 @@
*/
#include <config.h>
#include <objc/objc-api.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
#include <Foundation/NSPortMessage.h>
#include <Foundation/NSObjCRuntime.h>
@implementation NSPortMessage

View file

@ -27,9 +27,9 @@
#include <Foundation/NSMethodSignature.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSException.h>
#include <Foundation/NSObjCRuntime.h>
#include "limits.h"
#include <objc/objc-api.h>
@implementation NSProxy

View file

@ -25,7 +25,6 @@
#include <config.h>
#include <base/preface.h>
#include <base/fast.x>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSValue.h>

View file

@ -22,7 +22,6 @@
*/
#include <config.h>
#include <base/fast.x>
#include <base/Unicode.h>
#include <Foundation/NSScanner.h>
#include <Foundation/NSException.h>
@ -127,7 +126,7 @@ typedef struct {
aString = @"";
}
c = GSObjCClassOfObject(aString);
c = GSObjCClass(aString);
if (c == GSUString_class)
{
_isUnicode = YES;

View file

@ -23,7 +23,6 @@
#include <config.h>
#include <base/preface.h>
#include <base/fast.x>
#include <Foundation/NSData.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSArray.h>
@ -136,7 +135,7 @@ initSerializerInfo(_NSSerializerInfo* info, NSMutableData *d, BOOL u)
{
Class c;
c = GSObjCClassOfObject(d);
c = GSObjCClass(d);
info->data = d;
info->appImp = (void (*)())get_imp(c, appSel);
info->datImp = (void* (*)())get_imp(c, datSel);
@ -164,14 +163,14 @@ serializeToInfo(id object, _NSSerializerInfo* info)
{
Class c;
c = GSObjCClassOfObject(object);
if (fastIsClass(c) == NO)
if (object == nil || GSObjCIsInstance(object) == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"Class (%@) in property list - expected instance",
[c description]];
}
if (fastClassIsKindOfClass(c, CStringClass)
c = GSObjCClass(object);
if (GSObjCIsKindOf(c, CStringClass)
|| (c == MStringClass && ((ivars)object)->_flags.wide == 0))
{
GSIMapNode node;
@ -201,7 +200,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
(*info->serImp)(info->data, serSel, node->value.uint);
}
}
else if (fastClassIsKindOfClass(c, StringClass))
else if (GSObjCIsKindOf(c, StringClass))
{
GSIMapNode node;
@ -230,7 +229,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
(*info->serImp)(info->data, serSel, node->value.uint);
}
}
else if (fastClassIsKindOfClass(c, ArrayClass))
else if (GSObjCIsKindOf(c, ArrayClass))
{
unsigned int count;
@ -254,7 +253,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
}
}
}
else if (fastClassIsKindOfClass(c, DictionaryClass))
else if (GSObjCIsKindOf(c, DictionaryClass))
{
NSEnumerator *e = [object keyEnumerator];
id k;
@ -278,7 +277,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
serializeToInfo(o, info);
}
}
else if (fastClassIsKindOfClass(c, DataClass))
else if (GSObjCIsKindOf(c, DataClass))
{
(*info->appImp)(info->data, appSel, &st_data, 1);
(*info->serImp)(info->data, serSel, [object length]);

View file

@ -23,7 +23,6 @@
#include <config.h>
#include <base/behavior.h>
#include <base/fast.x>
#include <Foundation/NSSet.h>
#include <Foundation/NSGSet.h>
#include <Foundation/NSCoder.h>
@ -123,7 +122,7 @@ static Class NSMutableSet_concrete_class;
unsigned count;
Class c;
c = GSObjCClassOfObject(self);
c = GSObjCClass(self);
if (c == NSSet_abstract_class)
{
RELEASE(self);

View file

@ -70,8 +70,6 @@
#include <base/Unicode.h>
#include <base/fast.x>
@class GSString;
@class GSMString;
@class GSUString;
@ -440,7 +438,7 @@ handle_printf_atsign (FILE *stream,
{
char *s;
s = NSZoneMalloc(fastZone(self), length);
s = NSZoneMalloc(GSObjCZone(self), length);
for (i = 0; i < length; i++)
{
@ -454,7 +452,7 @@ handle_printf_atsign (FILE *stream,
{
unichar *s;
s = NSZoneMalloc(fastZone(self), sizeof(unichar)*length);
s = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*length);
memcpy(s, chars, sizeof(unichar)*length);
self = [self initWithCharactersNoCopy: s
@ -483,7 +481,7 @@ handle_printf_atsign (FILE *stream,
{
if (length > 0)
{
char *s = NSZoneMalloc(fastZone(self), length);
char *s = NSZoneMalloc(GSObjCZone(self), length);
if (byteString != 0)
{
@ -511,7 +509,7 @@ handle_printf_atsign (FILE *stream,
if (length > 0)
{
unichar *s = NSZoneMalloc(fastZone(self), sizeof(unichar)*length);
unichar *s = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*length);
[string getCharacters: s];
self = [self initWithCharactersNoCopy: s
@ -553,7 +551,7 @@ handle_printf_atsign (FILE *stream,
{
unichar *s;
s = NSZoneMalloc(fastZone(self), sizeof(unichar)*length);
s = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*length);
length = encode_strtoustr(s, bytes, length+1, NSUTF8StringEncoding);
self = [self initWithCharactersNoCopy: s
length: length
@ -604,7 +602,7 @@ handle_printf_atsign (FILE *stream,
NSString *ret;
#if ! HAVE_REGISTER_PRINTF_FUNCTION
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
/* If the available libc doesn't have `register_printf_function()', then
the `%@' printf directive isn't available with printf() and friends.
@ -894,7 +892,7 @@ handle_printf_atsign (FILE *stream,
if (len > 0)
{
char *s = NSZoneMalloc(fastZone(self), len);
char *s = NSZoneMalloc(GSObjCZone(self), len);
[data getBytes: s];
self = [self initWithCStringNoCopy: s length: len freeWhenDone: YES];
@ -929,7 +927,7 @@ handle_printf_atsign (FILE *stream,
{
unichar *u;
u = NSZoneMalloc(fastZone(self), sizeof(unichar)*length);
u = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*length);
length = encode_strtoustr(u, bytes, length+1, NSUTF8StringEncoding);
self = [self initWithCharactersNoCopy: u
length: length
@ -947,7 +945,7 @@ handle_printf_atsign (FILE *stream,
return [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
b = [data bytes];
u = NSZoneMalloc(fastZone(self), sizeof(unichar)*(len+1));
u = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*(len+1));
if (encoding == NSUnicodeStringEncoding)
{
if ((b[0]==0xFE) & (b[1]==0xFF))
@ -1080,7 +1078,7 @@ handle_printf_atsign (FILE *stream,
{
unsigned len = [self length];
unsigned otherLength = [aString length];
NSZone *z = fastZone(self);
NSZone *z = GSObjCZone(self);
unichar *s = NSZoneMalloc(z, (len+otherLength)*sizeof(unichar));
NSString *tmp;
@ -1148,7 +1146,7 @@ handle_printf_atsign (FILE *stream,
if (aRange.length == 0)
return @"";
buf = NSZoneMalloc(fastZone(self), sizeof(unichar)*aRange.length);
buf = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*aRange.length);
[self getCharacters: buf range: aRange];
ret = [[GSStringClass allocWithZone: NSDefaultMallocZone()]
initWithCharactersNoCopy: buf length: aRange.length freeWhenDone: YES];
@ -1323,13 +1321,13 @@ handle_printf_atsign (FILE *stream,
{
return YES;
}
if (anObject != nil)
if (anObject != nil && GSObjCIsInstance(anObject) == YES)
{
Class c = fastClassOfInstance(anObject);
Class c = GSObjCClass(anObject);
if (c != nil)
{
if (fastClassIsKindOfClass(c, NSStringClass))
if (GSObjCIsKindOf(c, NSStringClass))
{
return [self isEqualToString: anObject];
}
@ -1674,7 +1672,7 @@ handle_printf_atsign (FILE *stream,
if (whitespce == nil)
setupWhitespce();
s = NSZoneMalloc(fastZone(self), sizeof(unichar)*len);
s = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*len);
[self getCharacters: s];
while (count < len)
{
@ -1722,7 +1720,7 @@ handle_printf_atsign (FILE *stream,
{
return self;
}
s = NSZoneMalloc(fastZone(self), sizeof(unichar)*len);
s = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*len);
caiImp = (unichar (*)())[self methodForSelector: caiSel];
for (count = 0; count < len; count++)
{
@ -1743,7 +1741,7 @@ handle_printf_atsign (FILE *stream,
{
return self;
}
s = NSZoneMalloc(fastZone(self), sizeof(unichar)*len);
s = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*len);
caiImp = (unichar (*)())[self methodForSelector: caiSel];
for (count = 0; count < len; count++)
{
@ -2895,7 +2893,7 @@ handle_printf_atsign (FILE *stream,
#if GS_WITH_GC
zone = GSAtomicMallocZone();
#else
zone = fastZone(self);
zone = GSObjCZone(self);
#endif
if (enc == NSUnicodeStringEncoding)

View file

@ -23,11 +23,10 @@
#include <config.h>
#include <string.h>
#include <objc/objc-api.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSZone.h>
#include <Foundation/NSException.h>
#include <Foundation/NSByteOrder.h>
#include <Foundation/NSObjCRuntime.h>
/*
* Setup for inline operation of arrays.
@ -48,8 +47,6 @@
#include <Foundation/NSUtilities.h>
#include <Foundation/NSString.h>
#include <base/fast.x>
static const char*
typeToName1(char type)
{
@ -1149,7 +1146,7 @@ static Class NSDataMallocClass;
TEST_RELEASE(data);
data = RETAIN(anObject);
c = GSObjCClassOfObject(data);
c = GSObjCClass(data);
if (src != self)
{
src = data;

View file

@ -22,8 +22,8 @@
*/
#include <config.h>
#include <objc/objc-api.h>
#include <base/preface.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSString.h>
#include <Foundation/NSPathUtilities.h>
#include <Foundation/NSException.h>

View file

@ -85,7 +85,7 @@
#include <base/preface.h>
#include <stddef.h>
#include <string.h>
#include <objc/objc-api.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#include <Foundation/NSZone.h>

View file

@ -31,6 +31,7 @@
#include <config.h>
#include <base/preface.h>
#include <mframe.h>
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
#include <stdlib.h>