mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 20:26:42 +00:00
Initial revision
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
86aae03ebe
commit
a457b29979
11 changed files with 1172 additions and 0 deletions
92
Source/NSInvocation.m
Normal file
92
Source/NSInvocation.m
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "NSInvocation.h"
|
||||
|
||||
@implementation NSInvocation
|
||||
|
||||
+ (NSInvocation*) invocationWithMethodSignature: (MethodSignature*)ms
|
||||
frame: (arglist_t)aFrame
|
||||
{
|
||||
NSInvocation *newInv = [self invocationWithMethodSignature:ms];
|
||||
bcopy(aFrame->arg_ptr, newInv->agrFrame->arg_ptr, [ms frameLength]);
|
||||
...
|
||||
return newInv;
|
||||
}
|
||||
|
||||
+ (NSInvocation*) invocationWithMethodSignature: (MethodSignature*)ms
|
||||
{
|
||||
int argsize = [ms frameLength];
|
||||
int retsize = [ms methodReturnLength];
|
||||
NSInvocation* newInv = [self alloc];
|
||||
|
||||
newInv->methodSignature = ms;
|
||||
newInv->argFrame = malloc(argsize);
|
||||
newInv->argFrame->arg_ptr = malloc(argsize);
|
||||
newInv->retFrame = malloc(retsize);
|
||||
return newInv;
|
||||
}
|
||||
|
||||
- (void) getArgument: (void*)argumentLocation atIndex: (int)index
|
||||
{
|
||||
*argumentLocation =
|
||||
}
|
||||
|
||||
- (void) getReturnValue: (void*)returnLocation
|
||||
{
|
||||
bcopy(retFrame, returnLocation, [methodSignature methodReturnLength]);
|
||||
return;
|
||||
}
|
||||
|
||||
- (MethodSignature*) methodSignature
|
||||
{
|
||||
return methodSignature;
|
||||
}
|
||||
|
||||
- (SEL) selector
|
||||
{
|
||||
SEL s;
|
||||
[self getArgument:&s atIndex:1];
|
||||
return s;
|
||||
}
|
||||
|
||||
- (void) setArgument: (void*)argumentLocation atIndex: (int)index;
|
||||
- (void) setReturnValue: (void*)returnLocation
|
||||
{
|
||||
bcopy(returnLocation, retFrame, [methodSignature methodReturnLength]);
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) setSelector: (SEL)aSelector
|
||||
{
|
||||
[self setArgument:&aSelector atIndex:1];
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) setTarget: (id)aTarget
|
||||
{
|
||||
target = aTarget;
|
||||
return;
|
||||
}
|
||||
|
||||
- (id) target
|
||||
{
|
||||
id t;
|
||||
[self getArgument:&t atIndex:0];
|
||||
return t;
|
||||
}
|
||||
|
||||
- (void) invoke
|
||||
{
|
||||
char *type;
|
||||
Method* m;
|
||||
id target;
|
||||
SEL sel;
|
||||
IMP imp;
|
||||
|
||||
target = *(id*)method_get_first_argument(m, argFrame, &type);
|
||||
|
||||
= [target methodForSelector:
|
||||
__builtin_apply(
|
||||
|
||||
- (void) invokeWithTarget: (id)target
|
||||
{
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue