Make -invoke methods return void. Include objects/Invoking.h.

(return_type): ivar renamed from encoding.
(ArgframeInvocation args_retained): new ivar.
(MethodInvocation target_pointer): new ivar.
(MethodInvocation sel_pointer): new ivar.
(VoidFunctionInvocation): New class.
(ObjectFunctionInvocation): New class.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@997 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1996-02-24 16:42:35 +00:00
parent e13beb9d87
commit 2f78d229bb
2 changed files with 58 additions and 36 deletions

View file

@ -10,16 +10,15 @@
#include <objects/stdobjects.h>
#include <objects/Collection.h>
#include <objects/Invoking.h>
@interface Invocation : NSObject
@interface Invocation : NSObject <Invoking>
{
char *encoding;
char *return_type; /* may actually contain full argframe type */
unsigned return_size;
void *return_value;
}
- initWithReturnType: (const char *)encoding;
- (void) invoke;
- (void) invokeWithObject: anObj;
- (const char *) returnType;
- (unsigned) returnSize;
- (void) getReturnValue: (void*) addr;
@ -28,10 +27,15 @@
@interface ArgframeInvocation : Invocation
{
arglist_t argframe;
/* char *function_encoding; Using return_encoding */
BOOL args_retained;
/* Use return_type to hold full argframe type. */
}
- initWithArgframe: (arglist_t)frame type: (const char *)e;
- initWithType: (const char *)e;
- (void) retainArguments;
- (BOOL) argumentsRetained;
- (const char *) argumentTypeAtIndex: (unsigned)i;
- (unsigned) argumentSizeAtIndex: (unsigned)i;
- (void) getArgument: (void*)addr atIndex: (unsigned)i;
@ -40,6 +44,11 @@
@end
@interface MethodInvocation : ArgframeInvocation
{
id *target_pointer;
SEL *sel_pointer;
}
- initWithArgframe: (arglist_t)frame selector: (SEL)s;
- initWithSelector: (SEL)s;
- initWithTarget: target selector: (SEL)s, ...;
@ -50,30 +59,33 @@
- (void) setTarget: t;
@end
/* Same as MethodInvocation, except that when sent
[ -invokeWithObject: anObj], anObj does not become the target
for the invocation's selector, it becomes the first object
argument of the selector. */
@interface ObjectMethodInvocation : MethodInvocation
{
id *arg_object_pointer;
}
@end
@interface VoidFunctionInvocation : Invocation
{
void (*function)();
}
- initWithFunction: (void(*)())f;
- initWithVoidFunction: (void(*)())f;
@end
#if 0
@interface VoidObjectFunctionInvocation : Invocation
{
void (*function)(id);
id object;
}
- initWithFunction: (void(*)())f;
@end
@interface ObjectObjectFunctionInvocation : Invocation
@interface ObjectFunctionInvocation : Invocation
{
id (*function)(id);
}
- initWithFunction: (void(*)())f;
- initWithObjectFunction: (id(*)(id))f;
@end
#if 0
@interface FunctionInvocation : ArgframeInvocation
{
void (*function)();
@ -82,7 +94,6 @@
argframe: (arglist_t)frame type: (const char *)e;
- initWithFunction: (void(*)())f;
@end
#endif
#endif /* __Invocation_h_OBJECTS_INCLUDE */

View file

@ -10,16 +10,15 @@
#include <objects/stdobjects.h>
#include <objects/Collection.h>
#include <objects/Invoking.h>
@interface Invocation : NSObject
@interface Invocation : NSObject <Invoking>
{
char *encoding;
char *return_type; /* may actually contain full argframe type */
unsigned return_size;
void *return_value;
}
- initWithReturnType: (const char *)encoding;
- (void) invoke;
- (void) invokeWithObject: anObj;
- (const char *) returnType;
- (unsigned) returnSize;
- (void) getReturnValue: (void*) addr;
@ -28,10 +27,15 @@
@interface ArgframeInvocation : Invocation
{
arglist_t argframe;
/* char *function_encoding; Using return_encoding */
BOOL args_retained;
/* Use return_type to hold full argframe type. */
}
- initWithArgframe: (arglist_t)frame type: (const char *)e;
- initWithType: (const char *)e;
- (void) retainArguments;
- (BOOL) argumentsRetained;
- (const char *) argumentTypeAtIndex: (unsigned)i;
- (unsigned) argumentSizeAtIndex: (unsigned)i;
- (void) getArgument: (void*)addr atIndex: (unsigned)i;
@ -40,6 +44,11 @@
@end
@interface MethodInvocation : ArgframeInvocation
{
id *target_pointer;
SEL *sel_pointer;
}
- initWithArgframe: (arglist_t)frame selector: (SEL)s;
- initWithSelector: (SEL)s;
- initWithTarget: target selector: (SEL)s, ...;
@ -50,30 +59,33 @@
- (void) setTarget: t;
@end
/* Same as MethodInvocation, except that when sent
[ -invokeWithObject: anObj], anObj does not become the target
for the invocation's selector, it becomes the first object
argument of the selector. */
@interface ObjectMethodInvocation : MethodInvocation
{
id *arg_object_pointer;
}
@end
@interface VoidFunctionInvocation : Invocation
{
void (*function)();
}
- initWithFunction: (void(*)())f;
- initWithVoidFunction: (void(*)())f;
@end
#if 0
@interface VoidObjectFunctionInvocation : Invocation
{
void (*function)(id);
id object;
}
- initWithFunction: (void(*)())f;
@end
@interface ObjectObjectFunctionInvocation : Invocation
@interface ObjectFunctionInvocation : Invocation
{
id (*function)(id);
}
- initWithFunction: (void(*)())f;
- initWithObjectFunction: (id(*)(id))f;
@end
#if 0
@interface FunctionInvocation : ArgframeInvocation
{
void (*function)();
@ -82,7 +94,6 @@
argframe: (arglist_t)frame type: (const char *)e;
- initWithFunction: (void(*)())f;
@end
#endif
#endif /* __Invocation_h_OBJECTS_INCLUDE */