Changeset 312


Ignore:
Timestamp:
Jan 17, 2004, 7:40:32 PM (21 years ago)
Author:
Gary Byers
Message:

Use safer accessors. (May revert back some cases, since .accessors should
now use INSTANCE-SLOTS rather than INSTANCE.SLOTS.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-clos.lisp

    r284 r312  
    2828
    2929(defun extract-instance-direct-slotds (class)
    30   (extract-slotds-with-allocation :instance (%class.direct-slots class)))
     30  (extract-slotds-with-allocation :instance (%class-direct-slots class)))
    3131
    3232(defun extract-class-direct-slotds (class)
    33   (extract-slotds-with-allocation :class (%class.direct-slots class)))
     33  (extract-slotds-with-allocation :class (%class-direct-slots class)))
    3434
    3535(defun extract-instance-effective-slotds (class)
     
    5050
    5151(defun direct-instance-and-class-slotds (class)
    52   (extract-instance-and-class-slotds (%class.direct-slots class)))
     52  (extract-instance-and-class-slotds (%class-direct-slots class)))
    5353
    5454(defun effective-instance-and-class-slotds (class)
    55   (extract-instance-and-class-slotds (%class.slots class)))
     55  (extract-instance-and-class-slotds (%class-slots class)))
    5656
    5757(defun %shared-initialize (instance slot-names initargs)
     
    6767      (update-obsolete-instance instance)
    6868      (setq wrapper (instance.class-wrapper instance)))
    69     (dolist (slotd (%class.slots class))
     69    (dolist (slotd (%class-slots class))
    7070      (let* ((loc (%slot-definition-location slotd)))
    7171        (unless loc (error "Blew it! no location for ~s" slotd))
     
    288288                               (- (%slot-definition-location e) 1)))
    289289                      (%slot-definition-name e)))))
    290            (old-wrapper (%class.own-wrapper class))
     290           (old-wrapper (%class-own-wrapper class))
    291291           (old-ordering (if old-wrapper (%wrapper-instance-slots old-wrapper)))
    292292           (new-wrapper
     
    303303                   #|(%class.own-wrapper class)|#
    304304                   (%cons-wrapper class)))))
    305       (setf (%class.slots class) eslotds)
     305      (setf (%class-slots class) eslotds)
    306306      (setf (%wrapper-instance-slots new-wrapper) new-ordering
    307307            (%wrapper-class-slots new-wrapper) (%class-get class :class-slots)
    308             (%class.own-wrapper class) new-wrapper)
     308            (%class-own-wrapper class) new-wrapper)
    309309      (setup-slot-lookup new-wrapper eslotds))))
    310310
     
    390390
    391391(defmethod add-direct-subclass ((class class) (subclass class))
    392   (pushnew subclass (%class.subclasses class))
     392  (pushnew subclass (%class-direct-subclasses class))
    393393  subclass)
    394394
    395395(defmethod remove-direct-subclass ((class class) (subclass class))
    396   (setf (%class.subclasses class)
    397         (remove subclass (%class.subclasses class)))
     396  (setf (%class-direct-subclasses class)
     397        (remove subclass (%class-direct-subclasses class)))
    398398  subclass)
    399399
    400400(defun add-direct-subclasses (class new)
    401401  (dolist (n new)
    402     (unless (memq class (%class.subclasses  class))
     402    (unless (memq class (%class-direct-subclasses  class))
    403403      (add-direct-subclass n class))))
    404404
     
    416416;;; both UPDATE-CPL and UPDATE-SLOTS have been called on the class.
    417417(defmethod class-finalized-p ((class std-class))
    418   (let* ((w (%class.own-wrapper class)))
     418  (let* ((w (%class-own-wrapper class)))
    419419    (and w (typep (%wrapper-instance-slots w) 'vector))))
    420420
     
    485485  (or (forward-referenced-class-p class)
    486486      (some #'class-has-a-forward-referenced-superclass-p
    487             (%class.local-supers class))))
     487            (%class-direct-superclasses class))))
    488488
    489489(defun update-cpl (class cpl)
     
    561561                    but the meta-classes ~S and~%~S are incompatible."
    562562                 superclass class (class-of superclass) (class-of class))))
    563       (setf (%class.local-supers class) direct-superclasses))
    564     (setq direct-superclasses (%class.local-supers class)))
     563      (setf (%class-direct-superclasses class) direct-superclasses))
     564    (setq direct-superclasses (%class-direct-superclasses class)))
    565565  (setq direct-slots
    566566        (if direct-slots-p
    567           (setf (%class.direct-slots class)
     567          (setf (%class-direct-slots class)
    568568                (mapcar #'(lambda (initargs)
    569569                            (make-direct-slot-definition class initargs))
    570570                        direct-slots))
    571           (%class.direct-slots class)))
     571          (%class-direct-slots class)))
    572572  (if direct-default-initargs-p
    573       (setf (%class.local-default-initargs class)  direct-default-initargs)
    574       (setq direct-default-initargs (%class.local-default-initargs class)))
     573      (setf (%class-direct-default-initargs class)  direct-default-initargs)
     574      (setq direct-default-initargs (%class-direct-default-initargs class)))
    575575  (let* ((class-slot-cells ()))
    576576    (dolist (slot direct-slots)
     
    702702
    703703(defun %find-direct-slotd (class name)
    704   (dolist (dslotd (%class.direct-slots class)
     704  (dolist (dslotd (%class-direct-slots class)
    705705           (error "Direct slot definition for ~s not found in ~s" name class))
    706706    (when (eq (%slot-definition-name dslotd) name)
     
    712712      (destructuring-bind (slot-name &rest readers) pair
    713713        (setf (%slot-definition-readers (%find-direct-slotd class slot-name)) readers)))
    714     (add-accessor-methods class (%class.direct-slots class))))
     714    (add-accessor-methods class (%class-direct-slots class))))
    715715
    716716(defun %add-slot-writers (class-name pairs)
     
    719719      (destructuring-bind (slot-name &rest readers) pair
    720720        (setf (%slot-definition-writers (%find-direct-slotd class slot-name)) readers)))
    721     (add-accessor-methods class (%class.direct-slots class))))
    722 
    723 
    724 
    725 
     721    (add-accessor-methods class (%class-direct-slots class))))
    726722
    727723
     
    10801076  (declare (ignore slot-names))
    10811077  (labels ((obsolete (class)
    1082              (dolist (sub (%class.subclasses class)) (obsolete sub))
     1078             (dolist (sub (%class-direct-subclasses class)) (obsolete sub))
    10831079             ;;Need to save old class info in wrapper for obsolete instance access...
    10841080             (setf (%class.cpl class) nil)))
    10851081    (obsolete class)
    10861082    (when direct-superclasses-p
    1087       (let* ((old-supers (%class.local-supers class))
     1083      (let* ((old-supers (%class-direct-superclasses class))
    10881084             (new-supers direct-superclasses))
    10891085        (dolist (c old-supers)
     
    10941090            (add-direct-subclass c class)))
    10951091        (setf (%class.local-supers class) new-supers)))
    1096     (unless (%class.own-wrapper class)
    1097       (setf (%class.own-wrapper class) (%cons-wrapper class)))
     1092    (unless (%class-own-wrapper class)
     1093      (setf (%class-own-wrapper class) (%cons-wrapper class)))
    10981094    (update-cpl class (compute-cpl class))))
    10991095             
     
    11621158      (fdefinition '%class-default-initargs) #'class-default-initargs
    11631159      (fdefinition '%class-direct-default-initargs) #'class-direct-default-initargs
     1160      (fdefinition '(setf %class-direct-default-initargs))
     1161      #'(lambda (new class)
     1162          (if (typep class 'slots-class)
     1163            (setf (slot-value class 'direct-default-initargs) new)
     1164            new))
    11641165      (fdefinition '%class-direct-slots) #'class-direct-slots
     1166      (fdefinition '(setf %class-direct-slots))
     1167                   #'(lambda (new class)
     1168                       (if (typep class 'slots-class)
     1169                         (setf (slot-value class 'direct-slots) new)
     1170                         new))
    11651171      (fdefinition '%class-slots) #'class-slots
    11661172      (fdefinition '%class-direct-superclasses) #'class-direct-superclasses
    1167       (fdefinition '%class-direct-subclasses) #'class-direct-subclasses)
     1173      (fdefinition '(setf %class-direct-superclasses))
     1174      #'(lambda (new class)
     1175          (setf (slot-value class 'direct-superclasses) new))
     1176      (fdefinition '%class-direct-subclasses) #'class-direct-subclasses
     1177)
    11681178
    11691179 
Note: See TracChangeset for help on using the changeset viewer.