File Coverage

lib/PDL/ImageND.xs
Criterion Covered Total %
statement 34 41 82.9
branch 87 230 37.8
condition n/a
subroutine n/a
pod n/a
total 121 271 44.6


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/ImageND.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_ImageND
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/ImageND.xs"
23             pdl_error pdl_run_convolve(pdl *a,pdl *b,pdl *adims,pdl *bdims,pdl *c);
24             pdl_error pdl_run_rebin(pdl *a,pdl *b,int ns);
25             pdl_error pdl_run_convolveND(pdl *k0,pdl *k,pdl *aa,pdl *a);
26             pdl_error pdl_run_contour_segments(pdl *c,pdl *data,pdl *points,pdl *segs,pdl *cnt);
27             pdl_error pdl_run_contour_polylines(pdl *c,pdl *data,pdl *points,pdl *pathendindex,pdl *paths);
28             pdl_error pdl_run_path_join(pdl *e,pdl *pathendindex,pdl *paths,PDL_Indx d,int directed);
29             pdl_error pdl_run_combcoords(pdl *x,pdl *y,pdl *z,pdl *coords);
30             pdl_error pdl_run_repulse(pdl *coords,pdl *vecs,double boxsize,int dmult,double a,double b,double c,double d);
31             pdl_error pdl_run_attract(pdl *coords,pdl *from,pdl *to,pdl *strength,pdl *vecs,double m,double ms);
32              
33             #line 449 "lib/PDL/PP.pm"
34             #include "pdlperl.h"
35             #line 36 "lib/PDL/ImageND.xs"
36              
37             Core* PDL = NULL; /* Structure hold core C functions */
38              
39             MODULE = PDL::ImageND PACKAGE = PDL PREFIX=pdl_run_
40              
41             PROTOTYPES: DISABLE
42              
43              
44             void
45             _convolve_int(a,b,adims,bdims,c)
46             pdl *a
47             pdl *b
48             pdl *adims
49             pdl *bdims
50             pdl *c
51             CODE:
52 1           PDL->barf_if_error(pdl_run_convolve(a,b,adims,bdims,c));
53              
54             void
55             _rebin_int(a,b,ns)
56             pdl *a
57             pdl *b
58             int ns
59             CODE:
60 0           PDL->barf_if_error(pdl_run_rebin(a,b,ns));
61              
62             void
63             _convolveND_int(k0,k,aa,a)
64             pdl *k0
65             pdl *k
66             pdl *aa
67             pdl *a
68             CODE:
69 3           PDL->barf_if_error(pdl_run_convolveND(k0,k,aa,a));
70              
71             void
72             pdl_run_contour_segments(c, data, points, segs=PDL_XS_PERLINIT_initsv(segs_SV), cnt=PDL_XS_PERLINIT_initsv(cnt_SV))
73             SV *segs_SV = items > 3 ? ST(3) : NULL;
74             SV *cnt_SV = items > 4 ? ST(4) : NULL;
75             PREINIT:
76 2 50         PDL_XS_PREAMBLE((items == 5) ? 0 : 2);
    100          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
77             INPUT:
78             pdl *c
79             pdl *data
80             pdl *points
81             pdl *segs
82             pdl *cnt
83             PPCODE:
84 2           PDL->barf_if_error(pdl_run_contour_segments(c,data,points,segs,cnt));
85 2 50         PDL_XS_RETURN(ST(0) = segs_SV;ST(1) = cnt_SV)
    50          
    50          
    50          
    0          
86              
87             void
88             pdl_run_contour_polylines(c, data, points, pathendindex=PDL_XS_PERLINIT_initsv(pathendindex_SV), paths=PDL_XS_PERLINIT_initsv(paths_SV))
89             SV *pathendindex_SV = items > 3 ? ST(3) : NULL;
90             SV *paths_SV = items > 4 ? ST(4) : NULL;
91             PREINIT:
92 1 50         PDL_XS_PREAMBLE((items == 5) ? 0 : 2);
    50          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
93             INPUT:
94             pdl *c
95             pdl *data
96             pdl *points
97             pdl *pathendindex
98             pdl *paths
99             PPCODE:
100 1           PDL->barf_if_error(pdl_run_contour_polylines(c,data,points,pathendindex,paths));
101 1 50         PDL_XS_RETURN(ST(0) = pathendindex_SV;ST(1) = paths_SV)
    50          
    50          
    50          
    0          
102              
103             void
104             pdl_run_path_join(e, pathendindex=pathendindex, paths=paths, d=d, directed=directed)
105             SV *pathendindex_SV = (items == 5) ? ST(1) : NULL;
106             SV *paths_SV = (items == 5) ? ST(2) : NULL;
107             SV *d_SV = (items == 5) ? ST(3) : ST(1);
108             SV *directed_SV = (items == 5) ? ST(4) : !(items == (3-1)) ? ST(2) : NULL;
109             PREINIT:
110 5 50         PDL_XS_PREAMBLE((items == 5) ? 0 : 2);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
111 5 50         if (!((items == (3-1)) || (items == 3) || (items == 5)))
    50          
    0          
