1 ! Copyright (C) 2011 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators command-line eval io io.pathnames kernel
4 layouts math math.parser namespaces parser system vocabs.loader ;
5 IN: command-line.startup
9 os windows? [ script get "/?" = or ] when ;
12 "Usage: " write vm-path file-name write " [options] [script] [arguments]
15 -help print this message and exit
16 -version print the Factor version and exit
17 -i=<image> load Factor image file <image> [" write vm-path file-stem write ".image]
18 -run=<vocab> run the MAIN: entry point of <vocab>
19 -run=listener run terminal listener
20 -run=ui.tools run Factor development UI
21 -e=<code> evaluate <code>
22 -ea=<code> evaluate <code> with auto-use
23 -no-user-init suppress loading of .factor-rc
24 -datastack=<int> datastack size in KiB [" write cell 32 * number>string write "]
25 -retainstack=<int> retainstack size in KiB [" write cell 32 * number>string write "]
26 -callstack=<int> callstack size in KiB [" write cell cpu ppc? 256 128 ? * number>string write "]
27 -callbacks=<int> callback heap size in KiB [256]
28 -young=<int> young gc generation 0 size in MiB [" write cell 4 / number>string write "]
29 -aging=<int> aging gc generation 1 size in MiB [" write cell 2 / number>string write "]
30 -tenured=<int> tenured gc generation 2 size in MiB [" write cell 24 * number>string write "]
31 -codeheap=<int> codeheap size in MiB [64]
32 -pic=<int> max pic size [3]
33 -fep enter fep mode immediately
34 -no-signals turn off OS signal handling
35 -roots=<paths> '" write os windows? ";" ":" ? write "'-separated list of extra vocab root directories
39 from within Factor for more information.
42 : version? ( -- ? ) "version" get ;
44 : version. ( -- ) "Factor " write vm-version print ;
46 : command-line-startup ( -- )
47 (command-line) parse-command-line {
48 { [ help? ] [ help. ] }
49 { [ version? ] [ version. ] }
53 "e" get "ea" get script get or or [
54 "e" get [ eval( -- ) ] when*
55 "ea" get [ t auto-use? [ eval( -- ) ] with-variable ] when*
56 script get [ run-script ] when*
63 output-stream get [ stream-flush ] when*