1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Imports standard MOP symbols into KMRCL
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Apr 2003
10 ;;;; $Id: mop.lisp,v 1.16 2003/06/25 20:11:54 kevin Exp $
12 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; KMRCL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
19 ;;; This file imports MOP symbols into KMR-MOP packages and then
20 ;;; re-exports them to hide differences in MOP implementations.
22 (in-package #:cl-user)
25 (eval-when (:compile-toplevel :load-toplevel :execute)
26 (if (find-package 'sb-mop)
27 (pushnew :kmr-sbcl-mop cl:*features*)
28 (pushnew :kmr-sbcl-pcl cl:*features*)))
31 (eval-when (:compile-toplevel :load-toplevel :execute)
32 (if (eq (symbol-package 'pcl:find-class)
33 (find-package 'common-lisp))
34 (pushnew :kmr-cmucl-mop cl:*features*)
35 (pushnew :kmr-cmucl-pcl cl:*features*)))
41 #+kmr-sbcl-mop #:sb-mop
46 #+openmcl #:openmcl-mop
49 (in-package #:kmr-mop)
52 (defun intern-eql-specializer (slot)
55 (defmacro process-class-option (metaclass slot-name &optional required)
57 `(defmethod clos:process-a-class-option ((class ,metaclass)
58 (name (eql ,slot-name))
60 (when (and ,required (null value))
61 (error "metaclass ~A class slot ~A must have a value" (quote ,metaclass) name))
64 (declare (ignore metaclass slot-name required))
67 (defmacro process-slot-option (metaclass slot-name)
69 `(defmethod clos:process-a-slot-option ((class ,metaclass)
70 (option (eql ,slot-name))
72 already-processed-options
74 (list* option `',value already-processed-options))
76 (declare (ignore metaclass slot-name))
80 (eval-when (:compile-toplevel :load-toplevel :execute)
83 '(excl::compute-effective-slot-definition-initargs)
85 '(clos::compute-effective-slot-definition-initargs)
87 '(#+kmr-sbcl-mop class-of #-kmr-sbcl-mop sb-pcl:class-of
88 #+kmr-sbcl-mop class-name #-kmr-sbcl-mop sb-pcl:class-name
89 #+kmr-sbcl-mop class-slots #-kmr-sbcl-mop sb-pcl:class-slots
90 #+kmr-sbcl-mop find-class #-kmr-sbcl-mop sb-pcl:find-class
91 sb-pcl::standard-class
92 sb-pcl:slot-definition-name sb-pcl::finalize-inheritance
93 sb-pcl::standard-direct-slot-definition
94 sb-pcl::standard-effective-slot-definition sb-pcl::validate-superclass
95 sb-pcl::direct-slot-definition-class
96 sb-pcl::effective-slot-definition-class
97 sb-pcl::compute-effective-slot-definition
98 sb-pcl:class-direct-slots
99 sb-pcl::compute-effective-slot-definition-initargs
100 sb-pcl::slot-value-using-class
101 sb-pcl:class-prototype sb-pcl:generic-function-method-class sb-pcl:intern-eql-specializer
102 sb-pcl:make-method-lambda sb-pcl:generic-function-lambda-list
103 sb-pcl::compute-slots)
105 '(pcl:class-of pcl:class-name pcl:class-slots pcl:find-class pcl::standard-class
106 pcl::slot-definition-name pcl:finalize-inheritance
107 pcl::standard-direct-slot-definition pcl::standard-effective-slot-definition
108 pcl::validate-superclass pcl:direct-slot-definition-class pcl::effective-slot-definition-class
109 pcl:compute-effective-slot-definition
110 pcl:class-direct-slots
111 pcl::compute-effective-slot-definition-initargs
112 pcl::slot-value-using-class
113 pcl:class-prototype pcl:generic-function-method-class pcl:intern-eql-specializer
114 pcl:make-method-lambda pcl:generic-function-lambda-list
117 '(class-of class-name class-slots find-class clos::standard-class
118 clos::slot-definition-name clos:finalize-inheritance
119 clos::standard-direct-slot-definition clos::standard-effective-slot-definition
120 clos::effective-slot-definition-class
121 clos:class-direct-slots
122 clos::validate-superclass clos:direct-slot-definition-class
123 clos:compute-effective-slot-definition
124 clos::compute-effective-slot-definition-initargs
125 clos::slot-value-using-class
126 clos::class-prototype clos:generic-function-method-class clos:intern-eql-specializer
127 clos:make-method-lambda clos:generic-function-lambda-list
129 ;; note: make-method-lambda is not fbound
132 '(openmcl-mop::slot-definition-name openmcl-mop:finalize-inheritance
133 openmcl-mop::standard-direct-slot-definition openmcl-mop::standard-effective-slot-definition
134 openmcl-mop::validate-superclass openmcl-mop:direct-slot-definition-class openmcl-mop::effective-slot-definition-class
135 openmcl-mop:compute-effective-slot-definition
136 openmcl-mop:class-direct-slots
137 openmcl-mop::compute-effective-slot-definition-initargs
138 openmcl-mop::slot-value-using-class
139 openmcl-mop:class-prototype openmcl-mop:generic-function-method-class openmcl-mop:intern-eql-specializer
140 openmcl-mop:make-method-lambda openmcl-mop:generic-function-lambda-list
141 openmcl-mop::compute-slots) ))
143 (eval-when (:compile-toplevel :load-toplevel :execute)
144 (export '(class-of class-name class-slots find-class
146 slot-definition-name finalize-inheritance
147 standard-direct-slot-definition
148 standard-effective-slot-definition validate-superclass
149 compute-effective-slot-definition-initargs
150 direct-slot-definition-class effective-slot-definition-class
151 compute-effective-slot-definition
152 slot-value-using-class
153 class-prototype generic-function-method-class intern-eql-specializer
154 make-method-lambda generic-function-lambda-list
157 ;; KMR-MOP encapsulating macros
159 process-class-option))
162 (if (find-package 'sb-mop)
163 (setq cl:*features* (delete :kmr-sbcl-mop cl:*features*))
164 (setq cl:*features* (delete :kmr-sbcl-pcl cl:*features*)))
167 (if (find-package 'mop)
168 (setq cl:*features* (delete :kmr-cmucl-mop cl:*features*))
169 (setq cl:*features* (delete :kmr-cmucl-pcl cl:*features*)))
171 (when (>= (length (generic-function-lambda-list
172 (ensure-generic-function
173 'compute-effective-slot-definition)))
175 (pushnew :kmr-normal-cesd cl:*features*))
177 (when (>= (length (generic-function-lambda-list
178 (ensure-generic-function
179 'direct-slot-definition-class)))
181 (pushnew :kmr-normal-dsdc cl:*features*))