File Coverage

pp-plpath.c
Criterion Covered Total %
statement 31 32 96.8
branch 32 60 53.3
condition n/a
subroutine n/a
pod n/a
total 63 92 68.4


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-plpath.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_plpath_readdata(pdl_trans *__privtrans) {
41             pdl_error PDL_err = {0, NULL, 0};
42             #line 43 "pp-plpath.c"
43 2 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plpath:" "broadcast.incs NULL");
44             /* broadcastloop declarations */
45             int __brcloopval;
46             register PDL_Indx __tind0,__tind1; /* counters along dim */
47 2           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
48             /* dims here are how many steps along those dims */
49 2           register PDL_Indx __tinc0_n = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
50 2           register PDL_Indx __tinc0_x1 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
51 2           register PDL_Indx __tinc0_x2 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
52 2           register PDL_Indx __tinc0_y1 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
53 2           register PDL_Indx __tinc0_y2 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
54 2           register PDL_Indx __tinc1_n = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
55 2           register PDL_Indx __tinc1_x1 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
56 2           register PDL_Indx __tinc1_x2 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
57 2           register PDL_Indx __tinc1_y1 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
58 2           register PDL_Indx __tinc1_y2 = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
59             #define PDL_BROADCASTLOOP_START_plpath_readdata PDL_BROADCASTLOOP_START( \
60             readdata, \
61             __privtrans->broadcast, \
62             __privtrans->vtable, \
63             n_datap += __offsp[0]; \
64             x1_datap += __offsp[1]; \
65             x2_datap += __offsp[2]; \
66             y1_datap += __offsp[3]; \
67             y2_datap += __offsp[4]; \
68             , \
69             ( ,n_datap += __tinc1_n - __tinc0_n * __tdims0 \
70             ,x1_datap += __tinc1_x1 - __tinc0_x1 * __tdims0 \
71             ,x2_datap += __tinc1_x2 - __tinc0_x2 * __tdims0 \
72             ,y1_datap += __tinc1_y1 - __tinc0_y1 * __tdims0 \
73             ,y2_datap += __tinc1_y2 - __tinc0_y2 * __tdims0 \
74             ), \
75             ( ,n_datap += __tinc0_n \
76             ,x1_datap += __tinc0_x1 \
77             ,x2_datap += __tinc0_x2 \
78             ,y1_datap += __tinc0_y1 \
79             ,y2_datap += __tinc0_y2 \
80             ) \
81             )
82             #define PDL_BROADCASTLOOP_END_plpath_readdata PDL_BROADCASTLOOP_END( \
83             __privtrans->broadcast, \
84             n_datap -= __tinc1_n * __tdims1 + __offsp[0]; \
85             x1_datap -= __tinc1_x1 * __tdims1 + __offsp[1]; \
86             x2_datap -= __tinc1_x2 * __tdims1 + __offsp[2]; \
87             y1_datap -= __tinc1_y1 * __tdims1 + __offsp[3]; \
88             y2_datap -= __tinc1_y2 * __tdims1 + __offsp[4]; \
89             )
90             #ifndef PDL_DECLARE_PARAMS_plpath_1
91             #define PDL_DECLARE_PARAMS_plpath_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_n,PDL_PPSYM_PARAM_n) \
92             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_n, n, (__privtrans->pdls[0]), 1, PDL_PPSYM_PARAM_n) \
93             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x1, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
94             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x2, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
95             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y1, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \
96             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y2, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP)
97             #endif
98             #define PDL_IF_BAD(t,f) f
99 2 50         switch (__privtrans->__datatype) { /* Start generic switch */
100 2           case PDL_D: {
101 2 50         PDL_DECLARE_PARAMS_plpath_1(PDL_Double,D,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
102 8 50         PDL_BROADCASTLOOP_START_plpath_readdata {c_plpath((n_datap)[0], (x1_datap)[0], (x2_datap)[0], (y1_datap)[0], (y2_datap)[0]);}PDL_BROADCASTLOOP_END_plpath_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
103 2           } break;
104 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plpath: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
105             }
106             #undef PDL_IF_BAD
107 2           return PDL_err;
108             }
109              
110             static pdl_datatypes pdl_plpath_vtable_gentypes[] = { PDL_D, -1 };
111             static PDL_Indx pdl_plpath_vtable_realdims[] = { 0, 0, 0, 0, 0 };
112             static char *pdl_plpath_vtable_parnames[] = { "n","x1","x2","y1","y2" };
113             static short pdl_plpath_vtable_parflags[] = {
114             PDL_PARAM_ISTYPED,
115             0,
116             0,
117             0,
118             0
119             };
120             static pdl_datatypes pdl_plpath_vtable_partypes[] = { PDL_L, -1, -1, -1, -1 };
121             static PDL_Indx pdl_plpath_vtable_realdims_starts[] = { 0, 0, 0, 0, 0 };
122             static PDL_Indx pdl_plpath_vtable_realdims_ind_ids[] = { 0 };
123             static char *pdl_plpath_vtable_indnames[] = { "" };
124             pdl_transvtable pdl_plpath_vtable = {
125             PDL_TRANS_DO_BROADCAST|PDL_TRANS_BADIGNORE|PDL_TRANS_NO_PARALLEL, 0, pdl_plpath_vtable_gentypes, 5, 5, NULL /*CORE21*/,
126             pdl_plpath_vtable_realdims, pdl_plpath_vtable_parnames,
127             pdl_plpath_vtable_parflags, pdl_plpath_vtable_partypes,
128             pdl_plpath_vtable_realdims_starts, pdl_plpath_vtable_realdims_ind_ids, 0,
129             0, pdl_plpath_vtable_indnames,
130             NULL, pdl_plpath_readdata, NULL,
131             NULL,
132             0,"PDL::Graphics::PLplot::plpath"
133             };
134              
135              
136 2           pdl_error pdl_run_plpath(pdl *n,pdl *x1,pdl *x2,pdl *y1,pdl *y2) {
137 2           pdl_error PDL_err = {0, NULL, 0};
138 2 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
139 2           pdl_trans *__privtrans = PDL->create_trans(&pdl_plpath_vtable);
140 2 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
141 2           __privtrans->pdls[0] = n;
142 2           __privtrans->pdls[1] = x1;
143 2           __privtrans->pdls[2] = x2;
144 2           __privtrans->pdls[3] = y1;
145 2           __privtrans->pdls[4] = y2;
146 2 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
147 2 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
148 2           return PDL_err;
149             }