0.8.16.9:
[sbcl.git] / src / code / class.lisp
index 8da8e98..e6b0b8b 100644 (file)
                              inherits
                              :key #'layout-proper-name)
                (warn "change in superclasses of class ~S:~%  ~
-                      ~A superclasses: ~S~%  ~
-                      ~A superclasses: ~S"
+                       ~A superclasses: ~S~%  ~
+                       ~A superclasses: ~S"
                      name
                      old-context
                      (map 'list #'layout-proper-name old-inherits)
                (when diff
                  (warn
                   "in class ~S:~%  ~
-                   ~:(~A~) definition of superclass ~S is incompatible with~%  ~
-                   ~A definition."
+                    ~:(~A~) definition of superclass ~S is incompatible with~%  ~
+                    ~A definition."
                   name
                   old-context
                   (layout-proper-name (svref old-inherits diff))
        (let ((old-length (layout-length old-layout)))
          (unless (= old-length length)
            (warn "change in instance length of class ~S:~%  ~
-                  ~A length: ~W~%  ~
-                  ~A length: ~W"
+                   ~A length: ~W~%  ~
+                   ~A length: ~W"
                  name
                  old-context old-length
                  context length)
            t))
        (unless (= (layout-depthoid old-layout) depthoid)
          (warn "change in the inheritance structure of class ~S~%  ~
-                between the ~A definition and the ~A definition"
+                 between the ~A definition and the ~A definition"
                name old-context context)
          t))))
 
     ;; system from scratch, so we no longer need this functionality in
     ;; order to maintain the SBCL system by modifying running images.
     (error "The class ~S was not changed, and there's no guarantee that~@
-           the loaded code (which expected another layout) will work."
+            the loaded code (which expected another layout) will work."
           (layout-proper-name layout)))
   (values))
 
 (eval-when (#-sb-xc :compile-toplevel :load-toplevel :execute)
 (defun find-classoid (name &optional (errorp t) environment)
   #!+sb-doc
-  "Return the class with the specified NAME. If ERRORP is false, then NIL is
-   returned when no such class exists."
+  "Return the class with the specified NAME. If ERRORP is false, then
+NIL is returned when no such class exists."
   (declare (type symbol name) (ignore environment))
   (let ((res (classoid-cell-classoid (find-classoid-cell name))))
     (if (or res (not errorp))
        res
-       (error "class not yet defined:~%  ~S" name))))
+       (error 'simple-type-error
+               :datum nil
+               :expected-type 'class
+               :format-control "class not yet defined:~%  ~S" 
+               :format-arguments (list name)))))
 (defun (setf find-classoid) (new-value name)
   #-sb-xc (declare (type (or null classoid) new-value))
   (cond
       (values nil nil)
       (invoke-complex-subtypep-arg1-method type1 class2 nil t)))
 
