;;; KLUDGE: we PROCLAIM these special here so that we can use restart
;;; macros in the compiler before the DEFVARs are compiled.
-(sb!xc:proclaim
- '(special *handler-clusters* *restart-clusters* *condition-restarts*))
+;;;
+;;; For an explanation of these data structures, see DEFVARs in
+;;; target-error.lisp.
+(sb!xc:proclaim '(special *handler-clusters* *restart-clusters* *condition-restarts*))
(defmacro-mundanely with-condition-restarts
(condition-form restarts-form &body body)
;;;; files for more information.
(in-package "SB!KERNEL")
-\f
-;;; a list of lists of restarts
-(defvar *restart-clusters* '())
-
-;;; an ALIST (condition . restarts) which records the restarts currently
-;;; associated with Condition
-(defvar *condition-restarts* ())
(defun muffle-warning-p (warning)
(declare (special *muffled-warnings*))
(when (muffle-warning-p warning)
(muffle-warning warning)))))))
+;;; an alist with elements of the form
+;;;
+;;; (CONDITION . (HANDLER1 HANDLER2 ...))
+;;;
+;;; Recently established handlers are added at the beginning of the
+;;; list. Elements to the left of the alist take precedence over
+;;; elements to the right.
(defvar *handler-clusters* (initial-handler-clusters))
+;;; a list of lists of currently active RESTART instances. maintained
+;;; by RESTART-BIND.
+(defvar *restart-clusters* '())
+
+;;; an ALIST with elements of the form
+;;;
+;;; (CONDITION . (RESTART1 RESTART2 ...))
+;;;
+;;; which records the restarts currently associated with
+;;; conditions. maintained by WITH-CONDITION-RESTARTS.
+(defvar *condition-restarts* ())
+
(defstruct (restart (:copier nil) (:predicate nil))
(name (missing-arg) :type symbol :read-only t)
(function (missing-arg) :type function)
(prin1 (restart-name restart) stream))
(restart-report restart stream)))
+#!+sb-doc
+(setf (fdocumentation 'restart-name 'function)
+ "Return the name of the given restart object.")
+
+(defun restart-report (restart stream)
+ (funcall (or (restart-report-function restart)
+ (lambda (stream)
+ (format stream "~S" (or (restart-name restart)
+ restart))))
+ stream))
+
(defvar *restart-test-stack* nil)
(defun compute-restarts (&optional condition)
(res restart)))))
(res))))
-#!+sb-doc
-(setf (fdocumentation 'restart-name 'function)
- "Return the name of the given restart object.")
-
-(defun restart-report (restart stream)
- (funcall (or (restart-report-function restart)
- (let ((name (restart-name restart)))
- (lambda (stream)
- (if name (format stream "~S" name)
- (format stream "~S" restart)))))
- stream))
-
(defun find-restart (identifier &optional condition)
#!+sb-doc
"Return the first restart identified by IDENTIFIER. If IDENTIFIER is a symbol,