get cont-responder examples test1 and test2 working
parent
d7c042238c
commit
1edc5b645e
|
@ -24,11 +24,11 @@
|
||||||
! Simple test applications
|
! Simple test applications
|
||||||
IN: cont-examples
|
IN: cont-examples
|
||||||
USE: cont-responder
|
USE: cont-responder
|
||||||
|
USE: hashtables
|
||||||
USE: html
|
USE: html
|
||||||
USE: kernel
|
USE: kernel
|
||||||
USE: io
|
USE: io
|
||||||
USE: html
|
USE: html
|
||||||
USE: lists
|
|
||||||
USE: strings
|
USE: strings
|
||||||
USE: math
|
USE: math
|
||||||
USE: namespaces
|
USE: namespaces
|
||||||
|
@ -40,24 +40,24 @@ USE: sequences
|
||||||
#! Display a page with some text to test the cont-responder.
|
#! Display a page with some text to test the cont-responder.
|
||||||
#! The page has a link to the 'next' continuation.
|
#! The page has a link to the 'next' continuation.
|
||||||
[
|
[
|
||||||
|
<h1> over write </h1>
|
||||||
swap [
|
swap [
|
||||||
<a =href a> "Next" write </a>
|
<a =href a> "Next" write </a>
|
||||||
] html-document
|
] html-document
|
||||||
] show drop drop ;
|
] show drop ;
|
||||||
|
|
||||||
: display-get-name-page ( -- name )
|
: display-get-name-page ( -- name )
|
||||||
#! Display a page prompting for input of a name and return that name.
|
#! Display a page prompting for input of a name and return that name.
|
||||||
[
|
dup [
|
||||||
"Enter your name" [
|
"Enter your name" [
|
||||||
|
<h1> swap write </h1>
|
||||||
<form "post" =method =action form>
|
<form "post" =method =action form>
|
||||||
"Name: " write
|
"Name: " write
|
||||||
<input "text" =type "name" =name "20" =size input/>
|
<input "text" =type "name" =name "20" =size input/>
|
||||||
<input "submit" =type "Ok" =value input/>
|
<input "submit" =type "Ok" =value input/>
|
||||||
</form>
|
</form>
|
||||||
] html-document
|
] html-document
|
||||||
] show [
|
] show "name" swap hash ;
|
||||||
"name" get
|
|
||||||
] bind ;
|
|
||||||
|
|
||||||
: test-cont-responder ( - )
|
: test-cont-responder ( - )
|
||||||
#! Test the cont-responder responder by displaying a few pages in a row.
|
#! Test the cont-responder responder by displaying a few pages in a row.
|
||||||
|
@ -67,22 +67,21 @@ USE: sequences
|
||||||
|
|
||||||
: test-cont-responder2 ( - )
|
: test-cont-responder2 ( - )
|
||||||
#! Test the cont-responder responder by displaying a few pages in a loop.
|
#! Test the cont-responder responder by displaying a few pages in a loop.
|
||||||
[ "one" "two" "three" "four" ] [ display-page [ .s ] string-out display-page ] each
|
[ "one" "two" "three" "four" ] [ display-page ] each
|
||||||
"Done!" display-page ;
|
"Done!" display-page ;
|
||||||
|
|
||||||
: test-cont-responder3 ( - )
|
: test-cont-responder3 ( - )
|
||||||
#! Test the quot-href word by displaying a menu of the current
|
#! Test the quot-href word by displaying a menu of the current
|
||||||
#! test words. Note that we drop the 'url' argument to the show
|
#! test words. Note that we use show-final as we don't link to a 'next' page.
|
||||||
#! quotation as we don't link to a 'next' page.
|
|
||||||
[
|
[
|
||||||
drop
|
|
||||||
"Menu" [
|
"Menu" [
|
||||||
|
<h1> "Menu" write </h1>
|
||||||
<ol>
|
<ol>
|
||||||
<li> "Test responder1" [ test-cont-responder ] quot-href </li>
|
<li> "Test responder1" [ test-cont-responder ] quot-href </li>
|
||||||
<li> "Test responder2" [ [ .s ] string-out display-page test-cont-responder2 [ .s ] string-out display-page ] quot-href </li>
|
<li> "Test responder2" [ [ .s ] string-out display-page test-cont-responder2 [ .s ] string-out display-page ] quot-href </li>
|
||||||
</ol>
|
</ol>
|
||||||
] html-document
|
] html-document
|
||||||
] show drop ;
|
] show-final ;
|
||||||
|
|
||||||
: counter-example ( count - )
|
: counter-example ( count - )
|
||||||
#! Display a counter which can be incremented or decremented
|
#! Display a counter which can be incremented or decremented
|
||||||
|
@ -119,6 +118,6 @@ USE: sequences
|
||||||
! Install the examples
|
! Install the examples
|
||||||
"counter1" [ drop 0 counter-example ] install-cont-responder
|
"counter1" [ drop 0 counter-example ] install-cont-responder
|
||||||
"counter2" [ drop counter-example2 ] install-cont-responder
|
"counter2" [ drop counter-example2 ] install-cont-responder
|
||||||
"test1" [ drop test-cont-responder ] install-cont-responder
|
"test1" [ test-cont-responder ] install-cont-responder
|
||||||
"test2" [ drop test-cont-responder2 ] install-cont-responder
|
"test2" [ drop test-cont-responder2 ] install-cont-responder
|
||||||
"test3" [ drop test-cont-responder3 ] install-cont-responder
|
"test3" [ drop test-cont-responder3 ] install-cont-responder
|
||||||
|
|
Loading…
Reference in New Issue