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.10 2003/04/29 07:52:38 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 (find-package 'mop)
33 (pushnew :kmr-cmucl-mop cl:*features*)
34 (pushnew :kmr-cmucl-pcl cl:*features*)))
40 #+kmr-sbcl-mop #:sb-mop
46 (in-package #:kmr-mop)
49 (defun intern-eql-specializer (slot)
52 (defmacro process-class-option (metaclass slot-name &optional required)
54 `(defmethod clos:process-a-class-option ((class ,metaclass)
55 (name (eql ,slot-name))
57 (when (and ,required (null value))
58 (error "metaclass ~A class slot ~A must have a value" (quote ,metaclass) name))
60 #+(or allegro sbcl cmu scl)
61 (declare (ignore slot-name required))
64 (defmacro process-slot-option (metaclass slot-name)
66 `(defmethod clos:process-a-slot-option ((class ,metaclass)
67 (option (eql ,slot-name))
69 already-processed-options
71 (list* option `',value already-processed-options))
73 (declare (ignore slot-name))
77 (eval-when (:compile-toplevel :load-toplevel :execute)
80 '(excl::compute-effective-slot-definition-initargs)
82 '(clos::compute-effective-slot-definition-initargs)
84 '(#+kmr-sbcl-mop class-of #-kmr-sbcl-mop sb-pcl:class-of
85 #+kmr-sbcl-mop class-name #-kmr-sbcl-mop sb-pcl:class-name
86 #+kmr-sbcl-mop class-slots #-kmr-sbcl-mop sb-pcl:class-slots
87 #+kmr-sbcl-mop find-class #-kmr-sbcl-mop sb-pcl:find-class
88 sb-pcl::standard-class
89 sb-pcl:slot-definition-name sb-pcl::finalize-inheritance
90 sb-pcl::standard-direct-slot-definition
91 sb-pcl::standard-effective-slot-definition sb-pcl::validate-superclass
92 sb-pcl::direct-slot-definition-class
93 sb-pcl::effective-slot-definition-class
94 sb-pcl::compute-effective-slot-definition
95 sb-pcl::compute-effective-slot-definition-initargs
96 sb-pcl::slot-value-using-class
97 sb-pcl:class-prototype sb-pcl:generic-function-method-class sb-pcl:intern-eql-specializer
98 sb-pcl:make-method-lambda sb-pcl:generic-function-lambda-list
99 sb-pcl::compute-slots)
101 '(pcl:class-of pcl:class-name pcl:class-slots pcl:find-class pcl::standard-class
102 pcl::slot-definition-name pcl:finalize-inheritance
103 pcl::standard-direct-slot-definition pcl::standard-effective-slot-definition
104 pcl::validate-superclass pcl:direct-slot-definition-class pcl::effective-slot-definition-class
105 pcl:compute-effective-slot-definition
106 pcl::compute-effective-slot-definition-initargs
107 pcl::slot-value-using-class
108 pcl:class-prototype pcl:generic-function-method-class pcl:intern-eql-specializer
109 pcl:make-method-lambda pcl:generic-function-lambda-list
112 '(class-of class-name class-slots find-class clos::standard-class
113 clos::slot-definition-name clos:finalize-inheritance
114 clos::standard-direct-slot-definition clos::standard-effective-slot-definition
115 clos::effective-slot-definition-class
116 clos::validate-superclass clos:direct-slot-definition-class
117 clos:compute-effective-slot-definition
118 clos::compute-effective-slot-definition-initargs
119 clos::slot-value-using-class
120 clos:class-prototype clos:generic-function-method-class clos:intern-eql-specializer
121 clos:make-method-lambda clos:generic-function-lambda-list
123 ;; note: make-method-lambda is not fbound
126 (eval-when (:compile-toplevel :load-toplevel :execute)
127 (export '(class-of class-name class-slots find-class
129 slot-definition-name finalize-inheritance
130 standard-direct-slot-definition
131 standard-effective-slot-definition validate-superclass
132 compute-effective-slot-definition-initargs
133 direct-slot-definition-class effective-slot-definition-class
134 compute-effective-slot-definition
135 slot-value-using-class
136 class-prototype generic-function-method-class intern-eql-specializer
137 make-method-lambda generic-function-lambda-list
139 ;; KMR-MOP encapsulating macros
141 process-class-option))
144 (if (find-package 'sb-mop)
145 (setq cl:*features* (delete :kmr-sbcl-mop cl:*features*))
146 (setq cl:*features* (delete :kmr-sbcl-pcl cl:*features*)))
149 (if (find-package 'mop)
150 (setq cl:*features* (delete :kmr-cmucl-mop cl:*features*))
151 (setq cl:*features* (delete :kmr-cmucl-pcl cl:*features*)))
153 (when (>= (length (generic-function-lambda-list
154 (ensure-generic-function
155 'compute-effective-slot-definition)))
157 (pushnew :kmr-normal-cesd cl:*features*))
159 (when (>= (length (generic-function-lambda-list
160 (ensure-generic-function
161 'direct-slot-definition-class)))
163 (pushnew :kmr-normal-dsdc cl:*features*))