generic kernel hashtables quotations words operations ;
HELP: +nullary+
{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, the command does not take any inputs, and the value passed to " { $link invoke-command } " will be ignored. Otherwise, it takes one input." } ;
HELP: +listener+
{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, " { $link invoke-command } " will run the command in the listener. Otherwise it will run in the event loop." } ;
HELP: +description+
{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". The value is a string displayed as part of the command's documentation by " { $link $command-map } "." } ;
HELP: in-listener?
{ $values { "command" "a command" } }
{ $description "Outputs if the command runs in the listener." } ;
{ $values { "command" "a command" } { "word" word } }
{ $description "Outputs the word that will be executed by " { $link invoke-command } ". This is only used for documentation purposes. Commands are words, so given a command this word does nothing; given an operation it outputs the value of the operation's " { $link operation-command } " slot." } ;
HELP: command-map
{ $class-description "A command map stores a group of related commands. Instances of this class delegate to arrays so behave like sequences; additionally the " { $link command-map-blurb } " slot stores a string description of the command group, or " { $link f } "."
$nl
"Command maps are created by calling " { $link <command-map> } " or " { $link define-command-map } "." } ;
"Defines a command map on the specified gadget class. The " { $snippet "specs" } " parameter is a sequence of pairs " { $snippet "{ gesture word }" } ". The words must be valid commands; see " { $link define-command } "."
{ $notes "Only one of " { $link define-command-map } " and " { $link set-gestures } " can be used on a given gadget class, since each word will overwrite the other word's definitions." } ;
HELP: $command-map
{ $values { "element" "a pair " { $snippet "{ class map }" } } }
{ $description "Prints a command map, where the first element of the pair is a class word and the second is a command map name." } ;
HELP: $command
{ $values { "element" "a triple " { $snippet "{ class map command }" } } }
{ $description "Prints the keyboard shortcut associated with " { $snippet "command" } " in the command map named " { $snippet "map" } " on the class " { $snippet "class" } "." } ;
{ $description "Defines a command. The hashtable can contain the following keys:"
{ $list
{ { $link +nullary+ } " - if set to a true value, the word must have stack effect " { $snippet "( -- )" } "; otherwise it must have stack effect " { $snippet "( target -- )" } }
{ { $link +listener+ } " - if set to a true value, the command will run in the listener" }
{ { $link +description+ } " - can be set to a string description of the command" }
}
} ;
HELP: command-string
{ $values { "gesture" "a gesture" } { "command" "a command" } }
{ $description "Outputs a string containing the command name followed by the gesture." }