Sun Mar 13 20:40:35 CET 2011 Tobias Rautenkranz * Fix loading on OSX. Thanks to Elliott Slaughter Sat Apr 3 14:34:21 CEST 2010 Tobias Rautenkranz * Account for possible lisp-object metatype id change when loading an image. diff -rN -u old-qt.core/src/qt.core.lisp new-qt.core/src/qt.core.lisp --- old-qt.core/src/qt.core.lisp 2014-11-24 14:11:57.000000000 +0100 +++ new-qt.core/src/qt.core.lisp 2014-11-24 14:11:57.000000000 +0100 @@ -33,6 +33,7 @@ (init-qt-smoke "init_qtcore_Smoke")) (define-foreign-library libclsmokeqtcore - (:unix "libclsmokeqtcore.so") + (:darwin "libclsmokeqtcore.dylib") + (:unix "libclsmokeqtcore.so") (t (:default "libclsmokeqtcore"))) (use-foreign-library libclsmokeqtcore)) diff -rN -u old-qt.core/src/variant.lisp new-qt.core/src/variant.lisp --- old-qt.core/src/variant.lisp 2014-11-24 14:11:57.000000000 +0100 +++ new-qt.core/src/variant.lisp 2014-11-24 14:11:58.000000000 +0100 @@ -76,54 +76,59 @@ (defun copy-object-from-pointer (class pointer) (make-instance class :arg0 (make-instance class :pointer pointer))) -(macrolet - ((variant-conversions ((variant) &body types) - (let* ((special-types '(long-long ulong-long map list hash)) - (exclude-types - (append '(63) ;; ColorGroup - (mapcar #'(lambda (s) - (value - (symbol-value - (intern (format nil "VARIANT.+~A+" s) - :qt)))) - special-types))) - (qt-types (loop for i from 1 to (value qt:variant.+user-type+) - when (and (qt:variant.type-to-name i) - ;; type-to-name returns longlong but - ;; should be LongLong - (not (member i exclude-types))) - collect - (smoke::lispify (qt:variant.type-to-name i) - :qt)))) - `(ecase (cxx:user-type ,variant) - ,@(loop for type in (append types special-types - (remove nil qt-types)) - collect - (if (symbolp type) - `(,(value (symbol-value - (let ((*package* - (find-package :cl-smoke.qt))) - (symbolicate 'variant.+ type '+)))) - ,(if (fboundp (intern (format nil "TO-~A" type) :cxx)) - `(,(intern (format nil "TO-~A" type) :cxx) ,variant) - `(copy-object-from-pointer - ;; intern since these types are in - ;; qt.gui not qt.core - (intern ,(symbol-name type) :qt) - (cxx:const-data ,variant)))) - type)))))) - (defun qt:from-variant (variant) - "Returns the value of VARIANT." - (variant-conversions (variant) - (#.(value qt:variant.+invalid+) - (cerror "Return (VALUES)" "Type of variant ~A is invalid." variant) - (values)) - (#.*cxx-lisp-object-metatype* - (let* ((lisp-object (cl-smoke-lisp-object-value (pointer variant))) - (value)) - (setf value (translate-cxx-lisp-object lisp-object)) - (free-cxx-lisp-object lisp-object) - value))))) +(eval-startup () +;; *cxx-lisp-object-metatype* can change when loading an image +(eval ' + (macrolet + ((variant-conversions ((variant) &body types) + (let* ((special-types '(long-long ulong-long map list hash)) + (exclude-types + (append '(63) ;; ColorGroup + (mapcar #'(lambda (s) + (value + (symbol-value + (intern (format nil "VARIANT.+~A+" s) + :qt)))) + special-types))) + (qt-types (loop for i from 1 to (value qt:variant.+user-type+) + when (and (qt:variant.type-to-name i) + ;; type-to-name returns longlong but + ;; should be LongLong + (not (member i exclude-types))) + collect + (smoke::lispify (qt:variant.type-to-name i) + :qt)))) + `(ecase (cxx:user-type ,variant) + ,@(loop for type in (append special-types + (remove nil qt-types)) + collect + `(,(value (symbol-value + (let ((*package* + (find-package :cl-smoke.qt))) + (symbolicate 'variant.+ type '+)))) + ,(if (fboundp (intern (format nil "TO-~A" type) :cxx)) + `(,(intern (format nil "TO-~A" type) :cxx) ,variant) + `(copy-object-from-pointer + ;; intern since these types are in + ;; qt.gui not qt.core + (intern ,(symbol-name type) :qt) + (cxx:const-data ,variant))))) + ,@(loop for type in types + collect + `(,(eval (first type)) + ,@(rest type))))))) + (defun qt:from-variant (variant) + "Returns the value of VARIANT." + (variant-conversions (variant) + ((value qt:variant.+invalid+) + (cerror "Return (VALUES)" "Type of variant ~A is invalid." variant) + (values)) + (*cxx-lisp-object-metatype* + (let* ((lisp-object (cl-smoke-lisp-object-value (pointer variant))) + (value)) + (setf value (translate-cxx-lisp-object lisp-object)) + (free-cxx-lisp-object lisp-object) + value))))))) (defmethod qt:value ((variant qt:variant)) "Returns the value of VARIANT." diff -rN -u old-qt.core/test.lisp new-qt.core/test.lisp --- old-qt.core/test.lisp 2014-11-24 14:11:57.000000000 +0100 +++ new-qt.core/test.lisp 2014-11-24 14:11:57.000000000 +0100 @@ -1,6 +1,11 @@ #| +v v v v v v v +cmake ./ +make +************* cmake ./ || exit 1 make || exit 1 +^ ^ ^ ^ ^ ^ ^ exec -a "$0" sbcl --noinform --noprint --disable-debugger --load $0 --end-toplevel-options "$@" # Used for testing on darcs record. |#