+GObject manual defines this type in the following way:
+
+``GBoxed is a generic wrapper mechanism for arbitrary C structures. The only thing the type system needs to know about the structures is how to copy and free them, beyond that they are treated as opaque chunks of memory.
+
+Boxed types are useful for simple value-holder structures like rectangles or points. They can also be used for wrapping structures defined in non-GObject based libraries.''
+
+Naturally, it is hard to provide support for ``arbitrary C structures''. We support a few useful use cases of GBoxed types:
+@itemize
+@item Simple C structures. A Lisp structure is a one-to-one correspondence to C structure and is passes to and from foreign code by copying the data it contains. Examples of simple structures are GdkPoint, GdkRectangle.
+@item ``Variant'' C structures. A one common idiom of C is to define a union of structures sharing the same parts in order to implement the polymorphism of structures. These structures are mapped to a hierarchy of Lisp structures (where one structure subclasses another via the @code{:include} @code{defstruct} option).
+
+For example, Gdk has structure GdkEvent which is a union of GdkEventAny, GdkEventExpose and other structures. These structures have common slots: ``type'', ``window'', ``send_event''. By dispatching on ``type'', user or GdkEvent structure knows which of GdkEvent* structures it has and can access other fields.
+@item Opaque C structures. A C structure the has ``hidden'' fields and should only created/destroyed with specific functions and be accessed only with specific accessors. Example of such structures is GtkTreePath.
+@end itemize
+
+@node define-g-boxed-cstruct
+@section define-g-boxed-cstruct
+@Macro define-g-boxed-cstruct
+@lisp
+(define-g-boxed-cstruct name g-type-name
+ &body slot*)
+
+slot ::= (slot-name slot-type &key count initform inline)
+@end lisp
+
+@table @var
+@item @var{name}
+A symbol naming the type being defined
+@item @var{g-type-name}
+A string specifying the GType name of this GBoxed. This may be nil if this type is not registered with GObject type system.
+@item @var{slot-name}
+A symbol naming the slot of a structure
+@item @var{slot-type}
+A foreign type of a slot
+@item @var{count}
+An integer. Corresponds to @code{:count} option of slot in CFFI @code{defcstruct}. If @code{count} is not NIL, then the slot is mapped to Lisp array.
+@item @var{initform}
+A form that is the initform of Lisp structure slot
+@item @var{inline}
+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.
+
+Example of usage:
+@lisp
+(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)))
+@end lisp
+
+@node define-g-boxed-variant-cstruct
+@section define-g-boxed-variant-cstruct
+
+@Macro define-g-boxed-variant-cstruct
+@lisp
+(define-g-boxed-variant-cstruct name g-type-name
+ &body slot-or-variant-specification*)
+
+slot ::= (slot-name slot-type &key count initform inline)
+variant-specification ::= (:variant dispatching-slot-name structure-variant*)
+structure-variant ::= (dispatching-slot-values structure-name &body slot-or-variant-specification*)
+@end lisp
+
+@table @var
+@item @var{name}
+A symbol naming the type being defined
+@item @var{g-type-name}
+A string specifying the GType name of this GBoxed. This may be nil if this type is not registered with GObject type system.
+@item @var{slot-name}
+A symbol naming the slot of a structure
+@item @var{slot-type}
+A foreign type of a slot
+@item @var{count}
+An integer. Corresponds to @code{:count} option of slot in CFFI @code{defcstruct}. If @code{count} is not NIL, then the slot is mapped to Lisp array.
+@item @var{initform}
+A form that is the initform of Lisp structure slot
+@item @var{inline}
+A boolean. If it is true, then the slot contains GBoxed structure whose name is @code{slot-type}.
+@item @var{dispatching-slot-name}
+A name of the dispatching slot
+@item @var{dispatching-slot-values}
+A single value or a list of values.
+@item @var{structure-name}
+A symbol naming the structure
+@end table
+
+Defines the variant GBoxed structure. Slots of variant structures are defined the same way as the slots of ``simple'' cstructs. After the last slot, @code{variant-specification} may be used to specify the variants of the structure. For this, dispatching slot is specified. The value of this slot specifies which variant of structure is used. Each variant is specified by values of the dispatching slot, by its slots and its variants.
+
+Variant structure is represented in Lisp via a hierarchy on structures. For example, @code{GdkEvent} structure has variants @code{GdkEventAny}, @code{GdkEventButton}, @code{GdkEventMotion}. In Lisp, @code{event} structure is defined with all common fields of these structures and @code{event-button}, @code{event-motion} structures inherit from @code{event} structure.
+
+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).
+
+For example, for these structures this assumption holds:
+@example
+union GdkEvent
+@{
+ GdkEventType type;
+ GdkEventKey key;
+ GdkEventButton button;
+@};
+
+struct GdkEventKey @{
+ GdkEventType type; //
+ GdkWindow *window; // These fields are common
+ gint8 send_event; //
+ guint32 time;
+ guint state;
+ guint keyval;
+ ...
+@};
+
+struct GdkEventButton @{
+ GdkEventType type; //
+ GdkWindow *window; // These fields are common
+ gint8 send_event; //
+ guint32 time;
+ gdouble x;
+ gdouble y;
+ ...
+@};
+@end example
+
+Example:
+@lisp
+(define-g-boxed-variant-cstruct event "GdkEvent"
+ (type event-type)
+ (window (g-object gdk-window))
+ (send-event (:boolean :int8))
+ (:variant type
+ ((:key-press :key-release) event-key
+ (time :uint32)
+ (state modifier-type)
+ (keyval :uint)
+ (length :int)
+ (string (:string :free-from-foreign nil
+ :free-to-foreign nil))
+ (hardware-keycode :uint16)
+ (group :uint8)
+ (is-modifier :uint))
+ ((:button-press :2button-press :3button-press
+ :button-release) event-button
+ (time :uint32)
+ (x :double)
+ (y :double)
+ (axes (fixed-array :double 2))
+ (state :uint)
+ (button :uint)
+ (device (g-object device))
+ (x-root :double)
+ (y-root :double))
+ ...))
+@end lisp
+
+This code defines following structures:
+@lisp
+(defstruct event
+ type window send-event)
+
+(defstruct (event-key (:include event))
+ time state keyval length string
+ hardware-keycode group is-modifier)
+
+(defstruct (event-button (:include event))
+ time x y axes state button device x-root y-root)
+@end lisp
+
+@node define-g-boxed-opaque
+@section define-g-boxed-opaque
+
+@Macro define-g-boxed-opaque
+@lisp
+(define-g-boxed-opaque name g-type-name &key alloc)
+@end lisp
+
+@table @var
+@item @var{name}
+A name of boxed type
+@item @var{g-type-name}
+A string; the name of GType
+@item @var{alloc}
+A form that when evaluated produces a pointer to newly allocated structure. This pointer should be copiable with @code{g_boxed_copy} and freeable with @code{g_boxed_free} function.
+@end table
+
+Defines a opaque boxed structure. A class named @var{name} is defined as a subclass of @code{g-boxed-opaque} class. Instances of this class contain pointers to corresponding structures. An @code{:after} method for @code{initialize-instance} generic function is defined that speciales on class @var{name}. This method either accepts a @code{:pointer} initarg or evaluates @var{alloc} form if @code{:pointer} is not specified; the resulting pointer is saved in instance; finalizer is registered to free the pointer when the garbage collectors deletes this object.
+
+Example:
+@lisp
+(defcfun gtk-tree-path-new :pointer)
+
+(define-g-boxed-opaque tree-path "GtkTreePath"
+ :alloc (gtk-tree-path-new))
+@end lisp
+@node g-boxed-opaque
+@section g-boxed-opaque
+@Class g-boxed-opaque
+@lisp
+(defclass g-boxed-opaque ()
+ ((pointer :initarg :pointer
+ :initform nil
+ :accessor g-boxed-opaque-pointer)))
+@end lisp
+
+A class that is the base class for wrappers of opaque structures. Contains a pointer to the wrapped opaque structure.
+
+Accessor function @code{g-boxed-opaque-pointer} is used to access the pointer. Pointer should not be modified directly, only read.
+@node define-boxed-opaque-accessor
+@section define-boxed-opaque-accessor
+@Macro define-boxed-opaque-accessor
+@lisp
+(define-boxed-opaque-accessor
+ boxed-name accessor-name &key type reader writer)
+@end lisp
+
+@table @var
+@item @var{boxed-name}
+A symbol naming the opaque structure type for which the accessor is being defined
+@item @var{accessor-name}
+A symbol naming the accessor
+@item @var{type}
+A CFFI foreign type of the property for which the accessor is being defined
+@item @var{reader}
+A @code{NIL} or a string or a function designator for the reader function
+@item @var{writer}
+A @code{NIL} or a string or a function designator for the writer function
+@end table
+
+Defines the accessor named @var{accessor-name} for property of opaque structure named @var{boxed-name} of type specified by CFFI foreign-type @var{type}.
+
+@var{reader} is a string naming a foreign function of one argument of CFFI foreign-type @code{(g-boxed-foreign @var{boxed-name})} that returns a value of CFFI foreign-type @var{type}; or a function designator for a function that accepts a single argument - an instance of @code{g-boxed-opaque} class and returns the value of a property; or a @code{NIL} if the property is not readable.
+
+@var{writer} is a string naming a foreign function of two arguments: of types @var{type} and @code{(g-boxed-foreign @var{boxed-name})} (with the first argument being the new value and the second being the object); or a function designator for a function of two arguments: a new value and an instance of @code{g-boxed-opaque} class; or a @code{NIL} if the property is not writable.
+
+Example:
+@lisp
+(define-boxed-opaque-accessor text-iter text-iter-child-anchor
+ :reader "gtk_text_iter_get_child_anchor" :type (g-object text-child-anchor))
+
+(define-boxed-opaque-accessor text-iter text-iter-tags
+ :reader "gtk_text_iter_get_tags" :type (gslist (g-object text-tag) :free-from-foreign t))
+
+(define-boxed-opaque-accessor text-iter text-iter-chars-in-line
+ :reader "gtk_text_iter_get_chars_in_line" :type :int)
+
+(define-boxed-opaque-accessor text-iter text-iter-offset
+ :reader "gtk_text_iter_get_offset" :writer "gtk_text_iter_set_offset" :type :int)
+@end lisp
+
+@node boxed-related-symbols
+@section boxed-related-symbols
+
+@Function boxed-related-symbols
+@lisp
+(boxed-related-symbols name) @result{} symbols
+@end lisp
+
+@table @var
+@item @var{name}
+A symbol naming the boxed type
+@item @var{symbols}
+A list of symbols
+@end table
+
+This function returns the list of symbols that are related to GBoxed type @var{name}. These symbols are returned:
+@itemize
+@item name of boxed type
+@item name of all accessors of cstruct and variant-cstruct boxed types
+@item names of all variants of variant-cstruct boxed types
+@item names of constructors and copiers of cstruct and variant-cstruct boxed-types
+@end itemize
+
+Typical usage of this function is to export the symbols related to given boxed type.
+
+Example:
+@lisp
+(define-g-boxed-cstruct rectangle "GdkRectangle"
+ (x :int :initform 0)
+ (y :int :initform 0)
+ (width :int :initform 0)
+ (height :int :initform 0))
+
+(boxed-related-symbols 'rectangle)
+@result{}
+(RECTANGLE MAKE-RECTANGLE COPY-RECTANGLE RECTANGLE-X RECTANGLE-Y
+ RECTANGLE-WIDTH RECTANGLE-HEIGHT)
+@end lisp
+
+@node GBoxed foreign type
+@section GBoxed foreign type
+
+@ForeignType g-boxed-foreign
+@lisp
+(g-boxed-foreign name &rest option*)
+
+option ::= :return
+@end lisp
+
+@table @var
+@item @var{name}
+Name of GBoxed type
+@item @var{option}
+Option of foreign type
+@item @code{:return}
+An option that identifies the foreign type which is used at return position (as foreign function return type or as a callback return type)
+@end table
+
+@code{g-boxed-foreign} type deals with marshaling data between Lisp code and foreign code. The marshaling follows the following principles:
+@itemize
+@item All operations on Lisp objects corresponding to GBoxed types are type-safe and should never lead to any form of memory corruption (if some operation is impossible due to e.g., pointer in opaque pointer wrapper being invalidated, error should be signalled)
+@item Lisp objects should not be manually managed and are properly reclaimed by garbage collector, leaving no memory leaks
+@item Foreign code can change objects that are passed to them as arguments. This is required for functions that operate by modifying their arguments
+@item Lisp code in callbacks can change objects that are passed as arguments. This is required to be able to implement interfaces that have functions that operate by modifying their arguments
+@end itemize
+
+The @code{:return} option is required to be able to properly manage memory of opaque pointer wrappers and propagate changes to foreign and lisp structures.
+
+In order to be able to correctly use @code{g-boxed-foreign} foreign type in callbacks, you should use @code{glib-defcallback}. This macro is a thin wrapper around @code{cffi:defcallback} that adds proper handling of @code{g-boxed-foreign} foreign types.
+
+Examples of usage:
+@lisp
+(define-vtable ("GtkTreeModel" c-gtk-tree-model)
+ ...
+ (tree-model-get-path-impl tree-model-get-path-cb
+ (g-boxed-foreign tree-path :return) (tree-model g-object) (iter (g-boxed-foreign tree-iter)))
+ (tree-model-get-value-impl tree-model-get-value-cb
+ :void (tree-model g-object) (iter (g-boxed-foreign tree-iter)) (n :int) (value (:pointer g-value)))
+ (tree-model-iter-next-impl tree-model-iter-next-cb
+ :boolean (tree-model g-object) (iter (g-boxed-foreign tree-iter)))
+ ...)
+
+(defcfun gtk-text-iter-forward-search :boolean
+ (iter (g-boxed-foreign text-iter))
+ (str (:string :free-to-foreign t))
+ (flags text-search-flags)
+ (match-start (g-boxed-foreign text-iter))
+ (match-end (g-boxed-foreign text-iter))
+ (limit (g-boxed-foreign text-iter)))
+@end lisp
+
+@node Generating type definitions by introspection
+@chapter Generating type definitions by introspection
+@menu
+* define-g-object-class::
+* define-g-interface::
+* define-g-enum::
+* define-g-flags::
+* get-g-enum-definition::
+* get-g-flags-definition::
+* get-g-interface-definition::
+* get-g-class-definition::
+* Specifying additional properties for CLOS classes::
+* Generating names for CLOS classes and accessors::
+* generate-types-hierarchy-to-file::
+@end menu
+
+CL-GTK2-GOBJECT includes facilities for automatically generating parts of bindings for libraries that use GObject type system.
+
+@node define-g-object-class
+@section define-g-object-class
+
+@Macro define-g-object-class
+@lisp
+(define-g-object-class g-type-name name
+ (&key (superclass 'g-object) (export t) interfaces type-initializer)
+ (&rest property*))
+
+property ::= (name accessor gname type readable writable)
+property ::= (:cffi name acessor type reader writer)
+@end lisp
+
+Parameters of @code{define-g-object-class}
+@table @var
+@item @var{superclass}
+A symbol naming the superclass of this class
+@item @var{export}
+Whether to export the name of the class and names of autogenerated properties names from the current package.
+@item @var{interfaces}
+A list of interfaces the this class implements
+@item @var{type-initializer}
+A string naming the type initiliazer function. It is usually named @code{class_get_type}.
+@item @var{properties}
+A list of slots of a class
+@end table
+
+Parameters of @code{property}:
+@table @var
+@item @var{name}
+A symbol naming the slot
+@item @var{accessor}
+A symbol naming the accessor function for this slot
+@item @var{gname}
+A string naming the property of GObject
+@item @var{type}
+A string naming the type of property of GObject (for GObject properties); or a symbol naming CFFI foreign type (for slots mapped to foreign accessors)
+@item @var{readable}
+A boolean specifying whether the slot can be read
+@item @var{writable}
+A boolean specifying whether the slot can be assigned to
+@item @var{reader}
+A string or a symbol naming getter function. See description of @code{gobject-class} metaclass for information.
+@item @var{writter}
+A string or a symbol naming setter function. See description of @code{gobject-class} metaclass for information.
+@end table
+
+Macro that expands to @code{defclass} for specified class. Additionally, if @code{export} is true, it exports accessor names and name of a class.
+
+Example:
+@lisp
+(define-g-object-class "GtkContainer" container
+ (:superclass widget :export t :interfaces
+ ("AtkImplementorIface" "GtkBuildable")
+ :type-initializer "gtk_container_get_type")
+ ((border-width container-border-width "border-width" "guint" t t)
+ (resize-mode container-resize-mode "resize-mode" "GtkResizeMode" t t)
+ (child container-child "child" "GtkWidget" nil t)
+ (:cffi focus-child container-focus-child g-object "gtk_container_get_focus_child" "gtk_container_set_focus_child")
+ (:cffi focus-vadjustment container-focus-vadjustment (g-object adjustment) "gtk_container_get_focus_vadjustment" "gtk_container_set_focus_vadjustment")
+ (:cffi focus-hadjustment container-focus-hadjustment (g-object adjustment) "gtk_container_get_focus_hadjustment" "gtk_container_set_focus_hadjustment")))
+@end lisp
+
+@node define-g-interface
+@section define-g-interface
+
+@Macro define-g-interface
+@lisp
+(define-g-interface g-type-name name (&key (export t) type-initializer)
+ &body property*)
+
+property ::= (name accessor gname type readable writable)
+property ::= (:cffi name acessor type reader writer)
+@end lisp
+
+Parameters of @code{define-g-interface}
+@table @var
+@item @var{export}
+Whether to export the name of the interface and names of autogenerated properties names from the current package.
+@item @var{type-initializer}
+A string naming the type initiliazer function. It is usually named @code{interface_get_type}.
+@item @var{properties}
+A list of slots of a interface
+@end table
+
+Parameters of @code{property}:
+@table @var
+@item @var{name}
+A symbol naming the slot
+@item @var{accessor}
+A symbol naming the accessor function for this slot
+@item @var{gname}
+A string naming the property of GObject
+@item @var{type}
+A string naming the type of property of GObject (for GObject properties); or a symbol naming CFFI foreign type (for slots mapped to foreign accessors)
+@item @var{readable}
+A boolean specifying whether the slot can be read
+@item @var{writable}
+A boolean specifying whether the slot can be assigned to
+@item @var{reader}
+A string or a symbol naming getter function. See description of @code{gobject-class} metaclass for information.
+@item @var{writter}
+A string or a symbol naming setter function. See description of @code{gobject-class} metaclass for information.
+@end table
+
+Macro that expands to @code{defclass} for specified interface. Additionally, if @code{export} is true, it exports accessor names and name of a interface.
+
+Example:
+@lisp
+(define-g-interface "GtkFileChooser" file-chooser
+ (:export t :type-initializer "gtk_file_chooser_get_type")
+ (do-overwrite-confirmation file-chooser-do-overwrite-confirmation "do-overwrite-confirmation" "gboolean" t t)
+ (select-multiple file-chooser-select-multiple "select-multiple" "gboolean" t t)
+ (filter file-chooser-filter "filter" "GtkFileFilter" t t)
+ (local-only file-chooser-local-only "local-only" "gboolean" t t)
+ (preview-widget file-chooser-preview-widget "preview-widget" "GtkWidget" t t)
+ (use-preview-label file-chooser-use-preview-label "use-preview-label" "gboolean" t t)
+ (preview-widget-active file-chooser-preview-widget-active "preview-widget-active" "gboolean" t t)
+ (file-system-backend file-chooser-file-system-backend "file-system-backend" "gchararray" nil nil)
+ (extra-widget file-chooser-extra-widget "extra-widget" "GtkWidget" t t)
+ (show-hidden file-chooser-show-hidden "show-hidden" "gboolean" t t)
+ (action file-chooser-action "action" "GtkFileChooserAction" t t)
+ (:cffi current-name file-chooser-current-name
+ (:string :free-to-foreign t :encoding :utf-8) nil "gtk_file_chooser_set_current_name")
+ (:cffi filename file-chooser-filename
+ (g-string :free-from-foreign t :free-to-foreign t)
+ "gtk_file_chooser_get_filename" "gtk_file_chooser_set_filename")
+ (:cffi current-folder file-chooser-current-folder
+ (g-string :free-from-foreign t :free-to-foreign t)
+ "gtk_file_chooser_get_current_folder"
+ "gtk_file_chooser_set_current_folder")
+ (:cffi uri file-chooser-uri
+ (g-string :free-from-foreign t :free-to-foreign t)
+ "gtk_file_chooser_get_uri" "gtk_file_chooser_set_uri")
+ (:cffi current-folder-uri file-chooser-current-folder-uri
+ (g-string :free-from-foreign t :free-to-foreign t)
+ "gtk_file_chooser_get_current_folder_uri"
+ "gtk_file_chooser_set_current_folder_uri")
+ (:cffi preview-filename file-chooser-preview-filename
+ (g-string :free-from-foreign t :free-to-foreign t)
+ "gtk_file_chooser_get_preview_filename" nil)
+ (:cffi preview-uri file-chooser-preview-uri
+ (g-string :free-from-foreign t :free-to-foreign t)
+ "gtk_file_chooser_get_preview_uri" nil))
+@end lisp
+
+@node define-g-enum
+@section define-g-enum
+
+@Macro define-g-enum
+@lisp
+(define-g-enum g-name name (&key (export t) type-initializer) &body value*)
+
+value ::= :keyword
+value ::= (:keyword integer)
+@end lisp
+
+@table @var
+@item @var{g-name}
+A string naming the GEnum type
+@item @var{name}
+A symbol naming the CFFI enumeration type
+@item @var{export}
+A boolean indicating whether to export @code{name}
+@item @var{type-initializer}
+A string naming the foreign type initializer function. Usually named @code{enum_get_type}.
+@end table
+
+Macro that defines CFFI enumeration, registers it with GValue, and calls the type initializer.
+
+Example:
+@lisp
+(define-g-enum "GtkTextDirection" text-direction
+ (:export t :type-initializer "gtk_text_direction_get_type")
+ (:none 0) (:ltr 1) (:rtl 2))
+
+(define-g-enum "GtkSizeGroupMode" size-group-mode
+ (:export t :type-initializer "gtk_size_group_mode_get_type")
+ :none :horizontal :vertical :both)
+@end lisp
+
+@node define-g-flags
+@section define-g-flags
+
+@Macro define-g-flags
+@lisp
+(define-g-flags g-name name (&key (export t) type-initializer) &body value*)
+
+value ::= :keyword
+value ::= (:keyword integer)
+@end lisp
+
+@table @var
+@item @var{g-name}
+A string naming the GFlags type
+@item @var{name}
+A symbol naming the CFFI flags type
+@item @var{export}
+A boolean indicating whether to export @code{name}
+@item @var{type-initializer}
+A string naming the foreign type initializer function. Usually named @code{flags_get_type}.
+@end table
+
+Macro that defines CFFI bitfield, registers it with GValue, and calls the type initializer.
+
+Example:
+@lisp
+(define-g-flags "GtkAttachOptions" attach-options
+ (:export t :type-initializer "gtk_attach_options_get_type")
+ (:expand 1) (:shrink 2) (:fill 4))
+
+(define-g-flags "GtkButtonAction" button-action
+ (:export t :type-initializer "gtk_button_action_get_type")
+ :ignored :selects :drags :expands)
+@end lisp
+
+@node get-g-enum-definition
+@section get-g-enum-definition
+
+@Function get-g-enum-definition
+@lisp
+(get-g-enum-definition type &optional lisp-name-package) @result{} definition
+@end lisp
+
+@table @var
+@item @var{type}
+A string naming the GEnum type
+@item @var{lisp-name-package}
+A package that will be used as a package for generated symbols (enum name). If not specified, symbols are interned in @code{*package*}
+@item @var{definition}
+A Lisp form that when evaluated defines the GEnum.
+@end table
+
+Uses GObject introspection capabilities to automatically produce the definition of GEnum. The foreign library that defines the enum type should be loaded.
+
+See @ref{Generating names for CLOS classes and accessors} for information about used method for generating names.
+
+Example:
+@lisp
+(get-g-enum-definition "GtkDirectionType")
+@result{}
+(DEFINE-G-ENUM "GtkDirectionType" GTK-DIRECTION-TYPE
+ (:EXPORT T :TYPE-INITIALIZER "gtk_direction_type_get_type")
+ (:TAB-FORWARD 0) (:TAB-BACKWARD 1) (:UP 2) (:DOWN 3) (:LEFT 4)
+ (:RIGHT 5))
+@end lisp
+
+@node get-g-flags-definition
+@section get-g-flags-definition
+
+@Function get-g-flags-definition
+@lisp
+(get-g-flags-definition type &optional lisp-name-package) @result{} definition
+@end lisp
+
+@table @var
+@item @var{type}
+A string naming the GFlags type
+@item @var{lisp-name-package}
+A package that will be used as a package for generated symbols (flags name). If not specified, symbols are interned in @code{*package*}
+@item @var{definition}
+A Lisp form that when evaluated defines the GFlags.
+@end table
+
+Uses GObject introspection capabilities to automatically produce the definition of GFlags. The foreign library that defines the flags type should be loaded.
+
+See @ref{Generating names for CLOS classes and accessors} for information about used method for generating names.
+
+Example:
+@lisp
+(get-g-flags-definition "GtkCalendarDisplayOptions")
+@result{}
+(DEFINE-G-FLAGS "GtkCalendarDisplayOptions" GTK-CALENDAR-DISPLAY-OPTIONS
+ (:EXPORT T :TYPE-INITIALIZER
+ "gtk_calendar_display_options_get_type")
+ (:SHOW-HEADING 1) (:SHOW-DAY-NAMES 2) (:NO-MONTH-CHANGE 4)
+ (:SHOW-WEEK-NUMBERS 8) (:WEEK-START-MONDAY 16)
+ (:SHOW-DETAILS 32))
+@end lisp
+
+@node get-g-interface-definition
+@section get-g-interface-definition
+
+@Function get-g-interface-definition
+@lisp
+get-g-interface-definition type &optional lisp-name-package) @result{} definition
+@end lisp
+
+@table @var
+@item @var{type}
+A string naming the GInterface type
+@item @var{lisp-name-package}
+A package that will be used as a package for generated symbols (type name, accessor names). If not specified, symbols are interned in @code{*package*}
+@item @var{definition}
+A Lisp form that when evaluated defines the GInterface.
+@end table
+
+Uses GObject introspection capabilities to automatically produce the definition of GInterface. The foreign library that defines the GInterface type should be loaded.
+
+See @ref{Generating names for CLOS classes and accessors} for information about used method for generating names.
+
+Example:
+@lisp
+(get-g-interface-definition "GtkActivatable")
+@result{}
+(DEFINE-G-INTERFACE "GtkActivatable" GTK-ACTIVATABLE
+ (:EXPORT T :TYPE-INITIALIZER "gtk_activatable_get_type")
+ (USE-ACTION-APPEARANCE
+ GTK-ACTIVATABLE-USE-ACTION-APPEARANCE
+ "use-action-appearance" "gboolean" T T)
+ (RELATED-ACTION GTK-ACTIVATABLE-RELATED-ACTION
+ "related-action" "GtkAction" T T))
+@end lisp
+
+@node get-g-class-definition
+@section get-g-class-definition
+
+@Function get-g-class-definition
+@lisp
+(get-g-class-definition type &optional lisp-name-package) @result{} definition
+@end lisp
+
+@table @var
+@item @var{type}
+A string naming the GObject type
+@item @var{lisp-name-package}
+A package that will be used as a package for generated symbols (type name, accessor names). If not specified, symbols are interned in @code{*package*}
+@item @var{definition}
+A Lisp form that when evaluated defines the GObject.
+@end table
+
+Uses GObject introspection capabilities to automatically produce the definition of GClass. The foreign library that defines the GObject type should be loaded.
+
+See @ref{Generating names for CLOS classes and accessors} for information about used method for generating names.
+
+Example:
+@lisp
+(get-g-class-definition "GtkButton")
+@result{}
+(DEFINE-G-OBJECT-CLASS "GtkButton" GTK-BUTTON
+ (:SUPERCLASS GTK-BIN :EXPORT T :INTERFACES
+ ("AtkImplementorIface" "GtkActivatable" "GtkBuildable")
+ :TYPE-INITIALIZER "gtk_button_get_type")
+ ((LABEL GTK-BUTTON-LABEL "label" "gchararray" T T)
+ (IMAGE GTK-BUTTON-IMAGE "image" "GtkWidget" T T)
+ (RELIEF GTK-BUTTON-RELIEF "relief" "GtkReliefStyle" T
+ T)
+ (USE-UNDERLINE GTK-BUTTON-USE-UNDERLINE "use-underline"
+ "gboolean" T T)
+ (USE-STOCK GTK-BUTTON-USE-STOCK "use-stock" "gboolean"
+ T T)
+ (FOCUS-ON-CLICK GTK-BUTTON-FOCUS-ON-CLICK
+ "focus-on-click" "gboolean" T T)
+ (XALIGN GTK-BUTTON-XALIGN "xalign" "gfloat" T T)
+ (YALIGN GTK-BUTTON-YALIGN "yalign" "gfloat" T T)
+ (IMAGE-POSITION GTK-BUTTON-IMAGE-POSITION
+ "image-position" "GtkPositionType" T T)))
+@end lisp
+
+@node Specifying additional properties for CLOS classes
+@section Specifying additional properties for CLOS classes
+
+Some properties are not exposed through GObject introspection facilities, but are rather present as a pair of functions (@code{class_get_property}, @code{class_set_property}). @code{gobject-class} metaclass supports such properties. For these properties to be included in automatically generated class definitions, they should be made known to the generator.
+
+Definitions generator uses variable @code{*additional-properties*} to get this information.
+
+Variable @code{*additional-properties*} contains a plist that maps GType names to a list of properties definitions (See @ref{define-g-object-class} for syntax of properties definitions).
+
+To supply the bindings generator with this information, bind @code{*additional-properties*} to such list when the generator is run.
+
+Example:
+@lisp
+(("GtkTreeViewColumn"
+ (:cffi gtk::tree-view
+ gtk::tree-view-column-tree-view
+ g-object "gtk_tree_view_column_get_tree_view" nil)
+ (:cffi gtk::sort-column-id
+ gtk::tree-view-column-sort-column-id
+ :int "gtk_tree_view_column_get_sort_column_id" "gtk_tree_view_column_set_sort_column_id")
+ (:cffi gtk::cell-renderers
+ gtk::tree-view-column-cell-renderers
+ (glist g-object :free-from-foreign t) "gtk_tree_view_column_get_cell_renderers" nil))
+ ("GtkTreeSelection"
+ (:cffi gtk::mode
+ gtk::tree-selection-mode
+ gtk::selection-mode "gtk_tree_selection_get_mode" "gtk_tree_selection_set_mode")
+ (:cffi gtk::select-function
+ gtk::tree-selection-select-function
+ nil gtk::tree-selection-get-selection-function gtk::tree-selection-set-select-function)))
+@end lisp
+
+@node Generating names for CLOS classes and accessors
+@section Generating names for CLOS classes and accessors
+
+Names of types are generated by mapping @code{CamelCaseNames} to @code{dash-separated-names} and interning them in specified package. Additionally, prefix from beginning of the name may be stripped (@code{"GtkWidget"} has prefix @code{"Gtk"}, after stripping it maps to @code{widget}). Some names may require special processing (e.g., @code{"GObject"}, @code{"GInitiallyUnowned"} should map to class names in @code{gobject} package; @code{"GtkWindow"} and @code{"GdkWindow"} should receive different @code{symbol-name}s so that they can both be imported in one package).
+
+Accessors for slots are generated by concatenating class name, dash and slot name, producing names like @code{class-slot}: @code{container-child}, @code{button-label}, etc.
+
+Name generation affected by following variables:
+@itemize
+@item @var{*strip-prefix*}
+A string variable specifying the prefix that should to be stripped from the names to generate symbols (e.g., if @code{(equal "Gtk" *strip-prefix*)}, then type named @code{"GtkWidget"} will map to class named @code{widget}.
+@item @var{*lisp-name-exceptions*}
+A plist mapping from strings (type names) to symbols (class names) that have special name processing.
+Example:
+@lisp
+`(("GObject" gobject:g-object)
+ ("GtkObject" ,(intern "GTK-OBJECT" (find-package :gtk)))
+ ("GInitiallyUnowned" gobject::g-initially-unowned)
+ ("GtkWindow" ,(intern "GTK-WINDOW" (find-package :gtk)))
+ ("GtkUIManager" ,(intern "UI-MANAGER" (find-package :gtk)))
+ ("GtkUIManagerItemType" ,(intern "UI-MANAGER-ITEM-TYPE" (find-package :gtk))))
+@end lisp
+@end itemize
+
+@node generate-types-hierarchy-to-file
+@section generate-types-hierarchy-to-file
+
+@Function generate-types-hierarchy-to-file
+@lisp
+(generate-types-hierarchy-to-file file
+ root-type
+ &key include-referenced
+ prefix
+ package
+ exceptions
+ prologue
+ interfaces
+ enums
+ flags
+ objects
+ exclusions
+ additional-properties)
+@end lisp
+
+@table @var
+@item @var{file}
+A string or pathname naming the file, or a stream.
+@item @var{root-type}
+A GType designator for a root type. All types that inherit from this type will be defined.
+@item @var{&key include-referenced}
+A boolean. Specifies whether referenced types should be included. Type is referenced if it is an interface or a type of property of type included in generation
+@item @var{prefix}
+A string naming the prefix that should be removed from the beginning of names
+@item @var{package}
+A package which will contain generated names of types, slots and accessors. It will also be the current package when the definitions are written to file
+@item @var{exceptions}
+A plist that maps GType names to their Lisp names.
+See @ref{Generating names for CLOS classes and accessors} for more info on exceptions from name generation mechanism
+@item @var{prologue}
+A string that will be included verbatim in generated code file
+@item @var{interfaces}
+Additional list of interfaces that will also be included in generation
+@item @var{enums}
+Additional list of enums that will also be included in generation
+@item @var{flags}
+Additional list of flags that will also be included in generation
+@item @var{objects}
+Additional list of object types that will also be included in generation
+@item @var{exclusions}
+A list of GType names that will be excluded from generation
+@item @var{additional-properties}
+A plist of properties definitions that will be added to generated classes.
+See @ref{Specifying additional properties for CLOS classes} for more information.
+@end table
+
+Generates definitions for all types in a type hierarchy. Recursively scan types hierarchy (starting from @code{root} and @code{objects} and @code{interfaces}) (except types that were specifically excluded) and generate defintion for every mentioned type. Parameters control various aspects of definition generation.