84 lines
2.4 KiB
Factor
84 lines
2.4 KiB
Factor
! Copyright (C) 2007, 2008 Slava Pestov.
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
USING: vocabs.loader io.files io kernel sequences assocs
|
|
splitting parser prettyprint namespaces math vocabs
|
|
hashtables tools.vocabs ;
|
|
IN: tools.deploy.config
|
|
|
|
SYMBOL: deploy-name
|
|
|
|
SYMBOL: deploy-ui?
|
|
SYMBOL: deploy-compiler?
|
|
SYMBOL: deploy-math?
|
|
SYMBOL: deploy-random?
|
|
SYMBOL: deploy-threads?
|
|
|
|
SYMBOL: deploy-io
|
|
|
|
: deploy-io-options
|
|
{
|
|
{ 1 "Level 1 - No input/output" }
|
|
{ 2 "Level 2 - Basic ANSI C streams" }
|
|
{ 3 "Level 3 - Non-blocking streams and networking" }
|
|
} ;
|
|
|
|
: strip-io? ( -- ? ) deploy-io get 1 = ;
|
|
|
|
: native-io? ( -- ? ) deploy-io get 3 = ;
|
|
|
|
SYMBOL: deploy-reflection
|
|
|
|
: deploy-reflection-options
|
|
{
|
|
{ 1 "Level 1 - No reflection" }
|
|
{ 2 "Level 2 - Retain word names" }
|
|
{ 3 "Level 3 - Prettyprinter" }
|
|
{ 4 "Level 4 - Debugger" }
|
|
{ 5 "Level 5 - Parser" }
|
|
{ 6 "Level 6 - Full environment" }
|
|
} ;
|
|
|
|
: strip-word-names? ( -- ? ) deploy-reflection get 2 < ;
|
|
: strip-prettyprint? ( -- ? ) deploy-reflection get 3 < ;
|
|
: strip-debugger? ( -- ? ) deploy-reflection get 4 < ;
|
|
: strip-dictionary? ( -- ? ) deploy-reflection get 5 < ;
|
|
: strip-globals? ( -- ? ) deploy-reflection get 6 < ;
|
|
|
|
SYMBOL: deploy-word-props?
|
|
SYMBOL: deploy-word-defs?
|
|
SYMBOL: deploy-c-types?
|
|
|
|
SYMBOL: deploy-vm
|
|
SYMBOL: deploy-image
|
|
|
|
: default-config ( vocab -- assoc )
|
|
vocab-name deploy-name associate H{
|
|
{ deploy-ui? f }
|
|
{ deploy-io 2 }
|
|
{ deploy-reflection 1 }
|
|
{ deploy-compiler? t }
|
|
{ deploy-threads? t }
|
|
{ deploy-random? t }
|
|
{ deploy-math? t }
|
|
{ deploy-word-props? f }
|
|
{ deploy-word-defs? f }
|
|
{ deploy-c-types? f }
|
|
! default value for deploy.macosx
|
|
{ "stop-after-last-window?" t }
|
|
} assoc-union ;
|
|
|
|
: deploy-config-path ( vocab -- string )
|
|
vocab-dir "deploy.factor" append-path ;
|
|
|
|
: deploy-config ( vocab -- assoc )
|
|
dup default-config swap
|
|
dup deploy-config-path vocab-file-contents
|
|
parse-fresh [ first assoc-union ] unless-empty ;
|
|
|
|
: set-deploy-config ( assoc vocab -- )
|
|
>r unparse-use string-lines r>
|
|
dup deploy-config-path set-vocab-file-contents ;
|
|
|
|
: set-deploy-flag ( value key vocab -- )
|
|
[ deploy-config [ set-at ] keep ] keep set-deploy-config ;
|