NextPrevUpTopContentsIndex

1.4.3.1 Special method argument and result conversion

For certain types of argument, there is more than one useful conversion from the FLI value to a Lisp value. To control this, the argument specification can include an arg-style , which describes how the argument should be converted. If the arg-style is specified as :foreign then the argument is converted using normal FLI rules, but by default certain types are converted differently:

Special argument conversion for define-objc-method

Argument type

Special argument behavior

ns-rect

The argument is a vector.

ns-point

The argument is a vector.

ns-size

The argument is a vector.

ns-range

The argument is a cons.

objc-bool

The argument is nil or t .

objc-object-pointer

Depending on the Objective-C class, allows automatic conversion to a string or array.

objc-c-string

The argument is a string.

Likewise, result conversion can be controlled by the result-style specification. If this is : foreign then the value is assumed to be suitable for conversion to the result-type using the normal FLI rules, but if result-style is : lisp then additional conversions are performed for specific values of result-type :

Special result conversion for define-objc-method

Result type

Special result types supported

ns-rect

The result can be a vector.

ns-point

The result can be a vector.

ns-size

The result can be a vector.

ns-range

The result can be a cons.

objc-bool

The result can be nil or t .

objc-object-pointer

The result can be a string or an array. An autoreleased NSString or NSArray is allocated.

objc-class

The result can be a string naming a class.


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

NextPrevUpTopContentsIndex