Rewrites.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2928 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-08-13 20:41:28 +00:00
parent 17d160cc4f
commit b3e2c71fcd
2 changed files with 80 additions and 35 deletions

View file

@ -1,8 +1,10 @@
/* Interface for NSInvocation for GNUStep
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Created: 1995
/* Interface for NSInvocation for GNUStep
Copyright (C) 1998 Free Software Foundation, Inc.
Written: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Date: 1998
Based on code by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
This file is part of the GNUstep Base Library.
@ -24,35 +26,67 @@
#ifndef __NSInvocation_h_GNUSTEP_BASE_INCLUDE
#define __NSInvocation_h_GNUSTEP_BASE_INCLUDE
#include <gnustep/base/preface.h>
@class NSMethodSignature;
#include <Foundation/NSMethodSignature.h>
@interface NSInvocation : NSObject
@end
{
NSMethodSignature *sig;
arglist_t argframe;
void *retval;
id target;
SEL selector;
int numArgs;
NSArgumentInfo *info;
BOOL argsRetained;
}
/* Put these in a category to avoid gcc complaints about methods
not being there; the method come from a behavior. */
@interface NSInvocation (GNUstep)
/*
* Creating instances.
*/
+ (NSInvocation*) invocationWithMethodSignature: (NSMethodSignature*)signature;
+ (NSInvocation*) invocationWithMethodSignature: (NSMethodSignature*)ms;
- (void) getArgument: (void*)argumentLocation atIndex: (int)index;
- (void) getReturnValue: (void*)returnLocation;
- (NSMethodSignature*) methodSignature;
/*
* Accessing message elements.
*/
- (void) getArgument: (void*)buffer
atIndex: (int)index;
- (void) getReturnValue: (void*)buffer;
- (SEL) selector;
- (void) setArgument: (void*)argumentLocation atIndex: (int)index;
- (void) setReturnValue: (void*)returnLocation;
- (void) setSelector: (SEL)aSelector;
- (void) setArgument: (void*)buffer
atIndex: (int)index;
- (void) setReturnValue: (void*)buffer;
- (void) setSelector: (SEL)selector;
- (void) setTarget: (id)target;
- (id) target;
/*
* Managing arguments.
*/
- (BOOL) argumentsRetained;
- (void) retainArguments;
/*
* Dispatching an Invocation.
*/
- (void) invoke;
- (void) invokeWithTarget: (id)target;
/*
* Getting the method signature.
*/
- (NSMethodSignature*)methodSignature;
@end
@interface NSInvocation (GNUstep)
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector;
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
- (id) initWithSelector: (SEL)aSelector;
- (id) initWithTarget: target selector: (SEL)aSelector, ...;
- (void*)returnFrame: (arglist_t)argFrame;
@end
/* -initWithTarget:selector:, a method used in the macros
is come from the MethodInvocation behavior.
So your gcc warns that NSInvocation doesn't have
@ -79,3 +113,4 @@
autorelease])
#endif /* __NSInvocation_h_GNUSTEP_BASE_INCLUDE */

View file

@ -1,8 +1,10 @@
/* Interface for NSMethodSignature for GNUStep
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1998 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Date: 1995
Rewritten: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Date: 1998
This file is part of the GNUstep Base Library.
@ -26,36 +28,44 @@
#include <Foundation/NSObject.h>
/* xxx Where does this go? */
/* Info about layout of arguments. */
typedef struct
{
int offset;
int size;
char *type;
/*
* Info about layout of arguments.
* Extended from the original OpenStep version to let us know if the
* arg is passed in registers or on the stack.
*
* NB. This no longer exists in Rhapsody/MacOS.
*/
typedef struct {
int offset;
unsigned size;
const char *type;
unsigned align;
unsigned qual;
BOOL isReg;
} NSArgumentInfo;
@interface NSMethodSignature : NSObject
{
char *types;
char *returnTypes;
unsigned argFrameLength;
unsigned returnFrameLength;
unsigned numArgs;
const char *methodTypes;
unsigned argFrameLength;
unsigned numArgs;
NSArgumentInfo *info;
}
+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)types;
- (NSArgumentInfo) argumentInfoAtIndex: (unsigned)index;
- (unsigned) frameLength;
- (const char*) getArgumentTypeAtIndex: (unsigned)index;
- (BOOL) isOneway;
- (unsigned) methodReturnLength;
- (char*) methodReturnType;
- (const char*) methodReturnType;
- (unsigned) numberOfArguments;
@end
@interface NSMethodSignature(GNU)
- (char*) methodType;
- (NSArgumentInfo*) methodInfo;
- (const char*) methodType;
@end
#endif /* __NSMethodSignature_h_GNUSTEP_BASE_INCLUDE */