Previous: Generating names for CLOS classes and accessors, Up: Generating type definitions by introspection


4.13.12 generate-types-hierarchy-to-file

— Function: generate-types-hierarchy-to-file
     (generate-types-hierarchy-to-file file
                                       root-type
                                       &key include-referenced
                                       prefix
                                       package
                                       exceptions
                                       prologue
                                       interfaces
                                       enums
                                       flags
                                       objects
                                       exclusions
                                       additional-properties)
file
A string or pathname naming the file, or a stream.
root-type
A GType designator for a root type. All types that inherit from this type will be defined.
&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
prefix
A string naming the prefix that should be removed from the beginning of names
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
exceptions
A plist that maps GType names to their Lisp names. See Generating names for CLOS classes and accessors for more info on exceptions from name generation mechanism
prologue
A string that will be included verbatim in generated code file
interfaces
Additional list of interfaces that will also be included in generation
enums
Additional list of enums that will also be included in generation
flags
Additional list of flags that will also be included in generation
objects
Additional list of object types that will also be included in generation
exclusions
A list of GType names that will be excluded from generation
additional-properties
A plist of properties definitions that will be added to generated classes. See Specifying additional properties for CLOS classes for more information.

Generates definitions for all types in a type hierarchy. Recursively scan types hierarchy (starting from root and objects and interfaces) (except types that were specifically excluded) and generate defintion for every mentioned type. Parameters control various aspects of definition generation.

Example of usage:

     (generate-types-hierarchy-to-file
      "gtk.generated-classes.lisp"
      "GtkObject"
      :include-referenced t
      :prefix "Gtk"
      :package (or (find-package :gtk) (make-package :gtk))
      :exceptions `(("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))))
      :prologue (format nil "(in-package :gtk)")
      :interfaces '("GtkBuildable" "GtkCellEditable" ...)
      :objects '("GtkSettings" "GtkRcStyle" ...)
      :flags '("GtkTextSearchFlags" "GtkAccelFlags" ...)
      :enums '("GtkTextDirection" "GtkSizeGroupMode" ...)
      :exclusions '("PangoStretch" "PangoVariant" ...)
      :additional-properties
      '(("GtkTreeViewColumn"
         (:cffi
          gtk::tree-view
          gtk::tree-view-column-tree-view
          g-object
          "gtk_tree_view_column_get_tree_view"
          nil)
         ...)
        ...))