Unless stated otherwise, the code generation methods all have a name
-cg. Most of them take a wrapset as their first
argument (i.e. instances of a sub-class of
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:
- an error condition that does not fit in the other names;
- a memory management exception;
- a range exception (e.g. for integer conversion);
- a type exception (e.g. wrong return type);
- a wrong-number-of-arguments exception;
- a range exception for one of the arguments;
- 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.