! Copyright (C) 2011 Joe Groff. ! See http://factorcode.org/license.txt for BSD license. USING: combinators command-line eval io io.pathnames kernel layouts math math.parser namespaces system vocabs.loader ; IN: command-line.startup : help? ( -- ? ) "help" get "h" get or os windows? [ script get "/?" = or ] when ; : help. ( -- ) "Usage: " write vm-path file-name write " [Factor arguments] [script] [script arguments] Factor arguments: -help print this message and exit -version print the Factor version and exit -i= load Factor image file [" write vm-path file-stem write ".image] -run= run the MAIN: entry point of -run=listener run terminal listener -run=ui.tools run Factor development UI -e= evaluate -no-user-init suppress loading of .factor-rc -datastack= datastack size in KiB [" write cell 32 * number>string write "] -retainstack= retainstack size in KiB [" write cell 32 * number>string write "] -callstack= callstack size in KiB [" write cell cpu ppc? 256 128 ? * number>string write "] -callbacks= callback heap size in KiB [256] -young= young gc generation 0 size in MiB [" write cell 4 / number>string write "] -aging= aging gc generation 1 size in MiB [" write cell 2 / number>string write "] -tenured= tenured gc generation 2 size in MiB [" write cell 24 * number>string write "] -codeheap= codeheap size in MiB [64] -pic= max pic size [3] -fep enter fep mode immediately -no-signals turn off OS signal handling -console open console if possible -roots= a list of \"" write os windows? ";" ":" ? write "\"-delimited extra vocab roots Enter \"command-line\" help from within Factor for more information. " write ; : version? ( -- ? ) "version" get ; : version. ( -- ) "Factor " write vm-version print ; : command-line-startup ( -- ) (command-line) parse-command-line { { [ help? ] [ help. ] } { [ version? ] [ version. ] } [ load-vocab-roots run-user-init "e" get script get or [ "e" get [ eval( -- ) ] when* script get [ run-script ] when* ] [ "run" get run ] if ] } cond output-stream get [ stream-flush ] when* 0 exit ;