From 54f0d2145a019fa4e15dba275dd7c40c5f962de4 Mon Sep 17 00:00:00 2001 From: erana Date: Mon, 23 Jan 2012 14:45:40 +0900 Subject: [PATCH] scratch - char-continuation functions --- scsh/scratch/packages.scm | 2 +- scsh/scratch/pkg-def.scm | 5 ++--- scsh/scratch/scratch.scm | 13 ++++++------- scsh/thttpd/thttpdaemon.scm | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/scsh/scratch/packages.scm b/scsh/scratch/packages.scm index b089279..aa3d72e 100644 --- a/scsh/scratch/packages.scm +++ b/scsh/scratch/packages.scm @@ -1,6 +1,6 @@ (define-interface scratch-interface (export - run-daemon-child-http)) + char-continue)) (define-structure thttpd scratch-interface diff --git a/scsh/scratch/pkg-def.scm b/scsh/scratch/pkg-def.scm index 76826a2..d8d38ff 100644 --- a/scsh/scratch/pkg-def.scm +++ b/scsh/scratch/pkg-def.scm @@ -1,4 +1,4 @@ -(define-package "thttpd" +(define-package "scratch" (0 1) ((install-lib-version (1 3 0))) (write-to-load-script @@ -8,5 +8,4 @@ (install-file "README" 'doc) (install-file "NEWS" 'doc) (install-string (COPYING) "COPYING" 'doc) - (install-file "packages.scm" 'scheme) - (install-file "tserver.scm" 'scheme)) + (install-file "scratch.scm" 'scheme)) diff --git a/scsh/scratch/scratch.scm b/scsh/scratch/scratch.scm index de8f146..598f53e 100644 --- a/scsh/scratch/scratch.scm +++ b/scsh/scratch/scratch.scm @@ -26,20 +26,19 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -(define (get-response-f lst) - (define (get return) +(define (char-continue lst) + (define (get-char return) (for-each (lambda (element) (set! return (call-with-current-continutation (lambda (r) - (set! get r) + (set! get-char r) (return element))))) lst) (return 'end-generate)) (define (gen) - (call-with-current-continuation get)) + (call-with-current-continuation get-char)) gen) - -(define (get-response l) - (get-response-f l)) +;; test +;; (char-continue l) generates the chars with each call diff --git a/scsh/thttpd/thttpdaemon.scm b/scsh/thttpd/thttpdaemon.scm index 48da24a..89336b4 100644 --- a/scsh/thttpd/thttpdaemon.scm +++ b/scsh/thttpd/thttpdaemon.scm @@ -59,7 +59,7 @@ (call-with-current-continuation get)) gen) -(define (get-response l) +(define (get-response l) ;; make l public and generate without args (get-response-f l)) (define (run-daemon-child-http rec)