From 2cbc9794603ea983ca5074520bbef60a1c9bd97e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 21 Nov 2008 20:09:23 -0600 Subject: [PATCH 1/3] Bail out on line-endings workarounds now that we have a better fix for that on Win64 --- basis/html/templates/fhtml/fhtml-tests.factor | 7 ++----- extra/benchmark/regex-dna/regex-dna-tests.factor | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/basis/html/templates/fhtml/fhtml-tests.factor b/basis/html/templates/fhtml/fhtml-tests.factor index d314a60124..6cebb55688 100644 --- a/basis/html/templates/fhtml/fhtml-tests.factor +++ b/basis/html/templates/fhtml/fhtml-tests.factor @@ -6,11 +6,8 @@ IN: html.templates.fhtml.tests : test-template ( path -- ? ) "resource:basis/html/templates/fhtml/test/" prepend - [ - ".fhtml" append [ call-template ] with-string-writer - lines - ] keep - ".html" append utf8 file-lines + [ ".fhtml" append [ call-template ] with-string-writer ] + [ ".html" append utf8 file-contents ] bi [ . . ] [ = ] 2bi ; [ t ] [ "example" test-template ] unit-test diff --git a/extra/benchmark/regex-dna/regex-dna-tests.factor b/extra/benchmark/regex-dna/regex-dna-tests.factor index 9f64d438c7..cdd83cb9af 100644 --- a/extra/benchmark/regex-dna/regex-dna-tests.factor +++ b/extra/benchmark/regex-dna/regex-dna-tests.factor @@ -4,7 +4,7 @@ IN: benchmark.regex-dna.tests [ t ] [ "resource:extra/benchmark/regex-dna/regex-dna-test-in.txt" - [ regex-dna ] with-string-writer lines + [ regex-dna ] with-string-writer "resource:extra/benchmark/regex-dna/regex-dna-test-out.txt" - ascii file-lines = + ascii file-contents = ] unit-test From d504d6b8dea089e0b222eeb9d2d7aef834a9817a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 21 Nov 2008 21:00:30 -0600 Subject: [PATCH 2/3] slice-errors now report the parameters to the slicing operation --- basis/debugger/debugger.factor | 5 ++--- core/sequences/sequences.factor | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/basis/debugger/debugger.factor b/basis/debugger/debugger.factor index ec93a01c19..0e7a56ee5f 100644 --- a/basis/debugger/debugger.factor +++ b/basis/debugger/debugger.factor @@ -206,9 +206,8 @@ M: no-cond summary M: no-case summary drop "Fall-through in case" ; -M: slice-error error. - "Cannot create slice because " write - reason>> print ; +M: slice-error summary + drop "Cannot create slice" ; M: bounds-error summary drop "Sequence index out of bounds" ; diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 0fe47f0099..9afc7c6168 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -190,7 +190,7 @@ TUPLE: slice : collapse-slice ( m n slice -- m' n' seq ) [ from>> ] [ seq>> ] bi >r tuck + >r + r> r> ; inline -ERROR: slice-error reason ; +ERROR: slice-error from to seq reason ; : check-slice ( from to seq -- from to seq ) pick 0 < [ "start < 0" slice-error ] when From f2e8d4dda52409eb0d8f467d0edc9e78c5a374c7 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 21 Nov 2008 21:00:49 -0600 Subject: [PATCH 3/3] Add hide-all-vars word, document var watching wordS --- basis/listener/listener-docs.factor | 24 +++++++++++++++++++++++- basis/listener/listener.factor | 6 ++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/basis/listener/listener-docs.factor b/basis/listener/listener-docs.factor index 8ef49ca0d9..ba3bb7275e 100644 --- a/basis/listener/listener-docs.factor +++ b/basis/listener/listener-docs.factor @@ -9,7 +9,29 @@ ARTICLE: "listener-watch" "Watching variables in the listener" { $subsection hide-var } "To add and remove multiple variables:" { $subsection show-vars } -{ $subsection hide-vars } ; +{ $subsection hide-vars } +"Hiding all visible variables:" +{ $subsection hide-all-vars } ; + +HELP: show-var +{ $values { "var" "a variable name" } } +{ $description "Adds a variable to the watch list; its value will be printed by the listener after every expression." } ; + +HELP: show-vars +{ $values { "seq" "a sequence of variable names" } } +{ $description "Adds a sequence of variables to the watch list; their values will be printed by the listener after every expression." } ; + +HELP: hide-var +{ $values { "var" "a variable name" } } +{ $description "Removes a variable from the watch list." } ; + +HELP: hide-vars +{ $values { "seq" "a sequence of variable names" } } +{ $description "Removes a sequence of variables from the watch list." } ; + +HELP: hide-all-vars +{ $values { "seq" "a sequence of variable names" } } +{ $description "Removes all variables from the watch list." } ; ARTICLE: "listener" "The listener" "The listener evaluates Factor expressions read from a stream. The listener is the primary interface to the Factor runtime. Typically, you write Factor code in a text editor, then load it using the listener and test it." diff --git a/basis/listener/listener.factor b/basis/listener/listener.factor index 7d8b72849b..95ad264000 100644 --- a/basis/listener/listener.factor +++ b/basis/listener/listener.factor @@ -42,14 +42,16 @@ PRIVATE> SYMBOL: visible-vars -: show-var ( sym -- ) visible-vars [ swap suffix ] change ; +: show-var ( var -- ) visible-vars [ swap suffix ] change ; : show-vars ( seq -- ) visible-vars [ swap union ] change ; -: hide-var ( sym -- ) visible-vars [ remove ] change ; +: hide-var ( var -- ) visible-vars [ remove ] change ; : hide-vars ( seq -- ) visible-vars [ swap diff ] change ; +: hide-all-vars ( -- ) visible-vars off ; + SYMBOL: error-hook [ print-error-and-restarts ] error-hook set-global