File Coverage

pp-plimagefr.c
Criterion Covered Total %
statement 0 67 0.0
branch 0 98 0.0
condition n/a
subroutine n/a
pod n/a
total 0 165 0.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-plimagefr.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_plimagefr {
55             #line 56 "pp-plimagefr.c"
56             SV *pltr;
57             SV *pltr_data;
58             } pdl_params_plimagefr;
59              
60              
61             #line 1857 "lib/PDL/PP.pm"
62             pdl_error pdl_plimagefr_readdata(pdl_trans *__privtrans) {
63             pdl_error PDL_err = {0, NULL, 0};
64             #line 65 "pp-plimagefr.c"
65 0           pdl_params_plimagefr *__params = __privtrans->params; (void)__params;
66 0 0         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plimagefr:" "broadcast.incs NULL");
67             /* broadcastloop declarations */
68             int __brcloopval;
69             register PDL_Indx __tind0,__tind1; /* counters along dim */
70 0           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
71             /* dims here are how many steps along those dims */
72 0           register PDL_Indx __tinc0_idata = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
73 0           register PDL_Indx __tinc0_xmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
74 0           register PDL_Indx __tinc0_xmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
75 0           register PDL_Indx __tinc0_ymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
76 0           register PDL_Indx __tinc0_ymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
77 0           register PDL_Indx __tinc0_zmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
78 0           register PDL_Indx __tinc0_zmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
79 0           register PDL_Indx __tinc0_valuemin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0);
80 0           register PDL_Indx __tinc0_valuemax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,0);
81 0           register PDL_Indx __tinc1_idata = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
82 0           register PDL_Indx __tinc1_xmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
83 0           register PDL_Indx __tinc1_xmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
84 0           register PDL_Indx __tinc1_ymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
85 0           register PDL_Indx __tinc1_ymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
86 0           register PDL_Indx __tinc1_zmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
87 0           register PDL_Indx __tinc1_zmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
88 0           register PDL_Indx __tinc1_valuemin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1);
89 0           register PDL_Indx __tinc1_valuemax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,1);
90             #define PDL_BROADCASTLOOP_START_plimagefr_readdata PDL_BROADCASTLOOP_START( \
91             readdata, \
92             __privtrans->broadcast, \
93             __privtrans->vtable, \
94             idata_datap += __offsp[0]; \
95             xmin_datap += __offsp[1]; \
96             xmax_datap += __offsp[2]; \
97             ymin_datap += __offsp[3]; \
98             ymax_datap += __offsp[4]; \
99             zmin_datap += __offsp[5]; \
100             zmax_datap += __offsp[6]; \
101             valuemin_datap += __offsp[7]; \
102             valuemax_datap += __offsp[8]; \
103             , \
104             ( ,idata_datap += __tinc1_idata - __tinc0_idata * __tdims0 \
105             ,xmin_datap += __tinc1_xmin - __tinc0_xmin * __tdims0 \
106             ,xmax_datap += __tinc1_xmax - __tinc0_xmax * __tdims0 \
107             ,ymin_datap += __tinc1_ymin - __tinc0_ymin * __tdims0 \
108             ,ymax_datap += __tinc1_ymax - __tinc0_ymax * __tdims0 \
109             ,zmin_datap += __tinc1_zmin - __tinc0_zmin * __tdims0 \
110             ,zmax_datap += __tinc1_zmax - __tinc0_zmax * __tdims0 \
111             ,valuemin_datap += __tinc1_valuemin - __tinc0_valuemin * __tdims0 \
112             ,valuemax_datap += __tinc1_valuemax - __tinc0_valuemax * __tdims0 \
113             ), \
114             ( ,idata_datap += __tinc0_idata \
115             ,xmin_datap += __tinc0_xmin \
116             ,xmax_datap += __tinc0_xmax \
117             ,ymin_datap += __tinc0_ymin \
118             ,ymax_datap += __tinc0_ymax \
119             ,zmin_datap += __tinc0_zmin \
120             ,zmax_datap += __tinc0_zmax \
121             ,valuemin_datap += __tinc0_valuemin \
122             ,valuemax_datap += __tinc0_valuemax \
123             ) \
124             )
125             #define PDL_BROADCASTLOOP_END_plimagefr_readdata PDL_BROADCASTLOOP_END( \
126             __privtrans->broadcast, \
127             idata_datap -= __tinc1_idata * __tdims1 + __offsp[0]; \
128             xmin_datap -= __tinc1_xmin * __tdims1 + __offsp[1]; \
129             xmax_datap -= __tinc1_xmax * __tdims1 + __offsp[2]; \
130             ymin_datap -= __tinc1_ymin * __tdims1 + __offsp[3]; \
131             ymax_datap -= __tinc1_ymax * __tdims1 + __offsp[4]; \
132             zmin_datap -= __tinc1_zmin * __tdims1 + __offsp[5]; \
133             zmax_datap -= __tinc1_zmax * __tdims1 + __offsp[6]; \
134             valuemin_datap -= __tinc1_valuemin * __tdims1 + __offsp[7]; \
135             valuemax_datap -= __tinc1_valuemax * __tdims1 + __offsp[8]; \
136             )
137 0           register PDL_Indx __inc_idata_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_idata_nx;register PDL_Indx __inc_idata_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_idata_ny;
138             #ifndef PDL_DECLARE_PARAMS_plimagefr_1
139             #define PDL_DECLARE_PARAMS_plimagefr_1(PDL_TYPE_OP,PDL_PPSYM_OP) \
140             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, idata, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
141             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xmin, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
142             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xmax, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
143             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ymin, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \
144             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ymax, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \
145             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, zmin, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP) \
146             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, zmax, (__privtrans->pdls[6]), 1, PDL_PPSYM_OP) \
147             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, valuemin, (__privtrans->pdls[7]), 1, PDL_PPSYM_OP) \
148             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, valuemax, (__privtrans->pdls[8]), 1, PDL_PPSYM_OP)
149             #endif
150             #define PDL_IF_BAD(t,f) f
151 0 0         switch (__privtrans->__datatype) { /* Start generic switch */
152 0           case PDL_D: {
153 0 0         PDL_DECLARE_PARAMS_plimagefr_1(PDL_Double,D)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
154 0 0         PDL_BROADCASTLOOP_START_plimagefr_readdata {
    0          
    0          
    0          
    0          
    0          
    0          
155             int i, j, size_x, size_y;
156             PLFLT** idata;
157             void (*pltrcb) ();
158             PLPointer pltrdt;
159              
160 0           size_x = __privtrans->ind_sizes[0];
161 0           size_y = __privtrans->ind_sizes[1];
162              
163 0           pltr_callback_set(__params->pltr,
164             "plimagefr: pltr must be either 0 or a subroutine pointer");
165              
166 0           pltrcb = get_standard_pltrcb (__params->pltr);
167 0 0         if (pltrcb != pltr_callback)
168 0 0         pltrdt = PLPTR_RECEIVE_SV(__params->pltr_data);
169             else
170 0           pltrdt = __params->pltr_data;
171              
172 0           plAlloc2dGrid (&idata, size_x, size_y);
173              
174 0 0         for (i = 0; i < size_x; i++)
175 0 0         for (j = 0; j < size_y; j++)
176 0           idata[i][j] = (idata_datap)[0+(__inc_idata_nx*(i))+(__inc_idata_ny*(j))];
177              
178 0 0         c_plimagefr ((const PLFLT **)idata, size_x, size_y,
    0          
179             (xmin_datap)[0], (xmax_datap)[0], (ymin_datap)[0], (ymax_datap)[0], (zmin_datap)[0], (zmax_datap)[0],
180             (valuemin_datap)[0], (valuemax_datap)[0],
181 0           (SvTRUE (__params->pltr) ? pltrcb : NULL),
182 0           (SvTRUE (__params->pltr) ? pltrdt : NULL));
183              
184 0 0         plFree2dGrid (idata, size_x, size_y);}PDL_BROADCASTLOOP_END_plimagefr_readdata
    0          
185 0           } break;
186 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plimagefr: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
187             }
188             #undef PDL_IF_BAD
189 0           return PDL_err;
190             }
191              
192              
193             #line 1857 "lib/PDL/PP.pm"
194             pdl_error pdl_plimagefr_free(pdl_trans *__privtrans, char destroy) {
195             pdl_error PDL_err = {0, NULL, 0};
196             #line 197 "pp-plimagefr.c"
197 0           pdl_params_plimagefr *__params = __privtrans->params; (void)__params;
198 0 0         PDL_FREE_CODE(__privtrans, destroy, SvREFCNT_dec(__params->pltr); /* CType.get_free */
199             SvREFCNT_dec(__params->pltr_data); /* CType.get_free */
200 0           , ) return PDL_err;
201             }
202              
203             static pdl_datatypes pdl_plimagefr_vtable_gentypes[] = { PDL_D, -1 };
204             static PDL_Indx pdl_plimagefr_vtable_realdims[] = { 2, 0, 0, 0, 0, 0, 0, 0, 0 };
205             static char *pdl_plimagefr_vtable_parnames[] = { "idata","xmin","xmax","ymin","ymax","zmin","zmax","valuemin","valuemax" };
206             static short pdl_plimagefr_vtable_parflags[] = {
207             0,
208             0,
209             0,
210             0,
211             0,
212             0,
213             0,
214             0,
215             0
216             };
217             static pdl_datatypes pdl_plimagefr_vtable_partypes[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
218             static PDL_Indx pdl_plimagefr_vtable_realdims_starts[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2 };
219             static PDL_Indx pdl_plimagefr_vtable_realdims_ind_ids[] = { 0, 1 };
220             static char *pdl_plimagefr_vtable_indnames[] = { "nx","ny" };
221             pdl_transvtable pdl_plimagefr_vtable = {
222             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plimagefr_vtable_gentypes, 9, 9, NULL /*CORE21*/,
223             pdl_plimagefr_vtable_realdims, pdl_plimagefr_vtable_parnames,
224             pdl_plimagefr_vtable_parflags, pdl_plimagefr_vtable_partypes,
225             pdl_plimagefr_vtable_realdims_starts, pdl_plimagefr_vtable_realdims_ind_ids, 2,
226             2, pdl_plimagefr_vtable_indnames,
227             NULL, pdl_plimagefr_readdata, NULL,
228             pdl_plimagefr_free,
229             sizeof(pdl_params_plimagefr),"PDL::Graphics::PLplot::plimagefr"
230             };
231              
232              
233 0           pdl_error pdl_run_plimagefr(pdl *idata,pdl *xmin,pdl *xmax,pdl *ymin,pdl *ymax,pdl *zmin,pdl *zmax,pdl *valuemin,pdl *valuemax,SV *pltr,SV *pltr_data) {
234 0           pdl_error PDL_err = {0, NULL, 0};
235 0 0         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
236 0           pdl_trans *__privtrans = PDL->create_trans(&pdl_plimagefr_vtable);
237 0 0         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
238 0           pdl_params_plimagefr *__params = __privtrans->params;
239 0           __privtrans->pdls[0] = idata;
240 0           __privtrans->pdls[1] = xmin;
241 0           __privtrans->pdls[2] = xmax;
242 0           __privtrans->pdls[3] = ymin;
243 0           __privtrans->pdls[4] = ymax;
244 0           __privtrans->pdls[5] = zmin;
245 0           __privtrans->pdls[6] = zmax;
246 0           __privtrans->pdls[7] = valuemin;
247 0           __privtrans->pdls[8] = valuemax;
248 0 0         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
249 0           (__params->pltr) = newSVsv(pltr); /* CType.get_copy */
250 0           (__params->pltr_data) = newSVsv(pltr_data); /* CType.get_copy */
251 0 0         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
252 0           return PDL_err;
253             }