]> gitweb.factorcode.org Git - factor.git/blob - core/init/init-docs.factor
calendar.format: make duration>human-readable more human readable
[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 startup-quot set-startup-quot } related-words
8
9 HELP: startup-quot
10 { $values { "quot" quotation } }
11 { $description "Outputs the initial quotation called by the VM on startup." } ;
12
13 HELP: set-startup-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: startup-hooks
19 { $var-description "An association list mapping string identifiers to quotations to be run on startup." } ;
20
21 HELP: shutdown-hooks
22 { $var-description "An association list mapping string identifiers to quotations to be run on shutdown." } ;
23
24 HELP: do-startup-hooks
25 { $description "Calls all initialization hook quotations." } ;
26
27 HELP: do-shutdown-hooks
28 { $description "Calls all shutdown hook quotations." } ;
29
30 HELP: add-startup-hook
31 { $values { "quot" quotation } { "name" string } }
32 { $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." } ;
33
34 { startup-hooks do-startup-hooks add-startup-hook add-shutdown-hook do-shutdown-hooks shutdown-hooks } related-words
35
36 ARTICLE: "init" "Initialization and startup"
37 "When Factor starts, the first thing it does is call a word:"
38 { $subsections boot }
39 "Next, initialization hooks are called:"
40 { $subsections do-startup-hooks }
41 "Initialization hooks can be defined:"
42 { $subsections add-startup-hook }
43 "Corresponding shutdown hooks may also be defined:"
44 { $subsections add-shutdown-hook }
45 "The boot quotation can be changed:"
46 { $subsections
47     startup-quot
48     set-startup-quot
49 }
50 "When quitting Factor, shutdown hooks are called:"
51 { $subsection do-shutdown-hooks } ;
52
53 ABOUT: "init"