Support modular smoke & cleanup.
Sun Jan 10 09:49:36 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Support modular smoke & cleanup.
move ./smoke.asd ./cl-smoke.smoke.asd
move ./src/smoke-c/csmokebinding.cpp ./src/smoke-c/smokebinding.cpp
move ./src/smoke-c/csmokebinding.h ./src/smoke-c/smokebinding.h
move ./src/smoke-c/smoke-c-util.cpp ./src/smoke-c/smoke_util.cpp
move ./src/smoke-c/smoke-c.cpp ./src/smoke-c/smoke.cpp
move ./src/smoke-c/smoke-c.lisp ./src/smoke-c/smoke.lisp
move ./src/smoke-c ./src/libsmoke
hunk ./cl-smoke.smoke.asd 1
-(defpackage smoke-system
- (:use :cl :asdf))
-
-(in-package smoke-system)
-
-(asdf:defsystem :smoke
- :name :smoke
+(defsystem :cl-smoke.smoke
+ :name :cl-smoke.smoke
hunk ./cl-smoke.smoke.asd 17
- (:file "smoke" :depends-on (:smoke-c :objects "clos"))
+ (:file "smoke" :depends-on (:libsmoke :objects "clos"))
hunk ./cl-smoke.smoke.asd 20
- (:file "bindings" :depends-on ("package"))
+ (:file "bindings" :depends-on ("package" :utils))
hunk ./cl-smoke.smoke.asd 22
- (:file "clos" :depends-on
- (:smoke-c "cxx-method" :objects "object-map" "class-map" "bindings"))
+ (:file "clos" :depends-on (:libsmoke "cxx-method" :objects
+ "object-map" "class-map" "bindings"))
hunk ./cl-smoke.smoke.asd 27
- :depends-on (:smoke-c :utils "bindings")
+ :depends-on (:libsmoke :utils "bindings")
hunk ./cl-smoke.smoke.asd 35
- (:module :smoke-c
+ (:module :libsmoke
hunk ./cl-smoke.smoke.asd 38
- ((:file "smoke-c") (:file "class" :depends-on ("smoke-c"))
+ ((:file "smoke")
+ (:file "class" :depends-on ("smoke"))
hunk ./cl-smoke.smoke.asd 57
-(defmethod asdf:perform ((operation test-op) (c (eql (find-system :smoke))))
- (operate 'asdf:load-op :qt)
- (operate 'asdf:test-op :qt))
+(defmethod operation-done-p ((o test-op) (c (eql (find-system :cl-smoke.smoke))))
+ nil)
+
+(defmethod perform ((operation test-op) (c (eql (find-system :cl-smoke.smoke))))
+ (operate 'asdf:load-op :cl-smoke.qt.tests)
+ (operate 'asdf:test-op :cl-smoke.qt.tests))
hunk ./src/CMakeLists.txt 1
-add_subdirectory(smoke-c)
+add_subdirectory(libsmoke)
hunk ./src/bindings.lisp 3
-(defvar *bindings* (make-hash-table)
- "The Smoke C++ binding classes to which virtual method calls are dispatched.")
-
-;; FIXME is this lock needed? (The user may not have to
-;; load additional modules while threads are running.
-(defvar *bindings-lock* (make-lock "bindings-lock"))
-
-(defun binding (smoke)
- "Returns the Smoke binding for the Smoke module SMOKE."
- (with-lock-held (*bindings-lock*)
- (multiple-value-bind (value present-p)
- (gethash (pointer-address smoke) *bindings*)
- (assert (eql t present-p)
- ()
- "No binding for ~A." smoke)
- value)))
-
-(defun (setf binding) (binding smoke)
- (with-lock-held (*bindings-lock*)
- (setf (gethash (pointer-address smoke) *bindings*)
- binding)))
-
hunk ./src/bindings.lisp 26
+(eval-on-save ()
+ (clrhash *smoke-modules*))
+
hunk ./src/clos.lisp 205
- (let ((*package* (find-package package)))
+ (let ((impl-package *package*)
+ (*package* (find-package package)))
hunk ./src/clos.lisp 210
- (unless (or (external-p class)
- (and (eq package :cl-smoke.qt)
- (string/= (smoke-get-module-name [_$_]
- (smoke-module-pointer smoke))
- "qt")
- (string= (name class) "QGlobalSpace")))
+ (unless (external-p class)
hunk ./src/clos.lisp 212
- (add-id class
- (closer-mop:ensure-class (lispify (name class))
- :direct-superclasses
- (mapcar #'smoke-class-symbol
- (smoke-class-direct-superclasses class))
- :id (id class)
- :smoke (smoke class)
- :metaclass 'smoke-standard-class))
- (export (lispify (name class))))))
+ (let ((class-name [_$_]
+ ;; There is a QGlobalSpace class per Smoke module.
+ ;; Put it in *package* and not PACKAGE to avoid
+ ;; clashes between multiple modules.
+ (if (string= "QGlobalSpace" (name class))
+ (lispify "QGlobalSpace" impl-package)
+ (lispify (name class)))))
+ (add-id class
+ (closer-mop:ensure-class class-name
+ :direct-superclasses
+ (mapcar #'smoke-class-symbol
+ (smoke-class-direct-superclasses class))
+ :id (id class)
+ :smoke (smoke class)
+ :metaclass 'smoke-standard-class))
+ (when (eql (symbol-package class-name) *package*)
+ (export class-name))))))
hunk ./src/libsmoke/CMakeLists.txt 11
-set(SMOKE_C_SOURCES smoke-c.cpp csmokebinding.cpp)
-add_library(smoke-c MODULE ${SMOKE_C_SOURCES})
-set_target_properties(smoke-c
+set(SMOKE_C_SOURCES smoke.cpp smokebinding.cpp)
+add_library(clsmoke MODULE ${SMOKE_C_SOURCES})
+set_target_properties(clsmoke
hunk ./src/libsmoke/CMakeLists.txt 18
-add_library(smoke-c-util MODULE smoke-c-util.cpp)
-set_target_properties(smoke-c-util
+add_library(clsmokeutil MODULE smoke_util.cpp)
+set_target_properties(clsmokeutil
hunk ./src/libsmoke/CMakeLists.txt 24
-install(TARGETS smoke-c smoke-c-util
+install(TARGETS clsmoke clsmokeutil
hunk ./src/libsmoke/cl_smoke.h 16
-/** @brief Common Lisp Smoke binding namespace. */
+/** @brief cl-smoke binding namespace. */
hunk ./src/libsmoke/class.lisp 20
-(defcfun smoke-find-class :void
+(defcfun (smoke-find-class "cl_smoke_find_class") :void
hunk ./src/libsmoke/class.lisp 25
-(defcfun smoke-class-id smoke-index
+(defcfun (smoke-class-id "cl_smoke_class_id") smoke-index
hunk ./src/libsmoke/class.lisp 29
-(defcfun smoke-get-class (:pointer smoke-class)
+(defcfun (smoke-get-class "cl_smoke_get_class") (:pointer smoke-class)
hunk ./src/libsmoke/class.lisp 33
-(defcfun smoke-is-derived-from :boolean
+(defcfun (smoke-is-derived-from "cl_smoke_is_derived_from") :boolean
hunk ./src/libsmoke/class.lisp 39
-(defcfun smoke-cast :pointer
+(defcfun (smoke-cast "cl_smoke_cast") :pointer
hunk ./src/libsmoke/method.lisp 37
-(defcfun smoke-find-method :void
+(defcfun (smoke-find-method "cl_smoke_find_method") :void
hunk ./src/libsmoke/smoke.cpp 1
-#include "csmokebinding.h"
hunk ./src/libsmoke/smoke.cpp 2
+#include "smokebinding.h"
hunk ./src/libsmoke/smoke.cpp 5
-
hunk ./src/libsmoke/smoke.cpp 22
-smoke_get_smoke(smoke_binding binding)
+cl_smoke_get_smoke(smoke_binding binding)
hunk ./src/libsmoke/smoke.cpp 37
-smoke_init(void* smoke, void* destruct, void* dispatch)
+cl_smoke_init(void* smoke, void* destruct, void* dispatch)
hunk ./src/libsmoke/smoke.cpp 48
-smoke_destruct(smoke_binding binding)
+cl_smoke_destruct(smoke_binding binding)
hunk ./src/libsmoke/smoke.cpp 60
-smoke_get_module_name(void* smoke)
+cl_smoke_get_module_name(void* smoke)
hunk ./src/libsmoke/smoke.cpp 137
-smoke_find_class(Smoke::ModuleIndex* c, void* smoke, const char* name)
+cl_smoke_find_class(Smoke::ModuleIndex* c, void* smoke, const char* name)
hunk ./src/libsmoke/smoke.cpp 149
-smoke_class_id(void* smoke, const char* name)
+cl_smoke_class_id(void* smoke, const char* name)
hunk ./src/libsmoke/smoke.cpp 164
-smoke_get_class(void* smoke, Smoke::Index class_index)
+cl_smoke_get_class(void* smoke, Smoke::Index class_index)
hunk ./src/libsmoke/smoke.cpp 179
-smoke_is_derived_from(void* smoke, Smoke::Index class_index, void* smoke_base, Smoke::Index base_index)
+cl_smoke_is_derived_from(void* smoke, Smoke::Index class_index, void* smoke_base,
+ Smoke::Index base_index)
hunk ./src/libsmoke/smoke.cpp 186
- get_smoke(smoke_base), base_index);
+ get_smoke(smoke_base), base_index);
hunk ./src/libsmoke/smoke.cpp 200
-smoke_find_method(Smoke::ModuleIndex* m, void* smoke,
+cl_smoke_find_method(Smoke::ModuleIndex* m, void* smoke,
hunk ./src/libsmoke/smoke.cpp 220
-smoke_find_type(void* smoke, const char* name)
+cl_smoke_find_type(void* smoke, const char* name)
hunk ./src/libsmoke/smoke.cpp 234
-smoke_cast(void* smoke, void* object, Smoke::Index from, Smoke::Index to)
+cl_smoke_cast(void* smoke, void* object, Smoke::Index from, Smoke::Index to)
hunk ./src/libsmoke/smoke.lisp 6
- (:unix "libsmokeqt.so.3")
+ (:unix "libsmokeqtcore.so.3")
hunk ./src/libsmoke/smoke.lisp 8
- (define-foreign-library libsmoke-c
- (:unix "libsmoke-c.so")
- (t (:default "libsmoke-c")))
- (define-foreign-library libsmoke-c-util
- (:unix "libsmoke-c-util.so")
- (t (:default "libsmoke-c-util")))
+ (define-foreign-library libclsmoke
+ (:unix "libclsmoke.so")
+ (t (:default "libclsmoke")))
+ (define-foreign-library libclsmokeutil
+ (:unix "libclsmokeutil.so")
+ (t (:default "libclsmokeutil")))
hunk ./src/libsmoke/smoke.lisp 15
- (use-foreign-library libsmoke-c))
+ (use-foreign-library libclsmoke))
hunk ./src/libsmoke/smoke.lisp 19
- (use-foreign-library libsmoke-c-util)
- (defcfun smoke-sizeof-bool :int)
+ (use-foreign-library libclsmokeutil)
+ (defcfun (smoke-sizeof-bool "cl_smoke_sizeof_bool") :int)
hunk ./src/libsmoke/smoke.lisp 23
- (load-foreign-library 'libsmoke-c-util)
+ (load-foreign-library 'libclsmokeutil)
hunk ./src/libsmoke/smoke.lisp 32
-;(close-foreign-library 'libsmoke-c-util)
+;(close-foreign-library 'libclsmokeutil)
hunk ./src/libsmoke/smoke.lisp 44
-(defcfun smoke-init smoke-binding
+(defcfun (smoke-init "cl_smoke_init") smoke-binding
hunk ./src/libsmoke/smoke.lisp 49
-(defcfun smoke-destruct :void
+(defcfun (smoke-destruct "cl_smoke_destruct") :void
hunk ./src/libsmoke/smoke.lisp 59
-(defcfun smoke-get-smoke :pointer
+(defcfun (smoke-get-smoke "cl_smoke_get_smoke") :pointer
hunk ./src/libsmoke/smoke.lisp 62
-(defcfun smoke-get-module-name :string
+(defcfun (smoke-get-module-name "cl_smoke_get_module_name") :string
hunk ./src/libsmoke/smoke_util.cpp 22
-smoke_sizeof_bool()
+cl_smoke_sizeof_bool()
hunk ./src/libsmoke/smokebinding.cpp 1
-#include "csmokebinding.h"
+#include "smokebinding.h"
hunk ./src/libsmoke/smokebinding.h 1
-#ifndef CSMOKEBINDING_H
-#define CSMOKEBINDING_H
+#ifndef SMOKEBINDING_H
+#define SMOKEBINDING_H
hunk ./src/libsmoke/smokebinding.h 39
-#endif // CSMOKEBINDING_H
+#endif // SMOKEBINDING_H
hunk ./src/libsmoke/type.lisp 18
-(defcfun smoke-find-type smoke-index
+(defcfun (smoke-find-type "cl_smoke_find_type") smoke-index
hunk ./src/object-map.lisp 41
+ (tg:gc :full t) ;; Try to get all #'smoke::make-auto-pointer
hunk ./src/object-map.lisp 43
- (warn "life object ~A" object)
+ (warn "life object ~A ~A" object (pointer object))
hunk ./src/smoke-to-clos.lisp 21
- `(define-constant ,symbol ;; a long not really an enum.
+ `(define-constant ,symbol ;; a long, not really an enum.
hunk ./src/smoke-to-clos.lisp 55
- (call-using-args (find-class (quote ,(lispify (name class) package)))
- ,method-name
- ,(if (< argument-count 0)
- 'args
- `(list ,@(make-lambda argument-count)))))
+ (call-using-args
+ (find-class (quote ,(lispify (name class) [_$_]
+ (if (string= (name class)
+ "QGlobalSpace")
+ *package* ;; See #'MAKE-SMOKE-CLASSES
+ package))))
+ ,method-name
+ ,(if (< argument-count 0)
+ 'args
+ `(list ,@(make-lambda argument-count)))))
hunk ./src/smoke-to-clos.lisp 116
- (when (enum-p method)
+ (when (and (enum-p method)
+ ;; qt.network has QIODevice::NotOpen(), but the
+ ;; class is external (workaround).
+ (not (external-p (get-class method))))
hunk ./src/smoke-to-clos.lisp 142
- (setf (gethash function-symbol function-symbols)
- (if methods (- (id method)) (id method)))))))
+ (unless (fboundp function-symbol) ;; do not overwrite
+ ;; existing functions e.g. qInstallMsgHandler of
+ ;; qt.core with that of qt.gui which causes a
+ ;; segfault when loading from an saved image.
+ (setf (gethash function-symbol function-symbols)
+ (if methods (- (id method)) (id method))))))))
hunk ./src/smoke-to-clos.lisp 164
- (eval-startup (:load-toplevel :execute)
- ;; eval on startup for class map.
- (make-smoke-classes ,package ,smoke))
hunk ./src/smoke-to-clos.lisp 165
+ (make-smoke-classes ,package ,smoke)
hunk ./src/smoke.lisp 1
-;;; Copyright (C) 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
+;;; Copyright (C) 2009, 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
hunk ./src/smoke.lisp 105
- (use-foreign-library libsmoke-c)
+ (use-foreign-library libclsmoke)
hunk ./src/smoke.lisp 108
- (setf (binding smoke) binding
- (smoke-module-pointer module) smoke
+ (setf (smoke-module-pointer module) smoke
hunk ./src/smoke.lisp 115
+ ;; Used by make-load-form for enums to reference the smoke module.
hunk ./src/smoke.lisp 148
- ;;FIXME speed this up, needed by (mb:document :smoke).
hunk ./test-bundle.sh 8
-MALLOC_CHECK_=3 sbcl --eval '(require :qt.tests)' \
+MALLOC_CHECK_=3 sbcl --eval '(require :cl-smoke.qt.tests)' \
hunk ./test.lisp 11
-sh ./test-bundle.sh || exit 2
+ sh ./test-bundle.sh || exit 2
hunk ./test.lisp 21
-(asdf:operate 'asdf:load-op :smoke)
-(asdf:operate 'asdf:test-op :smoke)
+(require :asdf)
+(asdf:operate 'asdf:load-op :cl-smoke.smoke)
+(asdf:operate 'asdf:test-op :cl-smoke.smoke)
changepref test
sh test.lisp