From: Dmitry Kalyanov Date: Fri, 2 Oct 2009 20:49:31 +0000 (+0400) Subject: define-g-boxed-*: generate predictable names for structures X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=67c097c0b05d1b89ec7b421ed780c792e3cc08dd;p=cl-gtk2.git define-g-boxed-*: generate predictable names for structures --- diff --git a/doc/gobject.ref.texi b/doc/gobject.ref.texi index 73eb95e..43daa9e 100644 --- a/doc/gobject.ref.texi +++ b/doc/gobject.ref.texi @@ -1842,7 +1842,7 @@ A form that is the initform of Lisp structure slot A boolean. If it is true, then the slot contains GBoxed structure whose name is @code{slot-type}. @end table -Defines the ``simple'' GBoxed structure corresponding to C structure. The slot specification is analogous to CFFI @code{defstruct} slot specification with the addition of @code{inline} option. +Defines the ``simple'' GBoxed structure corresponding to C structure. The slot specification is analogous to CFFI @code{defstruct} slot specification with the addition of @code{inline} option. This also defines the @var{name}-cstruct CFFI structure definition with equivalent structure. Example of usage: @lisp @@ -1906,6 +1906,8 @@ Variant structure is represented in Lisp via a hierarchy on structures. For exam It is assumed that the variant of structures can be represented as C structures with fields of their ``parent'' structures prepended to them. This assumption breaks when structures include their ``parent'' structure as a first field (this changes the memory alignment and changes offsets of fields). +This also defines the @var{name}-cstruct, @var{structure-name}-cstruct, @var{structure-name}-cunion CFFI structures definitions with equivalent structures (unions). + For example, for these structures this assumption holds: @example union GdkEvent diff --git a/glib/gobject.boxed.lisp b/glib/gobject.boxed.lisp index 5942250..4fe93b3 100644 --- a/glib/gobject.boxed.lisp +++ b/glib/gobject.boxed.lisp @@ -347,10 +347,10 @@ (collect variant))) (defun generated-cstruct-name (symbol) - (intern (format nil "~A-CSTRUCT-GENERATED-BY-GOBJECT-BOXED" (symbol-name symbol)) (symbol-package symbol))) + (intern (format nil "~A-CSTRUCT" (symbol-name symbol)) (symbol-package symbol))) (defun generated-cunion-name (symbol) - (intern (format nil "~A-CUNION-GENERATED-BY-GOBJECT-BOXED" (symbol-name symbol)) (symbol-package symbol))) + (intern (format nil "~A-CUNION" (symbol-name symbol)) (symbol-package symbol))) (defun generate-cstruct-1 (struct) `(defcstruct ,(generated-cstruct-name (cstruct-description-name struct))