File Coverage

lib/PDL/IO/Pnm.xs
Criterion Covered Total %
statement 17 22 77.2
branch 31 88 35.2
condition n/a
subroutine n/a
pod n/a
total 48 110 43.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/IO/Pnm.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_IO_Pnm
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/IO/Pnm.xs"
23             pdl_error pdl_run_pnminraw(pdl *type,pdl *im,IV ms,IV ns,int isbin,PerlIO *fp);
24             pdl_error pdl_run_pnminascii(pdl *type,pdl *im,IV ms,IV ns,int format,PerlIO *fp);
25             pdl_error pdl_run_pnmout(pdl *a,int israw,int isbin,PerlIO *fp);
26              
27             #line 449 "lib/PDL/PP.pm"
28             #include "pdlperl.h"
29             #line 30 "lib/PDL/IO/Pnm.xs"
30              
31             Core* PDL = NULL; /* Structure hold core C functions */
32              
33             MODULE = PDL::IO::Pnm PACKAGE = PDL PREFIX=pdl_run_
34              
35             PROTOTYPES: DISABLE
36              
37              
38             void
39             pdl_run_pnminraw(type, im=im, ms=ms, ns=ns, isbin=isbin, fp=fp)
40             SV *im_SV = (items == 6) ? ST(1) : NULL;
41             SV *ms_SV = (items == 6) ? ST(2) : ST(1);
42             SV *ns_SV = (items == 6) ? ST(3) : ST(2);
43             SV *isbin_SV = (items == 6) ? ST(4) : ST(3);
44             SV *fp_SV = (items == 6) ? ST(5) : ST(4);
45             PREINIT:
46 27 50         PDL_XS_PREAMBLE((items == 6) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
47 27 50         if (!((items == 5) || (items == 6)))
    50          
48 0           croak("Usage: PDL::pnminraw(type,[im],ms,ns,isbin,fp) (you may leave [outputs] and values with =defaults out of list)");
49             INPUT:
50             pdl *type
51             pdl *im=NO_INIT
52             IV ms; { ms = (IV)SvIV(ms_SV); }
53             IV ns; { ns = (IV)SvIV(ns_SV); }
54             int isbin; { isbin = (int)SvIV(isbin_SV); }
55             PerlIO *fp; { fp = IoIFP(sv_2io(fp_SV)); }
56             PPCODE:
57 27 50         if (im_SV) { im = PDL_CORE_(SvPDLV)(im_SV); } else im = PDL_XS_PERLINIT_initsv(im_SV);
    0          
58 27           PDL->barf_if_error(pdl_run_pnminraw(type,im,ms,ns,isbin,fp));
59 27 50         PDL_XS_RETURN(ST(0) = im_SV)
    0          
    0          
    0          
    50          
60              
61             void
62             pdl_run_pnminascii(type, im=im, ms=ms, ns=ns, format=format, fp=fp)
63             SV *im_SV = (items == 6) ? ST(1) : NULL;
64             SV *ms_SV = (items == 6) ? ST(2) : ST(1);
65             SV *ns_SV = (items == 6) ? ST(3) : ST(2);
66             SV *format_SV = (items == 6) ? ST(4) : ST(3);
67             SV *fp_SV = (items == 6) ? ST(5) : ST(4);
68             PREINIT:
69 16 50         PDL_XS_PREAMBLE((items == 6) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
70 16 50         if (!((items == 5) || (items == 6)))
    50          
71 0           croak("Usage: PDL::pnminascii(type,[im],ms,ns,format,fp) (you may leave [outputs] and values with =defaults out of list)");
72             INPUT:
73             pdl *type
74             pdl *im=NO_INIT
75             IV ms; { ms = (IV)SvIV(ms_SV); }
76             IV ns; { ns = (IV)SvIV(ns_SV); }
77             int format; { format = (int)SvIV(format_SV); }
78             PerlIO *fp; { fp = IoIFP(sv_2io(fp_SV)); }
79             PPCODE:
80 16 50         if (im_SV) { im = PDL_CORE_(SvPDLV)(im_SV); } else im = PDL_XS_PERLINIT_initsv(im_SV);
    0          
81 16           PDL->barf_if_error(pdl_run_pnminascii(type,im,ms,ns,format,fp));
82 16 50         PDL_XS_RETURN(ST(0) = im_SV)
    0          
    0          
    0          
    50          
83              
84             void
85             pdl_run_pnmout(a, israw, isbin, fp)
86             pdl *a
87             int israw
88             int isbin
89             PerlIO *fp
90             PPCODE:
91 37           PDL->barf_if_error(pdl_run_pnmout(a,israw,isbin,fp));
92              
93              
94             #line 483 "lib/PDL/PP.pm"
95             BOOT:
96             /* Get pointer to structure of core shared C routines */
97             /* make sure PDL::Core is loaded */
98             #line 99 "lib/PDL/IO/Pnm.xs"
99 15           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
100             #ifndef aTHX_
101             #define aTHX_
102             #endif
103 15 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
104 15           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
105 15 50         if (!CoreSV)
106 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
107 15 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
108 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
109 15 50         if (PDL->Version != PDL_CORE_VERSION)
110 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::IO::Pnm needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);