- (defclass object-class (gobject-class))
-
- (defclass direct-object-slot-definition (direct-virtual-slot-definition))
-
- (defclass effective-object-slot-definition
- (effective-virtual-slot-definition)))
-
-
-(defmethod initialize-instance :after ((slotd direct-object-slot-definition)
- &rest initargs &key)
- (declare (ignore initargs))
- (unless (slot-boundp slotd 'location)
- (with-slots (pcl::name location pcl::class) slotd
- (setf
- location
- (format nil "~A::~A"
- (alien-type-name (class-name pcl::class))
- (name-to-string pcl::name))))))
-
-
-(defmethod direct-slot-definition-class ((class object-class) initargs)
- (case (getf initargs :allocation)
- (:arg (find-class 'direct-object-slot-definition))
- (t (call-next-method))))
-
-
-(defmethod effective-slot-definition-class ((class object-class) initargs)
- (case (getf initargs :allocation)
- (:arg (find-class 'effective-object-slot-definition))
- (t (call-next-method))))
-
-
-(defmethod compute-virtual-slot-location
- ((class object-class) (slotd effective-object-slot-definition)
- direct-slotds)
- (with-slots (type) slotd
- (let ((location (slot-definition-location (first direct-slotds)))
- (type-number (find-type-number type))
- (reader (get-reader-function type))
- (writer (get-writer-function type))
- (destroy (get-destroy-function type)))
- (list
- #'(lambda (object)
- (with-gc-disabled
- (let ((arg (arg-new type-number)))
- (setf (arg-name arg) location)
- (object-get-arg object arg)
- (prog1
- (funcall reader arg +arg-value-offset+)
- (arg-free arg t t)))))
- #'(lambda (value object)
- (with-gc-disabled
- (let ((arg (arg-new type-number)))
- (setf (arg-name arg) location)
- (funcall writer value arg +arg-value-offset+)
- (object-set-arg object arg)
- (funcall destroy arg +arg-value-offset+)
- (arg-free arg nil)
- value)))))))