From 67c097c0b05d1b89ec7b421ed780c792e3cc08dd Mon Sep 17 00:00:00 2001 From: Dmitry Kalyanov Date: Sat, 3 Oct 2009 00:49:31 +0400 Subject: [PATCH] define-g-boxed-*: generate predictable names for structures --- doc/gobject.ref.texi | 4 +++- glib/gobject.boxed.lisp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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)) -- 1.7.10.4