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
11 SYMBOL: deploy-compiler?
13 SYMBOL: deploy-random?
14 SYMBOL: deploy-threads?
20 { 1 "Level 1 - No input/output" }
21 { 2 "Level 2 - Basic ANSI C streams" }
22 { 3 "Level 3 - Non-blocking streams and networking" }
25 : strip-io? ( -- ? ) deploy-io get 1 = ;
27 : native-io? ( -- ? ) deploy-io get 3 = ;
29 SYMBOL: deploy-reflection
31 : deploy-reflection-options
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" }
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 < ;
47 SYMBOL: deploy-word-props?
48 SYMBOL: deploy-word-defs?
49 SYMBOL: deploy-c-types?
54 : default-config ( vocab -- assoc )
55 vocab-name deploy-name associate H{
58 { deploy-reflection 1 }
59 { deploy-compiler? t }
63 { deploy-word-props? f }
64 { deploy-word-defs? f }
66 ! default value for deploy.macosx
67 { "stop-after-last-window?" t }
70 : deploy-config-path ( vocab -- string )
71 vocab-dir "deploy.factor" append-path ;
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 ;
78 : set-deploy-config ( assoc vocab -- )
79 >r unparse-use string-lines r>
80 dup deploy-config-path set-vocab-file-contents ;
82 : set-deploy-flag ( value key vocab -- )
83 [ deploy-config [ set-at ] keep ] keep set-deploy-config ;