File Coverage

pp-plbox3.c
Criterion Covered Total %
statement 45 46 97.8
branch 36 68 52.9
condition n/a
subroutine n/a
pod n/a
total 81 114 71.0


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-plbox3.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 1846 "lib/PDL/PP.pm"
40             typedef struct pdl_params_plbox3 {
41             #line 42 "pp-plbox3.c"
42             char *xopt;
43             char *xlabel;
44             char *yopt;
45             char *ylabel;
46             char *zopt;
47             char *zlabel;
48             } pdl_params_plbox3;
49              
50              
51             #line 1857 "lib/PDL/PP.pm"
52             pdl_error pdl_plbox3_readdata(pdl_trans *__privtrans) {
53             pdl_error PDL_err = {0, NULL, 0};
54             #line 55 "pp-plbox3.c"
55 38           pdl_params_plbox3 *__params = __privtrans->params; (void)__params;
56 38 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plbox3:" "broadcast.incs NULL");
57             /* broadcastloop declarations */
58             int __brcloopval;
59             register PDL_Indx __tind0,__tind1; /* counters along dim */
60 38           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
61             /* dims here are how many steps along those dims */
62 38           register PDL_Indx __tinc0_xtick = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
63 38           register PDL_Indx __tinc0_nsubx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
64 38           register PDL_Indx __tinc0_ytick = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
65 38           register PDL_Indx __tinc0_nsuby = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
66 38           register PDL_Indx __tinc0_ztick = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
67 38           register PDL_Indx __tinc0_nsubz = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
68 38           register PDL_Indx __tinc1_xtick = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
69 38           register PDL_Indx __tinc1_nsubx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
70 38           register PDL_Indx __tinc1_ytick = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
71 38           register PDL_Indx __tinc1_nsuby = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
72 38           register PDL_Indx __tinc1_ztick = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
73 38           register PDL_Indx __tinc1_nsubz = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
74             #define PDL_BROADCASTLOOP_START_plbox3_readdata PDL_BROADCASTLOOP_START( \
75             readdata, \
76             __privtrans->broadcast, \
77             __privtrans->vtable, \
78             xtick_datap += __offsp[0]; \
79             nsubx_datap += __offsp[1]; \
80             ytick_datap += __offsp[2]; \
81             nsuby_datap += __offsp[3]; \
82             ztick_datap += __offsp[4]; \
83             nsubz_datap += __offsp[5]; \
84             , \
85             ( ,xtick_datap += __tinc1_xtick - __tinc0_xtick * __tdims0 \
86             ,nsubx_datap += __tinc1_nsubx - __tinc0_nsubx * __tdims0 \
87             ,ytick_datap += __tinc1_ytick - __tinc0_ytick * __tdims0 \
88             ,nsuby_datap += __tinc1_nsuby - __tinc0_nsuby * __tdims0 \
89             ,ztick_datap += __tinc1_ztick - __tinc0_ztick * __tdims0 \
90             ,nsubz_datap += __tinc1_nsubz - __tinc0_nsubz * __tdims0 \
91             ), \
92             ( ,xtick_datap += __tinc0_xtick \
93             ,nsubx_datap += __tinc0_nsubx \
94             ,ytick_datap += __tinc0_ytick \
95             ,nsuby_datap += __tinc0_nsuby \
96             ,ztick_datap += __tinc0_ztick \
97             ,nsubz_datap += __tinc0_nsubz \
98             ) \
99             )
100             #define PDL_BROADCASTLOOP_END_plbox3_readdata PDL_BROADCASTLOOP_END( \
101             __privtrans->broadcast, \
102             xtick_datap -= __tinc1_xtick * __tdims1 + __offsp[0]; \
103             nsubx_datap -= __tinc1_nsubx * __tdims1 + __offsp[1]; \
104             ytick_datap -= __tinc1_ytick * __tdims1 + __offsp[2]; \
105             nsuby_datap -= __tinc1_nsuby * __tdims1 + __offsp[3]; \
106             ztick_datap -= __tinc1_ztick * __tdims1 + __offsp[4]; \
107             nsubz_datap -= __tinc1_nsubz * __tdims1 + __offsp[5]; \
108             )
109             #ifndef PDL_DECLARE_PARAMS_plbox3_1
110             #define PDL_DECLARE_PARAMS_plbox3_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_xtick,PDL_PPSYM_PARAM_xtick,PDL_TYPE_PARAM_nsubx,PDL_PPSYM_PARAM_nsubx,PDL_TYPE_PARAM_ytick,PDL_PPSYM_PARAM_ytick,PDL_TYPE_PARAM_nsuby,PDL_PPSYM_PARAM_nsuby,PDL_TYPE_PARAM_ztick,PDL_PPSYM_PARAM_ztick,PDL_TYPE_PARAM_nsubz,PDL_PPSYM_PARAM_nsubz) \
111             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_xtick, xtick, (__privtrans->pdls[0]), 1, PDL_PPSYM_PARAM_xtick) \
112             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_nsubx, nsubx, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_nsubx) \
113             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ytick, ytick, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_ytick) \
114             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_nsuby, nsuby, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_nsuby) \
115             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ztick, ztick, (__privtrans->pdls[4]), 1, PDL_PPSYM_PARAM_ztick) \
116             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_nsubz, nsubz, (__privtrans->pdls[5]), 1, PDL_PPSYM_PARAM_nsubz)
117             #endif
118             #define PDL_IF_BAD(t,f) f
119 38 50         switch (__privtrans->__datatype) { /* Start generic switch */
120 38           case PDL_D: {
121 38 50         PDL_DECLARE_PARAMS_plbox3_1(PDL_Double,D,PDL_Double,D,PDL_Long,L,PDL_Double,D,PDL_Long,L,PDL_Double,D,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
122 152 50         PDL_BROADCASTLOOP_START_plbox3_readdata {c_plbox3(__params->xopt,__params->xlabel,(xtick_datap)[0],(nsubx_datap)[0],__params->yopt,__params->ylabel,(ytick_datap)[0],(nsuby_datap)[0],__params->zopt,__params->zlabel,(ztick_datap)[0],(nsubz_datap)[0]);}PDL_BROADCASTLOOP_END_plbox3_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
123 38           } break;
124 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plbox3: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
125             }
126             #undef PDL_IF_BAD
127 38           return PDL_err;
128             }
129              
130              
131             #line 1857 "lib/PDL/PP.pm"
132             pdl_error pdl_plbox3_free(pdl_trans *__privtrans, char destroy) {
133             pdl_error PDL_err = {0, NULL, 0};
134             #line 135 "pp-plbox3.c"
135 38           pdl_params_plbox3 *__params = __privtrans->params; (void)__params;
136 38 50         PDL_FREE_CODE(__privtrans, destroy, free(__params->xopt); /* CType.get_free */
137             free(__params->xlabel); /* CType.get_free */
138             free(__params->yopt); /* CType.get_free */
139             free(__params->ylabel); /* CType.get_free */
140             free(__params->zopt); /* CType.get_free */
141             free(__params->zlabel); /* CType.get_free */
142 38           , ) return PDL_err;
143             }
144              
145             static pdl_datatypes pdl_plbox3_vtable_gentypes[] = { PDL_D, -1 };
146             static PDL_Indx pdl_plbox3_vtable_realdims[] = { 0, 0, 0, 0, 0, 0 };
147             static char *pdl_plbox3_vtable_parnames[] = { "xtick","nsubx","ytick","nsuby","ztick","nsubz" };
148             static short pdl_plbox3_vtable_parflags[] = {
149             PDL_PARAM_ISTYPED,
150             PDL_PARAM_ISTYPED,
151             PDL_PARAM_ISTYPED,
152             PDL_PARAM_ISTYPED,
153             PDL_PARAM_ISTYPED,
154             PDL_PARAM_ISTYPED
155             };
156             static pdl_datatypes pdl_plbox3_vtable_partypes[] = { PDL_D, PDL_L, PDL_D, PDL_L, PDL_D, PDL_L };
157             static PDL_Indx pdl_plbox3_vtable_realdims_starts[] = { 0, 0, 0, 0, 0, 0 };
158             static PDL_Indx pdl_plbox3_vtable_realdims_ind_ids[] = { 0 };
159             static char *pdl_plbox3_vtable_indnames[] = { "" };
160             pdl_transvtable pdl_plbox3_vtable = {
161             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plbox3_vtable_gentypes, 6, 6, NULL /*CORE21*/,
162             pdl_plbox3_vtable_realdims, pdl_plbox3_vtable_parnames,
163             pdl_plbox3_vtable_parflags, pdl_plbox3_vtable_partypes,
164             pdl_plbox3_vtable_realdims_starts, pdl_plbox3_vtable_realdims_ind_ids, 0,
165             0, pdl_plbox3_vtable_indnames,
166             NULL, pdl_plbox3_readdata, NULL,
167             pdl_plbox3_free,
168             sizeof(pdl_params_plbox3),"PDL::Graphics::PLplot::plbox3"
169             };
170              
171              
172 38           pdl_error pdl_run_plbox3(pdl *xtick,pdl *nsubx,pdl *ytick,pdl *nsuby,pdl *ztick,pdl *nsubz,char *xopt,char *xlabel,char *yopt,char *ylabel,char *zopt,char *zlabel) {
173 38           pdl_error PDL_err = {0, NULL, 0};
174 38 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
175 38           pdl_trans *__privtrans = PDL->create_trans(&pdl_plbox3_vtable);
176 38 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
177 38           pdl_params_plbox3 *__params = __privtrans->params;
178 38           __privtrans->pdls[0] = xtick;
179 38           __privtrans->pdls[1] = nsubx;
180 38           __privtrans->pdls[2] = ytick;
181 38           __privtrans->pdls[3] = nsuby;
182 38           __privtrans->pdls[4] = ztick;
183 38           __privtrans->pdls[5] = nsubz;
184 38 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
185 38           (__params->xopt) = malloc(strlen(xopt)+1); strcpy(__params->xopt,xopt); /* CType.get_copy */
186 38           (__params->xlabel) = malloc(strlen(xlabel)+1); strcpy(__params->xlabel,xlabel); /* CType.get_copy */
187 38           (__params->yopt) = malloc(strlen(yopt)+1); strcpy(__params->yopt,yopt); /* CType.get_copy */
188 38           (__params->ylabel) = malloc(strlen(ylabel)+1); strcpy(__params->ylabel,ylabel); /* CType.get_copy */
189 38           (__params->zopt) = malloc(strlen(zopt)+1); strcpy(__params->zopt,zopt); /* CType.get_copy */
190 38           (__params->zlabel) = malloc(strlen(zlabel)+1); strcpy(__params->zlabel,zlabel); /* CType.get_copy */
191 38 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
192 38           return PDL_err;
193             }