From e75a694b028cd8f7e378929fe95dd6ca355b1051 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Mon, 11 Feb 2008 17:34:57 +0100 Subject: Specialise MAKE-LOAD-FORM for pointer wrappers. darcs-hash:4a9e629e6e9a9e20d21c80c541e70b4b6a810645 --- Lisp/data-types.lisp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Lisp/data-types.lisp') diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp index e244e8d..36f0f2f 100644 --- a/Lisp/data-types.lisp +++ b/Lisp/data-types.lisp @@ -39,6 +39,17 @@ :initform (cffi:null-pointer))))) + + +(defmethod make-load-form ((instance c-pointer-wrapper) &optional environment) + (declare (ignore environment)) + ;; (TYPE-OF INSTANCE) works because MAKE-POINTER-WRAPPER accepts + ;; subclasses of ID as well as ID itself. + `(make-pointer-wrapper ',(type-of instance) + :pointer (make-pointer + ,(pointer-address (pointer-to instance))))) + + ;; The following may be needed by some implementations (namely Allegro ;; CL). (eval-when (:compile-toplevel :load-toplevel :execute) @@ -106,6 +117,13 @@ The following calls are all equivalent: (apply #'invoke-by-name receiver selector args)))) +(defmethod make-load-form ((selector selector) &optional environment) + (declare (ignore environment)) + `(make-pointer-wrapper 'selector + :pointer (make-pointer + ,(pointer-address (pointer-to selector))))) + + (defclass id (c-pointer-wrapper) () (:documentation "The type of all Objective-C objects. -- cgit v1.2.3