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 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 -no-user-init suppress loading of .factor-rc
23 -datastack=<int> datastack size in KiB [" write cell 32 * number>string write "]
24 -retainstack=<int> retainstack size in KiB [" write cell 32 * number>string write "]
25 -callstack=<int> callstack size in KiB [" write cell cpu ppc? 256 128 ? * number>string write "]
26 -callbacks=<int> callback heap size in KiB [256]
27 -young=<int> young gc generation 0 size in MiB [" write cell 4 / number>string write "]
28 -aging=<int> aging gc generation 1 size in MiB [" write cell 2 / number>string write "]
29 -tenured=<int> tenured gc generation 2 size in MiB [" write cell 24 * number>string write "]
30 -codeheap=<int> codeheap size in MiB [64]
31 -pic=<int> max pic size [3]
32 -fep enter fep mode immediately
33 -no-signals turn off OS signal handling
34 -console open console if possible
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 script get or [
54 "e" get [ eval( -- ) ] when*
55 script get [ run-script ] when*
62 output-stream get [ stream-flush ] when*