Commenting Out typemaps in Poly for the moment and adding
[Math-GSL.git] / Poly.i
blobb97c131c13c3b443227775524742ef8bba8e5692
1 %module Poly
2 /*%typemap(in) double const [] {
3 AV *tempav;
4 I32 len;
5 int i;
6 SV **tv;
7 if (!SvROK($input))
8 croak("$input is not a reference!");
9 if (SvTYPE(SvRV($input)) != SVt_PVAV)
10 croak("$input is not an array!");
12 tempav = (AV*)SvRV($input);
13 len = av_len(tempav);
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);
19 $1[i] = NAN;
22 %typemap(freearg) double const [] {
23 free($1);
26 %typemap(in) double * (double dvalue) {
27 SV* tempsv;
28 if (!SvROK($input)) {
29 croak("$input is not a reference!\n");
31 tempsv = SvRV($input);
32 if ((!SvNOK(tempsv)) && (!SvIOK(tempsv))) {
33 croak("$input is not a reference!\n");
35 dvalue = SvNV(tempsv);
36 $1 = &dvalue;
39 %typemap(argout) double * {
40 SV *tempsv;
41 tempsv = SvRV($input);
42 sv_setnv(tempsv, *$1);
43 }*/
46 #include "/usr/local/include/gsl/gsl_poly.h"
47 #include "/usr/local/include/gsl/gsl_complex.h"
50 %include "/usr/local/include/gsl/gsl_poly.h"
51 %include "/usr/local/include/gsl/gsl_complex.h"
53 %include "typemaps.i"
56 %perlcode %{
58 @EXPORT_OK = qw(gsl_poly_eval gsl_poly_solve_quadratic);
59 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );