48 lines
2.8 KiB
Plaintext
48 lines
2.8 KiB
Plaintext
IN: modules
|
|
USING: help io ;
|
|
|
|
HELP: prefix-paths
|
|
{ $values { "name" "a module name string" } { "seq" "a sequence of strings" } { "newseq" "a new sequence of path name strings" } }
|
|
{ $description "Prepend the location of the module named " { $snippet "name" } " to every file name in " { $snippet "seq" } "." } ;
|
|
|
|
HELP: module-def
|
|
{ $values { "name" "a module name string" } { "path" "a path name string" } }
|
|
{ $description "Outputs the location of the module definition file. This word looks for the module definition in two locations:"
|
|
{ $list
|
|
{ $snippet "contrib/" { $emphasis "name" } ".factor" }
|
|
{ $snippet "contrib/" { $emphasis "name" } "/load.factor" }
|
|
}
|
|
}
|
|
{ $notes "This file is loaded by " { $link require } ", and should contain the necessary " { $link POSTPONE: REQUIRES: } " and " { $link POSTPONE: PROVIDE: } " declarations for the module." } ;
|
|
|
|
HELP: modules
|
|
{ $var-description "Association list mapping loaded module names to " { $link module } " instances." }
|
|
{ $see-also require load-module } ;
|
|
|
|
HELP: load-module
|
|
{ $values { "name" "a module name string" } }
|
|
{ $description "Runs the module definition file given by " { $link module-def } ", which loads the module's dependencies and source files." }
|
|
{ $notes "Calling this word directly is rarely necessary. Usually, " { $link require } " is used to load modules and " { $link reload-modules } " is used to reload changed files." } ;
|
|
|
|
HELP: require
|
|
{ $values { "name" "a module name string" } }
|
|
{ $description "Ensures that a module has been loaded, along with all its dependencies, and compiles all new words."
|
|
$terpri
|
|
"If this module is already listed in the " { $link modules } " hashtable, this word does nothing. Otherwise, it calls " { $link load-module } "." }
|
|
{ $notes "Module definitions should use the " { $link POSTPONE: REQUIRES: } " parsing word instead. In the listener, the " { $link require } " word might be more useful since it recompiles new words after loading the module." } ;
|
|
|
|
HELP: provide
|
|
{ $values { "name" "a string" } { "hash" "a hashtable" } }
|
|
{ $description "Registers a module definition and loads its source files. The possible hashtable are documented in the " { $link POSTPONE: PROVIDE: } " word. Usually instead of calling this word, module definitions use the parsing word " { $link POSTPONE: PROVIDE: } " instead." } ;
|
|
|
|
HELP: test-module
|
|
{ $values { "name" "a module name string" } }
|
|
{ $description "Runs the unit test files associated to the module by a previous call to " { $link provide } " or " { $link POSTPONE: PROVIDE: } "." } ;
|
|
|
|
HELP: test-modules
|
|
{ $description "Runs unit test files for all loaded modules." } ;
|
|
|
|
HELP: run-module
|
|
{ $values { "name" "a module name string" } }
|
|
{ $description "Runs the main entry point of the module, first loading the module if necessary using " { $link require } ". Entry points can be defined with the " { $link POSTPONE: MAIN: } " word." } ;
|