File Coverage

pp-plcont.c
Criterion Covered Total %
statement 57 58 98.2
branch 44 76 57.8
condition n/a
subroutine n/a
pod n/a
total 101 134 75.3


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-plcont.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_plcont {
55             #line 56 "pp-plcont.c"
56             SV *pltr;
57             SV *pltr_data;
58             } pdl_params_plcont;
59              
60              
61             #line 1857 "lib/PDL/PP.pm"
62             pdl_error pdl_plcont_readdata(pdl_trans *__privtrans) {
63             pdl_error PDL_err = {0, NULL, 0};
64             #line 65 "pp-plcont.c"
65 13           pdl_params_plcont *__params = __privtrans->params; (void)__params;
66 13 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plcont:" "broadcast.incs NULL");
67             /* broadcastloop declarations */
68             int __brcloopval;
69             register PDL_Indx __tind0,__tind1; /* counters along dim */
70 13           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
71             /* dims here are how many steps along those dims */
72 13           register PDL_Indx __tinc0_f = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
73 13           register PDL_Indx __tinc0_kx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
74 13           register PDL_Indx __tinc0_lx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
75 13           register PDL_Indx __tinc0_ky = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
76 13           register PDL_Indx __tinc0_ly = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
77 13           register PDL_Indx __tinc0_clevel = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
78 13           register PDL_Indx __tinc1_f = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
79 13           register PDL_Indx __tinc1_kx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
80 13           register PDL_Indx __tinc1_lx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
81 13           register PDL_Indx __tinc1_ky = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
82 13           register PDL_Indx __tinc1_ly = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
83 13           register PDL_Indx __tinc1_clevel = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
84             #define PDL_BROADCASTLOOP_START_plcont_readdata PDL_BROADCASTLOOP_START( \
85             readdata, \
86             __privtrans->broadcast, \
87             __privtrans->vtable, \
88             f_datap += __offsp[0]; \
89             kx_datap += __offsp[1]; \
90             lx_datap += __offsp[2]; \
91             ky_datap += __offsp[3]; \
92             ly_datap += __offsp[4]; \
93             clevel_datap += __offsp[5]; \
94             , \
95             ( ,f_datap += __tinc1_f - __tinc0_f * __tdims0 \
96             ,kx_datap += __tinc1_kx - __tinc0_kx * __tdims0 \
97             ,lx_datap += __tinc1_lx - __tinc0_lx * __tdims0 \
98             ,ky_datap += __tinc1_ky - __tinc0_ky * __tdims0 \
99             ,ly_datap += __tinc1_ly - __tinc0_ly * __tdims0 \
100             ,clevel_datap += __tinc1_clevel - __tinc0_clevel * __tdims0 \
101             ), \
102             ( ,f_datap += __tinc0_f \
103             ,kx_datap += __tinc0_kx \
104             ,lx_datap += __tinc0_lx \
105             ,ky_datap += __tinc0_ky \
106             ,ly_datap += __tinc0_ly \
107             ,clevel_datap += __tinc0_clevel \
108             ) \
109             )
110             #define PDL_BROADCASTLOOP_END_plcont_readdata PDL_BROADCASTLOOP_END( \
111             __privtrans->broadcast, \
112             f_datap -= __tinc1_f * __tdims1 + __offsp[0]; \
113             kx_datap -= __tinc1_kx * __tdims1 + __offsp[1]; \
114             lx_datap -= __tinc1_lx * __tdims1 + __offsp[2]; \
115             ky_datap -= __tinc1_ky * __tdims1 + __offsp[3]; \
116             ly_datap -= __tinc1_ly * __tdims1 + __offsp[4]; \
117             clevel_datap -= __tinc1_clevel * __tdims1 + __offsp[5]; \
118             )
119 13           register PDL_Indx __inc_clevel_nlevel = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,5,0)]; (void)__inc_clevel_nlevel;
120 13           register PDL_Indx __inc_f_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_f_nx;register PDL_Indx __inc_f_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_f_ny;
121             #ifndef PDL_DECLARE_PARAMS_plcont_1
122             #define PDL_DECLARE_PARAMS_plcont_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_kx,PDL_PPSYM_PARAM_kx,PDL_TYPE_PARAM_lx,PDL_PPSYM_PARAM_lx,PDL_TYPE_PARAM_ky,PDL_PPSYM_PARAM_ky,PDL_TYPE_PARAM_ly,PDL_PPSYM_PARAM_ly) \
123             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, f, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
124             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_kx, kx, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_kx) \
125             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_lx, lx, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_lx) \
126             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ky, ky, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_ky) \
127             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ly, ly, (__privtrans->pdls[4]), 1, PDL_PPSYM_PARAM_ly) \
128             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, clevel, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP)
129             #endif
130             #define PDL_IF_BAD(t,f) f
131 13 50         switch (__privtrans->__datatype) { /* Start generic switch */
132 13           case PDL_D: {
133 13 100         PDL_DECLARE_PARAMS_plcont_1(PDL_Double,D,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          
134 52 50         PDL_BROADCASTLOOP_START_plcont_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
135             int i, j, size_x, size_y;
136             PLFLT** ff;
137             void (*pltrcb) ();
138             PLPointer pltrdt;
139              
140 13           size_x = __privtrans->ind_sizes[1];
141 13           size_y = __privtrans->ind_sizes[2];
142              
143 13           plAlloc2dGrid (&ff, size_x, size_y);
144              
145 473 100         for (i = 0; i < size_x; i++)
146 22060 100         for (j = 0; j < size_y; j++)
147 21600           ff[i][j] = (f_datap)[0+(__inc_f_nx*(i))+(__inc_f_ny*(j))];
148              
149 13           pltr_callback_set(__params->pltr,
150             "plcont: pltr must be either 0 or a subroutine pointer");
151              
152 13           pltrcb = get_standard_pltrcb (__params->pltr);
153 13 100         if (pltrcb != pltr_callback)
154 9 50         pltrdt = PLPTR_RECEIVE_SV(__params->pltr_data);
155             else
156 4           pltrdt = __params->pltr_data;
157              
158 13           c_plcont ((const PLFLT **)ff, size_x, size_y, (kx_datap)[0], (lx_datap)[0], (ky_datap)[0], (ly_datap)[0],
159 13           clevel_datap, __privtrans->ind_sizes[0],
160             pltrcb, pltrdt);
161              
162 26 50         plFree2dGrid (ff, size_x, size_y);}PDL_BROADCASTLOOP_END_plcont_readdata
    50          
163 13           } break;
164 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plcont: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
165             }
166             #undef PDL_IF_BAD
167 13           return PDL_err;
168             }
169              
170              
171             #line 1857 "lib/PDL/PP.pm"
172             pdl_error pdl_plcont_free(pdl_trans *__privtrans, char destroy) {
173             pdl_error PDL_err = {0, NULL, 0};
174             #line 175 "pp-plcont.c"
175 13           pdl_params_plcont *__params = __privtrans->params; (void)__params;
176 13 50         PDL_FREE_CODE(__privtrans, destroy, SvREFCNT_dec(__params->pltr); /* CType.get_free */
177             SvREFCNT_dec(__params->pltr_data); /* CType.get_free */
178 13           , ) return PDL_err;
179             }
180              
181             static pdl_datatypes pdl_plcont_vtable_gentypes[] = { PDL_D, -1 };
182             static PDL_Indx pdl_plcont_vtable_realdims[] = { 2, 0, 0, 0, 0, 1 };
183             static char *pdl_plcont_vtable_parnames[] = { "f","kx","lx","ky","ly","clevel" };
184             static short pdl_plcont_vtable_parflags[] = {
185             0,
186             PDL_PARAM_ISTYPED,
187             PDL_PARAM_ISTYPED,
188             PDL_PARAM_ISTYPED,
189             PDL_PARAM_ISTYPED,
190             PDL_PARAM_ISPHYS
191             };
192             static pdl_datatypes pdl_plcont_vtable_partypes[] = { -1, PDL_L, PDL_L, PDL_L, PDL_L, -1 };
193             static PDL_Indx pdl_plcont_vtable_realdims_starts[] = { 0, 2, 2, 2, 2, 2 };
194             static PDL_Indx pdl_plcont_vtable_realdims_ind_ids[] = { 1, 2, 0 };
195             static char *pdl_plcont_vtable_indnames[] = { "nlevel","nx","ny" };
196             pdl_transvtable pdl_plcont_vtable = {
197             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plcont_vtable_gentypes, 6, 6, NULL /*CORE21*/,
198             pdl_plcont_vtable_realdims, pdl_plcont_vtable_parnames,
199             pdl_plcont_vtable_parflags, pdl_plcont_vtable_partypes,
200             pdl_plcont_vtable_realdims_starts, pdl_plcont_vtable_realdims_ind_ids, 3,
201             3, pdl_plcont_vtable_indnames,
202             NULL, pdl_plcont_readdata, NULL,
203             pdl_plcont_free,
204             sizeof(pdl_params_plcont),"PDL::Graphics::PLplot::plcont"
205             };
206              
207              
208 13           pdl_error pdl_run_plcont(pdl *f,pdl *kx,pdl *lx,pdl *ky,pdl *ly,pdl *clevel,SV *pltr,SV *pltr_data) {
209 13           pdl_error PDL_err = {0, NULL, 0};
210 13 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
211 13           pdl_trans *__privtrans = PDL->create_trans(&pdl_plcont_vtable);
212 13 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
213 13           pdl_params_plcont *__params = __privtrans->params;
214 13           __privtrans->pdls[0] = f;
215 13           __privtrans->pdls[1] = kx;
216 13           __privtrans->pdls[2] = lx;
217 13           __privtrans->pdls[3] = ky;
218 13           __privtrans->pdls[4] = ly;
219 13           __privtrans->pdls[5] = clevel;
220 13 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
221 13           (__params->pltr) = newSVsv(pltr); /* CType.get_copy */
222 13           (__params->pltr_data) = newSVsv(pltr_data); /* CType.get_copy */
223 13 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
224 13           return PDL_err;
225             }