]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/bootstrap/stage2.factor
io.encodings.utf16: add a utf16n word for native utf16 type.
[factor.git] / basis / bootstrap / stage2.factor
index 0b517c0e66f649fd0c4d1228d2d422fa52390b26..8ff0d37d59edf231cdf60d9c880a5715c8def329 100644 (file)
@@ -1,11 +1,9 @@
 ! Copyright (C) 2004, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors init namespaces words words.symbol io
-kernel.private math memory continuations kernel io.files
-io.pathnames io.backend system parser vocabs sequences
-vocabs.loader combinators splitting source-files strings
-definitions assocs compiler.units math.parser
-generic sets command-line ;
+USING: command-line compiler.units continuations definitions io
+io.pathnames kernel math math.parser memory namespaces parser
+parser.notes sequences sets splitting system
+vocabs vocabs.loader ;
 IN: bootstrap.stage2
 
 SYMBOL: core-bootstrap-time
@@ -15,28 +13,25 @@ SYMBOL: bootstrap-time
 : strip-encodings ( -- )
     os unix? [
         [
-            P" resource:core/io/encodings/utf16/utf16.factor" 
-            P" resource:core/io/encodings/utf16n/utf16n.factor" [ forget ] bi@
-            "io.encodings.utf16" 
-            "io.encodings.utf16n" [ child-vocabs [ forget-vocab ] each ] bi@
+            P" resource:core/io/encodings/utf16/utf16.factor" forget
+            "io.encodings.utf16" loaded-child-vocab-names [ forget-vocab ] each
         ] with-compilation-unit
     ] when ;
 
 : default-image-name ( -- string )
-    vm file-name os windows? [ "." split1-last drop ] when
+    vm-path file-name os windows? [ "." split1-last drop ] when
     ".image" append resource-path ;
 
-: load-components ( -- )
-    "include" "exclude"
-    [ get-global " " split harvest ] bi@
-    diff
-    [ "bootstrap." prepend require ] each ;
+: load-component ( name -- )
+    dup "* Loading the " write write " component" print
+    "bootstrap." prepend require ;
 
-: count-words ( pred -- )
-    all-words swap count number>string write ; inline
+: load-components ( -- )
+    "include" "exclude" [ get-global " " split harvest ] bi@ diff
+    [ load-component ] each ;
 
-: print-time ( ms -- )
-    1000 /i
+: print-time ( us -- )
+    1,000,000,000 /i
     60 /mod swap
     number>string write
     " minutes and " write number>string write " seconds." print ;
@@ -47,22 +42,31 @@ SYMBOL: bootstrap-time
 
     "Bootstrapping is complete." print
     "Now, you can run Factor:" print
-    vm write " -i=" write "output-image" get print flush ;
+    vm-path write " -i=" write "output-image" get print flush ;
 
 : save/restore-error ( quot -- )
     error get-global
+    original-error get-global
     error-continuation get-global
-    [ call ] 2dip
+    [ call ] 3dip
     error-continuation set-global
+    original-error set-global
     error set-global ; inline
 
+CONSTANT: default-components
+    "math compiler threads io tools ui ui.tools unicode help handbook"
+
 [
     ! We time bootstrap
-    millis
+    nano-count
+
+    ! parser.notes sets this to t in the global namespace.
+    ! We have to change it back in finish-bootstrap.factor
+    f parser-quiet? set-global
 
     default-image-name "output-image" set-global
 
-    "math compiler threads help io tools ui ui.tools unicode handbook" "include" set-global
+    default-components "include" set-global
     "" "exclude" set-global
 
     strip-encodings
@@ -70,40 +74,34 @@ SYMBOL: bootstrap-time
     (command-line) parse-command-line
 
     ! Set dll paths
-    os wince? [ "windows.ce" require ] when
-    os winnt? [ "windows.nt" require ] when
+    os windows? [ "windows" require ] when
 
-    "staging" get "deploy-vocab" get or [
+    "staging" get [
         "stage2: deployment mode" print
     ] [
         "debugger" require
         "listener" require
-        "none" require
     ] if
 
     load-components
 
-    millis over - core-bootstrap-time set-global
+    nano-count over - core-bootstrap-time set-global
 
     run-bootstrap-init
 
-    f error set-global
-    f error-continuation set-global
-
-    millis swap - bootstrap-time set-global
+    nano-count swap - bootstrap-time set-global
     print-report
 
-    "deploy-vocab" get [
-        "tools.deploy.shaker" run
+    "staging" get [
+        "vocab:bootstrap/finish-staging.factor" run-file
     ] [
-        "staging" get [
-            "vocab:bootstrap/finish-staging.factor" run-file
-        ] [
-            "vocab:bootstrap/finish-bootstrap.factor" run-file
-        ] if
-
-        "output-image" get save-image-and-exit
+        "vocab:bootstrap/finish-bootstrap.factor" run-file
     ] if
+
+    f error set-global
+    f original-error set-global
+    f error-continuation set-global
+    "output-image" get save-image-and-exit
 ] [
     drop
     [