Changes to cont-responder to work with recent Factor changes

(string-output instead of string-output-stream, new cons format, etc).
cvs
Chris Double 2005-02-07 00:08:14 +00:00
parent 795884d6c4
commit 2b225a6c7b
6 changed files with 9 additions and 8 deletions

View File

@ -86,7 +86,7 @@ USE: listener
: write-editable-word-source ( vocab word -- ) : write-editable-word-source ( vocab word -- )
#! Write the source in a manner allowing it to be edited. #! Write the source in a manner allowing it to be edited.
<textarea name= "eval" rows= "30" cols= "80" textarea> <textarea name= "eval" rows= "30" cols= "80" textarea>
1024 <string-output-stream> dup >r [ 1024 <string-output> dup >r [
>r words r> swap [ over swap dup word-name rot = [ see ] [ drop ] ifte ] each drop >r words r> swap [ over swap dup word-name rot = [ see ] [ drop ] ifte ] each drop
] with-stream r> stream>str chars>entities write ] with-stream r> stream>str chars>entities write
</textarea> <br/> </textarea> <br/>
@ -224,3 +224,4 @@ USE: listener
"browser" f <browser> browse ; "browser" f <browser> browse ;
"browser" [ f browser-responder ] install-cont-responder "browser" [ f browser-responder ] install-cont-responder
!"browser-edit" [ t browser-responder ] install-cont-responder

View File

@ -193,7 +193,7 @@ DEFER: show
: with-string-stream ( quot -- string ) : with-string-stream ( quot -- string )
#! Call the quotation with standard output bound to a string output #! Call the quotation with standard output bound to a string output
#! stream. Return the string on exit. #! stream. Return the string on exit.
1024 <string-output-stream> dup >r swap with-stream r> stream>str ; 1024 <string-output> dup >r swap with-stream r> stream>str ;
: redirect-to-here ( -- ) : redirect-to-here ( -- )
#! Force a redirect to the client browser so that the browser #! Force a redirect to the client browser so that the browser

View File

@ -73,7 +73,7 @@ USE: logging
: escape-quotes ( string -- string ) : escape-quotes ( string -- string )
#! Replace occurrences of single quotes with #! Replace occurrences of single quotes with
#! backslash quote. #! backslash quote.
[ dup [ [ CHAR: ' | "\\'" ] [ CHAR: " | "\\\"" ] ] assoc dup rot ? ] str-map ; [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc dup rot ? ] str-map ;
: make-eval-javascript ( string -- string ) : make-eval-javascript ( string -- string )
#! Give a string return some javascript that when #! Give a string return some javascript that when
@ -187,7 +187,7 @@ USE: logging
#! callstack along with the resulting datastack as a list. #! callstack along with the resulting datastack as a list.
<namespace> [ <namespace> [
"inspect" "responder" set "inspect" "responder" set
1024 <string-output-stream> dup >r <html-stream> [ 1024 <string-output> dup >r <html-stream> [
do-eval do-eval
] with-stream r> stream>str ] with-stream r> stream>str
] bind ; ] bind ;

View File

@ -39,7 +39,7 @@ USE: lists
: get-live-updater-js ( filename -- string ) : get-live-updater-js ( filename -- string )
#! Return the liveUpdater javascript code as a string. #! Return the liveUpdater javascript code as a string.
<filecr> [ get-live-updater-js* ] make-string ; <file-reader> [ get-live-updater-js* ] make-string ;
: live-updater-url ( -- url ) : live-updater-url ( -- url )
#! Generate an URL to the liveUpdater.js code. #! Generate an URL to the liveUpdater.js code.

View File

@ -91,7 +91,7 @@ USE: hashtables
: store-todo ( <todo> filename -- ) : store-todo ( <todo> filename -- )
#! store the todo list in the given file. #! store the todo list in the given file.
<filecw> [ write-todo ] with-stream ; <file-writer> [ write-todo ] with-stream ;
: read-todo ( -- <todo> ) : read-todo ( -- <todo> )
#! Read a todo list from the current input stream. #! Read a todo list from the current input stream.
@ -106,7 +106,7 @@ USE: hashtables
] times ; ] times ;
: load-todo ( filename -- <todo> ) : load-todo ( filename -- <todo> )
<filecr> [ read-todo ] with-stream ; <file-reader> [ read-todo ] with-stream ;
: password-matches? ( password <todo> -- <todo> ) : password-matches? ( password <todo> -- <todo> )
#! Returns the <todo> if the password matches otherwise #! Returns the <todo> if the password matches otherwise

View File

@ -152,7 +152,7 @@ Dynamic Data
============ ============
Adding dynamic data to the page is relatively easy. This example pulls Adding dynamic data to the page is relatively easy. This example pulls
a information from the 'room' word which displays memory details about information from the 'room' word which displays memory details about
the running Factor system. It also uses 'room.' which outputs these the running Factor system. It also uses 'room.' which outputs these
details to standard output and this is wrapped in a <pre> tag so it is details to standard output and this is wrapped in a <pre> tag so it is
formatted correctly. formatted correctly.