home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
s48.zip
/
MISC
/
COMPOSE-.S
< prev
next >
Wrap
Text File
|
1992-06-17
|
1KB
|
41 lines
; Copyright (c) 1992 by Richard Kelsey and Jonathan Rees. See file COPYING.
(define (compose-continuation proc cont)
(primitive-catch
(lambda (k)
(with-continuation (if cont cont null-continuation)
(lambda ()
(proc (primitive-catch
(lambda (k2) (with-continuation k (lambda () k2))))))))))
;(define null-continuation #f)
(define null-continuation (make-continuation 4 #f)) ;temp kludge
(continuation-set! null-continuation 1 0)
(continuation-set! null-continuation 2
(make-template (make-code-vector 1 140) #f '())) ;op/trap
;(put 'primitive-catch 'scheme-indent-hook 0)
;(put 'with-continuation 'scheme-indent-hook 1)
;(define compose-continuation
; (let ((tem
; (let ((cv (make-code-vector 6 0)))
; (code-vector-set! cv 0 op/push) ;push return value
; (code-vector-set! cv 1 op/local) ;fetch procedure
; (code-vector-set! cv 3 1) ;over = 1
; (code-vector-set! cv 4 op/call)
; (code-vector-set! cv 5 1) ;one argument
; (make-template cv 0 '()))))
; (lambda (proc parent-cont)
; (let ((cont (make-continuation 4 #f)))
; (continuation-set! cont 0 parent-cont)
; (continuation-set! cont 1 0) ;pc
; (continuation-set! cont 2 tem) ;template
; (continuation-set! cont 3 (vector #f proc)) ;environment
; cont))))