Support Clozure CL
Tue May 12 15:54:46 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Support Clozure CL
diff -rN -u old-smoke/src/cxx-method.lisp new-smoke/src/cxx-method.lisp
--- old-smoke/src/cxx-method.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/cxx-method.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -93,6 +93,7 @@
(defmethod no-applicable-method ((gf cxx-method-generic-function) &rest args)
(apply #'no-applicable-method (cxx-generic-function gf) args))
+#+sbcl
(defmethod closer-mop:compute-applicable-methods-using-classes ((gf cxx-generic-function) classes)
(let ((gf2 (find-generic-function-by-argument-count gf (length classes))))
(if gf2
@@ -115,6 +116,7 @@
(t (apply #'no-applicable-method ,cxx-generic-function args)))))))
+#+sbcl
(defmethod compute-applicable-methods ((gf cxx-generic-function) arguments)
;; -using-classes only cares abount the number of arguments;
;; thus no the to actually pass the classes.
diff -rN -u old-smoke/src/method.lisp new-smoke/src/method.lisp
--- old-smoke/src/method.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/method.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -142,6 +142,7 @@
`(progn (check-recompile ,smoke)
,@functions
(eval-when (:load-toplevel :execute)
+ (register-smoke-module-var (quote ,smoke))
(ensure-generic-methods ',(hash-table-alist generics))
(make-smoke-classes ,smoke))
,@constants
diff -rN -u old-smoke/src/objects/enum.lisp new-smoke/src/objects/enum.lisp
--- old-smoke/src/objects/enum.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/objects/enum.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -5,7 +5,7 @@
;;;
;;; One could map enum-values to lisp symbols, store the type in the plist
-;;; an use thouse as enums, but C++ enums may have several symbols for
+;;; an use those as enums, but C++ enums may have several symbols for
;;; the same value and thus lisp symbols can not be used.
(defclass enum ()
@@ -15,6 +15,16 @@
:initarg :type))
(:documentation "Holds the integer value and type of an C++ enum value."))
+;; Clozure CL needs this
+(defmethod make-load-form ((enum enum) &optional environment)
+ (declare (ignore environment))
+ `(make-instance 'enum
+ :value ,(value enum)
+ :type (make-instance 'smoke::smoke-type
+ :id ,(id (enum-type enum))
+ :smoke ,(smoke::get-smoke-variable-for-pointer
+ (smoke::smoke (enum-type enum))))))
+
(defmethod print-object ((enum enum) stream)
(print-unreadable-object (enum stream :type t)
(format stream "~A ~A" (name (enum-type enum))
diff -rN -u old-smoke/src/overload-resolution.lisp new-smoke/src/overload-resolution.lisp
--- old-smoke/src/overload-resolution.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/overload-resolution.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -205,7 +205,6 @@
(defmacro make-match (type &optional (name ''identity)
(argument nil)
&rest args)
- (format t "~S: ~S~%" type name)
`(make-instance ,type
:conversion-function-name ,(conversion-function name argument)
@@ -253,7 +252,6 @@
(declare (type (function (t list) (values t function)) get-sequence))
(when (and (using-typep)
(not (typep class 'smoke-standard-class)))
- (format t "ERROR TYPE~%")
(throw 'unspecific-type class))
(let ((viable-functions (viable-functions name (length objects)
class))
diff -rN -u old-smoke/src/package.lisp new-smoke/src/package.lisp
--- old-smoke/src/package.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/package.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -13,6 +13,7 @@
(:use #:cl #:cffi #:trivial-garbage #:bordeaux-threads #:cxx-support
#:alexandria)
(:export #:init
+ #:get-smoke-variable-for-pointer
#:make-smoke-classes
diff -rN -u old-smoke/src/smoke-c/smoke-c.lisp new-smoke/src/smoke-c/smoke-c.lisp
--- old-smoke/src/smoke-c/smoke-c.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/smoke-c/smoke-c.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -1,6 +1,6 @@
(in-package #:smoke)
-#|
+;; Load the qt smoke binding to prevent undefined aliens.
(eval-when (:load-toplevel :compile-toplevel :execute)
(define-foreign-library libsmokeqt
(:unix "libsmokeqt.so.2")
@@ -8,12 +8,9 @@
(use-foreign-library libsmokeqt)
- (use-foreign-library libsmoke-c)
-)
-|#
+ (use-foreign-library libsmoke-c))
-
(eval-when (:load-toplevel :compile-toplevel :execute)
(use-foreign-library libsmoke-c-util)
(defcfun smoke-sizeof-bool :int)
diff -rN -u old-smoke/src/smoke.lisp new-smoke/src/smoke.lisp
--- old-smoke/src/smoke.lisp 2014-09-28 09:40:20.000000000 +0200
+++ new-smoke/src/smoke.lisp 2014-09-28 09:40:21.000000000 +0200
@@ -106,6 +106,15 @@
(setf (binding smoke) binding)
binding))
+(let ((pointer-symbol-map (make-hash-table)))
+ (defun register-smoke-module-var (symbol)
+ "Registers SYMBOL of a variable containing a pointer to a Smoke module."
+ (setf (gethash (pointer-address (eval symbol)) pointer-symbol-map)
+ symbol))
+ (defun get-smoke-variable-for-pointer (pointer)
+ "Returns the SYMBOL of the variable whose value is POINTER."
+ (gethash (pointer-address pointer) pointer-symbol-map)))
+
(defun call (object method-name &rest args)
(smoke-call (class-of object)
(pointer object)