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
parent
e987c96820
commit
a5782d290e
|
@ -45,6 +45,7 @@ USE: parser
|
||||||
USE: errors
|
USE: errors
|
||||||
USE: unparser
|
USE: unparser
|
||||||
USE: logging
|
USE: logging
|
||||||
|
USE: listener
|
||||||
|
|
||||||
: <browser> ( allow-edit? vocab word -- )
|
: <browser> ( allow-edit? vocab word -- )
|
||||||
#! An object for storing the current browser
|
#! An object for storing the current browser
|
||||||
|
@ -107,18 +108,8 @@ USE: logging
|
||||||
] bind drop ;
|
] bind drop ;
|
||||||
|
|
||||||
: write-vm-statistics ( -- )
|
: write-vm-statistics ( -- )
|
||||||
#! Display statistics about the JVM in use.
|
#! Display statistics about the vm.
|
||||||
room swap unparse >r unparse r>
|
<pre> room. </pre> ;
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td> "Free Memory" write </td>
|
|
||||||
<td> write </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td> "Total Memory" write </td>
|
|
||||||
<td> write </td>
|
|
||||||
</tr>
|
|
||||||
</table> ;
|
|
||||||
|
|
||||||
: write-browser-body ( -- )
|
: write-browser-body ( -- )
|
||||||
#! Write out the HTML for the body of the main browser page.
|
#! Write out the HTML for the body of the main browser page.
|
||||||
|
|
|
@ -75,7 +75,7 @@ USE: namespaces
|
||||||
|
|
||||||
: guess-banner
|
: guess-banner
|
||||||
"I'm thinking of a number between 0 and 100." web-print ;
|
"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-high "Too high" web-print ;
|
||||||
: too-low "Too low" web-print ;
|
: too-low "Too low" web-print ;
|
||||||
: correct "Correct - you win!" web-print ;
|
: correct "Correct - you win!" web-print ;
|
||||||
|
|
|
@ -100,7 +100,7 @@ USE: inspector
|
||||||
: continuation-items ( -- alist )
|
: continuation-items ( -- alist )
|
||||||
#! Return an alist of all continuation items in the continuation
|
#! Return an alist of all continuation items in the continuation
|
||||||
#! table with the car as the id and the cdr as the item.
|
#! 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-continuations ( timeout-seconds -- )
|
||||||
#! Expire all continuations in the continuation table
|
#! Expire all continuations in the continuation table
|
||||||
|
|
|
@ -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> <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> <th> "Apropos" write </th> <th> "Usages" write </th> </tr>
|
||||||
<tr> <td valign= "top" td> [ apropos. ] with-simple-html-output </td>
|
<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>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
] bind ;
|
] bind ;
|
||||||
|
@ -126,17 +126,15 @@ USE: logging
|
||||||
#! Write out the html for code that accepts
|
#! Write out the html for code that accepts
|
||||||
#! the name of a word, and displays the source
|
#! the name of a word, and displays the source
|
||||||
#! code of that word.
|
#! 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>
|
||||||
"Enter the name of a word: " write
|
]
|
||||||
"see" [ html-for-word-source ] live-search
|
] vertical-layout ;
|
||||||
]
|
|
||||||
[
|
|
||||||
<div id= "see" div> "" write </div>
|
|
||||||
]
|
|
||||||
] vertical-layout
|
|
||||||
</form> ;
|
|
||||||
|
|
||||||
: display-last-output ( string -- )
|
: display-last-output ( string -- )
|
||||||
#! Write out html to display the last output.
|
#! Write out html to display the last output.
|
||||||
|
|
|
@ -162,15 +162,24 @@ and free memory in the system.
|
||||||
<body>
|
<body>
|
||||||
<table border= "1" table>
|
<table border= "1" table>
|
||||||
<tr>
|
<tr>
|
||||||
<td> "Total Memory" write </td>
|
<td> "Total Data Memory" write </td>
|
||||||
<td> room unparse write </td>
|
<td> room unparse write </td>
|
||||||
</tr>
|
</tr>
|
||||||
<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>
|
<td> unparse write </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
<pre> room. </pre>
|
||||||
</html>
|
</html>
|
||||||
] show drop ;
|
] show drop ;
|
||||||
|
|
||||||
|
@ -183,14 +192,14 @@ information.
|
||||||
The HTML output can be refactored into different words. For example:
|
The HTML output can be refactored into different words. For example:
|
||||||
|
|
||||||
: memory-stats-table ( free total -- )
|
: memory-stats-table ( free total -- )
|
||||||
#! Output a table containing the given statistcs.
|
#! Output a table containing the given statistics.
|
||||||
<table border= "1" table>
|
<table border= "1" table>
|
||||||
<tr>
|
<tr>
|
||||||
<td> "Total Memory" write </td>
|
<td> "Total Data Memory" write </td>
|
||||||
<td> unparse write </td>
|
<td> unparse write </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> "Free Memory" write </td>
|
<td> "Free Data Memory" write </td>
|
||||||
<td> unparse write </td>
|
<td> unparse write </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table> ;
|
</table> ;
|
||||||
|
@ -200,7 +209,7 @@ The HTML output can be refactored into different words. For example:
|
||||||
drop
|
drop
|
||||||
<html>
|
<html>
|
||||||
<head> <title> "Memory Statistics 2" write </title> </head>
|
<head> <title> "Memory Statistics 2" write </title> </head>
|
||||||
<body> room memory-stats-table </body>
|
<body> room memory-stats-table 2drop </body>
|
||||||
</html>
|
</html>
|
||||||
] show drop ;
|
] show drop ;
|
||||||
|
|
||||||
|
@ -303,7 +312,7 @@ page.
|
||||||
|
|
||||||
Notice that after the show that a '3drop' is done whereas
|
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
|
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
|
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
|
(which we've been dropping and will explain later what it is). The
|
||||||
|
|
Loading…
Reference in New Issue