]> gitweb.factorcode.org Git - factor.git/blob - core/init/init-docs.factor
e76b6e8fee053d8e7a3ceb2f9570ed64716c7988
[factor.git] / core / init / init-docs.factor
1 USING: help.markup help.syntax quotations strings ;
2 IN: init
3
4 HELP: boot
5 { $description "Called on startup as part of the boot quotation  to initialize the runtime and prepare it for running user code." } ;
6
7 { boot boot-quot set-boot-quot } related-words
8
9 HELP: boot-quot
10 { $values { "quot" quotation } }
11 { $description "Outputs the initial quotation called by the VM on startup." } ;
12
13 HELP: set-boot-quot
14 { $values { "quot" quotation } }
15 { $description "Sets the initial quotation called by the VM on startup. This quotation must begin with a call to " { $link boot } ". The image must be saved for changes to the boot quotation to take effect." }
16 { $notes "The " { $link "tools.deploy" } " tool uses this word." } ;
17
18 HELP: init-hooks
19 { $var-description "An association list mapping string identifiers to quotations to be run on startup." } ;
20
21 HELP: do-init-hooks
22 { $description "Calls all initialization hook quotations." } ;
23
24 HELP: add-init-hook
25 { $values { "quot" quotation } { "name" string } }
26 { $description "Registers a startup hook. The hook will always run when Factor is started. If the hook was not already defined, this word also calls it immediately." } ;
27
28 { init-hooks do-init-hooks add-init-hook } related-words
29
30 ARTICLE: "init" "Initialization and startup"
31 "When Factor starts, the first thing it does is call a word:"
32 { $subsections boot }
33 "Next, initialization hooks are called:"
34 { $subsections do-init-hooks }
35 "Initialization hooks can be defined:"
36 { $subsections add-init-hook }
37 "The boot quotation can be changed:"
38 { $subsections
39     boot-quot
40     set-boot-quot
41 } ;
42
43 ABOUT: "init"