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 : strip-encodings ( -- )
18 P" resource:core/io/encodings/utf16/utf16.factor"
19 P" resource:core/io/encodings/utf16n/utf16n.factor" [ forget ] bi@
21 "io.encodings.utf16n" [ child-vocabs [ forget-vocab ] each ] bi@
22 ] with-compilation-unit
25 : default-image-name ( -- string )
26 vm file-name os windows? [ "." split1-last drop ] when
27 ".image" append resource-path ;
29 : load-components ( -- )
31 [ get-global " " split harvest ] bi@
33 [ "bootstrap." prepend require ] each ;
35 : count-words ( pred -- )
36 all-words swap count number>string write ; inline
38 : print-time ( us -- )
42 " minutes and " write number>string write " seconds." print ;
45 "Core bootstrap completed in " write core-bootstrap-time get print-time
46 "Bootstrap completed in " write bootstrap-time get print-time
48 "Bootstrapping is complete." print
49 "Now, you can run Factor:" print
50 vm write " -i=" write "output-image" get print flush ;
52 : save/restore-error ( quot -- )
54 error-continuation get-global
56 error-continuation set-global
57 error set-global ; inline
64 default-image-name "output-image" set-global
66 "math compiler threads help io tools ui ui.tools unicode handbook" "include" set-global
67 "" "exclude" set-global
71 (command-line) parse-command-line
74 os wince? [ "windows.ce" require ] when
75 os winnt? [ "windows.nt" require ] when
77 "staging" get "deploy-vocab" get or [
78 "stage2: deployment mode" print
87 nano-count over - core-bootstrap-time set-global
92 f error-continuation set-global
94 nano-count swap - bootstrap-time set-global
98 "tools.deploy.shaker" run
101 "vocab:bootstrap/finish-staging.factor" run-file
103 "vocab:bootstrap/finish-bootstrap.factor" run-file
106 "output-image" get save-image-and-exit
112 [ "vocab:bootstrap/bootstrap-error.factor" parse-file ] save/restore-error