(define-g-boxed-cstruct name g-type-name &body slot*) slot ::= (slot-name slot-type &key count initform inline)
:count
option of slot in CFFI defcstruct
. If count
is not NIL, then the slot is mapped to Lisp array.
slot-type
.
Defines the “simple” GBoxed structure corresponding to C structure. The slot specification is analogous to CFFI defstruct
slot specification with the addition of inline
option. This also defines the name-cstruct CFFI structure definition with equivalent structure.
Example of usage:
(define-g-boxed-cstruct rectangle "GdkRectangle" (left :int :initform 0) (top :int :initform 0) (width :int :initform 0) (height :int :initform 0)) (define-g-boxed-cstruct point nil (x :int :initform 0) (y :int :initform 0)) (define-g-boxed-cstruct vector4 nil (coords :double :count 4 :initform (vector 0d0 0d0 0d0 0d0))) (define-g-boxed-cstruct segment nil (a point :inline t :initform (make-point)) (b point :inline t :initform (make-point)))