X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=attrib-class.lisp;h=0b837adda6f44f586a1a58aa25c4e079a6de41af;hb=aa610805927518a648eb0da6a8713cd0a83337df;hp=05a0778492aa28061f71086fc58cdd6b5a621a5e;hpb=1245205caa5937842d5d13ec805e15fe0d6a88c2;p=kmrcl.git diff --git a/attrib-class.lisp b/attrib-class.lisp index 05a0778..0b837ad 100644 --- a/attrib-class.lisp +++ b/attrib-class.lisp @@ -7,12 +7,13 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: attrib-class.lisp,v 1.3 2002/10/06 13:35:30 kevin Exp $ +;;;; $Id: attrib-class.lisp,v 1.5 2003/04/28 21:12:27 kevin Exp $ ;;;; -;;;; This file, part of Kmrcl, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; -;;;; Kmrcl users are granted the rights to distribute and use this software -;;;; as governed by the terms of the GNU General Public License. +;;;; KMRCL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* ;;;; Defines a metaclass that allows the use of attributes (or subslots) @@ -20,39 +21,51 @@ (in-package :kmrcl) -(defclass attributes-dsd (mop::standard-direct-slot-definition) +(defclass attributes-dsd (standard-direct-slot-definition) ((attributes :initarg :attributes :initform nil :accessor attributes))) -(defclass attributes-esd (mop::standard-effective-slot-definition) +(defclass attributes-esd (standard-effective-slot-definition) ((attributes :initarg :attributes :initform nil :accessor slot-definition-attributes))) -(defclass attributes-class (mop::standard-class) +(defclass attributes-class (standard-class) () ) -(defmethod mop::direct-slot-definition-class ((cl attributes-class) +#+(or cmu scl sbcl) +(defmethod validate-superclass ((class attributes-class) + (superclass standard-class)) + t) + +(defmethod direct-slot-definition-class ((cl attributes-class) &rest iargs &key attributes) (declare (ignorable attributes)) ;; (format t "attributes:~s iargs:~s~%" attributes iargs) (find-class 'attributes-dsd)) +(eval-when (:compile-toplevel :load-toplevel :execute) + (when (>= (length (generic-function-lambda-list + (ensure-generic-function + 'compute-effective-slot-definition))) + 3) + (push :ho-named-cesd-fun cl:*features*))) -(defmethod mop::compute-effective-slot-definition :around - ((cl attributes-class) slot dsds) - (declare (ignorable slot)) +(defmethod compute-effective-slot-definition :around + ((cl attributes-class) #+ho-named-cesd-fun name dsds) + #+ho-named-cesd-fun (declare (ignore name)) (apply #'make-instance 'attributes-esd :attributes (remove-duplicates (mapappend #'attributes dsds)) - (excl::compute-effective-slot-definition-initargs cl dsds)) + (compute-effective-slot-definition-initargs cl dsds)) ) #+ignore -(defmethod mop::compute-effective-slot-definition ((cl attributes-class) slot dsds) - (declare (ignorable slot)) +(defmethod compute-effective-slot-definition :around + ((cl attributes-class) #+ho-named-cesd-fun name dsds) + #+ho-named-cesd-fun (declare (ignore name)) (let ((normal-slot (call-next-method))) (setf (slot-definition-attributes normal-slot) (remove-duplicates @@ -60,7 +73,7 @@ normal-slot)) -(defmethod mop::compute-slots ((class attributes-class)) +(defmethod compute-slots ((class attributes-class)) (let* ((normal-slots (call-next-method)) (alist (mapcar @@ -97,28 +110,3 @@ attr-bucket))) -#|| -(in-package :kmrcl) - -(defclass credit-rating () - ((level :attributes (date-set time-set)) - (id :attributes (person-setting))) - (:metaclass kmrcl:attributes-class)) -(defparameter cr (make-instance 'credit-rating)) - -(format t "~&date-set: ~a" (slot-attribute cr 'level 'date-set)) -(setf (slot-attribute cr 'level 'date-set) "12/15/1990") -(format t "~&date-set: ~a" (slot-attribute cr 'level 'date-set)) - -(defclass monitored-credit-rating (credit-rating) - ((level :attributes (last-checked interval date-set)) - (cc :initarg :cc) - (id :attributes (verified)) - ) - (:metaclass attributes-class)) -(defparameter mcr (make-instance 'monitored-credit-rating)) - -(setf (slot-attribute mcr 'level 'date-set) "01/05/2002") -(format t "~&date-set for mcr: ~a" (slot-attribute mcr 'level 'date-set)) - -||#