File Coverage

lib/PDL/Slices.xs
Criterion Covered Total %
statement 63 66 95.4
branch 184 442 41.6
condition n/a
subroutine n/a
pod n/a
total 247 508 48.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/Slices.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_Slices
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/Slices.xs"
23             pdl_error pdl_run_index(pdl *a,pdl *ind,pdl *c);
24             pdl_error pdl_run_index1d(pdl *a,pdl *ind,pdl *c);
25             pdl_error pdl_run_index2d(pdl *a,pdl *inda,pdl *indb,pdl *c);
26             pdl_error pdl_run_rangeb(pdl *PARENT,pdl *CHILD,pdl *ind_pdl,SV *size_sv,SV *boundary_sv);
27             pdl_error pdl_run_rld(pdl *a,pdl *b,pdl *c,IV sumover_max);
28             pdl_error pdl_run_rle(pdl *c,pdl *a,pdl *b);
29             pdl_error pdl_run_rlevec(pdl *c,pdl *a,pdl *b);
30             pdl_error pdl_run_rldvec(pdl *a,pdl *b,pdl *c,IV sumover_max);
31             pdl_error pdl_run_rleseq(pdl *c,pdl *a,pdl *b);
32             pdl_error pdl_run_rldseq(pdl *a,pdl *b,pdl *c,IV sumover_max);
33             pdl_error pdl_run__clump_int(pdl *PARENT,pdl *CHILD,PDL_Indx n);
34             pdl_error pdl_run_xchg(pdl *PARENT,pdl *CHILD,PDL_Indx n1,PDL_Indx n2);
35             pdl_error pdl_run_mv(pdl *PARENT,pdl *CHILD,PDL_Indx n1,PDL_Indx n2);
36             pdl_error pdl_run_lags(pdl *PARENT,pdl *CHILD,PDL_Indx nthdim,PDL_Indx step,PDL_Indx nlags);
37             pdl_error pdl_run_splitdim(pdl *PARENT,pdl *CHILD,PDL_Indx nthdim,PDL_Indx nsp);
38             pdl_error pdl_run_rotate(pdl *x,pdl *shift,pdl *y);
39             pdl_error pdl_run_broadcastI(pdl *PARENT,pdl *CHILD,PDL_Indx id,PDL_Indx *whichdims,PDL_Indx whichdims_count);
40             pdl_error pdl_run_unbroadcast(pdl *PARENT,pdl *CHILD,PDL_Indx atind);
41             pdl_error pdl_run_slice(pdl *PARENT,pdl *CHILD,pdl_slice_args *arglist);
42             pdl_error pdl_run_diagonal(pdl *PARENT,pdl *CHILD,PDL_Indx *whichdims,PDL_Indx whichdims_count);
43              
44             #line 449 "lib/PDL/PP.pm"
45             #include "pdlperl.h"
46             #line 47 "lib/PDL/Slices.xs"
47              
48             Core* PDL = NULL; /* Structure hold core C functions */
49              
50             MODULE = PDL::Slices PACKAGE = PDL PREFIX=pdl_run_
51              
52             PROTOTYPES: DISABLE
53              
54              
55             void
56             pdl_run_index(a, ind)
57             SV *c_SV = NULL;
58             PREINIT:
59 1324 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
60             INPUT:
61             pdl *a
62             pdl *ind
63             pdl *c=PDL_XS_PERLINIT_initsv(c_SV);
64             PPCODE:
65 1324           PDL->barf_if_error(pdl_run_index(a,ind,c));
66 1324 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
67              
68             void
69             pdl_run_index1d(a, ind)
70             SV *c_SV = NULL;
71             PREINIT:
72 5881 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
73             INPUT:
74             pdl *a
75             pdl *ind
76             pdl *c=PDL_XS_PERLINIT_initsv(c_SV);
77             PPCODE:
78 5881           PDL->barf_if_error(pdl_run_index1d(a,ind,c));
79 5881 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
80              
81             void
82             pdl_run_index2d(a, inda, indb)
83             SV *c_SV = NULL;
84             PREINIT:
85 94 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
86             INPUT:
87             pdl *a
88             pdl *inda
89             pdl *indb
90             pdl *c=PDL_XS_PERLINIT_initsv(c_SV);
91             PPCODE:
92 94           PDL->barf_if_error(pdl_run_index2d(a,inda,indb,c));
93 94 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
94              
95             void
96             pdl_run_rangeb(PARENT, ind_pdl, size_sv, boundary_sv)
97             SV *CHILD_SV = NULL;
98             PREINIT:
99 83 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
100             INPUT:
101             pdl *PARENT
102             pdl *ind_pdl
103             SV *size_sv
104             SV *boundary_sv
105             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
106             PPCODE:
107 83           PDL->barf_if_error(pdl_run_rangeb(PARENT,CHILD,ind_pdl,size_sv,boundary_sv));
108 83 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
109              
110             void
111             _rld_int(a,b,c,sumover_max)
112             pdl *a
113             pdl *b
114             pdl *c
115             IV sumover_max
116             CODE:
117 5           PDL->barf_if_error(pdl_run_rld(a,b,c,sumover_max));
118              
119             void
120             _rle_int(c,a,b)
121             pdl *c
122             pdl *a
123             pdl *b
124             CODE:
125 5           PDL->barf_if_error(pdl_run_rle(c,a,b));
126              
127             void
128             pdl_run_rlevec(c, a=PDL_XS_PERLINIT_initsv(a_SV), b=PDL_XS_PERLINIT_initsv(b_SV))
129             SV *a_SV = items > 1 ? ST(1) : NULL;
130             SV *b_SV = items > 2 ? ST(2) : NULL;
131             PREINIT:
132 3 100         PDL_XS_PREAMBLE((items == 3) ? 0 : 2);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
133             INPUT:
134             pdl *c
135             pdl *a
136             pdl *b
137             PPCODE:
138 3           PDL->barf_if_error(pdl_run_rlevec(c,a,b));
139 3 100         PDL_XS_RETURN(ST(0) = a_SV;ST(1) = b_SV)
    50          
    50          
    50          
    50          
