File Coverage

lib/PDL/Compression.xs
Criterion Covered Total %
statement 13 17 76.4
branch 24 54 44.4
condition n/a
subroutine n/a
pod n/a
total 37 71 52.1


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/Compression.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_Compression
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/Compression.xs"
23             pdl_error pdl_run_rice_compress(pdl *in,pdl *out,pdl *len,int blocksize);
24             pdl_error pdl_run_rice_expand(pdl *in,pdl *len,pdl *out,IV dim0,int blocksize);
25              
26             #line 449 "lib/PDL/PP.pm"
27             #include "pdlperl.h"
28             #line 29 "lib/PDL/Compression.xs"
29              
30             Core* PDL = NULL; /* Structure hold core C functions */
31              
32             MODULE = PDL::Compression PACKAGE = PDL PREFIX=pdl_run_
33              
34             PROTOTYPES: DISABLE
35              
36              
37             void
38             _rice_compress_int(in,out,len,blocksize)
39             pdl *in
40             pdl *out
41             pdl *len
42             int blocksize
43             CODE:
44 4           PDL->barf_if_error(pdl_run_rice_compress(in,out,len,blocksize));
45              
46             void
47             pdl_run_rice_expand(in, len, out=out, dim0=dim0, blocksize=blocksize)
48             SV *out_SV = (items == 5) ? ST(2) : NULL;
49             SV *dim0_SV = (items == 5) ? ST(3) : ST(2);
50             SV *blocksize_SV = (items == 5) ? ST(4) : !(items == (4-1)) ? ST(3) : NULL;
51             PREINIT:
52 10 50         PDL_XS_PREAMBLE((items == 5) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
53 10 100         if (!((items == (4-1)) || (items == 4) || (items == 5)))
    50          
    0          
54 0           croak("Usage: PDL::rice_expand(in,len,[out],dim0,blocksize=32) (you may leave [outputs] and values with =defaults out of list)");
55             INPUT:
56             pdl *in
57             pdl *len
58             pdl *out=NO_INIT
59             IV dim0; { dim0 = (IV)SvIV(dim0_SV); }
60             int blocksize=NO_INIT
61             PPCODE:
62 10 100         if (!blocksize_SV) { blocksize = (32); } else { blocksize = (int)SvIV(blocksize_SV); }
63 10 50         if (out_SV) { out = PDL_CORE_(SvPDLV)(out_SV); } else out = PDL_XS_PERLINIT_initsv(out_SV);
    50          
64 10           PDL->barf_if_error(pdl_run_rice_expand(in,len,out,dim0,blocksize));
65 10 50         PDL_XS_RETURN(ST(0) = out_SV)
    50          
    50          
    50          
    0          
66              
67              
68             #line 483 "lib/PDL/PP.pm"
69             BOOT:
70             /* Get pointer to structure of core shared C routines */
71             /* make sure PDL::Core is loaded */
72             #line 73 "lib/PDL/Compression.xs"
73 3           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
74             #ifndef aTHX_
75             #define aTHX_
76             #endif
77 3 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
78 3           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
79 3 50         if (!CoreSV)
80 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
81 3 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
82 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
83 3 50         if (PDL->Version != PDL_CORE_VERSION)
84 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::Compression needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);