Make "quiet" true by default. Disable quiet mode for listener, bootstrap, and deploy tool.

Move "quiet" to parser-quiet? in parser.notes. Change a few places where quiet was handle wrong.
db4
Doug Coleman 2011-09-06 16:29:15 -07:00
parent deb1ac9e1d
commit 5fce2d0f27
14 changed files with 35 additions and 44 deletions

View File

@ -11,7 +11,7 @@ source-files definitions debugger quotations.private combinators
combinators.short-circuit math.order math.private accessors combinators.short-circuit math.order math.private accessors
slots.private generic.single.private compiler.units slots.private generic.single.private compiler.units
compiler.constants fry locals bootstrap.image.syntax compiler.constants fry locals bootstrap.image.syntax
generalizations ; generalizations parser.notes ;
IN: bootstrap.image IN: bootstrap.image
: arch ( os cpu -- arch ) : arch ( os cpu -- arch )
@ -606,6 +606,7 @@ PRIVATE>
: make-image ( arch -- ) : make-image ( arch -- )
[ [
f parser-quiet? set
architecture set architecture set
"resource:/core/bootstrap/stage1.factor" run-file "resource:/core/bootstrap/stage1.factor" run-file
build-image build-image

View File

@ -5,7 +5,7 @@ kernel.private math memory continuations kernel io.files
io.pathnames io.backend system parser vocabs sequences io.pathnames io.backend system parser vocabs sequences
vocabs.loader combinators splitting source-files strings vocabs.loader combinators splitting source-files strings
definitions assocs compiler.units math.parser definitions assocs compiler.units math.parser
generic sets command-line ; generic sets command-line parser.notes ;
IN: bootstrap.stage2 IN: bootstrap.stage2
SYMBOL: core-bootstrap-time SYMBOL: core-bootstrap-time
@ -62,6 +62,8 @@ SYMBOL: bootstrap-time
! We time bootstrap ! We time bootstrap
nano-count nano-count
parser-quiet? off
default-image-name "output-image" set-global default-image-name "output-image" set-global
"math compiler threads help io tools ui ui.tools unicode handbook" "include" set-global "math compiler threads help io tools ui ui.tools unicode handbook" "include" set-global

View File

@ -89,7 +89,6 @@ ARTICLE: "standard-cli-args" "Command line switches for general usage"
{ { $snippet "-e=" { $emphasis "code" } } { "This specifies a code snippet to evaluate. If you want Factor to exit immediately after, also specify " { $snippet "-run=none" } "." } } { { $snippet "-e=" { $emphasis "code" } } { "This specifies a code snippet to evaluate. If you want Factor to exit immediately after, also specify " { $snippet "-run=none" } "." } }
{ { $snippet "-run=" { $emphasis "vocab" } } { { $snippet { $emphasis "vocab" } } " is the name of a vocabulary with a " { $link POSTPONE: MAIN: } " hook to run on startup, for example " { $vocab-link "listener" } ", " { $vocab-link "ui.tools" } " or " { $vocab-link "none" } "." } } { { $snippet "-run=" { $emphasis "vocab" } } { { $snippet { $emphasis "vocab" } } " is the name of a vocabulary with a " { $link POSTPONE: MAIN: } " hook to run on startup, for example " { $vocab-link "listener" } ", " { $vocab-link "ui.tools" } " or " { $vocab-link "none" } "." } }
{ { $snippet "-no-user-init" } { "Inhibits the running of user initialization files on startup. See " { $link "rc-files" } "." } } { { $snippet "-no-user-init" } { "Inhibits the running of user initialization files on startup. See " { $link "rc-files" } "." } }
{ { $snippet "-quiet" } { "If set, " { $link run-file } " and " { $link require } " will not print load messages." } }
} ; } ;
ARTICLE: ".factor-boot-rc" "Bootstrap initialization file" ARTICLE: ".factor-boot-rc" "Bootstrap initialization file"

View File

