]> gitweb.factorcode.org Git - factor.git/blob - basis/cocoa/messages/messages-docs.factor
Create basis vocab root
[factor.git] / basis / cocoa / messages / messages-docs.factor
1 USING: help.markup help.syntax strings alien ;
2 IN: cocoa.messages
3
4 HELP: send
5 { $values { "args..." "method arguments" } { "receiver" alien } { "selector" string } { "return..." "value returned by method, if any" } }
6 { $description "Sends an Objective C message named by " { $snippet "selector" } " to " { $snippet "receiver" } ". The arguments must be on the stack in left-to-right order." }
7 { $errors "Throws an error if the receiver does not recognize the message, or if the arguments have inappropriate types." }
8 { $notes "This word uses a special fast code path if " { $snippet "selector" } " is a literal and the word containing the call to " { $link send } " is compiled." } ;
9
10 HELP: super-send
11 { $values { "args..." "method arguments" } { "receiver" alien } { "selector" string } { "return..." "value returned by method, if any" } }
12 { $description "Sends an Objective C message named by " { $snippet "selector" } " to the super class of " { $snippet "receiver" } ". Otherwise behaves identically to " { $link send } "." } ;
13
14 HELP: objc-class
15 { $values { "string" string } { "class" alien } }
16 { $description "Outputs the Objective C class named by " { $snippet "string" } ". This class can then be used as the receiver in message sends calling class methods, for example:"
17 { $code "NSMutableArray -> alloc" } }
18 { $errors "Throws an error if there is no class named by " { $snippet "string" } "." } ;
19
20 HELP: objc-meta-class
21 { $values { "string" string } { "class" alien } }
22 { $description "Outputs the meta class of the Objective C class named by " { $snippet "string" } "." }
23 { $errors "Throws an error if there is no meta class named by " { $snippet "string" } "." } ;
24
25 HELP: objc>alien-types
26 { $var-description "Hashtable mapping Objective C type identifiers to alien types. See " { $link "c-data" } "." } ;
27
28 HELP: alien>objc-types
29 { $var-description "Hashtable mapping alien types to Objective C type identifiers. See " { $link "c-data" } "." } ;
30
31 { objc>alien-types alien>objc-types } related-words
32
33 HELP: import-objc-class
34 { $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( -- )" } } }
35 { $description "If a class named " { $snippet "name" } " is already known to the Objective C interface, does nothing. Otherwise, first calls the quotation. The quotation should make the class available to the Objective C runtime if necessary, either by loading a framework or defining it directly. After the quotation returns, this word makes the class available to Factor programs by importing methods and creating a class word the class object in the " { $vocab-link "cocoa.classes" } " vocabulary." }
36 { $notes "In most cases, the quotation should be " { $link f } "." }
37 { $examples
38     { $code "\"QTMovie\" f import-objc-class" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
39 } ;
40
41 HELP: root-class
42 { $values { "class" alien } { "root" alien } }
43 { $description "Outputs the class at the root of the inheritance hierarchy for " { $snippet "class" } ". In most cases this will be the " { $snippet "NSObject" } " class." } ;