X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/75689fea8b73ccc1e8cb32b671b7fd881da40cf3..4080e30aa85143a0975ae5718cd81628b24e20c2:/glib/proxy.lisp diff --git a/glib/proxy.lisp b/glib/proxy.lisp index 1ca8fe5..f43b806 100644 --- a/glib/proxy.lisp +++ b/glib/proxy.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: proxy.lisp,v 1.36 2006-02-26 15:30:01 espen Exp $ +;; $Id: proxy.lisp,v 1.39 2006-03-06 14:28:03 espen Exp $ (in-package "GLIB") @@ -211,8 +211,9 @@ (defmethod compute-effective-slot-definition-initargs ((class virtual-slots-clas (let ((boundp (most-specific-slot-value direct-slotds 'boundp))) (unless (eq boundp *unbound-marker*) (setf (getf initargs :boundp) boundp))) - ;; Need this to prevent type expansion in SBCL >= 0.9.8 - (let ((type (most-specific-slot-value direct-slotds 'type))) + ;; This is needed to avoid type expansion in SBCL version >= 0.9.8 + #+sbcl>=0.9.8 + (let ((type (most-specific-slot-value direct-slotds #-sbcl>=0.9.10'type #+sbcl>=0.9.10'sb-pcl::%type))) (unless (eq type *unbound-marker*) (setf (getf initargs :type) type))) (nconc initargs (call-next-method)))) @@ -450,8 +451,12 @@ (defmethod initialize-internal-slot-functions ((slotd effective-alien-slot-def (call-next-method)) - ;; TODO: call some C code to detect this a compile time - (defconstant +struct-alignmen+ 4) + (defconstant +struct-alignmen+ + #+sbcl (/ (sb-alien-internals:alien-type-alignment + (sb-alien-internals:parse-alien-type + 'system-area-pointer nil)) + 8) + #-sbcl 4) (defun align-offset (size) (if (zerop (mod size +struct-alignmen+)) @@ -670,19 +675,25 @@ (defmethod unreference-foreign ((class static-struct-class) location) (deftype inlined (type) type) (define-type-method size-of ((type inlined)) - (let ((class (type-expand (second type)))) + (let ((class (second (type-expand-to 'inlined type)))) (foreign-size class))) (define-type-method reader-function ((type inlined)) - (let ((class (type-expand (second type)))) + (let ((class (second (type-expand-to 'inlined type)))) #'(lambda (location &optional (offset 0) weak-p) (declare (ignore weak-p)) (ensure-proxy-instance class (reference-foreign class (sap+ location offset)))))) (define-type-method writer-function ((type inlined)) - (let ((class (type-expand (second type)))) + (let ((class (second (type-expand-to 'inlined type)))) #'(lambda (instance location &optional (offset 0)) (copy-memory (foreign-location instance) (foreign-size class) (sap+ location offset))))) +(define-type-method destroy-function ((type inlined)) + (declare (ignore type)) + #'(lambda (location &optional offset) + (declare (ignore location offset)))) + + (export 'inlined)