File Coverage

pp-plhist.c
Criterion Covered Total %
statement 32 33 96.9
branch 32 60 53.3
condition n/a
subroutine n/a
pod n/a
total 64 93 68.8


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 plplot.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_Graphics_PLplot
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "pp-plhist.c"
23             #include
24             #include
25             #include
26             #include
27              
28             #ifndef PDL /* this is needed for PDL pre-2.058 */
29             #define PDL PDL_Graphics_PLplot
30             Core* PDL = NULL; PDL_COMMENT("Structure hold core C functions")
31             #endif
32              
33             #define PLPTR_DEFINE(t) typedef t *t ## Ptr; typedef t *t ## Ptr__OUT;
34             PLPTR_DEFINE(PLcGrid)
35             PLPTR_DEFINE(PLcGrid2)
36             #define PLPTR_RECEIVE_IN(t, v, v_in) t *v = (t *)v_in;
37             #define PLPTR_RECEIVE_SV(v) ((PLPointer) (SvROK(v) ? SvIV((SV*)SvRV(v)) : (IV)NULL))
38              
39             #line 1857 "lib/PDL/PP.pm"
40             pdl_error pdl_plhist_readdata(pdl_trans *__privtrans) {
41             pdl_error PDL_err = {0, NULL, 0};
42             #line 43 "pp-plhist.c"
43 7 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plhist:" "broadcast.incs NULL");
44             /* broadcastloop declarations */
45             int __brcloopval;
46             register PDL_Indx __tind0,__tind1; /* counters along dim */
47 7           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
48             /* dims here are how many steps along those dims */
49 7           register PDL_Indx __tinc0_data = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
50 7           register PDL_Indx __tinc0_datmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
51 7           register PDL_Indx __tinc0_datmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
52 7           register PDL_Indx __tinc0_nbin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
53 7           register PDL_Indx __tinc0_oldwin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
54 7           register PDL_Indx __tinc1_data = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
55 7           register PDL_Indx __tinc1_datmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
56 7           register PDL_Indx __tinc1_datmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
57 7           register PDL_Indx __tinc1_nbin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
58 7           register PDL_Indx __tinc1_oldwin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
59             #define PDL_BROADCASTLOOP_START_plhist_readdata PDL_BROADCASTLOOP_START( \
60             readdata, \
61             __privtrans->broadcast, \
62             __privtrans->vtable, \
63             data_datap += __offsp[0]; \
64             datmin_datap += __offsp[1]; \
65             datmax_datap += __offsp[2]; \
66             nbin_datap += __offsp[3]; \
67             oldwin_datap += __offsp[4]; \
68             , \
69             ( ,data_datap += __tinc1_data - __tinc0_data * __tdims0 \
70             ,datmin_datap += __tinc1_datmin - __tinc0_datmin * __tdims0 \
71             ,datmax_datap += __tinc1_datmax - __tinc0_datmax * __tdims0 \
72             ,nbin_datap += __tinc1_nbin - __tinc0_nbin * __tdims0 \
73             ,oldwin_datap += __tinc1_oldwin - __tinc0_oldwin * __tdims0 \
74             ), \
75             ( ,data_datap += __tinc0_data \
76             ,datmin_datap += __tinc0_datmin \
77             ,datmax_datap += __tinc0_datmax \
78             ,nbin_datap += __tinc0_nbin \
79             ,oldwin_datap += __tinc0_oldwin \
80             ) \
81             )
82             #define PDL_BROADCASTLOOP_END_plhist_readdata PDL_BROADCASTLOOP_END( \
83             __privtrans->broadcast, \
84             data_datap -= __tinc1_data * __tdims1 + __offsp[0]; \
85             datmin_datap -= __tinc1_datmin * __tdims1 + __offsp[1]; \
86             datmax_datap -= __tinc1_datmax * __tdims1 + __offsp[2]; \
87             nbin_datap -= __tinc1_nbin * __tdims1 + __offsp[3]; \
88             oldwin_datap -= __tinc1_oldwin * __tdims1 + __offsp[4]; \
89             )
90 7           register PDL_Indx __inc_data_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_data_n;
91             #ifndef PDL_DECLARE_PARAMS_plhist_1
92             #define PDL_DECLARE_PARAMS_plhist_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_nbin,PDL_PPSYM_PARAM_nbin,PDL_TYPE_PARAM_oldwin,PDL_PPSYM_PARAM_oldwin) \
93             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, data, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
94             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, datmin, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
95             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, datmax, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
96             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_nbin, nbin, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_nbin) \
97             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_oldwin, oldwin, (__privtrans->pdls[4]), 1, PDL_PPSYM_PARAM_oldwin)
98             #endif
99             #define PDL_IF_BAD(t,f) f
100 7 50         switch (__privtrans->__datatype) { /* Start generic switch */
101 7           case PDL_D: {
102 7 50         PDL_DECLARE_PARAMS_plhist_1(PDL_Double,D,PDL_Long,L,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
103 28 50         PDL_BROADCASTLOOP_START_plhist_readdata {c_plhist(__privtrans->ind_sizes[0],data_datap,(datmin_datap)[0],(datmax_datap)[0],(nbin_datap)[0],(oldwin_datap)[0]);}PDL_BROADCASTLOOP_END_plhist_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
104 7           } break;
105 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plhist: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
106             }
107             #undef PDL_IF_BAD
108 7           return PDL_err;
109             }
110              
111             static pdl_datatypes pdl_plhist_vtable_gentypes[] = { PDL_D, -1 };
112             static PDL_Indx pdl_plhist_vtable_realdims[] = { 1, 0, 0, 0, 0 };
113             static char *pdl_plhist_vtable_parnames[] = { "data","datmin","datmax","nbin","oldwin" };
114             static short pdl_plhist_vtable_parflags[] = {
115             PDL_PARAM_ISPHYS,
116             0,
117             0,
118             PDL_PARAM_ISTYPED,
119             PDL_PARAM_ISTYPED
120             };
121             static pdl_datatypes pdl_plhist_vtable_partypes[] = { -1, -1, -1, PDL_L, PDL_L };
122             static PDL_Indx pdl_plhist_vtable_realdims_starts[] = { 0, 1, 1, 1, 1 };
123             static PDL_Indx pdl_plhist_vtable_realdims_ind_ids[] = { 0 };
124             static char *pdl_plhist_vtable_indnames[] = { "n" };
125             pdl_transvtable pdl_plhist_vtable = {
126             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plhist_vtable_gentypes, 5, 5, NULL /*CORE21*/,
127             pdl_plhist_vtable_realdims, pdl_plhist_vtable_parnames,
128             pdl_plhist_vtable_parflags, pdl_plhist_vtable_partypes,
129             pdl_plhist_vtable_realdims_starts, pdl_plhist_vtable_realdims_ind_ids, 1,
130             1, pdl_plhist_vtable_indnames,
131             NULL, pdl_plhist_readdata, NULL,
132             NULL,
133             0,"PDL::Graphics::PLplot::plhist"
134             };
135              
136              
137 7           pdl_error pdl_run_plhist(pdl *data,pdl *datmin,pdl *datmax,pdl *nbin,pdl *oldwin) {
138 7           pdl_error PDL_err = {0, NULL, 0};
139 7 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
140 7           pdl_trans *__privtrans = PDL->create_trans(&pdl_plhist_vtable);
141 7 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
142 7           __privtrans->pdls[0] = data;
143 7           __privtrans->pdls[1] = datmin;
144 7           __privtrans->pdls[2] = datmax;
145 7           __privtrans->pdls[3] = nbin;
146 7           __privtrans->pdls[4] = oldwin;
147 7 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
148 7 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
149 7           return PDL_err;
150             }