File Coverage

pp-plimage.c
Criterion Covered Total %
statement 0 59 0.0
branch 0 100 0.0
condition n/a
subroutine n/a
pod n/a
total 0 159 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-plimage.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 1857 "lib/PDL/PP.pm"
54             pdl_error pdl_plimage_readdata(pdl_trans *__privtrans) {
55             pdl_error PDL_err = {0, NULL, 0};
56             #line 57 "pp-plimage.c"
57 0 0         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plimage:" "broadcast.incs NULL");
58             /* broadcastloop declarations */
59             int __brcloopval;
60             register PDL_Indx __tind0,__tind1; /* counters along dim */
61 0           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
62             /* dims here are how many steps along those dims */
63 0           register PDL_Indx __tinc0_idata = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
64 0           register PDL_Indx __tinc0_xmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
65 0           register PDL_Indx __tinc0_xmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
66 0           register PDL_Indx __tinc0_ymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
67 0           register PDL_Indx __tinc0_ymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
68 0           register PDL_Indx __tinc0_zmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
69 0           register PDL_Indx __tinc0_zmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
70 0           register PDL_Indx __tinc0_Dxmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0);
71 0           register PDL_Indx __tinc0_Dxmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,0);
72 0           register PDL_Indx __tinc0_Dymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,9,0);
73 0           register PDL_Indx __tinc0_Dymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,10,0);
74 0           register PDL_Indx __tinc1_idata = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
75 0           register PDL_Indx __tinc1_xmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
76 0           register PDL_Indx __tinc1_xmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
77 0           register PDL_Indx __tinc1_ymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
78 0           register PDL_Indx __tinc1_ymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
79 0           register PDL_Indx __tinc1_zmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
80 0           register PDL_Indx __tinc1_zmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
81 0           register PDL_Indx __tinc1_Dxmin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1);
82 0           register PDL_Indx __tinc1_Dxmax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,8,1);
83 0           register PDL_Indx __tinc1_Dymin = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,9,1);
84 0           register PDL_Indx __tinc1_Dymax = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,10,1);
85             #define PDL_BROADCASTLOOP_START_plimage_readdata PDL_BROADCASTLOOP_START( \
86             readdata, \
87             __privtrans->broadcast, \
88             __privtrans->vtable, \
89             idata_datap += __offsp[0]; \
90             xmin_datap += __offsp[1]; \
91             xmax_datap += __offsp[2]; \
92             ymin_datap += __offsp[3]; \
93             ymax_datap += __offsp[4]; \
94             zmin_datap += __offsp[5]; \
95             zmax_datap += __offsp[6]; \
96             Dxmin_datap += __offsp[7]; \
97             Dxmax_datap += __offsp[8]; \
98             Dymin_datap += __offsp[9]; \
99             Dymax_datap += __offsp[10]; \
100             , \
101             ( ,idata_datap += __tinc1_idata - __tinc0_idata * __tdims0 \
102             ,xmin_datap += __tinc1_xmin - __tinc0_xmin * __tdims0 \
103             ,xmax_datap += __tinc1_xmax - __tinc0_xmax * __tdims0 \
104             ,ymin_datap += __tinc1_ymin - __tinc0_ymin * __tdims0 \
105             ,ymax_datap += __tinc1_ymax - __tinc0_ymax * __tdims0 \
106             ,zmin_datap += __tinc1_zmin - __tinc0_zmin * __tdims0 \
107             ,zmax_datap += __tinc1_zmax - __tinc0_zmax * __tdims0 \
108             ,Dxmin_datap += __tinc1_Dxmin - __tinc0_Dxmin * __tdims0 \
109             ,Dxmax_datap += __tinc1_Dxmax - __tinc0_Dxmax * __tdims0 \
110             ,Dymin_datap += __tinc1_Dymin - __tinc0_Dymin * __tdims0 \
111             ,Dymax_datap += __tinc1_Dymax - __tinc0_Dymax * __tdims0 \
112             ), \
113             ( ,idata_datap += __tinc0_idata \
114             ,xmin_datap += __tinc0_xmin \
115             ,xmax_datap += __tinc0_xmax \
116             ,ymin_datap += __tinc0_ymin \
117             ,ymax_datap += __tinc0_ymax \
118             ,zmin_datap += __tinc0_zmin \
119             ,zmax_datap += __tinc0_zmax \
120             ,Dxmin_datap += __tinc0_Dxmin \
121             ,Dxmax_datap += __tinc0_Dxmax \
122             ,Dymin_datap += __tinc0_Dymin \
123             ,Dymax_datap += __tinc0_Dymax \
124             ) \
125             )
126             #define PDL_BROADCASTLOOP_END_plimage_readdata PDL_BROADCASTLOOP_END( \
127             __privtrans->broadcast, \
128             idata_datap -= __tinc1_idata * __tdims1 + __offsp[0]; \
129             xmin_datap -= __tinc1_xmin * __tdims1 + __offsp[1]; \
130             xmax_datap -= __tinc1_xmax * __tdims1 + __offsp[2]; \
131             ymin_datap -= __tinc1_ymin * __tdims1 + __offsp[3]; \
132             ymax_datap -= __tinc1_ymax * __tdims1 + __offsp[4]; \
133             zmin_datap -= __tinc1_zmin * __tdims1 + __offsp[5]; \
134             zmax_datap -= __tinc1_zmax * __tdims1 + __offsp[6]; \
135             Dxmin_datap -= __tinc1_Dxmin * __tdims1 + __offsp[7]; \
136             Dxmax_datap -= __tinc1_Dxmax * __tdims1 + __offsp[8]; \
137             Dymin_datap -= __tinc1_Dymin * __tdims1 + __offsp[9]; \
138             Dymax_datap -= __tinc1_Dymax * __tdims1 + __offsp[10]; \
139             )
140 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;
141             #ifndef PDL_DECLARE_PARAMS_plimage_1
142             #define PDL_DECLARE_PARAMS_plimage_1(PDL_TYPE_OP,PDL_PPSYM_OP) \
143             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, idata, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
144             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xmin, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
145             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xmax, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
146             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ymin, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \
147             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ymax, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \
148             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, zmin, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP) \
149             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, zmax, (__privtrans->pdls[6]), 1, PDL_PPSYM_OP) \
150             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, Dxmin, (__privtrans->pdls[7]), 1, PDL_PPSYM_OP) \
151             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, Dxmax, (__privtrans->pdls[8]), 1, PDL_PPSYM_OP) \
152             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, Dymin, (__privtrans->pdls[9]), 1, PDL_PPSYM_OP) \
153             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, Dymax, (__privtrans->pdls[10]), 1, PDL_PPSYM_OP)
154             #endif
155             #define PDL_IF_BAD(t,f) f
156 0 0         switch (__privtrans->__datatype) { /* Start generic switch */
157 0           case PDL_D: {
158 0 0         PDL_DECLARE_PARAMS_plimage_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          
    0          
    0          
    0          
    0          
    0          
    0          
159 0 0         PDL_BROADCASTLOOP_START_plimage_readdata {
    0          
    0          
    0          
    0          
    0          
    0          
160             int i, j, size_x, size_y;
161             PLFLT** idata;
162              
163 0           size_x = __privtrans->ind_sizes[0];
164 0           size_y = __privtrans->ind_sizes[1];
165              
166 0           plAlloc2dGrid (&idata, size_x, size_y);
167              
168 0 0         for (i = 0; i < size_x; i++)
169 0 0         for (j = 0; j < size_y; j++)
170 0           idata[i][j] = (idata_datap)[0+(__inc_idata_nx*(i))+(__inc_idata_ny*(j))];
171              
172 0           plimage ((const PLFLT **)idata, size_x, size_y,
173             (xmin_datap)[0], (xmax_datap)[0], (ymin_datap)[0], (ymax_datap)[0], (zmin_datap)[0], (zmax_datap)[0],
174             (Dxmin_datap)[0], (Dxmax_datap)[0], (Dymin_datap)[0], (Dymax_datap)[0]);
175              
176 0 0         plFree2dGrid (idata, size_x, size_y);}PDL_BROADCASTLOOP_END_plimage_readdata
    0          
177 0           } break;
178 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plimage: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
179             }
180             #undef PDL_IF_BAD
181 0           return PDL_err;
182             }
183              
184             static pdl_datatypes pdl_plimage_vtable_gentypes[] = { PDL_D, -1 };
185             static PDL_Indx pdl_plimage_vtable_realdims[] = { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
186             static char *pdl_plimage_vtable_parnames[] = { "idata","xmin","xmax","ymin","ymax","zmin","zmax","Dxmin","Dxmax","Dymin","Dymax" };
187             static short pdl_plimage_vtable_parflags[] = {
188             0,
189             0,
190             0,
191             0,
192             0,
193             0,
194             0,
195             0,
196             0,
197             0,
198             0
199             };
200             static pdl_datatypes pdl_plimage_vtable_partypes[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
201             static PDL_Indx pdl_plimage_vtable_realdims_starts[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
202             static PDL_Indx pdl_plimage_vtable_realdims_ind_ids[] = { 0, 1 };
203             static char *pdl_plimage_vtable_indnames[] = { "nx","ny" };
204             pdl_transvtable pdl_plimage_vtable = {
205             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plimage_vtable_gentypes, 11, 11, NULL /*CORE21*/,
206             pdl_plimage_vtable_realdims, pdl_plimage_vtable_parnames,
207             pdl_plimage_vtable_parflags, pdl_plimage_vtable_partypes,
208             pdl_plimage_vtable_realdims_starts, pdl_plimage_vtable_realdims_ind_ids, 2,
209             2, pdl_plimage_vtable_indnames,
210             NULL, pdl_plimage_readdata, NULL,
211             NULL,
212             0,"PDL::Graphics::PLplot::plimage"
213             };
214              
215              
216 0           pdl_error pdl_run_plimage(pdl *idata,pdl *xmin,pdl *xmax,pdl *ymin,pdl *ymax,pdl *zmin,pdl *zmax,pdl *Dxmin,pdl *Dxmax,pdl *Dymin,pdl *Dymax) {
217 0           pdl_error PDL_err = {0, NULL, 0};
218 0 0         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
219 0           pdl_trans *__privtrans = PDL->create_trans(&pdl_plimage_vtable);
220 0 0         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
221 0           __privtrans->pdls[0] = idata;
222 0           __privtrans->pdls[1] = xmin;
223 0           __privtrans->pdls[2] = xmax;
224 0           __privtrans->pdls[3] = ymin;
225 0           __privtrans->pdls[4] = ymax;
226 0           __privtrans->pdls[5] = zmin;
227 0           __privtrans->pdls[6] = zmax;
228 0           __privtrans->pdls[7] = Dxmin;
229 0           __privtrans->pdls[8] = Dxmax;
230 0           __privtrans->pdls[9] = Dymin;
231 0           __privtrans->pdls[10] = Dymax;
232 0 0         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
233 0 0         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
234 0           return PDL_err;
235             }