112 0           croak("Usage: PDL::path_join(e,[pathendindex],[paths],d,directed=1) (you may leave [outputs] and values with =defaults out of list)");
113             INPUT:
114             pdl *e
115             pdl *pathendindex=NO_INIT
116             pdl *paths=NO_INIT
117             PDL_Indx d; { d = (PDL_Indx)SvIV(d_SV); }
118             int directed=NO_INIT
119             PPCODE:
120 5 50         if (!directed_SV) { directed = (1); } else { directed = (int)SvIV(directed_SV); }
121 5 50         if (pathendindex_SV) { pathendindex = PDL_CORE_(SvPDLV)(pathendindex_SV); } else pathendindex = PDL_XS_PERLINIT_initsv(pathendindex_SV);
    50          
122 5 50         if (paths_SV) { paths = PDL_CORE_(SvPDLV)(paths_SV); } else paths = PDL_XS_PERLINIT_initsv(paths_SV);
    50          
123 5           PDL->barf_if_error(pdl_run_path_join(e,pathendindex,paths,d,directed));
124 5 50         PDL_XS_RETURN(ST(0) = pathendindex_SV;ST(1) = paths_SV)
    50          
    50          
    50          
    0          
125              
126             void
127             pdl_run_combcoords(x, y, z, coords=PDL_XS_PERLINIT_initsv(coords_SV))
128             SV *coords_SV = items > 3 ? ST(3) : NULL;
129             PREINIT:
130 1 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
131             INPUT:
132             pdl *x
133             pdl *y
134             pdl *z
135             pdl *coords
136             PPCODE:
137 1           PDL->barf_if_error(pdl_run_combcoords(x,y,z,coords));
138 1 50         PDL_XS_RETURN(ST(0) = coords_SV)
    50          
    50          
    50          
    0          
139              
140             void
141             pdl_run_repulse(coords, vecs=vecs, boxsize=boxsize, dmult=dmult, a=a, b=b, c=c, d=d)
142             SV *vecs_SV = (items == 8) ? ST(1) : NULL;
143             SV *boxsize_SV = (items == 8) ? ST(2) : ST(1);
144             SV *dmult_SV = (items == 8) ? ST(3) : ST(2);
145             SV *a_SV = (items == 8) ? ST(4) : ST(3);
146             SV *b_SV = (items == 8) ? ST(5) : ST(4);
147             SV *c_SV = (items == 8) ? ST(6) : ST(5);
148             SV *d_SV = (items == 8) ? ST(7) : ST(6);
149             PREINIT:
150 1 50         PDL_XS_PREAMBLE((items == 8) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
151 1 50         if (!((items == 7) || (items == 8)))
    0          
152 0           croak("Usage: PDL::repulse(coords,[vecs],boxsize,dmult,a,b,c,d) (you may leave [outputs] and values with =defaults out of list)");
153             INPUT:
154             pdl *coords
155             pdl *vecs=NO_INIT
156             double boxsize; { boxsize = (double)SvNV(boxsize_SV); }
157             int dmult; { dmult = (int)SvIV(dmult_SV); }
158             double a; { a = (double)SvNV(a_SV); }
159             double b; { b = (double)SvNV(b_SV); }
160             double c; { c = (double)SvNV(c_SV); }
161             double d; { d = (double)SvNV(d_SV); }
162             PPCODE:
163 1 50         if (vecs_SV) { vecs = PDL_CORE_(SvPDLV)(vecs_SV); } else vecs = PDL_XS_PERLINIT_initsv(vecs_SV);
    50          
164 1           PDL->barf_if_error(pdl_run_repulse(coords,vecs,boxsize,dmult,a,b,c,d));
165 1 50         PDL_XS_RETURN(ST(0) = vecs_SV)
    50          
    50          
    50          
    0          
166              
167             void
168             pdl_run_attract(coords, from, to, strength, vecs=vecs, m=m, ms=ms)
169             SV *vecs_SV = (items == 7) ? ST(4) : NULL;
170             SV *m_SV = (items == 7) ? ST(5) : ST(4);
171             SV *ms_SV = (items == 7) ? ST(6) : ST(5);
172             PREINIT:
173 1 50         PDL_XS_PREAMBLE((items == 7) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
174 1 50         if (!((items == 6) || (items == 7)))
    0          
175 0           croak("Usage: PDL::attract(coords,from,to,strength,[vecs],m,ms) (you may leave [outputs] and values with =defaults out of list)");
176             INPUT:
177             pdl *coords
178             pdl *from
179             pdl *to
180             pdl *strength
181             pdl *vecs=NO_INIT
182             double m; { m = (double)SvNV(m_SV); }
183             double ms; { ms = (double)SvNV(ms_SV); }
184             PPCODE:
185 1 50         if (vecs_SV) { vecs = PDL_CORE_(SvPDLV)(vecs_SV); } else vecs = PDL_XS_PERLINIT_initsv(vecs_SV);
    50          
186 1           PDL->barf_if_error(pdl_run_attract(coords,from,to,strength,vecs,m,ms));
187 1 50         PDL_XS_RETURN(ST(0) = vecs_SV)
    50          
    50          
    50          
    0          
188              
189              
190             #line 483 "lib/PDL/PP.pm"
191             BOOT:
192             /* Get pointer to structure of core shared C routines */
193             /* make sure PDL::Core is loaded */
194             #line 195 "lib/PDL/ImageND.xs"
195 5           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
196             #ifndef aTHX_
197             #define aTHX_
198             #endif
199 5 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
200 5           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
201 5 50         if (!CoreSV)
202 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
203 5 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
204 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
205 5 50         if (PDL->Version != PDL_CORE_VERSION)
206 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::ImageND needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);