1 %module
"Math::GSL::Poly"
3 // %include
"typemaps.i"
4 %include
"gsl_typemaps.i"
7 #include
"gsl/gsl_sys.h"
9 %include
"gsl/gsl_sys.h"
11 %typemap
(in
) double
* (double dvalue
) {
14 croak
("$input is not a reference!\n");
16 tempsv
= SvRV
($input
);
17 if
((!SvNOK
(tempsv
)) && (!SvIOK(tempsv))) {
18 croak
("$input is not a reference to number!\n");
20 dvalue
= SvNV
(tempsv
);
24 #gsl_complex gsl_complex_poly_complex_eval
(const gsl_complex c
[], const int len
, const gsl_complex z
);
26 %typemap
(argout
) gsl_complex
{
32 //fprintf
(stderr
,"--> %g <--\n", GSL_REAL
($
1));
33 //fprintf
(stderr
,"--> %g <--\n", GSL_IMAG
($
1));
35 $result
= sv_newmortal
();
40 /* the next
2 lines blow up
46 %typemap
(argout
) double
* {
48 tempsv
= SvRV
($input
);
49 sv_setnv
(tempsv
, *$
1);
52 %typemap
(in
) gsl_complex const
[] {
58 SV
**elem
, **helem
, **real
, **imag
;
63 printf
("gsl_complex typemap\n");
65 croak
("Math::GSL : $input is not a reference!");
66 if
(SvTYPE
(SvRV
($input
)) != SVt_PVAV
)
67 croak
("Math::GSL : $input is not an array ref!");
69 z
= gsl_complex_rect
(0,0);
70 tempav
= (AV
*)SvRV
($input
);
72 $
1 = (gsl_complex
*) malloc
((len
+1)*sizeof
(gsl_complex
));
73 for
(i
= 0; i
<= len
; i
++) {
74 elem
= av_fetch
(tempav
, i
, 0);
76 hash
= (HV
*) SvRV
(*elem
);
77 helem
= hv_fetch
(hash
, "dat", 3, 0);
78 magic
= mg_get
(*helem
);
80 croak
("FETCH magic failed!\n");
82 printf
("magic = %d\n", magic
);
84 croak
("Structure does not contain 'dat' element\n");
85 printf
("helem is:\n");
86 //Perl_sv_dump
(*helem
);
88 svtmp
= (SV
*)SvRV
(*helem
);
89 //Perl_sv_dump
(svtmp
);
91 printf
("re z = %f\n", GSL_REAL
(z
) );
92 printf
("im z = %f\n", GSL_IMAG
(z
) );
97 #include
"gsl/gsl_nan.h"
98 #include
"gsl/gsl_poly.h"
99 #include
"gsl/gsl_complex.h"
100 #include
"gsl/gsl_complex_math.h"
103 %include
"gsl/gsl_nan.h"
104 %include
"gsl/gsl_poly.h"
105 %include
"gsl/gsl_complex.h"
106 %include
"gsl/gsl_complex_math.h"
107 %include
"../pod/Poly.pod"