Correctly manage callbacks
commitbb9ba6cf16e19bc55693df6e42535e6b0b6150a7
authorVincent Danjean <Vincent.Danjean@ens-lyon.org>
Wed, 22 Apr 2009 20:11:50 +0000 (22 22:11 +0200)
committerDuke Leto <jonathan@leto.net>
Thu, 23 Apr 2009 02:38:41 +0000 (22 19:38 -0700)
treeece0cbd8208976915dae59691a2c3017915eea3a
parentcc9c839844eb2bcf252161ac538cbc5a4f89cc69
Correctly manage callbacks

gsl_function and gsl_monte_function are handled in this patch.
This implementation do not mess with the memory.
We put on the C stack during all the function using the callback
a structure (gsl_[monte_]function_perl) that has all what we need.
We use the 'params' parameter in the original C structure to
track the adress of this structure and our C callback
(call_gsl_[monte_]function) use params to get back the info and
call the perl callback.

When a gsl_function is required, the corresponding Perl parameter
must be either a function (ref to code or routine name string)
or a reference to a array of a function (ref to code or routine
name string), [an integer for gsl_monte_function, ]and a
scalar that will be passed "as it is" to the callback perl function.
swig/Deriv.i
swig/gsl_typemaps.i
t/Deriv.t