@ -3,7 +3,7 @@
USING: init continuations hashtables io io.encodings.utf8 USING: init continuations hashtables io io.encodings.utf8
io.files io.pathnames kernel kernel.private namespaces parser io.files io.pathnames kernel kernel.private namespaces parser
sequences source-files strings system splitting vocabs.loader sequences source-files strings system splitting vocabs.loader
alien.strings accessors ; alien.strings accessors parser.notes ;
IN: command-line IN: command-line
SYMBOL: script SYMBOL: script
@ -40,7 +40,7 @@ SYMBOL: command-line
"=" split1 [ var-param ] [ bool-param ] if* ; "=" split1 [ var-param ] [ bool-param ] if* ;
: run-script ( file -- ) : run-script ( file -- )
t "quiet" [ t parser-quiet? [
[ run-file ] [ run-file ]
[ source-file main>> [ execute( -- ) ] when* ] bi [ source-file main>> [ execute( -- ) ] when* ] bi
] with-variable ; ] with-variable ;
@ -63,10 +63,8 @@ SYMBOL: main-vocab-hook
: default-cli-args ( -- ) : default-cli-args ( -- )
global [ global [
"quiet" off
"e" off "e" off
"user-init" on "user-init" on
embedded? "quiet" set
main-vocab "run" set main-vocab "run" set
] bind ; ] bind ;

View File

@ -13,7 +13,6 @@ Common arguments:
-i=<image> load Factor image file <image> (default """ write vm file-name write """.image) -i=<image> load Factor image file <image> (default """ write vm file-name write """.image)
-run=<vocab> run the MAIN: entry point of <vocab> -run=<vocab> run the MAIN: entry point of <vocab>
-e=<code> evaluate <code> -e=<code> evaluate <code>
-quiet suppress "Loading vocab.factor" messages
-no-user-init suppress loading of .factor-rc -no-user-init suppress loading of .factor-rc
Enter Enter
@ -25,17 +24,15 @@ from within Factor for more information.
: command-line-startup ( -- ) : command-line-startup ( -- )
(command-line) parse-command-line (command-line) parse-command-line
"help" get "-help" get or "h" get or [ cli-usage ] [ "help" get "-help" get or "h" get or [ cli-usage ] [
"e" get script get or "quiet" [ load-vocab-roots
load-vocab-roots run-user-init
run-user-init
"e" get script get or [ "e" get script get or [
"e" get [ eval( -- ) ] when* "e" get [ eval( -- ) ] when*
script get [ run-script ] when* script get [ run-script ] when*
] [ ] [
"run" get run "run" get run
] if ] if
] with-variable
] if ] if
output-stream get [ stream-flush ] when* output-stream get [ stream-flush ] when*

View File

