Stub files use the Yacas cstubgen module.

cstubgen can generate a stub file that allows linking in dynamic
link libraries into Yacas at runtime. It works by generating
a .cc file that should be compiled and linked with the library.
The input file can contain commands defined by cstubgen.

Currently defined functions:

>>> StubApiCStart()

To start up generating a c stub file for linking a c library with
Yacas. A stub specification file needs to start with this
function call, to reset the internal state of Yacas for emitting
a stub c++ file.

>>> StubApiCShortIntegerConstant(const,value)

define a constant 'const' to have value 'value'.  The value should
be short integer constant. This is useful for linking in
defines and enumerated values into Yacas.
If the library for instance has a define <br>
#define FOO 10
Then 
StubApiCShortIntegerConstant("FOO","FOO")
will bind the global variable FOO to the value for FOO defined in
the library header file.

>>> StubApiCInclude(file)

Declare an include file (a header file for the library, for instance)
The delimiters need to be specified too. So, for a standard library
like the one needed for opengl, you need to specify <br>
StubApiCInclude("<GL/gl.h>") <BR>
and for user include file:
StubApiCInclude("\"GL/gl.h\"") <BR>

>>> StubApiCFunction(returntype,fname,args)
>>> StubApiCFunction(returntype,fname,fname2,args)

return type, function name, and list of arguments. All of these
should be literal strings (surrounded by quotes).

The return types currently supported are "int", "double" and "void".

The argument values that are currently supported
are "int", "double", and "input_string".


>>> StubApiCFile(basename)

Generate the c++ stub file, "basename.cc".


>>> StubApiCSetEnv(func)

This function forces the plugin to call the function func, with as
argument LispEnvironment& aEnvironment. This lets the plugin store
the environment class (which is needed for almost any thing to do with
Yacas), somewhere in a global variable. aEnvironment can then be used
from within a callback function in the plugin that doesn't take the
extra argument by design.



extract_stub.pl: a perl script to automatically extract functions from C++ header files.
It prepares a Yacas-language stub file to be included into the main stub file.

Usage: 
	cat /usr/include/gsl/*.h | perl -w extract_stub.pl > outputfile.stub
This will export over a hundred functions from the GSL library, assuming that it its include files are in /usr/include/gsl/.
The resulting stub file can be Load()-ed from the main stub file.

Sample output:
---
StubAPICFunction("double", "gsl_sf_lngamma", "gsl'sf'lngamma", {{"const double",
 "x"}});
StubAPICFunction("double", "gsl_sf_gamma", "gsl'sf'gamma", {{"const double", "x"
}});
StubAPICFunction("double", "gsl_sf_gammastar", "gsl'sf'gammastar", {{"const doub
le", "x"}});
StubAPICFunction("double", "gsl_sf_gammainv", "gsl'sf'gammainv", {{"const double
", "x"}});
StubAPICFunction("double", "gsl_sf_taylorcoeff", "gsl'sf'taylorcoeff", {{"const 
int", "n"}, {"const double", "x"}});
StubAPICFunction("double", "gsl_sf_fact", "gsl'sf'fact", {{"const unsigned int",
 "n"}});
---

Right now, only numerical functions are processed, i.e. functions with numerical types of arguments and return values (double, int or unsigned int).
This can be configured in the script.



