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