140              
141             void
142             _rldvec_int(a,b,c,sumover_max)
143             pdl *a
144             pdl *b
145             pdl *c
146             IV sumover_max
147             CODE:
148 9           PDL->barf_if_error(pdl_run_rldvec(a,b,c,sumover_max));
149              
150             void
151             pdl_run_rleseq(c, a=PDL_XS_PERLINIT_initsv(a_SV), b=PDL_XS_PERLINIT_initsv(b_SV))
152             SV *a_SV = items > 1 ? ST(1) : NULL;
153             SV *b_SV = items > 2 ? ST(2) : NULL;
154             PREINIT:
155 1 50         PDL_XS_PREAMBLE((items == 3) ? 0 : 2);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
156             INPUT:
157             pdl *c
158             pdl *a
159             pdl *b
160             PPCODE:
161 1           PDL->barf_if_error(pdl_run_rleseq(c,a,b));
162 1 50         PDL_XS_RETURN(ST(0) = a_SV;ST(1) = b_SV)
    50          
    50          
    50          
    0          
163              
164             void
165             _rldseq_int(a,b,c,sumover_max)
166             pdl *a
167             pdl *b
168             pdl *c
169             IV sumover_max
170             CODE:
171 2           PDL->barf_if_error(pdl_run_rldseq(a,b,c,sumover_max));
172              
173             void
174             pdl_run__clump_int(PARENT, n)
175             SV *CHILD_SV = NULL;
176             PREINIT:
177 11906 50         PDL_XS_PREAMBLE(1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
178             INPUT:
179             pdl *PARENT
180             PDL_Indx n
181             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
182             PPCODE:
183 11906           PDL->barf_if_error(pdl_run__clump_int(PARENT,CHILD,n));
184 11906 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
185              
186             void
187             pdl_run_xchg(PARENT, n1, n2)
188             SV *CHILD_SV = NULL;
189             PREINIT:
190 351 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
191             INPUT:
192             pdl *PARENT
193             PDL_Indx n1
194             PDL_Indx n2
195             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
196             PPCODE:
197 351           PDL->barf_if_error(pdl_run_xchg(PARENT,CHILD,n1,n2));
198 351 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
199              
200             void
201             pdl_run_mv(PARENT, n1, n2)
202             SV *CHILD_SV = NULL;
203             PREINIT:
204 12456 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
205             INPUT:
206             pdl *PARENT
207             PDL_Indx n1
208             PDL_Indx n2
209             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
210             PPCODE:
211 12456           PDL->barf_if_error(pdl_run_mv(PARENT,CHILD,n1,n2));
212 12456 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
213              
214             void
215             pdl_run_lags(PARENT, nthdim, step, nlags)
216             SV *CHILD_SV = NULL;
217             PREINIT:
218 3 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
219             INPUT:
220             pdl *PARENT
221             PDL_Indx nthdim
222             PDL_Indx step
223             PDL_Indx nlags
224             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
225             PPCODE:
226 3           PDL->barf_if_error(pdl_run_lags(PARENT,CHILD,nthdim,step,nlags));
227 3 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
228              
229             void
230             pdl_run_splitdim(PARENT, nthdim, nsp)
231             SV *CHILD_SV = NULL;
232             PREINIT:
233 76 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
234             INPUT:
235             pdl *PARENT
236             PDL_Indx nthdim
237             PDL_Indx nsp
238             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
239             PPCODE:
240 76           PDL->barf_if_error(pdl_run_splitdim(PARENT,CHILD,nthdim,nsp));
241 76 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
242              
243             void
244             pdl_run_rotate(x, shift)
245             SV *y_SV = NULL;
246             PREINIT:
247 71 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
248             INPUT:
249             pdl *x
250             pdl *shift
251             pdl *y=PDL_XS_PERLINIT_initsv(y_SV);
252             PPCODE:
253 71           PDL->barf_if_error(pdl_run_rotate(x,shift,y));
254 71 50         PDL_XS_RETURN(ST(0) = y_SV)
    50          
    50          
    50          
    0          
255              
256             void
257             pdl_run_broadcastI(PARENT, id, whichdims)
258             SV *CHILD_SV = NULL;
259             PREINIT:
260 940 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
261             INPUT:
262             PDL_Indx whichdims_count=0;
263             pdl *PARENT
264             PDL_Indx id
265             PDL_Indx *whichdims
266             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
267             PPCODE:
268 940           PDL->barf_if_error(pdl_run_broadcastI(PARENT,CHILD,id,whichdims,whichdims_count));
269 940 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
270              
271             void
272             pdl_run_unbroadcast(PARENT, atind)
273             SV *CHILD_SV = NULL;
274             PREINIT:
275 46 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
276             INPUT:
277             pdl *PARENT
278             PDL_Indx atind
279             pdl *CHILD=PDL_XS_PERLINIT_initsv(CHILD_SV);
280             PPCODE:
281 46           PDL->barf_if_error(pdl_run_unbroadcast(PARENT,CHILD,atind));
282 46 50         PDL_XS_RETURN(ST(0) = CHILD_SV)
    50          
    50          
    50          
    0          
283              
284             void
285             _slice_int(PARENT,CHILD,arglist)
286             pdl *PARENT
287             pdl *CHILD
288             pdl_slice_args *arglist
289             CODE:
290 7651           PDL->barf_if_error(pdl_run_slice(PARENT,CHILD,arglist));
291              
292             void
293             _diagonal_int(PARENT,CHILD,whichdims)
294             PDL_Indx whichdims_count=0;
295             pdl *PARENT
296             pdl *CHILD
297             PDL_Indx *whichdims
298             CODE:
299 278           PDL->barf_if_error(pdl_run_diagonal(PARENT,CHILD,whichdims,whichdims_count));
300              
301              
302             #line 483 "lib/PDL/PP.pm"
303             BOOT:
304             /* Get pointer to structure of core shared C routines */
305             /* make sure PDL::Core is loaded */
306             #line 307 "lib/PDL/Slices.xs"
307 71           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
308             #ifndef aTHX_
309             #define aTHX_
310             #endif
311 71 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
312 71           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
313 71 50         if (!CoreSV)
314 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
315 71 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
316 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
317 71 50         if (PDL->Version != PDL_CORE_VERSION)
318 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::Slices needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);
319 71           char *package = "PDL";
320 71           HV* stash = gv_stashpvn(package, strlen(package), TRUE);
321 71           char *meths[] = {"index","index1d","index2d","rangeb","xchg","mv","broadcastI","unbroadcast",NULL}, **methsptr = meths;
322 639 100         for (; *methsptr; methsptr++) {
323 568           SV **meth = hv_fetch(stash, *methsptr, strlen(*methsptr), 0);
324 568 50         if (!meth) croak("No found method '%s' in '%s'", *methsptr, package);
325 568           CV *cv = GvCV(*meth);
326 568 50         if (!cv) croak("No found CV for '%s' in '%s'", *methsptr, package);
327 568           CvLVALUE_on(cv);
328             }