File Coverage

pp-plsurf3d.c
Criterion Covered Total %
statement 44 45 97.7
branch 37 64 57.8
condition n/a
subroutine n/a
pod n/a
total 81 109 74.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-plsurf3d.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 1857 "lib/PDL/PP.pm"
40             pdl_error pdl_plsurf3d_readdata(pdl_trans *__privtrans) {
41             pdl_error PDL_err = {0, NULL, 0};
42             #line 43 "pp-plsurf3d.c"
43 8 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plsurf3d:" "broadcast.incs NULL");
44             /* broadcastloop declarations */
45             int __brcloopval;
46             register PDL_Indx __tind0,__tind1; /* counters along dim */
47 8           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
48             /* dims here are how many steps along those dims */
49 8           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
50 8           register PDL_Indx __tinc0_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
51 8           register PDL_Indx __tinc0_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
52 8           register PDL_Indx __tinc0_opt = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
53 8           register PDL_Indx __tinc0_clevel = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
54 8           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
55 8           register PDL_Indx __tinc1_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
56 8           register PDL_Indx __tinc1_z = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
57 8           register PDL_Indx __tinc1_opt = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
58 8           register PDL_Indx __tinc1_clevel = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
59             #define PDL_BROADCASTLOOP_START_plsurf3d_readdata PDL_BROADCASTLOOP_START( \
60             readdata, \
61             __privtrans->broadcast, \
62             __privtrans->vtable, \
63             x_datap += __offsp[0]; \
64             y_datap += __offsp[1]; \
65             z_datap += __offsp[2]; \
66             opt_datap += __offsp[3]; \
67             clevel_datap += __offsp[4]; \
68             , \
69             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
70             ,y_datap += __tinc1_y - __tinc0_y * __tdims0 \
71             ,z_datap += __tinc1_z - __tinc0_z * __tdims0 \
72             ,opt_datap += __tinc1_opt - __tinc0_opt * __tdims0 \
73             ,clevel_datap += __tinc1_clevel - __tinc0_clevel * __tdims0 \
74             ), \
75             ( ,x_datap += __tinc0_x \
76             ,y_datap += __tinc0_y \
77             ,z_datap += __tinc0_z \
78             ,opt_datap += __tinc0_opt \
79             ,clevel_datap += __tinc0_clevel \
80             ) \
81             )
82             #define PDL_BROADCASTLOOP_END_plsurf3d_readdata PDL_BROADCASTLOOP_END( \
83             __privtrans->broadcast, \
84             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
85             y_datap -= __tinc1_y * __tdims1 + __offsp[1]; \
86             z_datap -= __tinc1_z * __tdims1 + __offsp[2]; \
87             opt_datap -= __tinc1_opt * __tdims1 + __offsp[3]; \
88             clevel_datap -= __tinc1_clevel * __tdims1 + __offsp[4]; \
89             )
90 8           register PDL_Indx __inc_clevel_nlevel = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,0)]; (void)__inc_clevel_nlevel;
91 8           register PDL_Indx __inc_x_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_x_nx;
92 8           register PDL_Indx __inc_y_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_y_ny;
93 8           register PDL_Indx __inc_z_nx = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_z_nx;register PDL_Indx __inc_z_ny = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,1)]; (void)__inc_z_ny;
94             #ifndef PDL_DECLARE_PARAMS_plsurf3d_1
95             #define PDL_DECLARE_PARAMS_plsurf3d_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_opt,PDL_PPSYM_PARAM_opt) \
96             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
97             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
98             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, z, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
99             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_opt, opt, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_opt) \
100             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, clevel, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP)
101             #endif
102             #define PDL_IF_BAD(t,f) f
103 8 50         switch (__privtrans->__datatype) { /* Start generic switch */
104 8           case PDL_D: {
105 8 50         PDL_DECLARE_PARAMS_plsurf3d_1(PDL_Double,D,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    100          
    50          
106 32 50         PDL_BROADCASTLOOP_START_plsurf3d_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
107             int i, j, size_x, size_y;
108             PLFLT** zz;
109              
110 8           size_x = __privtrans->ind_sizes[1];
111 8           size_y = __privtrans->ind_sizes[2];
112 8           plAlloc2dGrid (&zz, size_x, size_y);
113 288 100         for (i = 0; i < size_x; i++)
114 12880 100         for (j = 0; j < size_y; j++)
115 12600           zz[i][j] = (z_datap)[0+(__inc_z_nx*(i))+(__inc_z_ny*(j))];
116 8           c_plsurf3d (x_datap, y_datap, (const PLFLT **)zz, size_x, size_y, (opt_datap)[0],
117 8           clevel_datap, __privtrans->ind_sizes[0]);
118 16 50         plFree2dGrid (zz, size_x, size_y);}PDL_BROADCASTLOOP_END_plsurf3d_readdata
    50          
119 8           } break;
120 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plsurf3d: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
121             }
122             #undef PDL_IF_BAD
123 8           return PDL_err;
124             }
125              
126             static pdl_datatypes pdl_plsurf3d_vtable_gentypes[] = { PDL_D, -1 };
127             static PDL_Indx pdl_plsurf3d_vtable_realdims[] = { 1, 1, 2, 0, 1 };
128             static char *pdl_plsurf3d_vtable_parnames[] = { "x","y","z","opt","clevel" };
129             static short pdl_plsurf3d_vtable_parflags[] = {
130             PDL_PARAM_ISPHYS,
131             PDL_PARAM_ISPHYS,
132             0,
133             PDL_PARAM_ISTYPED,
134             PDL_PARAM_ISPHYS
135             };
136             static pdl_datatypes pdl_plsurf3d_vtable_partypes[] = { -1, -1, -1, PDL_L, -1 };
137             static PDL_Indx pdl_plsurf3d_vtable_realdims_starts[] = { 0, 1, 2, 4, 4 };
138             static PDL_Indx pdl_plsurf3d_vtable_realdims_ind_ids[] = { 1, 2, 1, 2, 0 };
139             static char *pdl_plsurf3d_vtable_indnames[] = { "nlevel","nx","ny" };
140             pdl_transvtable pdl_plsurf3d_vtable = {
141             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plsurf3d_vtable_gentypes, 5, 5, NULL /*CORE21*/,
142             pdl_plsurf3d_vtable_realdims, pdl_plsurf3d_vtable_parnames,
143             pdl_plsurf3d_vtable_parflags, pdl_plsurf3d_vtable_partypes,
144             pdl_plsurf3d_vtable_realdims_starts, pdl_plsurf3d_vtable_realdims_ind_ids, 5,
145             3, pdl_plsurf3d_vtable_indnames,
146             NULL, pdl_plsurf3d_readdata, NULL,
147             NULL,
148             0,"PDL::Graphics::PLplot::plsurf3d"
149             };
150              
151              
152 8           pdl_error pdl_run_plsurf3d(pdl *x,pdl *y,pdl *z,pdl *opt,pdl *clevel) {
153 8           pdl_error PDL_err = {0, NULL, 0};
154 8 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
155 8           pdl_trans *__privtrans = PDL->create_trans(&pdl_plsurf3d_vtable);
156 8 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
157 8           __privtrans->pdls[0] = x;
158 8           __privtrans->pdls[1] = y;
159 8           __privtrans->pdls[2] = z;
160 8           __privtrans->pdls[3] = opt;
161 8           __privtrans->pdls[4] = clevel;
162 8 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
163 8 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
164 8           return PDL_err;
165             }