NextPrevUpTopContentsIndex

invoke-into

Function
Summary

Invokes an Objective-C method that returns a specific type or fills a specific object.

Package

objc

Signature

invoke-into result class-or-object-pointer method &rest args => value

Arguments

result

A symbol or list naming the return type or an object to contain the returned value.

class-or-object-pointer

A string naming an Objective-C class or a pointer to an Objective-C foreign object.

method

A string naming the method to invoke.

args

Arguments to the method.

Values

value

The value returned by the method.

Description

The function invoke-into is used to call Objective-C instance and class methods that return specific types which are not supported directly by invoke or for methods that return values of some foreign structure type where an existing object should be filled with the value. The meaning of the class-or-object-pointer , method and args is identical to invoke.

The value of result controls how the value of the method is converted and returned as follows:

the symbol string

If the result type of the method is id , then the value is assumed to be an Objective-C object of class NSString and is converted a string and returned. Otherwise no special conversion is performed.

the symbol array

If the result type of the method is id , then the value is assumed to be an Objective-C object of class NSArray and is converted a vector and returned. Otherwise no special conversion is performed.

a list of the form (array elt-type )

If the result type of the method is id , then the value is assumed to be an Objective-C object of class NSArray and is recursively converted a vector and returned. The component elt-type should be either string , array or another list of the form (array sub-elt-type ) and is used to control the conversion of the elements.

Otherwise no special conversion is performed.

the symbol :pointer

If the result type of the method is unsigned char * , then the value is returned as a pointer of type objc-c-string.

Otherwise no special conversion is performed.

a list of the form (:pointer elt-type )

If the result type of the method is unsigned char * , then the value is returned as a pointer with element type elt-type .

Otherwise no special conversion is performed.

a pointer to a foreign structure

If the result type of the method is a foreign structure type defined with define-objc-struct or a built-in structure type such as NSRect , the value is copied into the structure pointed to by result and the pointer is returned. Otherwise no special conversion is performed.

an object of type vector

If the result type of the method is id , then the value is assumed to be an Objective-C object of class NSArray and is converted to fill the vector, which must be at least as long as the NSArray . The vector is returned.

If the result type of the method is NSRect , NSSize or NSPoint then the first 4, 2 or 2 elements respectively of the vector are set to the corresponding components of the result. The vector is returned.

Otherwise no special conversion is performed.

an object of type cons

If the result type of the method is NSRange then the car of the cons is set to the location of the range and the cdr of the cons is set to the length of the range. The cons is returned.

Otherwise no special conversion is performed.

See also

invoke
invoke-bool
define-objc-struct


LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 29 Feb 2008

NextPrevUpTopContentsIndex