0.pre7.127:
[sbcl.git] / src / compiler / generic / interr.lisp
1 ;;;; This file defines all of the internal errors. How they are
2 ;;;; handled is defined in .../code/interr.lisp. How they are signaled
3 ;;;; depends on the machine.
4
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
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.
13
14 (in-package "SB!KERNEL")
15
16 (defun error-number-or-lose (name)
17   (or (position name sb!c:*backend-internal-errors* :key #'car)
18       (error "unknown internal error: ~S" name)))
19
20 ;;; FIXME: Having each of these error handlers be a full, named function
21 ;;; seems to contribute a noticeable amount of bloat and little value.
22 ;;; Perhaps we could just make a single error-handling function with a
23 ;;; big CASE statement inside it? Or at least implement the error handling
24 ;;; functions as closures instead of DEFUNs?
25 (eval-when (:compile-toplevel :execute)
26   (def!macro define-internal-errors (&rest errors)
27              (let ((info (mapcar (lambda (x)
28                                    (if x
29                                        (cons (symbolicate (first x) "-ERROR")
30                                              (second x))
31                                        '(nil . "unused")))
32                                  errors)))
33                `(progn
34                   (setf sb!c:*backend-internal-errors*
35                         ',(coerce info 'vector))
36                   nil))))
37
38 (define-internal-errors
39   (unknown
40    "unknown system lossage")
41   (object-not-fun
42    "Object is not of type FUNCTION.")
43   (object-not-list
44    "Object is not of type LIST.")
45   (object-not-bignum
46    "Object is not of type BIGNUM.")
47   (object-not-ratio
48    "Object is not of type RATIO.")
49   (object-not-single-float
50    "Object is not of type SINGLE-FLOAT.")
51   (object-not-double-float
52    "Object is not of type DOUBLE-FLOAT.")
53   #!+long-float
54   (object-not-long-float
55    "Object is not of type LONG-FLOAT.")
56   (object-not-simple-string
57    "Object is not of type SIMPLE-STRING.")
58   (object-not-simple-bit-vector
59    "Object is not of type SIMPLE-BIT-VECTOR.")
60   (object-not-simple-vector
61    "Object is not of type SIMPLE-VECTOR.")
62   (object-not-fixnum
63    "Object is not of type FIXNUM.")
64   (object-not-vector
65    "Object is not of type VECTOR.")
66   (object-not-string
67    "Object is not of type STRING.")
68   (object-not-bit-vector
69    "Object is not of type BIT-VECTOR.")
70   (object-not-array
71    "Object is not of type ARRAY.")
72   (object-not-number
73    "Object is not of type NUMBER.")
74   (object-not-rational
75    "Object is not of type RATIONAL.")
76   (object-not-float
77    "Object is not of type FLOAT.")
78   (object-not-real
79    "Object is not of type REAL.")
80   (object-not-integer
81    "Object is not of type INTEGER.")
82   (object-not-cons
83    "Object is not of type CONS.")
84   (object-not-symbol
85    "Object is not of type SYMBOL.")
86   (undefined-symbol
87    ;; FIXME: Isn't this used for calls to unbound (SETF FOO) too? If so, revise
88    ;; the name.
89    "An attempt was made to use an undefined FDEFINITION.")
90   (object-not-coerceable-to-fun
91    "Object is not coerceable to type FUNCTION.")
92   (invalid-argument-count
93    "invalid argument count")
94   (bogus-argument-to-values-list
95    "bogus argument to VALUES-LIST")
96   (unbound-symbol
97    "An attempt was made to use an undefined SYMBOL-VALUE.")
98   ;; FIXME: We shouldn't need these placeholder NIL entries any more
99   ;; now that we pass our magic numbers cleanly through sbcl.h.
100   nil 
101   (object-not-sap
102    "Object is not a System Area Pointer (SAP).")
103   (invalid-unwind
104    "attempt to RETURN-FROM a block that no longer exists")
105   (unseen-throw-tag
106    "attempt to THROW to a non-existent tag")
107   (division-by-zero
108    "division by zero")
109   (object-not-type
110    "Object is of the wrong type.")
111   (odd-key-arguments
112    "odd number of &KEY arguments")
113   (unknown-key-argument
114    "unknown &KEY argument")
115   nil
116   nil
117   (invalid-array-index
118    "invalid array index")
119   (wrong-number-of-indices
120    "wrong number of indices")
121   (object-not-simple-array
122    "Object is not of type SIMPLE-ARRAY.")
123   (object-not-signed-byte-32
124    "Object is not of type (SIGNED-BYTE 32).")
125   (object-not-unsigned-byte-32
126    "Object is not of type (UNSIGNED-BYTE 32).")
127   (object-not-simple-array-unsigned-byte-2
128    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 2) (*)).")
129   (object-not-simple-array-unsigned-byte-4
130    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 4) (*)).")
131   (object-not-simple-array-unsigned-byte-8
132    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).")
133   (object-not-simple-array-unsigned-byte-16
134    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 16) (*)).")
135   (object-not-simple-array-unsigned-byte-32
136    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 32) (*)).")
137   (object-not-simple-array-signed-byte-8
138    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 8) (*)).")
139   (object-not-simple-array-signed-byte-16
140    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 16) (*)).")
141   (object-not-simple-array-signed-byte-30
142    "Object is not of type (SIMPLE-ARRAY FIXNUM (*)).")
143   (object-not-simple-array-signed-byte-32
144    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 32) (*)).")
145   (object-not-simple-array-single-float
146    "Object is not of type (SIMPLE-ARRAY SINGLE-FLOAT (*)).")
147   (object-not-simple-array-double-float
148    "Object is not of type (SIMPLE-ARRAY DOUBLE-FLOAT (*)).")
149   #!+long-float
150   (object-not-simple-array-long-float
151    "Object is not of type (SIMPLE-ARRAY LONG-FLOAT (*)).")
152   (object-not-simple-array-complex-single-float
153    "Object is not of type (SIMPLE-ARRAY (COMPLEX SINGLE-FLOAT) (*)).")
154   (object-not-simple-array-complex-double-float
155    "Object is not of type (SIMPLE-ARRAY (COMPLEX DOUBLE-FLOAT) (*)).")
156   #!+long-float
157   (object-not-simple-array-complex-long-float
158    "Object is not of type (SIMPLE-ARRAY (COMPLEX LONG-FLOAT) (*)).")
159   (object-not-complex
160    "Object is not of type COMPLEX.")
161   (object-not-complex-rational
162    "Object is not of type (COMPLEX RATIONAL).")
163   (object-not-complex-float
164    "Object is not of type (COMPLEX FLOAT).")
165   (object-not-complex-single-float
166    "Object is not of type (COMPLEX SINGLE-FLOAT).")
167   (object-not-complex-double-float
168    "Object is not of type (COMPLEX DOUBLE-FLOAT).")
169   #!+long-float
170   (object-not-complex-long-float
171    "Object is not of type (COMPLEX LONG-FLOAT).")
172   (object-not-weak-pointer
173    "Object is not a WEAK-POINTER.")
174   (object-not-instance
175    "Object is not a INSTANCE.")
176   (object-not-base-char
177    "Object is not of type BASE-CHAR.")
178   (nil-fun-returned
179    "A function with declared result type NIL returned.")
180   (layout-invalid
181    "Object layout is invalid. (indicates obsolete instance)")
182   (object-not-complex-vector
183    "Object is not a complex (non-SIMPLE-ARRAY) vector."))