~ubuntu-branches/ubuntu/trusty/cl-kmrcl/trusty

1 by Kevin M. Rosenberg
Import upstream version 1.73
1
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2
;;;; *************************************************************************
3
;;;; FILE IDENTIFICATION
4
;;;;
5
;;;; Name:          mop.lisp
6
;;;; Purpose:       Imports standard MOP symbols into KMRCL
7
;;;; Programmer:    Kevin M. Rosenberg
8
;;;; Date Started:  Apr 2003
9
;;;;
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
10
;;;; This file, part of KMRCL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
1 by Kevin M. Rosenberg
Import upstream version 1.73
11
;;;;
12
;;;; KMRCL users are granted the rights to distribute and use this software
13
;;;; as governed by the terms of the Lisp Lesser GNU Public License
14
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15
;;;; *************************************************************************
16
17
;;; This file imports MOP symbols into KMR-MOP packages and then
18
;;; re-exports them to hide differences in MOP implementations.
19
20
(in-package #:cl-user)
21
22
#+sbcl
23
(eval-when (:compile-toplevel :load-toplevel :execute)
24
  (if (find-package 'sb-mop)
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
25
      (pushnew 'kmrcl::sbcl-mop cl:*features*)
26
      (pushnew 'kmrcl::sbcl-pcl cl:*features*)))
1 by Kevin M. Rosenberg
Import upstream version 1.73
27
28
#+cmu
29
(eval-when (:compile-toplevel :load-toplevel :execute)
30
  (if (eq (symbol-package 'pcl:find-class)
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
31
          (find-package 'common-lisp))
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
32
      (pushnew 'kmrcl::cmucl-mop cl:*features*)
33
      (pushnew 'kmrcl::cmucl-pcl cl:*features*)))
1 by Kevin M. Rosenberg
Import upstream version 1.73
34
35
(defpackage #:kmr-mop
36
  (:use
37
   #:cl
38
   #:kmrcl
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
39
   #+kmrcl::sbcl-mop #:sb-mop
40
   #+kmrcl::cmucl-mop #:mop
1 by Kevin M. Rosenberg
Import upstream version 1.73
41
   #+allegro #:mop
42
   #+lispworks #:clos
1.1.4 by Kevin M. Rosenberg
Import upstream version 1.90
43
   #+clisp #:clos
1 by Kevin M. Rosenberg
Import upstream version 1.73
44
   #+scl #:clos
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
45
   #+ccl #:openmcl-mop
1 by Kevin M. Rosenberg
Import upstream version 1.73
46
   )
47
  )
48
49
(in-package #:kmr-mop)
50
51
#+lispworks
52
(defun intern-eql-specializer (slot)
53
  `(eql ,slot))
54
55
(defmacro process-class-option (metaclass slot-name &optional required)
56
  #+lispworks
57
  `(defmethod clos:process-a-class-option ((class ,metaclass)
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
58
                                           (name (eql ,slot-name))
59
                                           value)
1 by Kevin M. Rosenberg
Import upstream version 1.73
60
    (when (and ,required (null value))
61
      (error "metaclass ~A class slot ~A must have a value" (quote ,metaclass) name))
62
    (list name `',value))
63
  #-lispworks
64
  (declare (ignore metaclass slot-name required))
65
  )
66
67
(defmacro process-slot-option (metaclass slot-name)
68
  #+lispworks
69
  `(defmethod clos:process-a-slot-option ((class ,metaclass)
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
70
                                          (option (eql ,slot-name))
71
                                          value
72
                                          already-processed-options
73
                                          slot)
1 by Kevin M. Rosenberg
Import upstream version 1.73
74
    (list* option `',value already-processed-options))
75
  #-lispworks
76
  (declare (ignore metaclass slot-name))
77
  )
78
79
80
(eval-when (:compile-toplevel :load-toplevel :execute)
81
  (shadowing-import
82
   #+allegro
83
   '(excl::compute-effective-slot-definition-initargs)
84
   #+lispworks
85
   '(clos::compute-effective-slot-definition-initargs)
1.1.4 by Kevin M. Rosenberg
Import upstream version 1.90
86
   #+clisp
87
   '(clos::compute-effective-slot-definition-initargs)
1 by Kevin M. Rosenberg
Import upstream version 1.73
88
   #+sbcl
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
89
   '(#+kmrcl::sbcl-mop class-of #-kmrcl::sbcl-mop sb-pcl:class-of
90
     #+kmrcl::sbcl-mop class-name #-kmrcl::sbcl-mop sb-pcl:class-name
91
     #+kmrcl::sbcl-mop class-slots #-kmrcl::sbcl-mop sb-pcl:class-slots
92
     #+kmrcl::sbcl-mop find-class #-kmrcl::sbcl-mop sb-pcl:find-class
1 by Kevin M. Rosenberg
Import upstream version 1.73
93
     sb-pcl::standard-class
94
     sb-pcl:slot-definition-name sb-pcl::finalize-inheritance
95
     sb-pcl::standard-direct-slot-definition
96
     sb-pcl::standard-effective-slot-definition sb-pcl::validate-superclass
97
     sb-pcl::direct-slot-definition-class
98
     sb-pcl::effective-slot-definition-class
99
     sb-pcl::compute-effective-slot-definition
100
     sb-pcl:class-direct-slots
101
     sb-pcl::compute-effective-slot-definition-initargs
102
     sb-pcl::slot-value-using-class
103
     sb-pcl:class-prototype sb-pcl:generic-function-method-class sb-pcl:intern-eql-specializer
104
     sb-pcl:make-method-lambda sb-pcl:generic-function-lambda-list
105
     sb-pcl::compute-slots)
106
   #+cmu
107
   '(pcl:class-of  pcl:class-name pcl:class-slots pcl:find-class pcl::standard-class
108
     pcl::slot-definition-name pcl:finalize-inheritance
109
     pcl::standard-direct-slot-definition pcl::standard-effective-slot-definition
110
     pcl::validate-superclass pcl:direct-slot-definition-class pcl::effective-slot-definition-class
111
     pcl:compute-effective-slot-definition
112
     pcl:class-direct-slots
113
     pcl::compute-effective-slot-definition-initargs
114
     pcl::slot-value-using-class
115
     pcl:class-prototype pcl:generic-function-method-class pcl:intern-eql-specializer
116
     pcl:make-method-lambda pcl:generic-function-lambda-list
117
     pcl::compute-slots)
118
   #+scl
119
   '(class-of class-name class-slots find-class clos::standard-class
120
     clos::slot-definition-name clos:finalize-inheritance
121
     clos::standard-direct-slot-definition clos::standard-effective-slot-definition
122
     clos::effective-slot-definition-class
123
     clos:class-direct-slots
124
     clos::validate-superclass clos:direct-slot-definition-class
125
     clos:compute-effective-slot-definition
126
     clos::compute-effective-slot-definition-initargs
127
     clos::slot-value-using-class
128
     clos::class-prototype clos:generic-function-method-class clos:intern-eql-specializer
129
     clos:make-method-lambda clos:generic-function-lambda-list
130
     clos::compute-slots
131
     ;; note: make-method-lambda is not fbound
132
     )
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
133
   #+ccl
1 by Kevin M. Rosenberg
Import upstream version 1.73
134
   '(openmcl-mop::slot-definition-name openmcl-mop:finalize-inheritance
135
     openmcl-mop::standard-direct-slot-definition openmcl-mop::standard-effective-slot-definition
136
     openmcl-mop::validate-superclass openmcl-mop:direct-slot-definition-class openmcl-mop::effective-slot-definition-class
137
     openmcl-mop:compute-effective-slot-definition
138
     openmcl-mop:class-direct-slots
139
     openmcl-mop::compute-effective-slot-definition-initargs
140
     openmcl-mop::slot-value-using-class
141
     openmcl-mop:class-prototype openmcl-mop:generic-function-method-class openmcl-mop:intern-eql-specializer
142
     openmcl-mop:make-method-lambda openmcl-mop:generic-function-lambda-list
143
     openmcl-mop::compute-slots)   ))
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
144
1 by Kevin M. Rosenberg
Import upstream version 1.73
145
(eval-when (:compile-toplevel :load-toplevel :execute)
146
  (export '(class-of class-name class-slots find-class
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
147
            standard-class
148
            slot-definition-name finalize-inheritance
149
            standard-direct-slot-definition
150
            standard-effective-slot-definition validate-superclass
151
            compute-effective-slot-definition-initargs
152
            direct-slot-definition-class effective-slot-definition-class
153
            compute-effective-slot-definition
154
            slot-value-using-class
155
            class-prototype generic-function-method-class intern-eql-specializer
156
            make-method-lambda generic-function-lambda-list
157
            compute-slots
158
            class-direct-slots
159
            ;; KMR-MOP encapsulating macros
160
            process-slot-option
161
            process-class-option))
162
1 by Kevin M. Rosenberg
Import upstream version 1.73
163
  #+sbcl
164
  (if (find-package 'sb-mop)
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
165
      (setq cl:*features* (delete 'kmrcl::sbcl-mop cl:*features*))
166
      (setq cl:*features* (delete 'kmrcl::sbcl-pcl cl:*features*)))
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
167
1 by Kevin M. Rosenberg
Import upstream version 1.73
168
  #+cmu
169
  (if (find-package 'mop)
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
170
      (setq cl:*features* (delete 'kmrcl::cmucl-mop cl:*features*))
171
      (setq cl:*features* (delete 'kmrcl::cmucl-pcl cl:*features*)))
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
172
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
173
  (when (< (length (generic-function-lambda-list
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
174
                     (ensure-generic-function
175
                      'compute-effective-slot-definition)))
176
            3)
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
177
    (pushnew 'short-arg-cesd cl:*features*))
1.1.8 by Kevin M. Rosenberg
Import upstream version 1.97
178
1.1.11 by Kevin M. Rosenberg
Import upstream version 1.102
179
  (when (< (length (generic-function-lambda-list
180
                    (ensure-generic-function
181
                     'direct-slot-definition-class)))
182
           3)
183
    (pushnew 'short-arg-dsdc cl:*features*))
1 by Kevin M. Rosenberg
Import upstream version 1.73
184
185
  )  ;; eval-when