Changeset 543
- Timestamp:
- Feb 15, 2004, 8:22:13 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/objc-clos.lisp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/objc-clos.lisp
r533 r543 148 148 (declare (fixnum type flags index)) 149 149 (ecase flags 150 (#.objc-flag-instance (gethash p *objc-object-slot-vectors*)) 150 (#.objc-flag-instance (or (gethash p *objc-object-slot-vectors*) 151 (error "~s has no slots." p))) 151 152 (#.objc-flag-class (id->objc-class-slots-vector index)) 152 153 (#.objc-flag-metaclass (id->objc-metaclass-slots-vector index))))) … … 703 704 append (list (first l) (second l)) into new-initargs))) 704 705 706 (defun create-foreign-instance-slot-vector (class) 707 (let* ((max 0)) 708 (dolist (slotd (class-slots class) 709 (unless (zerop max) 710 (allocate-typed-vector :slot-vector (1+ max) (%slot-unbound-marker)))) 711 (when (typep slotd 'standard-effective-slot-definition) 712 (let* ((loc (slot-definition-location slotd))) 713 (if (> loc max) 714 (setq max loc))))))) 715 716 717 705 718 (defmethod allocate-instance ((class objc:objc-class) &rest initargs &key &allow-other-keys) 706 719 (unless (class-finalized-p class) … … 713 726 (apply #'%send (%send class 'alloc) (lisp-to-objc-init ks) vs)))) 714 727 (unless (%null-ptr-p instance) 715 (let* ((len (length (%wrapper-instance-slots (class-own-wrapper class)))) 716 (raw-ptr (raw-macptr-for-instance instance)) 717 (slot-vector 718 (unless (zerop len) 719 (allocate-typed-vector :slot-vector (1+ len) (%slot-unbound-marker))))) 720 (setf (slot-vector.instance slot-vector) raw-ptr) 728 (let* ((raw-ptr (raw-macptr-for-instance instance)) 729 (slot-vector (create-foreign-instance-slot-vector class))) 730 (when slot-vector 731 (setf (slot-vector.instance slot-vector) raw-ptr) 732 (setf (gethash raw-ptr *objc-object-slot-vectors*) slot-vector)) 721 733 (register-canonical-objc-instance instance raw-ptr))))) 722 734 … … 852 864 &rest initargs) 853 865 (declare (ignore initargs)) 854 (find-class 'standard- reader-method))866 (find-class 'standard-writer-method)) 855 867 856 868
Note:
See TracChangeset
for help on using the changeset viewer.
