(defun description-print-name (description)
(description-class-name (class-of description)))
+(defun description-attributes (description)
+ (description-class-attributes (class-of description)))
+
(defun find-attribute (description attribute-name)
- (slot-value description attribute-name))
+ (find attribute-name (description-attributes description)
+ :key #'attribute-name))
-#+nil(mapcar (lambda (slotd)
- (slot-value-using-class (class-of description) description slotd))
- (class-slots (class-of description)))
-(defun description-attributes (description)
- (mapcar #'attribute-object (class-slots (class-of description))))
+(define-layered-function description-active-descriptions (description)
+ (:method ((description standard-description-object))
+ (attribute-value (find-attribute description 'active-descriptions)))
+ (:method ((description attribute))
+ (attribute-active-descriptions description)))
+
+(define-layered-function description-inactive-descriptions (description)
+ (:method ((description standard-description-object))
+ (attribute-value (find-attribute description 'inactive-descriptions)))
+ (:method ((description attribute))
+ (attribute-inactive-descriptions description)))
(define-layered-function attributes (description)
(:method (description)
- (remove-if-not
- (lambda (attribute)
- (and (eq (class-of description)
- (print (slot-value attribute 'description-class)))
- (some #'layer-active-p
- (mapcar #'find-layer
- (slot-definition-layers
- (attribute-effective-attribute-definition attribute))))))
- (description-attributes description))))
+ (let* ((active-attributes
+ (find-attribute description 'active-attributes))
+ (attributes (when active-attributes
+ (attribute-value active-attributes))))
+ (if attributes
+ (mapcar (lambda (spec)
+ (find-attribute
+ description
+ (if (listp spec)
+ (car spec)
+ spec)))
+ attributes)
+ (remove-if-not
+ (lambda (attribute)
+ (and (attribute-active-p attribute)
+ (some #'layer-active-p
+ (mapcar #'find-layer
+ (slot-definition-layers
+ (attribute-effective-attribute-definition attribute))))))
+ (description-attributes description))))))
+
+
+
+
;;; A handy macro.
(destructuring-bind (&optional slots &rest options) options
(let ((description-layers (cdr (assoc :in-description options))))
(if description-layers
- `(eval-when (:compile-toplevel :load-toplevel :execute)
+ `(progn ;eval-when (:compile-toplevel :load-toplevel :execute)
,@(loop
:for layer
:in description-layers
,@(acons
:in-layer (defining-description layer)
(remove :in-description options :key #'car)))))
- `(eval-when (:compile-toplevel :load-toplevel :execute)
+ `(progn ;eval-when (:compile-toplevel :load-toplevel :execute)
; `(progn
(defclass ,description-name
,(append (mapcar #'defining-description
,@options
,@(unless (assoc :metaclass options)
'((:metaclass standard-description-class))))
-; (initialize-description)
+ (initialize-descriptions)
(find-description ',name)))))))