chiark / gitweb /
Callbacks from C done properly
[clg] / glib / glib.lisp
index 68bda1999cb7c3ecf5e96a460623760a4b59968a..650bb80b14e28d762b2608fb4cc192038ae7c0a5 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: glib.lisp,v 1.10 2001/05/11 16:00:33 espen Exp $
+;; $Id: glib.lisp,v 1.15 2004/11/01 00:08:49 espen Exp $
 
 
 (in-package "GLIB")
@@ -32,10 +32,10 @@ (defbinding (reallocate-memory "g_realloc") () pointer
   (address pointer)
   (size unsigned-long))
 
-;(defbinding (deallocate-memory "g_free") () nil
-;  (address pointer))
-(defun deallocate-memory (address)
-  (declare (ignore address)))
+(defbinding (deallocate-memory "g_free") () nil
+  (address pointer))
+;(defun deallocate-memory (address)
+;  (declare (ignore address)))
 
 (defun copy-memory (from length &optional (to (allocate-memory length)))
   (kernel:system-area-copy from 0 to 0 (* 8 length))
@@ -48,7 +48,6 @@ (internal *user-data* *user-data-count*)
 
 (declaim (fixnum *user-data-count*))
 
-(defvar *destroy-notify* (system:foreign-symbol-address "destroy_notify"))
 (defvar *user-data* (make-hash-table))
 (defvar *user-data-count* 0)
 
@@ -327,7 +326,7 @@ (deftype-method translate-from-alien
         (dotimes (i ,length)
           (setf
            (aref vector i)
-           ,(translate-to-alien
+           ,(translate-from-alien
              element-type
              `(,(sap-ref-fname element-type) c-array (* i ,element-size))
              weak-ref)))
@@ -351,10 +350,10 @@ (deftype-method unreference-alien vector (type-spec c-vector)
                  `(dotimes (i ,length)
                     (unreference-alien
                      element-type (sap-ref-sap c-vector (* i ,element-size))))
-               `(do ((offset 0 (+ offset ,element-size))
+               `(do ((offset 0 (+ offset ,element-size)))
                      ((sap=
                        (sap-ref-sap c-vector offset)
-                       *magic-end-of-array*)))
+                       *magic-end-of-array*))
                     ,(unreference-alien
                       element-type '(sap-ref-sap c-vector offset))))))
         (deallocate-memory c-vector)))))
@@ -379,4 +378,3 @@ (defun map-c-array (seqtype function location element-type length)
           (elt sequence i)
           (funcall function (funcall reader location (* i size)))))
        sequence)))))
-     
\ No newline at end of file