;;; -*-Scheme-*-
;;;
-;;; $Id: comred.scm,v 1.109 1993/10/26 18:42:29 cph Exp $
+;;; $Id: comred.scm,v 1.110 1993/12/17 00:09:21 cph Exp $
;;;
;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
;;;
(define (bind-abort-editor-command thunk)
(call-with-current-continuation
(lambda (continuation)
- (bind-restart 'ABORT-EDITOR-COMMAND "Return to the editor command loop."
+ (with-restart 'ABORT-EDITOR-COMMAND "Return to the editor command loop."
(lambda (#!optional input)
(within-continuation continuation
(lambda ()
(begin
(reset-command-state!)
(apply-input-event input))))))
- (lambda (restart) restart (thunk))))))
+ values
+ thunk))))
(define (return-to-command-loop condition)
(let ((restart (find-restart 'ABORT-EDITOR-COMMAND)))
;;; -*-Scheme-*-
;;;
-;;; $Id: schmod.scm,v 1.35 1993/12/10 19:25:09 cph Exp $
+;;; $Id: schmod.scm,v 1.36 1993/12/17 00:09:14 cph Exp $
;;;
;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
;;;
(WITHIN-CONTINUATION . 1)
(MAKE-CONDITION-TYPE . 3)
- (BIND-RESTART . 3)
+ (WITH-RESTART . 4)
(WITH-SIMPLE-RESTART . 2)
(BIND-CONDITION-HANDLER . 2)
(LIST-TRANSFORM-POSITIVE . 1)
#| -*-Scheme-*-
-$Id: advice.scm,v 14.13 1993/10/21 11:49:41 cph Exp $
+$Id: advice.scm,v 14.14 1993/12/17 00:05:20 cph Exp $
Copyright (c) 1988-93 Massachusetts Institute of Technology
(call-with-current-continuation
(lambda (continuation)
(fluid-let ((advice-continuation continuation))
- (bind-restart 'USE-VALUE
+ (with-restart 'USE-VALUE
"Return a value from the advised procedure."
continuation
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (lambda ()
- (prompt-for-evaluated-expression "Procedure value")))
+ (lambda ()
+ (prompt-for-evaluated-expression "Procedure value"))
+ (lambda ()
(for-each (lambda (advice)
(with-simple-restart 'CONTINUE
"Continue with advised procedure."
#| -*-Scheme-*-
-$Id: error.scm,v 14.40 1993/12/17 00:03:57 cph Exp $
+$Id: error.scm,v 14.41 1993/12/17 00:11:59 cph Exp $
Copyright (c) 1988-93 Massachusetts Institute of Technology
'WITH-RESTART))
(let ((restart (%make-restart name reporter effector interactor)))
(fluid-let ((*bound-restarts* (cons restart *bound-restarts*)))
- (receiver restart))))
+ (thunk))))
(define (with-simple-restart name reporter thunk)
(call-with-current-continuation
(define (restart/put! restart key datum)
(if (eq? key 'INTERACTIVE)
- (set-restart/interactor! restart datum)
+ (set-%restart/interactor! restart datum)
(1d-table/put! (restart/properties restart) key datum)))
(define (bind-restart name reporter effector receiver)
#| -*-Scheme-*-
-$Id: rep.scm,v 14.45 1993/12/06 19:34:06 cph Exp $
+$Id: rep.scm,v 14.46 1993/12/17 00:09:03 cph Exp $
Copyright (c) 1988-93 Massachusetts Institute of Technology
(define (bind-abort-restart cmdl thunk)
(call-with-current-continuation
(lambda (continuation)
- (bind-restart 'ABORT
+ (with-restart 'ABORT
(string-append "Return to "
(if (repl? cmdl)
"read-eval-print"
(port/set-default-directory port
(working-directory-pathname))))
(if (default-object? message) "Abort!" message))))
- (lambda (restart)
- (restart/put! restart cmdl-abort-restart-tag cmdl)
+ values
+ (lambda ()
+ (restart/put! (first-bound-restart) cmdl-abort-restart-tag cmdl)
(thunk))))))
+(define (cmdl-abort-restart? restart)
+ (restart/get restart cmdl-abort-restart-tag))
+
(define *nearest-cmdl*)
(define (nearest-cmdl)
(define (invoke-abort restart message)
(let ((effector (restart/effector restart)))
- (if (restart/get restart cmdl-abort-restart-tag)
+ (if (cmdl-abort-restart? restart)
(effector message)
(effector))))
(let loop ((restarts restarts))
(if (null? restarts)
'()
- (cons (car restarts)
- (if (restart/get (car restarts) cmdl-abort-restart-tag)
- (list-transform-positive (cdr restarts)
- (lambda (restart)
- (restart/get restart cmdl-abort-restart-tag)))
- (loop (cdr restarts)))))))
+ (let ((rest
+ (if (cmdl-abort-restart? (car restarts))
+ (list-transform-positive (cdr restarts) cmdl-abort-restart?)
+ (loop (cdr restarts)))))
+ (if (restart/interactor (car restarts))
+ (cons (car restarts) rest)
+ rest)))))
\f
(define-structure (repl-state
(conc-name repl-state/)
(call-with-current-continuation
(lambda (restart-continuation)
(let ((continuation (or continuation restart-continuation)))
- (bind-restart 'CONTINUE
+ (with-restart 'CONTINUE
(if (string=? "bkpt>" prompt)
"Return from BKPT."
"Continue from breakpoint.")
(lambda () (restart-continuation unspecific))
- (lambda (restart)
- restart
+ values
+ (lambda ()
(call-with-values
(lambda ()
(get-breakpoint-environment continuation environment message))
#| -*-Scheme-*-
-$Id: uerror.scm,v 14.36 1993/12/14 22:22:49 cph Exp $
+$Id: uerror.scm,v 14.37 1993/12/17 00:05:57 cph Exp $
Copyright (c) 1988-93 Massachusetts Institute of Technology
;;;; Restart Bindings
(define (unbound-variable/store-value continuation environment name thunk)
- (bind-restart 'STORE-VALUE
+ (with-restart 'STORE-VALUE
(lambda (port)
(write-string "Define " port)
(write name port)
(lambda (value)
(local-assignment environment name value)
(continuation unspecific))
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (let ((prompt (string-append "Define " (write-to-string name) " as")))
- (lambda ()
- (values (prompt-for-evaluated-expression prompt environment)))))
- (thunk))))
+ (let ((prompt (string-append "Define " (write-to-string name) " as")))
+ (lambda ()
+ (values (prompt-for-evaluated-expression prompt environment))))
+ thunk))
(define (unassigned-variable/store-value continuation environment name thunk)
- (bind-restart 'STORE-VALUE
+ (with-restart 'STORE-VALUE
(lambda (port)
(write-string "Set " port)
(write name port)
(lambda (value)
(environment-assign! environment name value)
(continuation unspecific))
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (let ((prompt (string-append "Set " (write-to-string name) " to")))
- (lambda ()
- (values (prompt-for-evaluated-expression prompt environment)))))
- (thunk))))
+ (let ((prompt (string-append "Set " (write-to-string name) " to")))
+ (lambda ()
+ (values (prompt-for-evaluated-expression prompt environment))))
+ thunk))
(define (variable/use-value continuation environment name thunk)
(let ((continuation (continuation/next-continuation continuation)))
(if continuation
- (bind-restart 'USE-VALUE
+ (with-restart 'USE-VALUE
(lambda (port)
(write-string "Specify a value to use instead of " port)
(write name port)
(write-string "." port))
continuation
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (let ((prompt
- (string-append "Value to use instead of "
- (write-to-string name))))
- (lambda ()
- (values
- (prompt-for-evaluated-expression prompt environment)))))
- (thunk)))
+ (let ((prompt
+ (string-append "Value to use instead of "
+ (write-to-string name))))
+ (lambda ()
+ (values
+ (prompt-for-evaluated-expression prompt environment))))
+ thunk)
(thunk))))
(define (inapplicable-object/use-value continuation operands thunk)
(let ((continuation (continuation/next-continuation continuation)))
(if continuation
- (bind-restart 'USE-VALUE "Specify a procedure to use in its place."
+ (with-restart 'USE-VALUE "Specify a procedure to use in its place."
(lambda (operator)
(within-continuation continuation
(lambda ()
(apply operator operands))))
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (lambda ()
- (values (prompt-for-evaluated-expression "New procedure"))))
- (thunk)))
+ (lambda ()
+ (values (prompt-for-evaluated-expression "New procedure")))
+ thunk)
(thunk))))
\f
(define (illegal-arg-signaller type)
(define (illegal-argument/use-value continuation operator operands index thunk)
(let ((continuation (continuation/next-continuation continuation)))
(if continuation
- (bind-restart 'USE-VALUE "Specify an argument to use in its place."
+ (with-restart 'USE-VALUE "Specify an argument to use in its place."
(lambda (operand)
(within-continuation continuation
(lambda ()
(apply operator
(substitute-element operands index operand)))))
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (lambda ()
- (values (prompt-for-evaluated-expression "New argument"))))
- (thunk)))
+ (lambda ()
+ (values (prompt-for-evaluated-expression "New argument")))
+ thunk)
(thunk))))
(define (file-operation-signaller)
verb noun thunk)
(let ((continuation (continuation/next-continuation continuation)))
(if continuation
- (bind-restart 'USE-VALUE
+ (with-restart 'USE-VALUE
(string-append "Try to " verb " a different " noun ".")
(lambda (operand)
(within-continuation continuation
(lambda ()
(apply operator
(substitute-element operands index operand)))))
- (let ((prompt
- (string-append "New "
- noun
- " name (an expression to be evaluated)")))
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE
- (lambda ()
- (values (prompt-for-evaluated-expression prompt))))
- (thunk))))
+ (let ((prompt
+ (string-append "New "
+ noun
+ " name (an expression to be evaluated)")))
+ (lambda ()
+ (values (prompt-for-evaluated-expression prompt))))
+ thunk)
(thunk))))
(define (file-operation/retry continuation operator operands verb noun thunk)
(let ((continuation (continuation/next-continuation continuation)))
(if continuation
- (bind-restart 'RETRY
+ (with-restart 'RETRY
(string-append "Try to " verb " the same " noun " again.")
(lambda ()
(within-continuation continuation
(lambda ()
(apply operator operands))))
- (lambda (restart)
- (restart/put! restart 'INTERACTIVE values)
- (thunk)))
+ values
+ thunk)
(thunk))))
(define (substitute-element list index element)
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.220 1993/12/05 06:15:14 cph Exp $
+$Id: runtime.pkg,v 14.221 1993/12/17 00:05:06 cph Exp $
Copyright (c) 1988-1993 Massachusetts Institute of Technology
error:wrong-type-argument
error:wrong-type-datum
find-restart
+ first-bound-restart
format-error-message
hook/invoke-condition-handler
ignore-errors
muffle-warning
restart/effector
restart/get
+ restart/interactor
restart/name
restart/properties
restart/put!
store-value
use-value
warn
+ with-restart
with-simple-restart
write-condition-report
write-restart-report)