]> gitweb.factorcode.org Git - factor.git/blob - core/bootstrap/stage1.factor
run bootstrap and startup hooks inside a with-destructors. use &dispose instead...
[factor.git] / core / bootstrap / stage1.factor
1 ! Copyright (C) 2004, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays assocs continuations debugger generic hashtables
4 init io io.files kernel kernel.private make math memory
5 namespaces parser prettyprint sequences splitting system
6 vectors vocabs vocabs.loader words destructors ;
7 QUALIFIED: bootstrap.image.private
8 IN: bootstrap.stage1
9
10 "Bootstrap stage 1..." print flush
11
12 "vocab:bootstrap/primitives.factor" run-file
13
14 load-help? off
15 { "resource:core" } vocab-roots set
16
17 ! Create a boot quotation for the target
18 [
19     [
20         ! Rehash hashtables, since bootstrap.image creates them
21         ! using the host image's hashing algorithms. We don't
22         ! use each-object here since the catch stack isn't yet
23         ! set up.
24         gc
25         begin-scan
26         [ hashtable? ] pusher [ (each-object) ] dip
27         end-scan
28         [ rehash ] each
29         boot
30     ] %
31
32     "math.integers" require
33     "math.floats" require
34     "memory" require
35     
36     "io.streams.c" require
37     "vocabs.loader" require
38     
39     "syntax" require
40     "bootstrap.layouts" require
41
42     [
43         "resource:basis/bootstrap/stage2.factor"
44         dup exists? [
45             [ run-file ] with-destructors
46         ] [
47             "Cannot find " write write "." print
48             "Please move " write image write " to the same directory as the Factor sources," print
49             "and try again." print
50             1 (exit)
51         ] if
52     ] %
53 ] [ ] make
54 bootstrap.image.private:bootstrap-boot-quot set