This module serves as a way to automatically populate G-Wrap wrapsets using information parsed out of C header files.
First, the C header files are parsed into S-expression API description forms and
.defs files. These files are typically included in the
distribution, and regenerated infrequently. Then, the binding author includes a
load-defs in their G-Wrap wrapset definition, which loads those
API definitions into the wrapset.
.defs files are usually produced using the API scanner script,
h2defs.py, included in the Guile-GNOME source distribution.
Code in this module is only loaded when generating wrapsets; as such, it is not for end users.
As an example, ATK is wrapped with the following code, from
(define-module (gnome gw atk-spec) #:use-module (oop goops) #:use-module (gnome gw support g-wrap) #:use-module (gnome gw gobject-spec) #:use-module (gnome gw support gobject) #:use-module (gnome gw support defs)) (define-class <atk-wrapset> (<gobject-wrapset-base>) #:id 'gnome-atk #:dependencies '(standard gnome-glib gnome-gobject)) (define-method (global-declarations-cg (self <atk-wrapset>)) (list (next-method) "#include <atk/atk.h>\n" "#include <atk/atk-enum-types.h>\n")) (define-method (initialize (ws <atk-wrapset>) initargs) (next-method ws (append '(#:module (gnome gw atk)) initargs)) ;; manually wrap AtkState as a 64 bit uint (add-type-alias! ws "AtkState" 'unsigned-int64) (load-defs-with-overrides ws "gnome/defs/atk.defs"))
The wrapper-specifiction modules are actually installed, along with the .defs files, so that other wrappers which use ATK's types, such as GTK+, can have them available.
A full discussion of the Makefile mechanics of how to generate and compile the C
file, or how to interact with the wrapset objects, is probably prone to bitrot
here. Your best bet is to poke at Guile-GNOME's source, or especially the source
of a module distributed independently of
guile-gnome-platform, such as
Further details about the procedural API available for use e.g. within the
initialize function can be found in the documentation for
(gnome gw support gobject), and in G-Wrap's documentation.
Load G-Wrap type and function information from file into the G-Wrap wrapset ws.
file should be a relative path, which will be searched in the vicinity of Guile's
includedirectives in the file will be searched relative to the absolute path of the file.
The following forms are understood:
The optional argument, overrides, specifies the location of an overrides file that will be spliced into the
.defsfile at the point of an