(string-output instead of string-output-stream, new cons format, etc).
: write-editable-word-source ( vocab word -- )
#! Write the source in a manner allowing it to be edited.
<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
] with-stream r> stream>str chars>entities write
</textarea> <br/>
"browser" f <browser> browse ;
"browser" [ f browser-responder ] install-cont-responder
+!"browser-edit" [ t browser-responder ] install-cont-responder
: with-string-stream ( quot -- string )
#! Call the quotation with standard output bound to a string output
#! 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 ( -- )
#! Force a redirect to the client browser so that the browser
: escape-quotes ( string -- string )
#! Replace occurrences of single quotes with
#! backslash quote.
- [ dup [ [ CHAR: ' | "\\'" ] [ CHAR: " | "\\\"" ] ] assoc dup rot ? ] str-map ;
+ [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc dup rot ? ] str-map ;
: make-eval-javascript ( string -- string )
#! Give a string return some javascript that when
#! callstack along with the resulting datastack as a list.
<namespace> [
"inspect" "responder" set
- 1024 <string-output-stream> dup >r <html-stream> [
+ 1024 <string-output> dup >r <html-stream> [
do-eval
] with-stream r> stream>str
] bind ;
: get-live-updater-js ( filename -- 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 )
#! Generate an URL to the liveUpdater.js code.
: store-todo ( <todo> filename -- )
#! store the todo list in the given file.
- <filecw> [ write-todo ] with-stream ;
+ <file-writer> [ write-todo ] with-stream ;
: read-todo ( -- <todo> )
#! Read a todo list from the current input stream.
] times ;
: load-todo ( filename -- <todo> )
- <filecr> [ read-todo ] with-stream ;
+ <file-reader> [ read-todo ] with-stream ;
: password-matches? ( password <todo> -- <todo> )
#! Returns the <todo> if the password matches otherwise
============
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
details to standard output and this is wrapped in a <pre> tag so it is
formatted correctly.