+(!define-type-method (classoid :negate) (type)
+  (make-negation-type :type type))
+
 (!define-type-method (classoid :unparse) (type)
   (classoid-proper-name type))
 \f
   (setq
    *built-in-classes*
    '((t :state :read-only :translation t)
-     (character :enumerable t :translation base-char
-                :prototype-form (code-char 42))
-     (base-char :enumerable t
-               :inherits (character)
-               :codes (#.sb!vm:base-char-widetag)
+     (character :enumerable t 
+                :codes (#.sb!vm:character-widetag)
                 :prototype-form (code-char 42))
      (symbol :codes (#.sb!vm:symbol-header-widetag)
              :prototype-form '#:mu)
       :translation (and integer (not fixnum))
       :inherits (integer rational real number)
       :codes (#.sb!vm:bignum-widetag)
-      ;; FIXME: wrong for 64-bit!
-      :prototype-form (expt 2 42))
+      :prototype-form (expt 2 #.(* sb!vm:n-word-bits (/ 3 2))))
 
      (array :translation array :codes (#.sb!vm:complex-array-widetag)
             :hierarchical-p nil
       :direct-superclasses (vector simple-array)
       :inherits (vector simple-array array sequence)
       :prototype-form (make-array 0 :element-type '(unsigned-byte 4)))
+     (simple-array-unsigned-byte-7
+      :translation (simple-array (unsigned-byte 7) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-7-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 7)))
      (simple-array-unsigned-byte-8
       :translation (simple-array (unsigned-byte 8) (*))
       :codes (#.sb!vm:simple-array-unsigned-byte-8-widetag)
       :direct-superclasses (vector simple-array)
       :inherits (vector simple-array array sequence)
       :prototype-form (make-array 0 :element-type '(unsigned-byte 8)))
+     (simple-array-unsigned-byte-15
+      :translation (simple-array (unsigned-byte 15) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-15-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 15)))
      (simple-array-unsigned-byte-16
       :translation (simple-array (unsigned-byte 16) (*))
       :codes (#.sb!vm:simple-array-unsigned-byte-16-widetag)
       :direct-superclasses (vector simple-array)
       :inherits (vector simple-array array sequence)
       :prototype-form (make-array 0 :element-type '(unsigned-byte 16)))
+     #!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or))
+     (simple-array-unsigned-byte-29
+      :translation (simple-array (unsigned-byte 29) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-29-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 29)))
+     (simple-array-unsigned-byte-31
+      :translation (simple-array (unsigned-byte 31) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-31-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 31)))
      (simple-array-unsigned-byte-32
       :translation (simple-array (unsigned-byte 32) (*))
       :codes (#.sb!vm:simple-array-unsigned-byte-32-widetag)
       :direct-superclasses (vector simple-array)
       :inherits (vector simple-array array sequence)
       :prototype-form (make-array 0 :element-type '(unsigned-byte 32)))
+     #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
+     (simple-array-unsigned-byte-60
+      :translation (simple-array (unsigned-byte 60) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-60-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 60)))
+     #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
+     (simple-array-unsigned-byte-63
+      :translation (simple-array (unsigned-byte 63) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-63-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 63)))
+     #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
+     (simple-array-unsigned-byte-64
+      :translation (simple-array (unsigned-byte 64) (*))
+      :codes (#.sb!vm:simple-array-unsigned-byte-64-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(unsigned-byte 64)))
      (simple-array-signed-byte-8
       :translation (simple-array (signed-byte 8) (*))
       :codes (#.sb!vm:simple-array-signed-byte-8-widetag)
       :direct-superclasses (vector simple-array)
       :inherits (vector simple-array array sequence)
       :prototype-form (make-array 0 :element-type '(signed-byte 16)))
+     #!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or))
      (simple-array-signed-byte-30
       :translation (simple-array (signed-byte 30) (*))
       :codes (#.sb!vm:simple-array-signed-byte-30-widetag)
       :direct-superclasses (vector simple-array)
       :inherits (vector simple-array array sequence)
       :prototype-form (make-array 0 :element-type '(signed-byte 32)))
+     #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
+     (simple-array-signed-byte-61
+      :translation (simple-array (signed-byte 61) (*))
+      :codes (#.sb!vm:simple-array-signed-byte-61-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(signed-byte 61)))
+     #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
+     (simple-array-signed-byte-64
+      :translation (simple-array (signed-byte 64) (*))
+      :codes (#.sb!vm:simple-array-signed-byte-64-widetag)
+      :direct-superclasses (vector simple-array)
+      :inherits (vector simple-array array sequence)
+      :prototype-form (make-array 0 :element-type '(signed-byte 64)))
      (simple-array-single-float
       :translation (simple-array single-float (*))
       :codes (#.sb!vm:simple-array-single-float-widetag)
                   name
                   layout))))))
 
-;;; a vector that maps type codes to layouts, used for quickly finding
-;;; the layouts of built-in classes
-(defvar *built-in-class-codes*) ; initialized in cold load
-(declaim (type simple-vector *built-in-class-codes*))
-
 (!cold-init-forms
   #-sb-xc-host (/show0 "about to set *BUILT-IN-CLASS-CODES*")
   (setq *built-in-class-codes*