* Headers/Foundation/NSMethodSignature.h:

(NSArgumentInfo): Document limitations of NSArgumentInfo's
        offset and registier information.  Match size for NO_GNUSTEP.
        (NSMethodSignature): Match ivar name with runtime information.

        * Source/GSFFCallInvocation.m
        * Source/GSFFIInvocation.m
        * Source/NSInvocation.m
        (gs_method_for_receiver_and_selector)
        ([-invokeWithTarget:]): Use GSGetMethod instead of deprecated
        GSGetInstanceMethod and GSGetClassMethod.
        * Source/NSConnection.m ([-_service_typeForSelector]): Ditto.
        * Source/NSDistantObject.m ([+respondsToSelector]): Ditto.
        * Source/NSObject.m ([+instanceMethodSignatureForSelector:])
        ([-methodSignatureForSelector:])
        ([+descriptionForInstanceMethod], [-descriptionForMethod]): Ditto.
        * Source/NSProtocolChecker.m ([-methodSignatureForSelector]): Ditto.
        * Source/NSProxy.m ([+methodSignatureForSelector])
        ([-methodSignatureForSelector]): Ditto.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19896 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ayers 2004-08-20 17:53:16 +00:00
parent 0c58c618de
commit b803fe27a6
10 changed files with 78 additions and 53 deletions

View file

@ -8,6 +8,26 @@
2004-08-20 David Ayers <d.ayers@inode.at>
* Headers/Foundation/NSMethodSignature.h:
(NSArgumentInfo): Document limitations of NSArgumentInfo's offset
and registier information. Match size for NO_GNUSTEP.
(NSMethodSignature): Match ivar name with runtime information.
* Source/GSFFCallInvocation.m
* Source/GSFFIInvocation.m
* Source/NSInvocation.m
(gs_method_for_receiver_and_selector)
([-invokeWithTarget:]): Use GSGetMethod instead of deprecated
GSGetInstanceMethod and GSGetClassMethod.
* Source/NSConnection.m ([-_service_typeForSelector]): Ditto.
* Source/NSDistantObject.m ([+respondsToSelector]): Ditto.
* Source/NSObject.m ([+instanceMethodSignatureForSelector:])
([-methodSignatureForSelector:])
([+descriptionForInstanceMethod], [-descriptionForMethod]): Ditto.
* Source/NSProtocolChecker.m ([-methodSignatureForSelector]): Ditto.
* Source/NSProxy.m ([+methodSignatureForSelector])
([-methodSignatureForSelector]): Ditto.
* Headers/Additions/GNUstepBase/GSObjCRuntime.h
(GSFindInstanceVariable, GSGetVariable, GSSetVariable)
(GSGetValue, GSSetValue, GSObjCName, GSObjCSelectorName)

View file

