2 %typemap
(in
) double const
[] {
8 croak
("Math::GSL : $input is not a reference!");
9 if
(SvTYPE
(SvRV
($input
)) != SVt_PVAV
)
10 croak
("Math::GSL : $input 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
[] { size_t
*p
};
23 %apply double const
[] { double
*data
, double
*dest
, double
*f_in
, double
*f_out
, double data
[], const double
* src
};
24 %apply double const
[] { double x
[], double a
[], double b
[] };
25 %apply double const
[] { const double
* x
, const double
* y
, const double
* w
};
26 %apply double const
[] { const double x_array
[], const double xrange
[], const double yrange
[]};
27 %apply double const
[] { double
* base
, const double
* base
};
28 %apply double const
[] { const double xrange
[], const double yrange
[] };
29 %apply double const
[] { const double
* array
};
30 %apply double const
[] { const double data2
[], const double w
[] };
31 %apply double const
[] { float const
*A
, float const
*B
, float const
*C
, float
*C
};
33 %apply double
* OUTPUT { double
*abserr
, double
*result
};
35 static HV
* Callbacks
= (HV
*)NULL;
36 /* this function returns the value
37 of evaluating the function pointer
38 stored in func with argument x
40 double callthis
(double x
, int func
, void
*params
){
45 //fprintf
(stderr
, "LOOKUP CALLBACK\n");
46 sv
= hv_fetch
(Callbacks
, (char
*)func
, sizeof
(func
), FALSE );
47 if
(sv
== (SV
**)NULL) {
48 fprintf
(stderr
, "Math::GSL(callthis): %d not in Callbacks!\n", func
);
53 XPUSHs
(sv_2mortal
(newSVnv
((double
)x
)));
55 call_sv
(*sv
, G_SCALAR
);
60 %typemap
(in
) gsl_function
* {
67 croak
("Math::GSL : $1_name is not a reference value!");
69 if
(Callbacks
== (HV
*)NULL)
71 //fprintf
(stderr
,"STORE CALLBACK: %d\n", (int
)$input
);
72 hv_store
( Callbacks
, (char
*)&$input, sizeof($input), newSVsv($input), 0 );
75 F.function
= &callthis;