r10789: Automated commit for Debian build of clsql upstream-version-3.3.1
[clsql/s11.git] / sql / kmr-mop.lisp
blob8fccf57778e306a4a9ce6b3b7801dfd49c026d3e
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name: kmr-mop.lisp
6 ;;;; Purpose: MOP support for multiple-implementions
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Apr 2003
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file imports MOP symbols into the CLSQL-MOP package and then
13 ;;;; re-exports into CLSQL-SYS them to hide differences in
14 ;;;; MOP implementations.
15 ;;;;
16 ;;;; This file was extracted from the KMRCL utilities
17 ;;;; *************************************************************************
19 (in-package #:clsql-sys)
21 #+lispworks
22 (defun intern-eql-specializer (slot)
23 `(eql ,slot))
25 (defmacro process-class-option (metaclass slot-name &optional required)
26 #+lispworks
27 `(defmethod clos:process-a-class-option ((class ,metaclass)
28 (name (eql ,slot-name))
29 value)
30 (when (and ,required (null value))
31 (error "metaclass ~A class slot ~A must have a value" (quote ,metaclass) name))
32 (list name `',value))
33 #-lispworks
34 (declare (ignore metaclass slot-name required))
37 (defmacro process-slot-option (metaclass slot-name)
38 #+lispworks
39 `(defmethod clos:process-a-slot-option ((class ,metaclass)
40 (option (eql ,slot-name))
41 value
42 already-processed-options
43 slot)
44 (list* option `',value already-processed-options))
45 #-lispworks
46 (declare (ignore metaclass slot-name))
49 (eval-when (:compile-toplevel :load-toplevel :execute)
50 (defclass %slot-order-test-class ()
51 ((a)
52 (b)))
53 (finalize-inheritance (find-class '%slot-order-test-class))
54 (let ((slots (class-slots (find-class '%slot-order-test-class))))
55 (ecase (slot-definition-name (first slots))
56 (a)
57 (b (pushnew :mop-slot-order-reversed cl:*features*)))))
59 (defun ordered-class-slots (class)
60 #+mop-slot-order-reversed (reverse (class-slots class))
61 #-mop-slot-order-reversed (class-slots class))
63 ;; Lispworks has symbol for slot rather than the slot instance
64 (defun %svuc-slot-name (slot)
65 #+lispworks slot
66 #-lispworks (slot-definition-name slot))
68 (defun %svuc-slot-object (slot class)
69 (declare (ignorable class))
70 #+lispworks (clos:find-slot-definition slot class)
71 #-lispworks slot)