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 "Bootstrapping is complete." print
39 "Now, you can run Factor:" print
40 vm write " -i=" write "output-image" get print flush ;
42 : save/restore-error ( quot -- )
44 error-continuation get-global
46 error-continuation set-global
47 error set-global ; inline
53 default-image-name "output-image" set-global
55 "math compiler threads help io tools ui ui.tools unicode handbook" "include" set-global
56 "" "exclude" set-global
58 (command-line) parse-command-line
61 os wince? [ "windows.ce" require ] when
62 os winnt? [ "windows.nt" require ] when
64 "staging" get "deploy-vocab" get or [
65 "stage2: deployment mode" print
68 "alien.prettyprint" require
70 "tools.errors" require
77 millis over - core-bootstrap-time set-global
82 f error-continuation set-global
84 millis swap - bootstrap-time set-global
88 "tools.deploy.shaker" run
91 "vocab:bootstrap/finish-staging.factor" run-file
93 "vocab:bootstrap/finish-bootstrap.factor" run-file
96 "output-image" get save-image-and-exit
102 [ "vocab:bootstrap/bootstrap-error.factor" parse-file ] save/restore-error