1995-03-23 03:39:18 +00:00
|
|
|
/* Interface for NSInvocation for GNUStep
|
2003-04-04 10:59:11 +00:00
|
|
|
Copyright (C) 1998,2003 Free Software Foundation, Inc.
|
1995-07-01 19:01:11 +00:00
|
|
|
|
2003-04-04 10:59:11 +00:00
|
|
|
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
1998-08-13 20:41:28 +00:00
|
|
|
Date: 1998
|
|
|
|
Based on code by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1995-03-23 03:39:18 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-03-23 03:39:18 +00:00
|
|
|
|
|
|
|
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
|
2005-05-22 03:32:16 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
1995-03-23 03:39:18 +00:00
|
|
|
*/
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSInvocation_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSInvocation_h_GNUSTEP_BASE_INCLUDE
|
1995-03-23 03:39:18 +00:00
|
|
|
|
1998-08-13 20:41:28 +00:00
|
|
|
#include <Foundation/NSMethodSignature.h>
|
1995-03-12 15:50:38 +00:00
|
|
|
|
2002-03-10 06:21:24 +00:00
|
|
|
|
1995-03-23 03:39:18 +00:00
|
|
|
@interface NSInvocation : NSObject
|
1998-08-13 20:41:28 +00:00
|
|
|
{
|
1999-09-16 07:21:34 +00:00
|
|
|
NSMethodSignature *_sig;
|
2000-12-08 19:06:00 +00:00
|
|
|
void *_cframe;
|
1999-09-16 07:21:34 +00:00
|
|
|
void *_retval;
|
|
|
|
id _target;
|
|
|
|
SEL _selector;
|
2003-01-03 20:14:47 +00:00
|
|
|
unsigned int _numArgs;
|
2002-03-10 07:38:56 +00:00
|
|
|
#ifndef STRICT_MACOS_X
|
1999-09-16 07:21:34 +00:00
|
|
|
NSArgumentInfo *_info;
|
2002-03-10 07:38:56 +00:00
|
|
|
#else
|
|
|
|
void *_dummy;
|
|
|
|
#endif
|
1999-09-16 07:21:34 +00:00
|
|
|
BOOL _argsRetained;
|
2005-09-17 21:41:12 +00:00
|
|
|
BOOL _targetRetained;
|
1999-09-16 07:21:34 +00:00
|
|
|
BOOL _validReturn;
|
2001-05-15 17:11:10 +00:00
|
|
|
BOOL _sendToSuper;
|
1998-08-13 20:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Creating instances.
|
|
|
|
*/
|
2001-12-17 14:31:42 +00:00
|
|
|
+ (NSInvocation*) invocationWithMethodSignature: (NSMethodSignature*)_signature;
|
1998-08-13 20:41:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Accessing message elements.
|
|
|
|
*/
|
|
|
|
- (void) getArgument: (void*)buffer
|
|
|
|
atIndex: (int)index;
|
|
|
|
- (void) getReturnValue: (void*)buffer;
|
1994-11-08 16:44:01 +00:00
|
|
|
- (SEL) selector;
|
1998-08-13 20:41:28 +00:00
|
|
|
- (void) setArgument: (void*)buffer
|
|
|
|
atIndex: (int)index;
|
|
|
|
- (void) setReturnValue: (void*)buffer;
|
2001-12-17 14:31:42 +00:00
|
|
|
- (void) setSelector: (SEL)aSelector;
|
|
|
|
- (void) setTarget: (id)anObject;
|
1994-11-08 16:44:01 +00:00
|
|
|
- (id) target;
|
|
|
|
|
1998-08-13 20:41:28 +00:00
|
|
|
/*
|
|
|
|
* Managing arguments.
|
|
|
|
*/
|
|
|
|
- (BOOL) argumentsRetained;
|
|
|
|
- (void) retainArguments;
|
|
|
|
|
2005-09-17 21:41:12 +00:00
|
|
|
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE) && GS_API_VERSION(011201,GS_API_LATEST)
|
|
|
|
- (BOOL) targetRetained;
|
|
|
|
- (void) retainArgumentsIncludingTarget: (BOOL)retainTargetFlag;
|
|
|
|
#endif
|
|
|
|
|
1998-08-13 20:41:28 +00:00
|
|
|
/*
|
|
|
|
* Dispatching an Invocation.
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
- (void) invoke;
|
2001-12-17 14:31:42 +00:00
|
|
|
- (void) invokeWithTarget: (id)anObject;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
1998-08-13 20:41:28 +00:00
|
|
|
/*
|
|
|
|
* Getting the method signature.
|
|
|
|
*/
|
2000-10-30 13:56:31 +00:00
|
|
|
- (NSMethodSignature*) methodSignature;
|
1998-08-13 20:41:28 +00:00
|
|
|
|
1994-11-08 16:44:01 +00:00
|
|
|
@end
|
|
|
|
|
1998-11-02 10:55:53 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
1998-08-13 20:41:28 +00:00
|
|
|
@interface NSInvocation (GNUstep)
|
|
|
|
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector;
|
|
|
|
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
|
|
|
|
- (id) initWithSelector: (SEL)aSelector;
|
2001-12-17 14:31:42 +00:00
|
|
|
- (id) initWithTarget: (id)anObject selector: (SEL)aSelector, ...;
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void*) returnFrame: (arglist_t)argFrame;
|
2001-05-15 17:11:10 +00:00
|
|
|
- (BOOL) sendsToSuper;
|
|
|
|
- (void) setSendsToSuper: (BOOL)flag;
|
1998-08-13 20:41:28 +00:00
|
|
|
@end
|
1998-11-02 10:55:53 +00:00
|
|
|
#endif
|
1998-08-13 20:41:28 +00:00
|
|
|
|
2003-04-04 10:03:08 +00:00
|
|
|
/* Do NOT use these methods ... internal use only ... not public API */
|
|
|
|
@interface NSInvocation (MacroSetup)
|
|
|
|
+ (id) _newProxyForInvocation: (id)target;
|
|
|
|
+ (id) _newProxyForMessage: (id)target;
|
|
|
|
+ (NSInvocation*) _returnInvocationAndDestroyProxy: (id)proxy;
|
|
|
|
@end
|
|
|
|
|
2003-04-04 10:59:11 +00:00
|
|
|
/**
|
|
|
|
* Creates and returns an autoreleased invocation containing a
|
|
|
|
* message to an instance of the class. The 'message' consists
|
|
|
|
* of selector and arguments like a standard ObjectiveC method
|
|
|
|
* call.<br />
|
|
|
|
* Before using the returned invocation, you need to set its target.
|
|
|
|
*/
|
2003-04-04 10:03:08 +00:00
|
|
|
#define NS_INVOCATION(class, message...) ({\
|
|
|
|
id __proxy = [NSInvocation _newProxyForInvocation: class]; \
|
|
|
|
[__proxy message]; \
|
|
|
|
[NSInvocation _returnInvocationAndDestroyProxy: __proxy]; \
|
|
|
|
})
|
|
|
|
|
2003-04-04 10:59:11 +00:00
|
|
|
/**
|
|
|
|
* Creates and returns an autoreleased invocation containing a
|
|
|
|
* message to the target object. The 'message' consists
|
|
|
|
* of selector and arguments like a standard ObjectiveC method
|
|
|
|
* call.
|
|
|
|
*/
|
2003-04-04 10:03:08 +00:00
|
|
|
#define NS_MESSAGE(target, message...) ({\
|
|
|
|
id __proxy = [NSInvocation _newProxyForMessage: target]; \
|
|
|
|
[__proxy message]; \
|
|
|
|
[NSInvocation _returnInvocationAndDestroyProxy: __proxy]; \
|
|
|
|
})
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#endif /* __NSInvocation_h_GNUSTEP_BASE_INCLUDE */
|
1998-08-13 20:41:28 +00:00
|
|
|
|