This is NSMethodSignature.txt in view mode; [Download] [Up]
The `NSMethodSignature' class
The NSMethodSignature class is used to provide information for accessing
the arguments of a method. It is initialized either with an already
created encoding of a selector or only with its argument types.
For example:
id anObject;
struct objc_method* mth = class_get_instance_method(self->isa, aSelector);
const char* types = mth->method_types;
id signature = [NSMethodSignature signatureWithObjCTypes:types];
The above example shows the initialization of a NSMethodSignature object
given the complete selector's encoding. The example below shows the
initialization of a NSMethodSignature object giving only the method
types. This corresponds to a method that has the return type void and
has an integer argument.
id signature = [NSMethodSignature signatureWithObjCTypes:"v@:i];
Implementation notes
For a given machine you must define the following macros:
* CUMULATIVE_ARGS
* INIT_CUMULATIVE_ARGS
* FUNCTION_ARG_ENCODING
The name of this macros are the same with the similar ones from the GNU
CC compiler. However they don't correspond neither in semantics nor in
the argument types.
CUMULATIVE_ARGS is the data type of a variable used to hold about
arguments processed so far. On a machine where all the arguments are
passed on stack, this type is usually `int'.
INIT_CUMULATIVE_ARGS should initialize the variable of type
CUMULATIVE_ARGS described above.
FUNCTION_ARG_ENCODING determines the encoding of the next argument of a
method. It must produce a NSString describing the Objective-C encoding
and position of the argument in the arguments frame of the method.
If you want to determine how to write the encoding for a new machine you
could use the program generated by signature-test.pl perl script. This
generates a class with a lot of methods. You can look at the output of
the program to see how the compiler encodes the methods. Also take a
look in the objc-act.c file in the compiler to see how the methods are
encoded.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.