GObject: correctly specify :count options for slots of generated cstruct
authorDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Wed, 5 Aug 2009 17:59:22 +0000 (21:59 +0400)
committerDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Wed, 5 Aug 2009 17:59:22 +0000 (21:59 +0400)
glib/gobject.boxed.lisp

index 8605a4e..0c7f8be 100644 (file)
 (defmacro define-g-boxed-cstruct (name g-type-name &body slots)
   `(progn
      (defstruct ,name
-       ,@(iter (for (name type &key initarg) in slots)
+       ,@(iter (for (name type &key count initarg) in slots)
                (collect (list name initarg))))
      (defcstruct ,(generated-cstruct-name name)
-       ,@(iter (for (name type &key initarg) in slots)
-               (collect `(,name ,type))))
+       ,@(iter (for (name type &key count initarg) in slots)
+               (collect `(,name ,type ,@(when count `(:count ,count))))))
      (eval-when (:compile-toplevel :load-toplevel :execute)
        (setf (get ',name 'g-boxed-foreign-info)
              (make-g-boxed-cstruct-wrapper-info :name ',name
      ,@(iter (for slot in (var-struct-all-slots struct))
              (collect `(,(var-structure-slot-name slot) ,(var-structure-slot-type slot)
                          ,@(when (var-structure-slot-count slot)
-                                 (list `(:count ,(var-structure-slot-count slot)))))))))
+                                 `(:count ,(var-structure-slot-count slot))))))))
 
 (defun generate-c-structures (structure)
   (iter (for str in (all-structures structure))