X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/1143508416716e1236d7d7b772fa471716f06235..17349b4d1ae3139ef495047cbadd532dc4e94f97:/glib/glib.lisp diff --git a/glib/glib.lisp b/glib/glib.lisp index 220002e..a94b0fd 100644 --- a/glib/glib.lisp +++ b/glib/glib.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: glib.lisp,v 1.43 2008-04-01 21:17:59 espen Exp $ +;; $Id: glib.lisp,v 1.45 2008-12-14 21:37:25 espen Exp $ (in-package "GLIB") @@ -39,24 +39,23 @@ ;;;; Memory management -(defbinding (%allocate-memory "g_malloc0") () pointer - (size unsigned-long)) +(deftype gsize () 'unsigned-int) +(deftype gssize () 'int) +(deftype goffset () '(unsigned-int 64)) -(defbinding (%deallocate-memory "g_free") () nil - (address pointer)) -;; (setf -;; (symbol-function 'allocate-memory) #'%allocate-memory -;; (symbol-function 'deallocate-memory) #'%deallocate-memory) +(defbinding malloc0 () pointer + (size gsize)) + +(defbinding free () nil + (address pointer)) -(setf *memory-allocator* #'%allocate-memory) -(setf *memory-deallocator* #'%deallocate-memory) +(setf *memory-allocator* #'malloc0) +(setf *memory-deallocator* #'free) (defbinding (reallocate-memory "g_realloc") () pointer (address pointer) - (size unsigned-long)) - -(deftype gsize () 'unsigned-int) + (size gsize)) (defbinding (slice-alloc "g_slice_alloc0") () pointer (block-size gsize)) @@ -64,6 +63,8 @@ ;;;; User data is a mechanism to store references to lisp objects in ;;;; foreign code +;; TODO: move to gffi + (defvar *user-data-lock* (make-mutex)) (defvar *user-data* (make-hash-table)) (defvar *user-data-next-id* 1)