File: NTuple.i

package info (click to toggle)
libmath-gsl-perl 0.45-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192,156 kB
  • sloc: ansic: 895,524; perl: 24,682; makefile: 12
file content (50 lines) | stat: -rw-r--r-- 1,134 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%module "Math::GSL::NTuple"
%include "typemaps.i"
%include "gsl_typemaps.i"
%include "renames.i"

// XXX: This needs to properly take the type of array into account,
// this assumes ints
%typemap(in) void *ntuple_data {
    AV *tempav;
    I32 len;
    int i;
    SV  **tv;

    //fprintf(stderr,"symname=$symname \n");

    if (!SvROK($input))
        croak("Math::GSL::NTuple : $1_name is not a reference!");

    if (SvTYPE(SvRV($input)) != SVt_PVAV)
        croak("Math::GSL::NTuple : $1_name is not an array ref!");

    tempav = (AV*)SvRV($input);
    len = av_len(tempav);
    if( len > 0 ){
        $1 = (int **) malloc((len+1)*sizeof(int *));
        for (i = 0; i <= len; i++) {
            tv = av_fetch(tempav, i, 0);
            memset((int*)($1+i), SvIV(*tv) , sizeof(int *));
        }
    }
};

%typemap(argout) void *ntuple_data {
    //Perl_sv_dump($1);
}

%typemap(freearg) void *ntuple_data {
//    if ($1) free($1);
}

%{
    #include "gsl/gsl_ntuple.h"
    #include "gsl/gsl_errno.h"
    #include "gsl/gsl_histogram.h"
%}

%include "gsl/gsl_ntuple.h"
%include "gsl/gsl_histogram.h"

%include "../pod/NTuple.pod"