1.0.28.19: faster ARRAY-DIMENSION for non-vectors
[sbcl.git] / src / code / condition.lisp
index 59afa4a..7cc8946 100644 (file)
              "end of file on ~S"
              (stream-error-stream condition)))))
 
+(define-condition closed-stream-error (stream-error) ()
+  (:report
+   (lambda (condition stream)
+     (format stream "~S is closed" (stream-error-stream condition)))))
+
 (define-condition file-error (error)
   ((pathname :reader file-error-pathname :initarg :pathname))
   (:report
 (define-condition simple-reference-error (reference-condition simple-error)
   ())
 
+(define-condition simple-reference-warning (reference-condition simple-warning)
+  ())
+
 (define-condition duplicate-definition (reference-condition warning)
   ((name :initarg :name :reader duplicate-definition-name))
   (:report (lambda (c s)
                    '(:ansi-cl :function make-array)
                    '(:ansi-cl :function sb!xc:upgraded-array-element-type))))
 
-(define-condition displaced-to-array-too-small-error
-    (reference-condition simple-error)
-  ()
-  (:default-initargs
-      :references (list '(:ansi-cl :function adjust-array))))
-
 (define-condition type-warning (reference-condition simple-warning)
   ()
   (:default-initargs :references (list '(:sbcl :node "Handling of Types"))))
@@ -1093,6 +1095,21 @@ SB-EXT:PACKAGE-LOCKED-ERROR-SYMBOL."))
                     "No traps are enabled? How can this be?"
                     stream))))))
 
+(define-condition invalid-array-index-error (type-error)
+  ((array :initarg :array :reader invalid-array-index-error-array)
+   (axis :initarg :axis :reader invalid-array-index-error-axis))
+  (:report
+   (lambda (condition stream)
+     (let ((array (invalid-array-index-error-array condition)))
+       (format stream "Index ~W out of bounds for ~@[axis ~W of ~]~S, ~
+                       should be nonnegative and <~W."
+               (type-error-datum condition)
+               (when (> (array-rank array) 1)
+                 (invalid-array-index-error-axis condition))
+               (type-of array)
+               ;; Extract the bound from (INTEGER 0 (BOUND))
+               (caaddr (type-error-expected-type condition)))))))
+
 (define-condition index-too-large-error (type-error)
   ()
   (:report
@@ -1177,6 +1194,14 @@ SB-EXT:PACKAGE-LOCKED-ERROR-SYMBOL."))
                (simple-condition-format-arguments condition)
                (reader-impossible-number-error-error condition))))))
 
+(define-condition standard-readtable-modified-error (reference-condition error)
+  ((operation :initarg :operation :reader standard-readtable-modified-operation))
+  (:report (lambda (condition stream)
+             (format stream "~S would modify the standard readtable."
+                     (standard-readtable-modified-operation condition))))
+  (:default-initargs :references `((:ansi-cl :section (2 1 1 2))
+                                   (:ansi-cl :glossary "standard readtable"))))
+
 (define-condition timeout (serious-condition)
   ((seconds :initarg :seconds :initform nil :reader timeout-seconds))
   (:report (lambda (condition stream)
@@ -1276,8 +1301,9 @@ the values returned by the form as a list. No associated restarts."))
 \f
 ;;; A knob for muffling warnings, mostly for use while loading files.
 (defvar *muffled-warnings* 'uninteresting-redefinition
-  "A type that ought to specify a subtype of WARNING.  Whenever a warning
-is signaled, if the warning if of this type, it will be muffled.")
+  "A type that ought to specify a subtype of WARNING.  Whenever a
+warning is signaled, if the warning if of this type and is not
+handled by any other handler, it will be muffled.")
 \f
 ;;; Various STYLE-WARNING signaled in the system.
 ;; For the moment, we're only getting into the details for function
@@ -1398,11 +1424,10 @@ is signaled, if the warning if of this type, it will be muffled.")
        ;; clearly uninteresting, and we'll say arbitrarily that
        ;; replacing an interpreted function with an interpreted
        ;; function is uninteresting, too, but leave out the
-       ;; compiled-to-interpreted and interpreted-to-compiled cases.
-       (when (or (and (typep old-fdefn
-                             '(or #!+sb-eval sb!eval:interpreted-function))
-                      (typep new-fdefn
-                             '(or #!+sb-eval sb!eval:interpreted-function)))
+       ;; compiled-to-interpreted case.
+       (when (or (typep
+                  old-fdefn
+                  '(or #!+sb-eval sb!eval:interpreted-function))
                  (and (typep old-fdefn
                              '(and compiled-function
                                (not funcallable-instance)))
@@ -1468,7 +1493,7 @@ is signaled, if the warning if of this type, it will be muffled.")
                      (redefinition-with-deftransform-transform warning)))))
 \f
 ;;; Various other STYLE-WARNINGS
-(define-condition ignoring-asterisks-in-variable-name
+(define-condition dubious-asterisks-around-variable-name
     (style-warning simple-condition)
   ()
   (:report (lambda (warning stream)
@@ -1477,15 +1502,17 @@ the usual naming convention (names like *FOO*) for special variables"
                      (simple-condition-format-control warning)
                      (simple-condition-format-arguments warning)))))
 
-(define-condition ignoring-asterisks-in-lexical-variable-name
-    (ignoring-asterisks-in-variable-name)
+(define-condition asterisks-around-lexical-variable-name
+    (dubious-asterisks-around-variable-name)
   ())
 
-(define-condition ignoring-asterisks-in-constant-variable-name
-    (ignoring-asterisks-in-variable-name)
+(define-condition asterisks-around-constant-variable-name
+    (dubious-asterisks-around-variable-name)
   ())
 
-(define-condition undefined-alien (style-warning)
+;; We call this UNDEFINED-ALIEN-STYLE-WARNING because there are some
+;; subclasses of ERROR above having to do with undefined aliens.
+(define-condition undefined-alien-style-warning (style-warning)
   ((symbol :initarg :symbol :reader undefined-alien-symbol))
   (:report (lambda (warning stream)
              (format stream "Undefined alien: ~S"