Next: The Top-Level Methods, Up: G-Wrap's Code Generation API [Contents][Index]
Unless stated otherwise, the code generation methods all have a name
ending in -cg
. Most of them take a wrapset as their first
argument (i.e. instances of a sub-class of <gw-wrapset>
), some
of them don’t.
All code generation methods must return a code tree, that is a list whose elements are either strings, lists of strings, or a special forms. The strings and list of strings must be valid C code. Special forms are lists that are automatically expanded to produce C code when a tree is written to a file. The valid special forms are the following:
This special form expands to C code that tests whether the C variable named c-error-var (a string) denotes a G-Wrap error status. If error-value is provided, it must be a symbol denoting one of the various G-Wrap run-time error conditions:
misc
an error condition that does not fit in the other names;
memory
a memory management exception;
range
a range exception (e.g. for integer conversion);
type
a type exception (e.g. wrong return type);
argc
a wrong-number-of-arguments exception;
arg-range
a range exception for one of the arguments;
arg-type
a type exception for one of the arguments.
If error-value is provided, this special form expands to code that checks whether the C variable named c-error-var denotes an error condition equal to error-value.
Expands to C code that raises a G-Wrap run-time error of type error-type, with error-specific arguments args. error-type must be a symbol whose value is one of those described above.
Next: The Top-Level Methods, Up: G-Wrap's Code Generation API [Contents][Index]