From a5782d290e849b49bd3c05961a274c8e0612b269 Mon Sep 17 00:00:00 2001 From: Chris Double Date: Mon, 22 Nov 2004 22:07:17 +0000 Subject: [PATCH] fix 'usages.' usage in eval-responder. fix tutorial typo. update browser and tutorial for new room word changes. updated browser to use room. instead of room. remove form around live search field in eval-responder. prevent enter key on eval-responder in live search field from failing. removed double prompting of numbers game. removed vars-values usage and replaced with hash>alist. --- contrib/cont-responder/browser.factor | 15 +++--------- .../cont-responder/cont-numbers-game.factor | 2 +- contrib/cont-responder/cont-responder.factor | 2 +- contrib/cont-responder/eval-responder.factor | 20 ++++++++-------- contrib/cont-responder/tutorial.txt | 23 +++++++++++++------ 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/contrib/cont-responder/browser.factor b/contrib/cont-responder/browser.factor index abfd6b0806..05c304bedc 100644 --- a/contrib/cont-responder/browser.factor +++ b/contrib/cont-responder/browser.factor @@ -45,6 +45,7 @@ USE: parser USE: errors USE: unparser USE: logging +USE: listener : ( allow-edit? vocab word -- ) #! An object for storing the current browser @@ -107,18 +108,8 @@ USE: logging ] bind drop ; : write-vm-statistics ( -- ) - #! Display statistics about the JVM in use. - room swap unparse >r unparse r> - - - - - - - - - -
"Free Memory" write write
"Total Memory" write write
; + #! Display statistics about the vm. +
 room. 
; : write-browser-body ( -- ) #! Write out the HTML for the body of the main browser page. diff --git a/contrib/cont-responder/cont-numbers-game.factor b/contrib/cont-responder/cont-numbers-game.factor index 1e79e079e8..e5e3993788 100644 --- a/contrib/cont-responder/cont-numbers-game.factor +++ b/contrib/cont-responder/cont-numbers-game.factor @@ -75,7 +75,7 @@ USE: namespaces : guess-banner "I'm thinking of a number between 0 and 100." web-print ; -: guess-prompt "Enter your guess: " web-print ; +: guess-prompt ; : too-high "Too high" web-print ; : too-low "Too low" web-print ; : correct "Correct - you win!" web-print ; diff --git a/contrib/cont-responder/cont-responder.factor b/contrib/cont-responder/cont-responder.factor index 540cae6a1f..c7e71f7797 100644 --- a/contrib/cont-responder/cont-responder.factor +++ b/contrib/cont-responder/cont-responder.factor @@ -100,7 +100,7 @@ USE: inspector : continuation-items ( -- alist ) #! Return an alist of all continuation items in the continuation #! table with the car as the id and the cdr as the item. - continuation-table [ vars-values ] bind ; + continuation-table hash>alist ; : expire-continuations ( timeout-seconds -- ) #! Expire all continuations in the continuation table diff --git a/contrib/cont-responder/eval-responder.factor b/contrib/cont-responder/eval-responder.factor index 4cc4af7c64..afc6fb4610 100644 --- a/contrib/cont-responder/eval-responder.factor +++ b/contrib/cont-responder/eval-responder.factor @@ -117,7 +117,7 @@ USE: logging [ [ parse ] [ [ "No such word" write ] [ car see ] ifte ] catch ] with-simple-html-output "Apropos" write "Usages" write [ apropos. ] with-simple-html-output - [ usages. ] with-simple-html-output + [ [ parse ] [ [ "No such word" write ] [ car usages. ] ifte ] catch ] with-simple-html-output ] bind ; @@ -126,17 +126,15 @@ USE: logging #! Write out the html for code that accepts #! the name of a word, and displays the source #! code of that word. -
+ [ + [ + "Enter the name of a word: " write + "see" [ html-for-word-source ] live-search + ] [ - [ - "Enter the name of a word: " write - "see" [ html-for-word-source ] live-search - ] - [ -
"" write
- ] - ] vertical-layout -
; +
"" write
+ ] + ] vertical-layout ; : display-last-output ( string -- ) #! Write out html to display the last output. diff --git a/contrib/cont-responder/tutorial.txt b/contrib/cont-responder/tutorial.txt index e38d67f061..d9c18adace 100644 --- a/contrib/cont-responder/tutorial.txt +++ b/contrib/cont-responder/tutorial.txt @@ -162,15 +162,24 @@ and free memory in the system. - + - + + + + + + + + +
"Total Memory" write "Total Data Memory" write room unparse write
"Free Memory" write "Free Data Memory" write unparse write
"Total Code Memory" write unparse write
"Free Code Memory" write unparse write
+
 room. 
] show drop ; @@ -183,14 +192,14 @@ information. The HTML output can be refactored into different words. For example: : memory-stats-table ( free total -- ) - #! Output a table containing the given statistcs. + #! Output a table containing the given statistics. - + - +
"Total Memory" write "Total Data Memory" write unparse write
"Free Memory" write "Free Data Memory" write unparse write
; @@ -200,7 +209,7 @@ The HTML output can be refactored into different words. For example: drop "Memory Statistics 2" write - room memory-stats-table + room memory-stats-table 2drop ] show drop ; @@ -303,7 +312,7 @@ page. Notice that after the show that a '3drop' is done whereas previously we've only done a single 'drop'. This is due to a side -effect or 'show' using continuations. +effect of 'show' using continuations. After the 'show' call returns there will be one item on the stack (which we've been dropping and will explain later what it is). The