1 ! Copyright (C) 2004, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors init namespaces words words.symbol io
4 kernel.private math memory continuations kernel io.files
5 io.pathnames io.backend system parser vocabs sequences
6 vocabs.loader combinators splitting source-files strings
7 definitions assocs compiler.units math.parser
8 generic sets command-line ;
11 SYMBOL: core-bootstrap-time
13 SYMBOL: bootstrap-time
15 : default-image-name ( -- string )
16 vm file-name os windows? [ "." split1-last drop ] when
17 ".image" append resource-path ;
19 : load-components ( -- )
21 [ get-global " " split harvest ] bi@
23 [ "bootstrap." prepend require ] each ;
25 : count-words ( pred -- )
26 all-words swap count number>string write ; inline
28 : print-time ( ms -- )
32 " minutes and " write number>string write " seconds." print ;
35 "Core bootstrap completed in " write core-bootstrap-time get print-time
36 "Bootstrap completed in " write bootstrap-time get print-time
38 [ optimized>> ] count-words " compiled words" print
39 [ symbol? ] count-words " symbol words" print
40 [ ] count-words " words total" print
42 "Bootstrapping is complete." print
43 "Now, you can run Factor:" print
44 vm write " -i=" write "output-image" get print flush ;
46 : save/restore-error ( quot -- )
48 error-continuation get-global
50 error-continuation set-global
51 error set-global ; inline
57 default-image-name "output-image" set-global
59 "math compiler threads help io tools ui ui.tools unicode handbook" "include" set-global
60 "" "exclude" set-global
62 (command-line) parse-command-line
65 os wince? [ "windows.ce" require ] when
66 os winnt? [ "windows.nt" require ] when
68 "staging" get "deploy-vocab" get or [
69 "stage2: deployment mode" print
72 "alien.prettyprint" require
74 "tools.errors" require
81 millis over - core-bootstrap-time set-global
86 f error-continuation set-global
88 millis swap - bootstrap-time set-global
92 "tools.deploy.shaker" run
95 "vocab:bootstrap/finish-staging.factor" run-file
97 "vocab:bootstrap/finish-bootstrap.factor" run-file
100 "output-image" get save-image-and-exit
106 [ "vocab:bootstrap/bootstrap-error.factor" parse-file ] save/restore-error