1 ! Copyright (C) 2003, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: init continuations hashtables io io.encodings.utf8
4 io.files io.pathnames kernel kernel.private namespaces parser
5 sequences source-files strings system splitting vocabs.loader
6 alien.strings accessors parser.notes ;
12 : (command-line) ( -- args )
13 10 special-object sift [ alien>native-string ] map ;
15 : rc-path ( name -- path )
18 : run-bootstrap-init ( -- )
20 ".factor-boot-rc" rc-path ?run-file
23 : run-user-init ( -- )
25 ".factor-rc" rc-path ?run-file
28 : load-vocab-roots ( -- )
30 ".factor-roots" rc-path dup exists? [
31 utf8 file-lines harvest [ add-vocab-root ] each
35 : var-param ( name value -- ) swap set-global ;
37 : bool-param ( name -- ) "no-" ?head not var-param ;
40 "=" split1 [ var-param ] [ bool-param ] if* ;
42 : run-script ( file -- )
45 [ source-file main>> [ execute( -- ) ] when* ] bi
48 : parse-command-line ( args -- )
49 [ command-line off script off ] [
51 [ param parse-command-line ]
52 [ script set command-line set ] if
55 SYMBOL: main-vocab-hook
57 : main-vocab ( -- vocab )
59 "alien.remote-control"
61 main-vocab-hook get [ call( -- vocab ) ] [ "listener" ] if*
64 : default-cli-args ( -- )
71 [ default-cli-args ] "command-line" add-startup-hook