]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/config/config.factor
factor: trim more using lists.
[factor.git] / basis / tools / deploy / config / config.factor
1 ! Copyright (C) 2007, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs combinators.smart hashtables kernel math
4 namespaces sequences vocabs ;
5 IN: tools.deploy.config
6
7 SYMBOL: deploy-name
8
9 SYMBOL: deploy-ui?
10 SYMBOL: deploy-console?
11 SYMBOL: deploy-math?
12 SYMBOL: deploy-unicode?
13 SYMBOL: deploy-threads?
14 SYMBOL: deploy-help?
15
16 SYMBOL: deploy-io
17
18 CONSTANT: deploy-io-options
19     {
20         { 1 "Level 1 - No input/output" }
21         { 2 "Level 2 - Basic ANSI C streams" }
22         { 3 "Level 3 - Non-blocking streams and networking" }
23     }
24
25 : strip-io? ( -- ? ) deploy-io get 1 = ;
26
27 : native-io? ( -- ? ) deploy-io get 3 = ;
28
29 SYMBOL: deploy-reflection
30
31 CONSTANT: deploy-reflection-options
32     {
33         { 1 "Level 1 - No reflection" }
34         { 2 "Level 2 - Retain word names" }
35         { 3 "Level 3 - Prettyprinter" }
36         { 4 "Level 4 - Debugger" }
37         { 5 "Level 5 - Parser" }
38         { 6 "Level 6 - Full environment" }
39     }
40
41 : strip-word-names? ( -- ? ) deploy-reflection get 2 < ;
42 : strip-prettyprint? ( -- ? ) deploy-reflection get 3 < ;
43 : strip-debugger? ( -- ? ) deploy-reflection get 4 < ;
44 : strip-dictionary? ( -- ? ) deploy-reflection get 5 < ;
45 : strip-globals? ( -- ? ) deploy-reflection get 6 < ;
46
47 SYMBOL: deploy-word-props?
48 SYMBOL: deploy-word-defs?
49 SYMBOL: deploy-c-types?
50
51 SYMBOL: deploy-vm
52 SYMBOL: deploy-image
53
54 : default-config ( vocab -- assoc )
55     vocab-name deploy-name associate H{
56         { deploy-ui?                f }
57         { deploy-console?           t }
58         { deploy-io                 3 }
59         { deploy-reflection         1 }
60         { deploy-threads?           t }
61         { deploy-help?              f }
62         { deploy-unicode?           f }
63         { deploy-math?              t }
64         { deploy-word-props?        f }
65         { deploy-word-defs?         f }
66         { deploy-c-types?           f }
67         ! default value for deploy.macosx
68         { "stop-after-last-window?" t }
69     } assoc-union ;
70
71 SYMBOL: deploy-directory
72 "resource:" deploy-directory set-global
73
74 : config>profile ( config -- profile )
75     {
76         ! The order should be similar to default-components in
77         ! bootstrap.stage2.
78         [ deploy-math? of "math" f ? ]
79         [ deploy-threads? of "threads" f ? ]
80         [ drop "compiler" ]
81         [ deploy-io of 3 = "io" f ? ]
82         [ deploy-ui? of "ui" f ? ]
83         [ deploy-unicode? of "unicode" f ? ]
84         [ deploy-help? of "help" f ? ]
85     } cleave>array sift ;