@ -18,8 +18,7 @@ SYNTAX: eval( \ eval parse-call( ;
: (eval>string) ( str -- output ) : (eval>string) ( str -- output )
[ [
"quiet" on parser-quiet? on
parser-notes off
'[ _ (( -- )) (eval) ] [ print-error ] recover '[ _ (( -- )) (eval) ] [ print-error ] recover
] with-string-writer ; ] with-string-writer ;

View File

@ -59,8 +59,7 @@ SYNTAX: %> lexer get parse-%> ;
: parse-template ( string -- quot ) : parse-template ( string -- quot )
[ [
[ [
"quiet" on parser-quiet? on
parser-notes off
"html.templates.fhtml" use-vocab "html.templates.fhtml" use-vocab
string-lines parse-template-lines string-lines parse-template-lines
] with-file-vocabs ] with-file-vocabs

View File

@ -51,7 +51,7 @@ IN: io.launcher.windows.tests
[ ] [ [ ] [
<process> <process>
console-vm "-quiet" "-run=hello-world" 3array >>command console-vm "-run=hello-world" 3array >>command
"out.txt" temp-file >>stdout "out.txt" temp-file >>stdout
try-process try-process
] unit-test ] unit-test

View File

@ -4,7 +4,8 @@ USING: arrays hashtables io kernel math math.parser memory
namespaces parser lexer sequences strings io.styles namespaces parser lexer sequences strings io.styles
vectors words generic system combinators continuations debugger vectors words generic system combinators continuations debugger
definitions compiler.units accessors colors prettyprint fry definitions compiler.units accessors colors prettyprint fry
sets vocabs.parser source-files.errors locals vocabs vocabs.loader ; sets vocabs.parser source-files.errors locals vocabs vocabs.loader
parser.notes ;
IN: listener IN: listener
GENERIC: stream-read-quot ( stream -- quot/f ) GENERIC: stream-read-quot ( stream -- quot/f )
@ -107,6 +108,7 @@ t error-summary? set-global
] [ drop ] if ; ] [ drop ] if ;
:: (listener) ( datastack -- ) :: (listener) ( datastack -- )
parser-quiet? off
error-summary? get [ error-summary ] when error-summary? get [ error-summary ] when
visible-vars. visible-vars.
datastack datastack. datastack datastack.

View File

@ -8,7 +8,8 @@ IN: tools.deploy
dup find-vocab-root [ deploy* ] [ no-vocab ] if ; dup find-vocab-root [ deploy* ] [ no-vocab ] if ;
: deploy-image-only ( vocab image -- ) : deploy-image-only ( vocab image -- )
[ vm ] 2dip swap dup deploy-config make-deploy-image drop ; [ vm ] 2dip
swap dup deploy-config make-deploy-image drop ;
{ {
{ [ os macosx? ] [ "tools.deploy.macosx" ] } { [ os macosx? ] [ "tools.deploy.macosx" ] }

View File

@ -481,7 +481,7 @@ SYMBOL: deploy-vocab
set-startup-quot ; set-startup-quot ;
: startup-stripper ( -- ) : startup-stripper ( -- )
t "quiet" set-global t parser-quiet? set-global
f output-stream set-global f output-stream set-global
[ V{ "resource:" } clone vocab-roots set-global ] [ V{ "resource:" } clone vocab-roots set-global ]
"vocabs.loader" startup-hooks get-global set-at ; "vocabs.loader" startup-hooks get-global set-at ;

View File

@ -1,10 +1,6 @@
USING: help.markup help.syntax io ; USING: help.markup help.syntax io parser.notes ;
IN: parser.notes IN: parser.notes
HELP: parser-notes HELP: parser-quiet?
{ $var-description "A boolean controlling whether the parser will print various notes. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ; { $var-description "A boolean controlling whether the parser will print various notes. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should remain switched on, to prevent parser notes from polluting the output." } ;
HELP: parser-notes?
{ $values { "?" "a boolean" } }
{ $description "Tests if the parser will print various notes and warnings. To disable parser notes, either set " { $link parser-notes } " to " { $link f } ", or pass the " { $snippet "-quiet" } " command line switch." } ;

View File

@ -3,16 +3,13 @@
USING: namespaces kernel source-files lexer accessors io math.parser ; USING: namespaces kernel source-files lexer accessors io math.parser ;
IN: parser.notes IN: parser.notes
SYMBOL: parser-notes SYMBOL: parser-quiet?
t parser-notes set-global t parser-quiet? set-global
: parser-notes? ( -- ? )
parser-notes get "quiet" get not and ;
: note. ( str -- ) : note. ( str -- )
parser-notes? [ parser-quiet? get [
file get [ path>> write ":" write ] when* file get [ path>> write ":" write ] when*
lexer get [ line>> number>string write ": " write ] when* lexer get [ line>> number>string write ": " write ] when*
"Note:" print dup print "Note:" print dup print
] when drop ; ] unless drop ;

View File

@ -5,7 +5,7 @@ sequences strings vectors words words.symbol quotations io
combinators sorting splitting math.parser effects continuations combinators sorting splitting math.parser effects continuations
io.files vocabs io.encodings.utf8 source-files classes io.files vocabs io.encodings.utf8 source-files classes
hashtables compiler.units accessors sets lexer vocabs.parser hashtables compiler.units accessors sets lexer vocabs.parser
slots parser.notes ; slots parser.notes ;
IN: parser IN: parser
: location ( -- loc ) : location ( -- loc )
@ -135,7 +135,7 @@ print-use-hook [ [ ] ] initialize
] with-file-vocabs ; ] with-file-vocabs ;
: parsing-file ( file -- ) : parsing-file ( file -- )
"quiet" get [ drop ] [ "Loading " write print flush ] if ; parser-quiet? get [ drop ] [ "Loading " write print flush ] if ;
: filter-moved ( assoc1 assoc2 -- seq ) : filter-moved ( assoc1 assoc2 -- seq )
swap assoc-diff keys [ swap assoc-diff keys [