From 00c2d5f0581562aad24b596c2f7d90cef5ca06a9 Mon Sep 17 00:00:00 2001 From: Chris Double Date: Thu, 19 Aug 2004 22:04:10 +0000 Subject: [PATCH] Changes to get things working with latest factor updates. Post requests are currently broken. --- contrib/cont-responder/browser.factor | 2 +- contrib/cont-responder/cont-examples.factor | 10 +++++----- contrib/cont-responder/cont-html.factor | 1 - contrib/cont-responder/cont-responder.factor | 18 ++++++++++++------ contrib/cont-responder/eval-responder.factor | 2 +- .../live-updater-responder.factor | 2 +- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/contrib/cont-responder/browser.factor b/contrib/cont-responder/browser.factor index 0bf9d83393..7a1f5a559d 100644 --- a/contrib/cont-responder/browser.factor +++ b/contrib/cont-responder/browser.factor @@ -32,7 +32,7 @@ USE: stack USE: stdio USE: combinators USE: namespaces -USE: vocabularies +USE: words USE: lists USE: streams USE: strings diff --git a/contrib/cont-responder/cont-examples.factor b/contrib/cont-responder/cont-examples.factor index 1da63eb931..503ae7c91f 100644 --- a/contrib/cont-responder/cont-examples.factor +++ b/contrib/cont-responder/cont-examples.factor @@ -116,8 +116,8 @@ USE: unparser drop ; ! Install the examples - "counter1" [ drop 0 counter-example ] install-cont-responder - "counter2" [ drop counter-example2 ] install-cont-responder - "test1" [ drop test-cont-responder ] install-cont-responder - "test2" [ drop test-cont-responder2 ] install-cont-responder - "test3" [ drop test-cont-responder3 ] install-cont-responder +"counter1" [ drop 0 counter-example ] install-cont-responder +"counter2" [ drop counter-example2 ] install-cont-responder +"test1" [ drop test-cont-responder ] install-cont-responder +"test2" [ drop test-cont-responder2 ] install-cont-responder +"test3" [ drop test-cont-responder3 ] install-cont-responder diff --git a/contrib/cont-responder/cont-html.factor b/contrib/cont-responder/cont-html.factor index 61b767ed99..eb60886b7c 100644 --- a/contrib/cont-responder/cont-html.factor +++ b/contrib/cont-responder/cont-html.factor @@ -31,7 +31,6 @@ USE: combinators USE: stdio USE: namespaces USE: words -USE: vocabularies USE: logic ! These words in cont-html are used to provide a means of writing diff --git a/contrib/cont-responder/cont-responder.factor b/contrib/cont-responder/cont-responder.factor index 1e6c878ba6..a64a706b01 100644 --- a/contrib/cont-responder/cont-responder.factor +++ b/contrib/cont-responder/cont-responder.factor @@ -64,7 +64,7 @@ USE: unparser : continuation-table ( -- ) #! Return the global table of continuations "continuation-table" get ; - + : reset-continuation-table ( -- ) #! Create the initial global table "continuation-table" set ; @@ -234,8 +234,10 @@ DEFER: show call-exit-continuation ] callcc1 nip ; +USE: prettyprint +USE: inspector -: cont-get-responder ( id -- ) +: cont-get-responder ( id-or-f -- ) #! httpd responder that retrieves a continuation and calls it. dup f-or-"" [ #! No continuation id given @@ -250,7 +252,7 @@ DEFER: show #! Use the given continuation [ f swap resume-continuation ] with-exit-continuation ] ifte - [ print ] when* drop ; + [ write flush ] when* drop ; : post-request>alist ( post-request -- alist ) #! Return an alist containing name/value pairs from the @@ -313,17 +315,21 @@ DEFER: show #! Install a cont-responder with the given name #! that will initially run the given quotation. #! - #! Convert the quotation os it is run within a session namespace + #! Convert the quotation so it is run within a session namespace #! and that namespace is initialized first. [ init-session-namespace ] swap append unit [ with-new-session ] append "httpd-responders" get [ [ [ cont-get-responder ] "get" set [ cont-post-responder ] "post" set + over "responder-name" set + over "responder" set reset-continuation-table "disable-initial-redirect?" t put + ] extend dup >r rot set + r> [ f swap register-continuation "root-continuation" set - dup "responder-name" set - ] extend put + ] bind ] bind ; + diff --git a/contrib/cont-responder/eval-responder.factor b/contrib/cont-responder/eval-responder.factor index 668e1f78c3..6b33aae75c 100644 --- a/contrib/cont-responder/eval-responder.factor +++ b/contrib/cont-responder/eval-responder.factor @@ -40,7 +40,7 @@ USE: logic USE: combinators USE: live-updater USE: prettyprint -USE: vocabularies +USE: words : ( stack msg history -- ) #! Create an 'evaluator' object that holds diff --git a/contrib/cont-responder/live-updater-responder.factor b/contrib/cont-responder/live-updater-responder.factor index 0a1d21458b..95fde27650 100644 --- a/contrib/cont-responder/live-updater-responder.factor +++ b/contrib/cont-responder/live-updater-responder.factor @@ -29,7 +29,7 @@ USE: live-updater USE: namespaces USE: cont-html USE: html -USE: vocabularies +USE: words USE: stdio USE: stack USE: kernel