File Coverage

pp-plptex.c
Criterion Covered Total %
statement 37 38 97.3
branch 33 62 53.2
condition n/a
subroutine n/a
pod n/a
total 70 100 70.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-plptex.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 1846 "lib/PDL/PP.pm"
40             typedef struct pdl_params_plptex {
41             #line 42 "pp-plptex.c"
42             char *text;
43             } pdl_params_plptex;
44              
45              
46             #line 1857 "lib/PDL/PP.pm"
47             pdl_error pdl_plptex_readdata(pdl_trans *__privtrans) {
48             pdl_error PDL_err = {0, NULL, 0};
49             #line 50 "pp-plptex.c"
50 1587           pdl_params_plptex *__params = __privtrans->params; (void)__params;
51 1587 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plptex:" "broadcast.incs NULL");
52             /* broadcastloop declarations */
53             int __brcloopval;
54             register PDL_Indx __tind0,__tind1; /* counters along dim */
55 1587           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
56             /* dims here are how many steps along those dims */
57 1587           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
58 1587           register PDL_Indx __tinc0_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
59 1587           register PDL_Indx __tinc0_dx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
60 1587           register PDL_Indx __tinc0_dy = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
61 1587           register PDL_Indx __tinc0_just = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
62 1587           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
63 1587           register PDL_Indx __tinc1_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
64 1587           register PDL_Indx __tinc1_dx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
65 1587           register PDL_Indx __tinc1_dy = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
66 1587           register PDL_Indx __tinc1_just = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
67             #define PDL_BROADCASTLOOP_START_plptex_readdata PDL_BROADCASTLOOP_START( \
68             readdata, \
69             __privtrans->broadcast, \
70             __privtrans->vtable, \
71             x_datap += __offsp[0]; \
72             y_datap += __offsp[1]; \
73             dx_datap += __offsp[2]; \
74             dy_datap += __offsp[3]; \
75             just_datap += __offsp[4]; \
76             , \
77             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
78             ,y_datap += __tinc1_y - __tinc0_y * __tdims0 \
79             ,dx_datap += __tinc1_dx - __tinc0_dx * __tdims0 \
80             ,dy_datap += __tinc1_dy - __tinc0_dy * __tdims0 \
81             ,just_datap += __tinc1_just - __tinc0_just * __tdims0 \
82             ), \
83             ( ,x_datap += __tinc0_x \
84             ,y_datap += __tinc0_y \
85             ,dx_datap += __tinc0_dx \
86             ,dy_datap += __tinc0_dy \
87             ,just_datap += __tinc0_just \
88             ) \
89             )
90             #define PDL_BROADCASTLOOP_END_plptex_readdata PDL_BROADCASTLOOP_END( \
91             __privtrans->broadcast, \
92             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
93             y_datap -= __tinc1_y * __tdims1 + __offsp[1]; \
94             dx_datap -= __tinc1_dx * __tdims1 + __offsp[2]; \
95             dy_datap -= __tinc1_dy * __tdims1 + __offsp[3]; \
96             just_datap -= __tinc1_just * __tdims1 + __offsp[4]; \
97             )
98             #ifndef PDL_DECLARE_PARAMS_plptex_1
99             #define PDL_DECLARE_PARAMS_plptex_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_x,PDL_PPSYM_PARAM_x,PDL_TYPE_PARAM_y,PDL_PPSYM_PARAM_y,PDL_TYPE_PARAM_dx,PDL_PPSYM_PARAM_dx,PDL_TYPE_PARAM_dy,PDL_PPSYM_PARAM_dy,PDL_TYPE_PARAM_just,PDL_PPSYM_PARAM_just) \
100             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_x, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_PARAM_x) \
101             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_y, y, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_y) \
102             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_dx, dx, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_dx) \
103             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_dy, dy, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_dy) \
104             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_just, just, (__privtrans->pdls[4]), 1, PDL_PPSYM_PARAM_just)
105             #endif
106             #define PDL_IF_BAD(t,f) f
107 1587 50         switch (__privtrans->__datatype) { /* Start generic switch */
108 1587           case PDL_D: {
109 1587 50         PDL_DECLARE_PARAMS_plptex_1(PDL_Double,D,PDL_Double,D,PDL_Double,D,PDL_Double,D,PDL_Double,D,PDL_Double,D)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
110 6348 50         PDL_BROADCASTLOOP_START_plptex_readdata {c_plptex((x_datap)[0],(y_datap)[0],(dx_datap)[0],(dy_datap)[0],(just_datap)[0],__params->text);}PDL_BROADCASTLOOP_END_plptex_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
111 1587           } break;
112 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plptex: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
113             }
114             #undef PDL_IF_BAD
115 1587           return PDL_err;
116             }
117              
118              
119             #line 1857 "lib/PDL/PP.pm"
120             pdl_error pdl_plptex_free(pdl_trans *__privtrans, char destroy) {
121             pdl_error PDL_err = {0, NULL, 0};
122             #line 123 "pp-plptex.c"
123 1587           pdl_params_plptex *__params = __privtrans->params; (void)__params;
124 1587 50         PDL_FREE_CODE(__privtrans, destroy, free(__params->text); /* CType.get_free */
125 1587           , ) return PDL_err;
126             }
127              
128             static pdl_datatypes pdl_plptex_vtable_gentypes[] = { PDL_D, -1 };
129             static PDL_Indx pdl_plptex_vtable_realdims[] = { 0, 0, 0, 0, 0 };
130             static char *pdl_plptex_vtable_parnames[] = { "x","y","dx","dy","just" };
131             static short pdl_plptex_vtable_parflags[] = {
132             PDL_PARAM_ISTYPED,
133             PDL_PARAM_ISTYPED,
134             PDL_PARAM_ISTYPED,
135             PDL_PARAM_ISTYPED,
136             PDL_PARAM_ISTYPED
137             };
138             static pdl_datatypes pdl_plptex_vtable_partypes[] = { PDL_D, PDL_D, PDL_D, PDL_D, PDL_D };
139             static PDL_Indx pdl_plptex_vtable_realdims_starts[] = { 0, 0, 0, 0, 0 };
140             static PDL_Indx pdl_plptex_vtable_realdims_ind_ids[] = { 0 };
141             static char *pdl_plptex_vtable_indnames[] = { "" };
142             pdl_transvtable pdl_plptex_vtable = {
143             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plptex_vtable_gentypes, 5, 5, NULL /*CORE21*/,
144             pdl_plptex_vtable_realdims, pdl_plptex_vtable_parnames,
145             pdl_plptex_vtable_parflags, pdl_plptex_vtable_partypes,
146             pdl_plptex_vtable_realdims_starts, pdl_plptex_vtable_realdims_ind_ids, 0,
147             0, pdl_plptex_vtable_indnames,
148             NULL, pdl_plptex_readdata, NULL,
149             pdl_plptex_free,
150             sizeof(pdl_params_plptex),"PDL::Graphics::PLplot::plptex"
151             };
152              
153              
154 1587           pdl_error pdl_run_plptex(pdl *x,pdl *y,pdl *dx,pdl *dy,pdl *just,char *text) {
155 1587           pdl_error PDL_err = {0, NULL, 0};
156 1587 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
157 1587           pdl_trans *__privtrans = PDL->create_trans(&pdl_plptex_vtable);
158 1587 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
159 1587           pdl_params_plptex *__params = __privtrans->params;
160 1587           __privtrans->pdls[0] = x;
161 1587           __privtrans->pdls[1] = y;
162 1587           __privtrans->pdls[2] = dx;
163 1587           __privtrans->pdls[3] = dy;
164 1587           __privtrans->pdls[4] = just;
165 1587 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
166 1587           (__params->text) = malloc(strlen(text)+1); strcpy(__params->text,text); /* CType.get_copy */
167 1587 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
168 1587           return PDL_err;
169             }