Objective C and Cocoa

: .COCOASELECTORS   \ --
Display information for all declared selectors.

: .Selectors   \ --
Display information for all declared selectors.

The selector and parameter and return value list are defined as

 Cocoa: <name> ( p1 p2 p3 -- rval )

The brackets form the Forth stack comment, where p1 is the leftmost parameter in Objective C documentation. The object to which the selector is applied is a hidden rightmost parameter. The return value rval can be 0, 1 or 2 items. If you want your code to be portable to other Forth systems always set rval to one item, even if this causes you extra drops and fussing.

: Cocoa:   \ Cocoa: <name> ( params -- return )
Create a selector called <name> whose parameters and return value are defined by a list as above. You must remember to add an object pointer as the right hand item. Executing the selector causes it to be processed by objc_msgSend.

: SuperCocoa:   \ SuperCocoa: <name> ( params -- return )
Create a selector called <name> whose parameters and return value are defined by a list as above. You must remember to add an object pointer as the right hand item. Executing the selector causes it to be processed by objc_msgSendSuper.

: Cocoa-Stret:   \ Cocoa-Stret: <name> ( params stret -- return )
Create a selector called <name> whose parameters and return value are defined by a list as above. This selector returns a structure. You provide the address of the structure as an additional right hand paramter. You must remember to add an object pointer as the right hand item. Executing the selector causes it to be processed by objc_msgSend_stret.

: SuperCocoa-Stret:   \ SuperCocoa-Stret: <name> ( params stret -- return )
Create a selector called <name> whose parameters and return value are defined by a list as above. This selector returns a structure. You provide the address of the structure as an additional right hand paramter. You must remember to add an object pointer as the right hand item. Executing the selector causes it to be processed by objc_msgSendSuper_stret.

: Cocoa-Fpret:   \ Cocoa: <name> ( params -- ) ( F: -- x )
Create a selector called <name> whose parameters and return value are defined by a list as above. You must remember to add an object pointer as the right hand item. Executing the selector causes it to be processed by objc_msgSend_fpret. VFX uses the hardware/internal fp stack as its numeric stack. The call will automaticly push the double result on this stack, no further action is required. The data stackpicture for these calls will show no return.