]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/config/config.factor
Fix permission bits
[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: vocabs.loader io.files io kernel sequences assocs
4 splitting parser prettyprint namespaces math vocabs
5 hashtables tools.vocabs ;
6 IN: tools.deploy.config
7
8 SYMBOL: deploy-name
9
10 SYMBOL: deploy-ui?
11 SYMBOL: deploy-compiler?
12 SYMBOL: deploy-math?
13 SYMBOL: deploy-random?
14 SYMBOL: deploy-threads?
15
16 SYMBOL: deploy-io
17
18 : 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 : 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-io                 2 }
58         { deploy-reflection         1 }
59         { deploy-compiler?          t }
60         { deploy-threads?           t }
61         { deploy-random?            t }
62         { deploy-math?              t }
63         { deploy-word-props?        f }
64         { deploy-word-defs?         f }
65         { deploy-c-types?           f }
66         ! default value for deploy.macosx
67         { "stop-after-last-window?" t }
68     } assoc-union ;
69
70 : deploy-config-path ( vocab -- string )
71     vocab-dir "deploy.factor" append-path ;
72
73 : deploy-config ( vocab -- assoc )
74     dup default-config swap
75     dup deploy-config-path vocab-file-contents
76     parse-fresh [ first assoc-union ] unless-empty ;
77
78 : set-deploy-config ( assoc vocab -- )
79     >r unparse-use string-lines r>
80     dup deploy-config-path set-vocab-file-contents ;
81
82 : set-deploy-flag ( value key vocab -- )
83     [ deploy-config [ set-at ] keep ] keep set-deploy-config ;