2 %typemap
(in
) double const
[] {
8 croak
("Math::GSL : $$1_name is not a reference!");
9 if
(SvTYPE
(SvRV
($input
)) != SVt_PVAV
)
10 croak
("Math::GSL : $$1_name is not an array ref!");
12 tempav
= (AV
*)SvRV
($input
);
14 $
1 = (double
*) malloc
((len
+1)*sizeof
(double
));
15 for
(i
= 0; i
<= len
; i
++) {
16 tv
= av_fetch
(tempav
, i
, 0);
17 $
1[i
] = (double
) SvNV
(*tv
);
21 %apply double const
[] {
22 size_t
*p
,double
*data
, double
*dest
, double
*f_in
, double
*f_out
,
23 double data
[], const double
* src
, double x
[], double a
[], double b
[] ,
24 const double
* x
, const double
* y
, const double
* w
, const double x_array
[],
25 const double xrange
[], const double yrange
[], double
* base
,
26 const double
* base
, const double xrange
[], const double yrange
[] ,
27 const double
* array
, const double data2
[], const double w
[] ,
28 float const
*A
, float const
*B
, float const
*C
, float
*C
, double
*v
31 %apply int
*OUTPUT { size_t
*imin
, size_t
*imax
, size_t
*neval
};
32 %apply double
* OUTPUT {
33 double
* min_out
, double
* max_out
,
34 double
*abserr
, double
*result
37 static HV
* Callbacks
= (HV
*)NULL;
38 /* this function returns the value
39 of evaluating the function pointer
40 stored in func with argument x
42 double callthis
(double x
, int func
, void
*params
){
47 //fprintf
(stderr
, "LOOKUP CALLBACK\n");
48 sv
= hv_fetch
(Callbacks
, (char
*)func
, sizeof
(func
), FALSE );
49 if
(sv
== (SV
**)NULL) {
50 fprintf
(stderr
, "Math::GSL(callthis): %d not in Callbacks!\n", func
);
55 XPUSHs
(sv_2mortal
(newSVnv
((double
)x
)));
57 call_sv
(*sv
, G_SCALAR
);
62 %typemap
(in
) gsl_function
* {
69 croak
("Math::GSL : $1_name is not a reference value!");
71 if
(Callbacks
== (HV
*)NULL)
73 //fprintf
(stderr
,"STORE CALLBACK: %d\n", (int
)$input
);
74 hv_store
( Callbacks
, (char
*)&$input, sizeof($input), newSVsv($input), 0 );
77 F.function
= &callthis;
81 %typemap
(in
) gsl_function_fdf
* {
82 fprintf
(stderr
, 'FDF_FUNC'
);