Writing C Wrapper Functions Around Existing Code
The first step in composing a breve plugin is to write wrapper functions around your existing code. The wrapper functions simply act as a bridge between the internal breve function calling code, and standard C function calls. When a function is called from within steve, the wrapper function is called. The wrapper function, in turn, calls the necessary C code and coordinates input and output between the C code and the breve call.
The wrapper function passes input and output data between breve and C using a structure called brEval. The brEval struct is a C data
structure which is used internally to hold the values of expressions in steve. The structure is used to hold any and all types of steve expressions. So ints,
lists, objects and the rest of the steve types are all held in brEval structs. The type field of the struct specifies the type of the expression. The values union of the struct contains the actual value of the expression.
Information on how to use these fields is listed below.
Wrapper functions have the following prototype:
int function(brEval arguments[], brEval *result, void *instance);
Arguments are passed in as the arguments array of brEval objects. The function output is returned by setting the contents of
the brEval object pointed to by result. instance is an internal pointer to the
calling instance—this can be ignored.
