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.
cvs
Chris Double 2004-11-22 22:07:17 +00:00
parent e987c96820
commit a5782d290e
5 changed files with 30 additions and 32 deletions

View File

@ -45,6 +45,7 @@ USE: parser
USE: errors
USE: unparser
USE: logging
USE: listener
: <browser> ( 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>
<table>
<tr>
<td> "Free Memory" write </td>
<td> write </td>
</tr>
<tr>
<td> "Total Memory" write </td>
<td> write </td>
</tr>
</table> ;
#! Display statistics about the vm.
<pre> room. </pre> ;
: write-browser-body ( -- )
#! Write out the HTML for the body of the main browser page.

View File

@ -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 ;

View File

@ -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

View File

@ -117,7 +117,7 @@ USE: logging
<tr> <td colspan= "2" td> [ [ parse ] [ [ "No such word" write ] [ car see ] ifte ] catch ] with-simple-html-output </td> </tr>
<tr> <th> "Apropos" write </th> <th> "Usages" write </th> </tr>
<tr> <td valign= "top" td> [ apropos. ] with-simple-html-output </td>
<td valign= "top" td> [ usages. ] with-simple-html-output </td>
<td valign= "top" td> [ [ parse ] [ [ "No such word" write ] [ car usages. ] ifte ] catch ] with-simple-html-output </td>
</tr>
</table>
] 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.
<form method= "post" action= "." form>
[
[
[
"Enter the name of a word: " write
"see" [ html-for-word-source ] live-search
]
[
<div id= "see" div> "" write </div>
]
] vertical-layout
</form> ;
"Enter the name of a word: " write
"see" [ html-for-word-source ] live-search
]
[
<div id= "see" div> "" write </div>
]
] vertical-layout ;
: display-last-output ( string -- )
#! Write out html to display the last output.

View File

@ -162,15 +162,24 @@ and free memory in the system.
<body>
<table border= "1" table>
<tr>
<td> "Total Memory" write </td>
<td> "Total Data Memory" write </td>
<td> room unparse write </td>
</tr>
<tr>
<td> "Free Memory" write </td>
<td> "Free Data Memory" write </td>
<td> unparse write </td>
</tr>
<tr>
<td> "Total Code Memory" write </td>
<td> unparse write </td>
</tr>
<tr>
<td> "Free Code Memory" write </td>
<td> unparse write </td>
</tr>
</table>
</body>
<pre> room. </pre>
</html>
] 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.
<table border= "1" table>
<tr>
<td> "Total Memory" write </td>
<td> "Total Data Memory" write </td>
<td> unparse write </td>
</tr>
<tr>
<td> "Free Memory" write </td>
<td> "Free Data Memory" write </td>
<td> unparse write </td>
</tr>
</table> ;
@ -200,7 +209,7 @@ The HTML output can be refactored into different words. For example:
drop
<html>
<head> <title> "Memory Statistics 2" write </title> </head>
<body> room memory-stats-table </body>
<body> room memory-stats-table 2drop </body>
</html>
] 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