X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=attrib-class.lisp;fp=attrib-class.lisp;h=a76e9913ad3e7092a11b5fac05548d99c06592f1;hp=04f8840f14d9c6da7cb25381fcd1129b7c493b91;hb=e8c34efef61039ff3319203710b533be1a7906ca;hpb=0866fba9e22be18d536c8c94ae1f17e6f0f55f86 diff --git a/attrib-class.lisp b/attrib-class.lisp index 04f8840..a76e991 100644 --- a/attrib-class.lisp +++ b/attrib-class.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: attrib-class.lisp,v 1.14 2003/06/12 02:38:39 kevin Exp $ +;;;; $Id: attrib-class.lisp,v 1.15 2003/06/25 18:08:09 kevin Exp $ ;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -19,7 +19,7 @@ ;;;; Defines a metaclass that allows the use of attributes (or subslots) ;;;; on slots. Based on example in AMOP, but modified to use ACL's MOP. -(in-package :kmrcl) +(in-package #:kmrcl) (defclass attributes-class (kmr-mop:standard-class) () @@ -37,7 +37,7 @@ on example from AMOP")) ;; encapsulating macro for Lispworks (kmr-mop:process-slot-option attributes-class :attributes) -#+(or cmu scl sbcl) +#+(or cmu scl sbcl openmcl) (defmethod kmr-mop:validate-superclass ((class attributes-class) (superclass kmr-mop:standard-class)) t) @@ -59,28 +59,25 @@ on example from AMOP")) (defmethod kmr-mop:compute-slots ((class attributes-class)) (let* ((normal-slots (call-next-method)) - (alist (delete - nil - (mapcar - #'(lambda (slot) - (let ((attr-list (mapcar #'(lambda (attr) (list attr)) - (esd-attributes slot)))) - (when attr-list - (cons (kmr-mop:slot-definition-name slot) attr-list)))) - normal-slots)))) - (let ((attrib-slot (make-instance 'attributes-esd - :name 'all-attributes - :initform `',alist - :initfunction #'(lambda () alist) - :allocation :instance - :class class - :documentation "" - :type t - ;; This is an attempted work-around -- lispworks doesn't work - ;; it appears to setup storage someplace - #+lispworks :location #+lispworks (length normal-slots) - ))) - (append normal-slots (list attrib-slot))))) + (alist (mapcar + #'(lambda (slot) + (cons (kmr-mop:slot-definition-name slot) + (mapcar #'(lambda (attr) (list attr)) + (esd-attributes slot)))) + normal-slots))) + (cons (make-instance 'attributes-esd + :name 'all-attributes + :initform `',alist + :initfunction #'(lambda () alist) + :allocation :instance + :class class + :documentation "" + :type t + ;; This is an attempted work-around -- lispworks doesn't work + ;; it appears to setup storage someplace + ;; #+lispworks :location #+lispworks (length normal-slots) + ) + normal-slots))) (defun slot-attribute (instance slot-name attribute) (cdr (slot-attribute-bucket instance slot-name attribute)))