1 USING: help.markup help.syntax quotations strings ;
5 { $description "Called on startup as part of the boot quotation to initialize the runtime and prepare it for running user code." } ;
7 { boot startup-quot set-startup-quot } related-words
10 { $values { "quot" quotation } }
11 { $description "Outputs the initial quotation called by the VM on startup." } ;
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." } ;
19 { $var-description "An association list mapping string identifiers to quotations to be run on startup." } ;
22 { $var-description "An association list mapping string identifiers to quotations to be run on shutdown." } ;
24 HELP: do-startup-hooks
25 { $description "Calls all initialization hook quotations." } ;
27 HELP: do-shutdown-hooks
28 { $description "Calls all shutdown hook quotations." } ;
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." } ;
34 { startup-hooks do-startup-hooks add-startup-hook add-shutdown-hook do-shutdown-hooks shutdown-hooks } related-words
36 ARTICLE: "init" "Initialization and startup"
37 "When Factor starts, the first thing it does is call a word:"
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:"
50 "When quitting Factor, shutdown hooks are called:"
51 { $subsection do-shutdown-hooks } ;