Next: , Previous: , Up: G-Wrap's Code Generation API   [Contents][Index]


3.3.2 The Top-Level Methods

As we have just seen, wrapset objects (i.e. instances of a sub-class of <gw-wrapset>) are the most complex objects manipulated when using G-Wrap: they aggregate a number of objects providing information about what is to be wrapped. Consequently, the top-level code generation methods are those that apply to wrapset themselves.

method: generate-wrapset (lang <symbol>) (name <symbol>) (basename <string>)

This method generates a wrapset call name, for language run-time lang, and using basename as the base for the names of the generated files. This is the highest-level method in G-Wrap. It will actually lookup a registered wrapset with name name (using the get-wrapset method which returns a <gw-wrapset> object) and invoke the method described below.

method: generate-wrapset (lang <symbol>) (wrapset <gw-wrapset>) (basename <string>)

Generate wrapper code for the wrapset wrapset for language run-time lang. The generated files will named using basename as a base name: the name of C source files will be the concatenation of basename and ".c", etc. Currently, lang may be either guile (when generating wrappers for GNU Guile) or scheme48 (when generating wrappers for the Scheme48 system).

The default implementation of generate-wrapset will in turn call a number of methods whose purpose is to generate the necessary file includes, global declarations and definitions for each C file. These methods are listed below in the order in which they are invoked at code-generation time.

method: before-includes-cg

Return a tree of C code to be inserted before any #include directive.

method: global-declarations-cg (wrapset <gw-wrapset>)

Return a tree of C code that contains global declarations needed for wrapset wrapset.

method: global-definitions-cg (wrapset <gw-wrapset>)

Return a tree of C code that contains global definitions needed for wrapset wrapset.

method: declarations-cg (wrapset <gw-wrapset>)

Return a tree of C code that contains declarations of local variables for the wrapset run-time initialization function. By default, the generated wrapset run-time initialization function is named gw_initialize_wrapset_WRAPSET where WRAPSET is the name of the wrapset it initializes (actually a C-compatible representation of it).

FIXME: To be continued.


Next: , Previous: , Up: G-Wrap's Code Generation API   [Contents][Index]