Info Node: (g-wrap.info)Scanning source code for functions to export
(g-wrap.info)Scanning source code for functions to export
Scanning source code for functions to export
--------------------------------------------
- Function: gwrap-scan-source-file filename
This command looks through FILENAME for ANSI function declarations
that are preceded by a special comment, and does some simplistic
parsing to find out enough about each function to write a wrapper
function for it. To export a function, simply add the following
comment before an ANSI function declaration (note, the `/*[' must
be the first characters on the line, no indenting):
/*[EXPORT FLAGS]
DESCRIPTION
*/
where DESCRIPTION is a short description of what the function does,
and FLAGS (usually left empty) can indicate that g-wrap should
override its default assumptions about return type, parameter
types, or function name.
If FLAGS contains:
* `(name NEW-NAME)' the function is exported as NEW-NAME.
* `(types ((N NEW-TYPE) ...))' the type of the N-th parameter
(the first parameter is 0) is assumed to be NEW-TYPE.
* `(ret-type NEW-TYPE)' the return type of the function is
assumed to be NEW-TYPE.
Up to three characters of each line of DESCRIPTION are ignored if
they are space or '*' characters.
For example, if this function definition is in `lmatrix.c',
/*[EXPORT (ret-type RETVEC0)]
* out := A.x
*/
VEC *mv_mlt(VEC *v_out, MAT *A, VEC *x) {
....
}
then these lines in the library description file
(set! type-translations
(append '((VEC* VEC) (MAT* MAT)) type-translations))
(gwrap-scan-source-file "lmatrix.c")
will be equivalent to
(new-function
'mv-mlt
'VEC "mv_mlt" '((VEC v-out) (MAT A) (VEC x))
"out := A.x")