@ -45,6 +45,10 @@ typedef struct {
BOOL isReg; // extension, available only ifndef NO_GNUSTEP
} NSArgumentInfo;
</example>
* <p>NB. The offset and register information my not always be reliable.
* In the past it was dependant of locally maintained platform dependent
* information. In the future it may depend on layout information
* supplied by the compiler.<p>
*/
typedef struct {
int offset;
@ -54,6 +58,10 @@ typedef struct {
unsigned align;
unsigned qual;
BOOL isReg;
#else
unsigned _reserved1;
unsigned _reserved2;
BOOL _reserved3;
#endif
} NSArgumentInfo;
#endif
@ -77,7 +85,7 @@ typedef struct {
unsigned _argFrameLength;
unsigned _numArgs;
#ifdef STRICT_MACOS_X
void *_dummy;
void *_info;
#else
NSArgumentInfo *_info;
#endif

View file

@ -212,14 +212,11 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
{
if (receiver)
{
if (GSObjCIsInstance(receiver))
{
return GSGetInstanceMethod(GSObjCClass(receiver), sel);
}
else if (GSObjCIsClass(receiver))
{
return GSGetClassMethod(receiver, sel);
}
return GSGetMethod((GSObjCIsInstance(receiver)
? GSObjCClass(receiver) : (Class)receiver),
sel,
GSObjCIsInstance(receiver),
YES);
}
return METHOD_NULL;
@ -685,11 +682,14 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
}
else
{
imp = method_get_imp(GSObjCIsInstance(_target) ?
GSGetInstanceMethod(
((struct objc_class*)_target)->class_pointer, _selector)
: GSGetClassMethod(
((struct objc_class*)_target), _selector));
GSMethod method;
method = GSGetMethod((GSObjCIsInstance(_target)
? GSObjCClass(_target)
: _target),
_selector,
GSObjCIsInstance(_target),
YES);
imp = method_get_imp(method);
/*
* If fast lookup failed, we may be forwarding or something ...
*/

View file

@ -59,14 +59,11 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
{
if (receiver)
{
if (GSObjCIsInstance(receiver))
{
return GSGetInstanceMethod(GSObjCClass(receiver), sel);
}
else if (GSObjCIsClass(receiver))
{
return GSGetClassMethod(receiver, sel);
}
return GSGetMethod((GSObjCIsInstance(receiver)
? GSObjCClass(receiver) : (Class)receiver),
sel,
GSObjCIsInstance(receiver),
YES);
}
return METHOD_NULL;
@ -330,11 +327,14 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
}
else
{
imp = method_get_imp(GSObjCIsInstance(_target) ?
GSGetInstanceMethod(
((struct objc_class*)_target)->class_pointer, _selector)
: GSGetClassMethod(
(struct objc_class*)_target, _selector));
GSMethod method;
method = GSGetMethod((GSObjCIsInstance(_target)
? GSObjCClass(_target)
: _target),
_selector,
GSObjCIsInstance(_target),
YES);
imp = method_get_imp(method);
/*
* If fast lookup failed, we may be forwarding or something ...
*/

View file

@ -2585,7 +2585,7 @@ static void callEncoder (DOContext *ctxt)
/* xxx We should make sure that TARGET is a valid object. */
/* Not actually a Proxy, but we avoid the warnings "id" would have made. */
m = GSGetInstanceMethod(((NSDistantObject*)o)->isa, sel);
m = GSGetMethod(((NSDistantObject*)o)->isa, sel, YES, YES);
/* Perhaps I need to be more careful in the line above to get the
version of the method types that has the type qualifiers in it.
Search the protocols list. */

View file

@ -156,7 +156,7 @@ enum
+ (BOOL) respondsToSelector: (SEL)sel
{
return GSGetClassMethod(self, sel) != (GSMethod)0;
return GSGetMethod(self, sel, NO, YES) != (GSMethod)0;
}
+ (id) initWithCoder: (NSCoder*)aCoder

View file

@ -565,11 +565,14 @@ _arg_addr(NSInvocation *inv, int index)
}
else
{
imp = method_get_imp(GSObjCIsInstance(_target) ?
GSGetInstanceMethod(
((struct objc_class*)_target)->class_pointer, _selector)
: GSGetClassMethod(
((struct objc_class*)_target), _selector));
GSMethod method;
method = GSGetMethod((GSObjCIsInstance(_target)
? GSObjCClass(_target)
: _target),
_selector,
GSObjCIsInstance(_target),
YES);
imp = method_get_imp(method);
/*
* If fast lookup failed, we may be forwarding or something ...
*/

View file

@ -1372,7 +1372,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
[NSException raise: NSInvalidArgumentException
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
mth = GSGetInstanceMethod(self, aSelector);
mth = GSGetMethod(self, aSelector, YES, YES);
return mth ? [NSMethodSignature signatureWithObjCTypes:mth->method_types]
: nil;
}
@ -1392,16 +1392,8 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
[NSException raise: NSInvalidArgumentException
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
if (GSObjCIsInstance(self))
{
c = GSObjCClass(self);
mth = GSGetInstanceMethod(c, aSelector);
}
else
{
c = (Class)self;
mth = GSGetClassMethod(c, aSelector);
}
c = (GSObjCIsInstance(self) ? GSObjCClass(self) : (Class)self);
mth = GSGetMethod(c, aSelector, GSObjCIsInstance(self), YES);
if (mth == 0)
{
@ -2111,7 +2103,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
[NSException raise: NSInvalidArgumentException
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
mth = GSGetInstanceMethod(self, aSelector);
mth = GSGetMethod(self, aSelector, YES, YES);
return mth ? [NSMethodSignature signatureWithObjCTypes:mth->method_types]
: nil;
}
@ -2265,7 +2257,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
return ((struct objc_method_description *)
GSGetInstanceMethod(self, aSel));
GSGetMethod(self, aSel, YES, YES));
}
- (struct objc_method_description *) descriptionForMethod: (SEL)aSel
@ -2275,9 +2267,11 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
return ((struct objc_method_description *)
(GSObjCIsInstance(self)
? GSGetInstanceMethod(GSObjCClass(self), aSel)
: GSGetClassMethod((Class)self, aSel)));
GSGetMethod((GSObjCIsInstance(self)
? GSObjCClass(self) : (Class)self),
aSel,
GSObjCIsInstance(self),
YES));
}
/**

View file

@ -224,7 +224,7 @@
}
c = GSObjCClass(self);
mth = GSGetInstanceMethod(c, aSelector);
mth = GSGetMethod(c, aSelector, YES, YES);
if (mth == 0)
{
return nil; // Method not implemented

View file

@ -142,7 +142,7 @@ extern BOOL __objc_responds_to(id, SEL);
{
return nil;
}
mth = GSGetClassMethod(self, aSelector);
mth = GSGetMethod(self, aSelector, NO, YES);
if (mth != 0)
{
const char *types = mth->method_types;
@ -381,7 +381,7 @@ extern BOOL __objc_responds_to(id, SEL);
{
return nil;
}
mth = GSGetInstanceMethod(GSObjCClass(self), aSelector);
mth = GSGetMethod(GSObjCClass(self), aSelector, YES, YES);
if (mth != 0)
{
const char *types = mth->method_types;