File Coverage

pp-plstripc.c
Criterion Covered Total %
statement 83 87 95.4
branch 66 126 52.3
condition n/a
subroutine n/a
pod n/a
total 149 213 69.9


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-plstripc.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             void pltr_iv_set(IV iv0, IV iv1, IV iv2);
40             void pltr_callback_set(SV *sv, char *msg);
41             void pltr_callback(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data);
42             void* get_standard_pltrcb(SV* cb);
43             void defined_callback_set(SV *sv, char *msg);
44             PLINT defined_callback(PLFLT x, PLFLT y);
45             void default_magic(pdl *p, size_t pa);
46             void mapform_callback_set(SV *sv, char *msg);
47             void mapform_callback(PLINT n, PLFLT* x, PLFLT* y);
48             void xform_callback_set(SV *sv, char *msg);
49             void xform_callback(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data);
50             void labelfunc_callback_set(SV *sv, char *msg);
51             void labelfunc_callback(PLINT axis, PLFLT value, char *label_text, PLINT length, void *data);
52              
53             #line 1846 "lib/PDL/PP.pm"
54             typedef struct pdl_params_plstripc {
55             #line 56 "pp-plstripc.c"
56             char *xspec;
57             char *yspec;
58             SV *legline;
59             char *labx;
60             char *laby;
61             char *labtop;
62             } pdl_params_plstripc;
63              
64              
65             #line 1857 "lib/PDL/PP.pm"
66             pdl_error pdl_plstripc_readdata(pdl_trans *__privtrans) {
67             pdl_error PDL_err = {0, NULL, 0};
68             #line 69 "pp-plstripc.c"
69 1           pdl_params_plstripc *__params = __privtrans->params; (void)__params;
70 1 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plstripc:" "broadcast.incs NULL");
71             /* broadcastloop declarations */
72             int __brcloopval;
73             register PDL_Indx __tind0,__tind1; /* counters along dim */
74 1           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
75             /* dims here are how many steps along those dims */
76 1           register PDL_Indx __tinc0_xmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
77 1           register PDL_Indx __tinc0_xmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
78 1           register PDL_Indx __tinc0_xjump = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
79 1           register PDL_Indx __tinc0_ymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
80 1           register PDL_Indx __tinc0_ymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
81 1           register PDL_Indx __tinc0_xlpos = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
82 1           register PDL_Indx __tinc0_ylpos = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
83 1           register PDL_Indx __tinc0_y_ascl = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0);
84 1           register PDL_Indx __tinc0_acc = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,0);
85 1           register PDL_Indx __tinc0_colbox = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,9,0);
86 1           register PDL_Indx __tinc0_collab = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,10,0);
87 1           register PDL_Indx __tinc0_colline = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,11,0);
88 1           register PDL_Indx __tinc0_styline = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,12,0);
89 1           register PDL_Indx __tinc0_id = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,13,0);
90 1           register PDL_Indx __tinc1_xmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
91 1           register PDL_Indx __tinc1_xmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
92 1           register PDL_Indx __tinc1_xjump = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
93 1           register PDL_Indx __tinc1_ymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
94 1           register PDL_Indx __tinc1_ymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
95 1           register PDL_Indx __tinc1_xlpos = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
96 1           register PDL_Indx __tinc1_ylpos = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
97 1           register PDL_Indx __tinc1_y_ascl = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1);
98 1           register PDL_Indx __tinc1_acc = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,1);
99 1           register PDL_Indx __tinc1_colbox = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,9,1);
100 1           register PDL_Indx __tinc1_collab = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,10,1);
101 1           register PDL_Indx __tinc1_colline = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,11,1);
102 1           register PDL_Indx __tinc1_styline = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,12,1);
103 1           register PDL_Indx __tinc1_id = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,13,1);
104             #define PDL_BROADCASTLOOP_START_plstripc_readdata PDL_BROADCASTLOOP_START( \
105             readdata, \
106             __privtrans->broadcast, \
107             __privtrans->vtable, \
108             xmin_datap += __offsp[0]; \
109             xmax_datap += __offsp[1]; \
110             xjump_datap += __offsp[2]; \
111             ymin_datap += __offsp[3]; \
112             ymax_datap += __offsp[4]; \
113             xlpos_datap += __offsp[5]; \
114             ylpos_datap += __offsp[6]; \
115             y_ascl_datap += __offsp[7]; \
116             acc_datap += __offsp[8]; \
117             colbox_datap += __offsp[9]; \
118             collab_datap += __offsp[10]; \
119             colline_datap += __offsp[11]; \
120             styline_datap += __offsp[12]; \
121             id_datap += __offsp[13]; \
122             , \
123             ( ,xmin_datap += __tinc1_xmin - __tinc0_xmin * __tdims0 \
124             ,xmax_datap += __tinc1_xmax - __tinc0_xmax * __tdims0 \
125             ,xjump_datap += __tinc1_xjump - __tinc0_xjump * __tdims0 \
126             ,ymin_datap += __tinc1_ymin - __tinc0_ymin * __tdims0 \
127             ,ymax_datap += __tinc1_ymax - __tinc0_ymax * __tdims0 \
128             ,xlpos_datap += __tinc1_xlpos - __tinc0_xlpos * __tdims0 \
129             ,ylpos_datap += __tinc1_ylpos - __tinc0_ylpos * __tdims0 \
130             ,y_ascl_datap += __tinc1_y_ascl - __tinc0_y_ascl * __tdims0 \
131             ,acc_datap += __tinc1_acc - __tinc0_acc * __tdims0 \
132             ,colbox_datap += __tinc1_colbox - __tinc0_colbox * __tdims0 \
133             ,collab_datap += __tinc1_collab - __tinc0_collab * __tdims0 \
134             ,colline_datap += __tinc1_colline - __tinc0_colline * __tdims0 \
135             ,styline_datap += __tinc1_styline - __tinc0_styline * __tdims0 \
136             ,id_datap += __tinc1_id - __tinc0_id * __tdims0 \
137             ), \
138             ( ,xmin_datap += __tinc0_xmin \
139             ,xmax_datap += __tinc0_xmax \
140             ,xjump_datap += __tinc0_xjump \
141             ,ymin_datap += __tinc0_ymin \
142             ,ymax_datap += __tinc0_ymax \
143             ,xlpos_datap += __tinc0_xlpos \
144             ,ylpos_datap += __tinc0_ylpos \
145             ,y_ascl_datap += __tinc0_y_ascl \
146             ,acc_datap += __tinc0_acc \
147             ,colbox_datap += __tinc0_colbox \
148             ,collab_datap += __tinc0_collab \
149             ,colline_datap += __tinc0_colline \
150             ,styline_datap += __tinc0_styline \
151             ,id_datap += __tinc0_id \
152             ) \
153             )
154             #define PDL_BROADCASTLOOP_END_plstripc_readdata PDL_BROADCASTLOOP_END( \
155             __privtrans->broadcast, \
156             xmin_datap -= __tinc1_xmin * __tdims1 + __offsp[0]; \
157             xmax_datap -= __tinc1_xmax * __tdims1 + __offsp[1]; \
158             xjump_datap -= __tinc1_xjump * __tdims1 + __offsp[2]; \
159             ymin_datap -= __tinc1_ymin * __tdims1 + __offsp[3]; \
160             ymax_datap -= __tinc1_ymax * __tdims1 + __offsp[4]; \
161             xlpos_datap -= __tinc1_xlpos * __tdims1 + __offsp[5]; \
162             ylpos_datap -= __tinc1_ylpos * __tdims1 + __offsp[6]; \
163             y_ascl_datap -= __tinc1_y_ascl * __tdims1 + __offsp[7]; \
164             acc_datap -= __tinc1_acc * __tdims1 + __offsp[8]; \
165             colbox_datap -= __tinc1_colbox * __tdims1 + __offsp[9]; \
166             collab_datap -= __tinc1_collab * __tdims1 + __offsp[10]; \
167             colline_datap -= __tinc1_colline * __tdims1 + __offsp[11]; \
168             styline_datap -= __tinc1_styline * __tdims1 + __offsp[12]; \
169             id_datap -= __tinc1_id * __tdims1 + __offsp[13]; \
170             )
171 1           register PDL_Indx __inc_colline_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,11,0)]; (void)__inc_colline_n;
172 1           register PDL_Indx __inc_styline_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,12,0)]; (void)__inc_styline_n;
173             #ifndef PDL_DECLARE_PARAMS_plstripc_1
174             #define PDL_DECLARE_PARAMS_plstripc_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_y_ascl,PDL_PPSYM_PARAM_y_ascl,PDL_TYPE_PARAM_acc,PDL_PPSYM_PARAM_acc,PDL_TYPE_PARAM_colbox,PDL_PPSYM_PARAM_colbox,PDL_TYPE_PARAM_collab,PDL_PPSYM_PARAM_collab,PDL_TYPE_PARAM_colline,PDL_PPSYM_PARAM_colline,PDL_TYPE_PARAM_styline,PDL_PPSYM_PARAM_styline,PDL_TYPE_PARAM_id,PDL_PPSYM_PARAM_id) \
175             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xmin, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
176             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xmax, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
177             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xjump, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
178             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ymin, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \
179             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ymax, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \
180             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xlpos, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP) \
181             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ylpos, (__privtrans->pdls[6]), 1, PDL_PPSYM_OP) \
182             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_y_ascl, y_ascl, (__privtrans->pdls[7]), 1, PDL_PPSYM_PARAM_y_ascl) \
183             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_acc, acc, (__privtrans->pdls[8]), 1, PDL_PPSYM_PARAM_acc) \
184             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_colbox, colbox, (__privtrans->pdls[9]), 1, PDL_PPSYM_PARAM_colbox) \
185             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_collab, collab, (__privtrans->pdls[10]), 1, PDL_PPSYM_PARAM_collab) \
186             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_colline, colline, (__privtrans->pdls[11]), 1, PDL_PPSYM_PARAM_colline) \
187             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_styline, styline, (__privtrans->pdls[12]), 1, PDL_PPSYM_PARAM_styline) \
188             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_id, id, (__privtrans->pdls[13]), 1, PDL_PPSYM_PARAM_id)
189             #endif
190             #define PDL_IF_BAD(t,f) f
191 1 50         switch (__privtrans->__datatype) { /* Start generic switch */
192 1           case PDL_D: {
193 1 50         PDL_DECLARE_PARAMS_plstripc_1(PDL_Double,D,PDL_Long,L,PDL_Long,L,PDL_Long,L,PDL_Long,L,PDL_Long,L,PDL_Long,L,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
194 4 50         PDL_BROADCASTLOOP_START_plstripc_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
195             I32 i;
196             PLINT id;
197             char* legline[4];
198 1           SV* sv_legline = __params->legline;
199             AV* av_legline;
200              
201 1 50         if (! SvROK (sv_legline)
202 1 50         || SvTYPE (SvRV (sv_legline)) != SVt_PVAV)
203 0           return PDL->make_error(PDL_EUSERERROR, "Error in plstripc:" "plstripc: legline must be a reference to an array");
204              
205 1           av_legline = (AV*) SvRV (sv_legline);
206              
207 1 50         if (av_len (av_legline) != 3)
208 0           return PDL->make_error(PDL_EUSERERROR, "Error in plstripc:" "plstripc: legline must have four elements");
209              
210 1 50         if (__privtrans->ind_sizes[0] != 4)
211 0           return PDL->make_error(PDL_EUSERERROR, "Error in plstripc:" "plstripc: colline and styline must have four elements");
212              
213 5 100         for (i = 0; i < 4; i++) {
214 4           SV** elem = av_fetch (av_legline, i, 0);
215 4           legline[i] = (char *) SvPV_nolen (*elem);
216             }
217              
218 1           c_plstripc (&id, __params->xspec, __params->yspec,
219             (xmin_datap)[0], (xmax_datap)[0], (xjump_datap)[0], (ymin_datap)[0], (ymax_datap)[0],
220             (xlpos_datap)[0], (ylpos_datap)[0],(y_ascl_datap)[0], (acc_datap)[0], (colbox_datap)[0], (collab_datap)[0],
221             colline_datap, styline_datap, (const char **)legline,
222 1           __params->labx, __params->laby, __params->labtop);
223              
224 2 50         (id_datap)[0] = (int) id;}PDL_BROADCASTLOOP_END_plstripc_readdata
    50          
225 1           } break;
226 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plstripc: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
227             }
228             #undef PDL_IF_BAD
229 1           return PDL_err;
230             }
231              
232              
233             #line 1857 "lib/PDL/PP.pm"
234             pdl_error pdl_plstripc_free(pdl_trans *__privtrans, char destroy) {
235             pdl_error PDL_err = {0, NULL, 0};
236             #line 237 "pp-plstripc.c"
237 1           pdl_params_plstripc *__params = __privtrans->params; (void)__params;
238 1 50         PDL_FREE_CODE(__privtrans, destroy, free(__params->xspec); /* CType.get_free */
239             free(__params->yspec); /* CType.get_free */
240             SvREFCNT_dec(__params->legline); /* CType.get_free */
241             free(__params->labx); /* CType.get_free */
242             free(__params->laby); /* CType.get_free */
243             free(__params->labtop); /* CType.get_free */
244 1           , ) return PDL_err;
245             }
246              
247             static pdl_datatypes pdl_plstripc_vtable_gentypes[] = { PDL_D, -1 };
248             static PDL_Indx pdl_plstripc_vtable_realdims[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 };
249             static char *pdl_plstripc_vtable_parnames[] = { "xmin","xmax","xjump","ymin","ymax","xlpos","ylpos","y_ascl","acc","colbox","collab","colline","styline","id" };
250             static short pdl_plstripc_vtable_parflags[] = {
251             0,
252             0,
253             0,
254             0,
255             0,
256             0,
257             0,
258             PDL_PARAM_ISTYPED,
259             PDL_PARAM_ISTYPED,
260             PDL_PARAM_ISTYPED,
261             PDL_PARAM_ISTYPED,
262             PDL_PARAM_ISPHYS|PDL_PARAM_ISTYPED,
263             PDL_PARAM_ISPHYS|PDL_PARAM_ISTYPED,
264             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE
265             };
266             static pdl_datatypes pdl_plstripc_vtable_partypes[] = { -1, -1, -1, -1, -1, -1, -1, PDL_L, PDL_L, PDL_L, PDL_L, PDL_L, PDL_L, PDL_L };
267             static PDL_Indx pdl_plstripc_vtable_realdims_starts[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2 };
268             static PDL_Indx pdl_plstripc_vtable_realdims_ind_ids[] = { 0, 0 };
269             static char *pdl_plstripc_vtable_indnames[] = { "n" };
270             pdl_transvtable pdl_plstripc_vtable = {
271             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plstripc_vtable_gentypes, 13, 14, NULL /*CORE21*/,
272             pdl_plstripc_vtable_realdims, pdl_plstripc_vtable_parnames,
273             pdl_plstripc_vtable_parflags, pdl_plstripc_vtable_partypes,
274             pdl_plstripc_vtable_realdims_starts, pdl_plstripc_vtable_realdims_ind_ids, 2,
275             1, pdl_plstripc_vtable_indnames,
276             NULL, pdl_plstripc_readdata, NULL,
277             pdl_plstripc_free,
278             sizeof(pdl_params_plstripc),"PDL::Graphics::PLplot::plstripc"
279             };
280              
281              
282 1           pdl_error pdl_run_plstripc(pdl *xmin,pdl *xmax,pdl *xjump,pdl *ymin,pdl *ymax,pdl *xlpos,pdl *ylpos,pdl *y_ascl,pdl *acc,pdl *colbox,pdl *collab,pdl *colline,pdl *styline,pdl *id,char *xspec,char *yspec,SV *legline,char *labx,char *laby,char *labtop) {
283 1           pdl_error PDL_err = {0, NULL, 0};
284 1 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
285 1           pdl_trans *__privtrans = PDL->create_trans(&pdl_plstripc_vtable);
286 1 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
287 1           pdl_params_plstripc *__params = __privtrans->params;
288 1           __privtrans->pdls[0] = xmin;
289 1           __privtrans->pdls[1] = xmax;
290 1           __privtrans->pdls[2] = xjump;
291 1           __privtrans->pdls[3] = ymin;
292 1           __privtrans->pdls[4] = ymax;
293 1           __privtrans->pdls[5] = xlpos;
294 1           __privtrans->pdls[6] = ylpos;
295 1           __privtrans->pdls[7] = y_ascl;
296 1           __privtrans->pdls[8] = acc;
297 1           __privtrans->pdls[9] = colbox;
298 1           __privtrans->pdls[10] = collab;
299 1           __privtrans->pdls[11] = colline;
300 1           __privtrans->pdls[12] = styline;
301 1           __privtrans->pdls[13] = id;
302 1 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
303 1           (__params->xspec) = malloc(strlen(xspec)+1); strcpy(__params->xspec,xspec); /* CType.get_copy */
304 1           (__params->yspec) = malloc(strlen(yspec)+1); strcpy(__params->yspec,yspec); /* CType.get_copy */
305 1           (__params->legline) = newSVsv(legline); /* CType.get_copy */
306 1           (__params->labx) = malloc(strlen(labx)+1); strcpy(__params->labx,labx); /* CType.get_copy */
307 1           (__params->laby) = malloc(strlen(laby)+1); strcpy(__params->laby,laby); /* CType.get_copy */
308 1           (__params->labtop) = malloc(strlen(labtop)+1); strcpy(__params->labtop,labtop); /* CType.get_copy */
309 1 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
310 1           return PDL_err;
311             }