chiark / gitweb /
Added new type methods for handling of C callback arguments
authorespen <espen>
Sun, 19 Feb 2006 19:23:23 +0000 (19:23 +0000)
committerespen <espen>
Sun, 19 Feb 2006 19:23:23 +0000 (19:23 +0000)
glib/gtype.lisp
glib/proxy.lisp

index 8f6228e2cea2c07ec5f352712b8284f4c38f2a50..1b68524f9cac83cca1e1877c51252e36c698db7d 100644 (file)
@@ -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: gtype.lisp,v 1.43 2006/02/08 21:53:34 espen Exp $
+;; $Id: gtype.lisp,v 1.44 2006/02/19 19:23:23 espen Exp $
 
 (in-package "GLIB")
 
@@ -374,6 +374,9 @@ (defmethod invalidate-instance ((instance ginstance))
   ;; A ginstance should never be invalidated since it is ref counted
   nil)
 
+(defmethod callback-from-alien-form (form (type t) &rest args)
+  (apply #'from-alien-form form type args))
+
 (defmethod copy-from-alien-form (location (class ginstance-class) &rest args)
   (declare (ignore location class args))
   (error "Doing copy-from-alien on a ref. counted class is most certainly an error, but if it really is what you want you should use REFERENCE-FOREIGN on the returned instance instead."))
index 0baa3dc835babbb3ec28b57528a5c35d79f6a659..a114325ca5e09685150229a03f5b3e1dcf6563e7 100644 (file)
@@ -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.34 2006/02/19 19:10:33 espen Exp $
+;; $Id: proxy.lisp,v 1.35 2006/02/19 19:23:23 espen Exp $
 
 (in-package "GLIB")
 
@@ -660,6 +660,13 @@ (defmethod reader-function ((class struct-class) &rest args)
        (unless (null-pointer-p instance)
          (ensure-proxy-instance class instance :weak t)))))
 
+(defmethod callback-from-alien-form (form (class struct-class) &rest args)
+  `(ensure-proxy-instance ',(class-name class) ,form :weak t))
+
+(defmethod callback-cleanup-form (form (class struct-class) &rest args)
+  (declare (ignore class))
+  `(invalidate-instance ,form))
+
 
 ;;; Pseudo type for structs which are inlined in other objects