1 ;;;; SBCL-specific parts of the condition system, i.e. parts which
2 ;;;; don't duplicate/clobber functionality already provided by the
3 ;;;; cross-compilation host Common Lisp
5 ;;;; This software is part of the SBCL system. See the README file for
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
14 (in-package "SB!KERNEL")
16 ;;; not sure this is the right place, but where else?
17 (defun style-warn (format-control &rest format-arguments
)
18 (/show0
"entering STYLE-WARN")
19 (/show format-control format-arguments
)
20 (warn 'simple-style-warning
21 :format-control format-control
22 :format-arguments format-arguments
))
24 ;;; a utility for SIGNAL, ERROR, CERROR, WARN, COMPILER-NOTIFY and
25 ;;; INVOKE-DEBUGGER: Parse the hairy argument conventions into a
26 ;;; single argument that's directly usable by all the other routines.
27 (defun coerce-to-condition (datum arguments default-type fun-name
)
28 (cond ((typep datum
'condition
)
30 (cerror "Ignore the additional arguments."
34 :format-control
"You may not supply additional arguments ~
35 when giving ~S to ~S."
36 :format-arguments
(list datum fun-name
)))
38 ((symbolp datum
) ; roughly, (SUBTYPEP DATUM 'CONDITION)
39 (apply #'make-condition datum arguments
))
40 ((or (stringp datum
) (functionp datum
))
41 (make-condition default-type
43 :format-arguments arguments
))
45 (error 'simple-type-error
47 :expected-type
'(or symbol string
)
48 :format-control
"bad argument to ~S: ~S"
49 :format-arguments
(list fun-name datum
)))))
51 (define-condition layout-invalid
(type-error)
54 (lambda (condition stream
)
56 "~@<invalid structure layout: ~
57 ~2I~_A test for class ~4I~_~S ~
58 ~2I~_was passed the obsolete instance ~4I~_~S~:>"
59 (classoid-proper-name (type-error-expected-type condition
))
60 (type-error-datum condition
)))))
62 (define-condition case-failure
(type-error)
63 ((name :reader case-failure-name
:initarg
:name
)
64 (possibilities :reader case-failure-possibilities
:initarg
:possibilities
))
66 (lambda (condition stream
)
67 (format stream
"~@<~S fell through ~S expression. ~
68 ~:_Wanted one of ~:S.~:>"
69 (type-error-datum condition
)
70 (case-failure-name condition
)
71 (case-failure-possibilities condition
)))))
73 (define-condition simple-control-error
(simple-condition control-error
) ())
74 (define-condition simple-file-error
(simple-condition file-error
) ())
75 (define-condition simple-program-error
(simple-condition program-error
) ())
76 (define-condition simple-stream-error
(simple-condition stream-error
) ())
77 (define-condition simple-parse-error
(simple-condition parse-error
) ())
79 (define-condition control-stack-exhausted
(storage-condition)
82 (lambda (condition stream
)
83 (declare (ignore condition
))
85 "Control stack exhausted (no more space for function call frames). This is probably due to heavily nested or infinitely recursive function calls, or a tail call that SBCL cannot or has not optimized away."))))