diff --git a/contrib/cont-responder/cont-examples.factor b/contrib/cont-responder/cont-examples.factor index dc30bf1f89..76d0a721e4 100644 --- a/contrib/cont-responder/cont-examples.factor +++ b/contrib/cont-responder/cont-examples.factor @@ -34,6 +34,7 @@ USE: math USE: namespaces USE: prettyprint USE: unparser +USE: sequences : display-page ( title -- ) #! Display a page with some text to test the cont-responder. @@ -66,7 +67,7 @@ USE: unparser : test-cont-responder2 ( - ) #! Test the cont-responder responder by displaying a few pages in a loop. - [ "one" "two" "three" "four" ] [ display-page [ .s ] with-string-stream display-page ] each + [ "one" "two" "three" "four" ] [ display-page [ .s ] with-string display-page ] each "Done!" display-page ; : test-cont-responder3 ( - ) @@ -78,7 +79,7 @@ USE: unparser "Menu" [
  1. "Test responder1" [ test-cont-responder ] quot-href
  2. -
  3. "Test responder2" [ [ .s ] with-string-stream display-page test-cont-responder2 [ .s ] with-string-stream display-page ] quot-href
  4. +
  5. "Test responder2" [ [ .s ] with-string display-page test-cont-responder2 [ .s ] with-string display-page ] quot-href
] html-document ] show drop ; diff --git a/contrib/cont-responder/eval-responder.factor b/contrib/cont-responder/eval-responder.factor index 3960eba0a8..090f77d08a 100644 --- a/contrib/cont-responder/eval-responder.factor +++ b/contrib/cont-responder/eval-responder.factor @@ -73,7 +73,7 @@ USE: sequences : escape-quotes ( string -- string ) #! Replace occurrences of single quotes with #! backslash quote. - [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc dup rot ? ] string-map ; + [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc dup rot ? ] map ; : make-eval-javascript ( string -- string ) #! Give a string return some javascript that when @@ -88,7 +88,7 @@ USE: sequences #! Write out html to display the stack. - [ ] each + [ ] each
"Callstack" write
[ unparse write ] with-string-stream write-eval-link
[ unparse write ] with-string write-eval-link
; : display-clear-history-link ( -- ) @@ -190,12 +190,11 @@ USE: sequences #! Evaluate expression using 'list' as the current callstack. #! All output should go to a string which is returned on the #! callstack along with the resulting datastack as a list. - [ - "browser" "responder" set - 1024 dup >r [ - do-eval - ] with-stream r> stream>str - ] bind ; + [ + "browser" "responder" set + stdio [ ] change + do-eval + ] with-string ; : forever ( quot -- ) #! The code is evaluated in an infinite loop. Typically, a diff --git a/contrib/cont-responder/todo-example.factor b/contrib/cont-responder/todo-example.factor index da3ceb7935..513dfca3a3 100644 --- a/contrib/cont-responder/todo-example.factor +++ b/contrib/cont-responder/todo-example.factor @@ -41,6 +41,7 @@ USE: prettyprint USE: todo USE: math USE: kernel +USE: sequences : todo-stylesheet ( -- string ) #! Return the stylesheet for the todo list @@ -114,7 +115,7 @@ USE: kernel : show-stack-page ( -- ) #! Debug function to show a page containing the current call stack. - [ .s ] with-string-stream chars>entities show-message-page ; + [ .s ] with-string chars>entities show-message-page ; : row ( list -- ) #! Output an html TR row with each element of the list @@ -208,7 +209,7 @@ USE: kernel ] [ drop CHAR: _ ] ifte - ] string-map ; + ] map ; : is-valid-username? ( username -- bool ) #! Return true if the username parses correctly @@ -334,11 +335,11 @@ USE: kernel : priority-valid? ( string -- bool ) #! Test the string containing a priority to see if it is #! valid. It should be a single digit from 0-9. - dup string-length 1 = [ 0 swap string-nth digit? ] [ drop f ] ifte ; + dup length 1 = [ 0 swap string-nth digit? ] [ drop f ] ifte ; : todo-details-valid? ( priority description -- bool ) #! Return true if a valid priority and description were entered. - string-length 0 > [ priority-valid? ] [ drop f ] ifte ; + length 0 > [ priority-valid? ] [ drop f ] ifte ; : get-new-todo-item ( -- ) #! Enter a new item to the current todo list.