X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/9adccb27da69b60d058aa37867d55ea20ecf97ca..6bb2385148c2ff5f4f5daa87b508ae6c985b451b:/glib/glib.lisp diff --git a/glib/glib.lisp b/glib/glib.lisp index 149d392..ae3cda8 100644 --- a/glib/glib.lisp +++ b/glib/glib.lisp @@ -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.16 2004-11-06 21:39:58 espen Exp $ +;; $Id: glib.lisp,v 1.19 2004-11-12 13:27:41 espen Exp $ (in-package "GLIB") @@ -72,7 +72,6 @@ (defun destroy-user-data (id) (remhash id *user-data*)) - ;;;; Quarks (internal *quark-counter* *quark-from-object* *quark-to-object*) @@ -197,7 +196,7 @@ (defmethod to-alien-form (list (type (eql 'glist)) &rest args) `(make-glist ',element-type ,list))) (defmethod to-alien-function ((type (eql 'glist)) &rest args) - (declare (ignore type args)) + (declare (ignore type)) (destructuring-bind (element-type) args #'(lambda (list) (make-glist element-type list)))) @@ -277,7 +276,7 @@ (defmethod to-alien-form (list (type (eql 'gslist)) &rest args) `(make-sglist ',element-type ,list))) (defmethod to-alien-function ((type (eql 'gslist)) &rest args) - (declare (ignore type args)) + (declare (ignore type)) (destructuring-bind (element-type) args #'(lambda (list) (make-gslist element-type list)))) @@ -314,11 +313,19 @@ (defun make-c-vector (type length &optional content location) (let* ((size-of-type (size-of type)) (location (or location (allocate-memory (* size-of-type length)))) (writer (writer-function type))) - (loop - for element across content - for i from 0 below length - as offset = 0 then (+ offset size-of-type) - do (funcall writer element location offset)) + (etypecase content + (vector + (loop + for element across content + for i from 0 below length + as offset = 0 then (+ offset size-of-type) + do (funcall writer element location offset))) + (list + (loop + for element in content + for i from 0 below length + as offset = 0 then (+ offset size-of-type) + do (funcall writer element location offset)))) location))