new function: is_lisp_immediate()
[sbcl/pkhuong.git] / src / code / error-error.lisp
blob5d3be6f1b4f8a640428ac3b7cc114f101316479f
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!IMPL")
12 ;;; These specials are used by ERROR-ERROR to track the success of recovery
13 ;;; attempts.
14 (defvar *error-error-depth* 0)
16 ;;; ERROR-ERROR can be called when the error system is in trouble and needs to
17 ;;; punt fast. It prints a message without using FORMAT. If we get into this
18 ;;; recursively, then we halt.
19 (defun error-error (&rest messages)
20 (let ((*error-error-depth* (1+ *error-error-depth*)))
21 (case *error-error-depth*
22 (1)
24 (stream-cold-init-or-reset))
26 (/show0 "*ERROR-ERROR-DEPTH* too big, trying THROW")
27 (throw 'toplevel-catcher nil))
29 (/show0 "*ERROR-ERROR-DEPTH* too big, trying HALT")
30 (%primitive sb!c:halt)
31 (/show0 "*ERROR-ERROR-DEPTH* too big, trying THROW")
32 (throw 'toplevel-catcher nil)))
34 (with-standard-io-syntax
35 (let ((*print-readably* nil))
36 (dolist (item messages)
37 (princ item *terminal-io*))
38 (terpri *terminal-io*)
39 (sb!debug:backtrace most-positive-fixnum *terminal-io*)
40 (force-output *terminal-io*)
41 (invoke-debugger
42 (coerce-to-condition "Maximum error nesting depth exceeded" nil
43 'simple-error
44 'error))))))