1995-03-23 03:42:04 +00:00
|
|
|
/* Interface for NSMethodSignature for GNUStep
|
1998-08-13 20:41:28 +00:00
|
|
|
Copyright (C) 1995, 1998 Free Software Foundation, Inc.
|
1995-07-01 19:01:11 +00:00
|
|
|
|
1996-04-17 20:17:45 +00:00
|
|
|
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1995-07-01 19:01:11 +00:00
|
|
|
Date: 1995
|
1998-08-13 20:41:28 +00:00
|
|
|
Rewritten: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
Date: 1998
|
1995-03-23 03:42:04 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-03-23 03:42:04 +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
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
1995-03-23 03:42:04 +00:00
|
|
|
*/
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSMethodSignature_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSMethodSignature_h_GNUSTEP_BASE_INCLUDE
|
1994-11-08 16:44:01 +00:00
|
|
|
|
1995-04-17 21:13:20 +00:00
|
|
|
#include <Foundation/NSObject.h>
|
1994-11-08 16:44:01 +00:00
|
|
|
|
1998-11-02 10:55:53 +00:00
|
|
|
#ifndef STRICT_MACOS_X
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* <p>Info about layout of arguments.
|
1998-08-13 20:41:28 +00:00
|
|
|
* Extended from the original OpenStep version to let us know if the
|
2004-06-22 22:27:39 +00:00
|
|
|
* arg is passed in registers or on the stack.</p>
|
1998-08-13 20:41:28 +00:00
|
|
|
*
|
2004-06-22 22:27:39 +00:00
|
|
|
* <p>NB. This no longer exists in Rhapsody/MacOS.</p>
|
|
|
|
<example>
|
|
|
|
typedef struct {
|
|
|
|
int offset;
|
|
|
|
unsigned size;
|
|
|
|
const char *type;
|
|
|
|
unsigned align; // extension, available only ifndef NO_GNUSTEP
|
|
|
|
unsigned qual; // extension, available only ifndef NO_GNUSTEP
|
|
|
|
BOOL isReg; // extension, available only ifndef NO_GNUSTEP
|
|
|
|
} NSArgumentInfo;
|
|
|
|
</example>
|
2004-08-26 02:04:02 +00:00
|
|
|
* <p>NB. The offset and register information may not always be reliable.
|
|
|
|
* In the past it was dependent on locally maintained platform dependent
|
2004-08-20 17:53:16 +00:00
|
|
|
* information. In the future it may depend on layout information
|
2004-08-26 02:04:02 +00:00
|
|
|
* supplied by the compiler.</p>
|
1998-08-13 20:41:28 +00:00
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
int offset;
|
|
|
|
unsigned size;
|
|
|
|
const char *type;
|
1998-11-02 10:55:53 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
1998-08-13 20:41:28 +00:00
|
|
|
unsigned align;
|
|
|
|
unsigned qual;
|
|
|
|
BOOL isReg;
|
2004-08-20 17:53:16 +00:00
|
|
|
#else
|
|
|
|
unsigned _reserved1;
|
|
|
|
unsigned _reserved2;
|
|
|
|
BOOL _reserved3;
|
1998-11-02 10:55:53 +00:00
|
|
|
#endif
|
1995-11-06 17:35:50 +00:00
|
|
|
} NSArgumentInfo;
|
1998-11-02 10:55:53 +00:00
|
|
|
#endif
|
1995-11-06 17:35:50 +00:00
|
|
|
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* <p>Class encapsulating type information for method arguments and return
|
|
|
|
* value. It is used as a component of [NSInvocation] to implement message
|
|
|
|
* forwarding, such as within the distributed objects framework. Instances
|
|
|
|
* can be obtained from the [NSObject] method
|
|
|
|
* [NSObject-methodSignatureForSelector:].</p>
|
|
|
|
*
|
|
|
|
* <p>Basically, types are represented as Objective-C <code>@encode(...)</code>
|
|
|
|
* compatible strings, together with size information. The arguments are
|
|
|
|
* numbered starting from 0, including the implicit arguments
|
|
|
|
* <code><em>self</em></code> (type <code>id</code>, at position 0) and
|
|
|
|
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).</p>
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
@interface NSMethodSignature : NSObject
|
|
|
|
{
|
1999-09-16 07:21:34 +00:00
|
|
|
const char *_methodTypes;
|
|
|
|
unsigned _argFrameLength;
|
|
|
|
unsigned _numArgs;
|
2004-07-01 11:38:19 +00:00
|
|
|
#ifdef STRICT_MACOS_X
|
2004-08-20 17:53:16 +00:00
|
|
|
void *_info;
|
1998-11-02 10:55:53 +00:00
|
|
|
#else
|
1999-09-16 07:21:34 +00:00
|
|
|
NSArgumentInfo *_info;
|
1998-11-02 10:55:53 +00:00
|
|
|
#endif
|
1994-11-08 16:44:01 +00:00
|
|
|
}
|
|
|
|
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* Build a method signature directly from string description of return type and
|
|
|
|
* argument types, using the Objective-C <code>@encode(...)</code> type codes.
|
|
|
|
*/
|
2001-12-17 14:31:42 +00:00
|
|
|
+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)t;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
1998-11-02 10:55:53 +00:00
|
|
|
#ifndef STRICT_MACOS_X
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* Returns full information on given argument. Indices start at 0. Provide
|
|
|
|
* -1 to get info on return value.
|
|
|
|
*/
|
1995-11-06 17:35:50 +00:00
|
|
|
- (NSArgumentInfo) argumentInfoAtIndex: (unsigned)index;
|
1998-11-02 10:55:53 +00:00
|
|
|
#endif
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of bytes that the full set of arguments occupies on the stack, which
|
|
|
|
* is platformt(hardware)-dependent.
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
- (unsigned) frameLength;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns Objective-C <code>@encode(...)</code> compatible string. Arguments
|
|
|
|
* are numbered starting from 0, including the implicit arguments
|
|
|
|
* <code><em>self</em></code> (type <code>id</code>, at position 0) and
|
|
|
|
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).
|
|
|
|
*/
|
1998-08-13 20:41:28 +00:00
|
|
|
- (const char*) getArgumentTypeAtIndex: (unsigned)index;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pertains to distributed objects; method is asynchronous when invoked and
|
|
|
|
* return should not be waited for.
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
- (BOOL) isOneway;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of bytes that the return value occupies on the stack, which is
|
|
|
|
* platformt(hardware)-dependent.
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
- (unsigned) methodReturnLength;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns Objective-C <code>@encode(...)</code> compatible string. Arguments
|
|
|
|
* are numbered starting from 0, including the implicit arguments
|
|
|
|
* <code><em>self</em></code> (type <code>id</code>, at position 0) and
|
|
|
|
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).
|
|
|
|
*/
|
1998-08-13 20:41:28 +00:00
|
|
|
- (const char*) methodReturnType;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns number of arguments to method, including the implicit
|
|
|
|
* <code><em>self</em></code> and <code><em>_cmd</em></code>.
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
- (unsigned) numberOfArguments;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
1998-11-02 10:55:53 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* Declares a convenience method for getting the entire array of raw type and
|
|
|
|
* size information.
|
|
|
|
*/
|
1998-11-02 10:55:53 +00:00
|
|
|
@interface NSMethodSignature(GNUstep)
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* Convenience method for getting the entire array of raw type and size
|
|
|
|
* information.
|
|
|
|
*/
|
1998-08-13 20:41:28 +00:00
|
|
|
- (NSArgumentInfo*) methodInfo;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string containing all Objective-C
|
|
|
|
* <code>@encode(...)</code> compatible type information.
|
|
|
|
*/
|
1998-08-13 20:41:28 +00:00
|
|
|
- (const char*) methodType;
|
1998-01-26 14:18:18 +00:00
|
|
|
@end
|
1998-11-02 10:55:53 +00:00
|
|
|
#endif
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#endif /* __NSMethodSignature_h_GNUSTEP_BASE_INCLUDE */
|