- `(progn
- (defstruct ,name
- ,@(iter (for (name type &key count initarg) in slots)
- (collect (list name initarg))))
- (defcstruct ,(generated-cstruct-name name)
- ,@(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
- :g-type ,g-type-name
- :cstruct ',(generated-cstruct-name name)
- :slots ',(iter (for (name type &key initarg) in slots)
- (collect name)))
- (gethash ,g-type-name *g-type-name->g-boxed-foreign-info*)
- (get ',name 'g-boxed-foreign-info)))))
+ (let ((cstruct-description (parse-cstruct-definition name slots)))
+ `(progn
+ (defstruct ,name
+ ,@(iter (for slot in (cstruct-description-slots cstruct-description))
+ (for name = (cstruct-slot-description-name slot))
+ (for initform = (cstruct-slot-description-initform slot))
+ (collect (list name initform))))
+ (defcstruct ,(generated-cstruct-name name)
+ ,@(iter (for slot in (cstruct-description-slots cstruct-description))
+ (for name = (cstruct-slot-description-name slot))
+ (for type = (cstruct-slot-description-type slot))
+ (for count = (cstruct-slot-description-count slot))
+ (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
+ :g-type ,g-type-name
+ :cstruct-description ,cstruct-description)
+ (gethash ,g-type-name *g-type-name->g-boxed-foreign-info*)
+ (get ',name 'g-boxed-foreign-info))))))