File Coverage

pp-plsvect.c
Criterion Covered Total %
statement 32 33 96.9
branch 32 52 61.5
condition n/a
subroutine n/a
pod n/a
total 64 85 75.2


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-plsvect.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_plsvect_readdata(pdl_trans *__privtrans) {
55             pdl_error PDL_err = {0, NULL, 0};
56             #line 57 "pp-plsvect.c"
57 3 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plsvect:" "broadcast.incs NULL");
58             /* broadcastloop declarations */
59             int __brcloopval;
60             register PDL_Indx __tind0,__tind1; /* counters along dim */
61 3           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
62             /* dims here are how many steps along those dims */
63 3           register PDL_Indx __tinc0_arrowx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
64 3           register PDL_Indx __tinc0_arrowy = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
65 3           register PDL_Indx __tinc0_fill = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
66 3           register PDL_Indx __tinc1_arrowx = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
67 3           register PDL_Indx __tinc1_arrowy = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
68 3           register PDL_Indx __tinc1_fill = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
69             #define PDL_BROADCASTLOOP_START_plsvect_readdata PDL_BROADCASTLOOP_START( \
70             readdata, \
71             __privtrans->broadcast, \
72             __privtrans->vtable, \
73             arrowx_datap += __offsp[0]; \
74             arrowy_datap += __offsp[1]; \
75             fill_datap += __offsp[2]; \
76             , \
77             ( ,arrowx_datap += __tinc1_arrowx - __tinc0_arrowx * __tdims0 \
78             ,arrowy_datap += __tinc1_arrowy - __tinc0_arrowy * __tdims0 \
79             ,fill_datap += __tinc1_fill - __tinc0_fill * __tdims0 \
80             ), \
81             ( ,arrowx_datap += __tinc0_arrowx \
82             ,arrowy_datap += __tinc0_arrowy \
83             ,fill_datap += __tinc0_fill \
84             ) \
85             )
86             #define PDL_BROADCASTLOOP_END_plsvect_readdata PDL_BROADCASTLOOP_END( \
87             __privtrans->broadcast, \
88             arrowx_datap -= __tinc1_arrowx * __tdims1 + __offsp[0]; \
89             arrowy_datap -= __tinc1_arrowy * __tdims1 + __offsp[1]; \
90             fill_datap -= __tinc1_fill * __tdims1 + __offsp[2]; \
91             )
92 3           register PDL_Indx __inc_arrowx_npts = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_arrowx_npts;
93 3           register PDL_Indx __inc_arrowy_npts = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_arrowy_npts;
94             #ifndef PDL_DECLARE_PARAMS_plsvect_1
95             #define PDL_DECLARE_PARAMS_plsvect_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_fill,PDL_PPSYM_PARAM_fill) \
96             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, arrowx, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
97             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, arrowy, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
98             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_fill, fill, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_fill)
99             #endif
100             #define PDL_IF_BAD(t,f) f
101 3 50         switch (__privtrans->__datatype) { /* Start generic switch */
102 3           case PDL_D: {
103 3 50         PDL_DECLARE_PARAMS_plsvect_1(PDL_Double,D,PDL_Long,L)
    100          
    50          
    50          
    100          
    50          
    50          
    50          
    50          
104 12 50         PDL_BROADCASTLOOP_START_plsvect_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
105 6           c_plsvect (
106 3 100         (__privtrans->ind_sizes[0] != 0) ? arrowx_datap : NULL,
107 3           (__privtrans->ind_sizes[0] != 0) ? arrowy_datap : NULL,
108 3 100         __privtrans->ind_sizes[0], (fill_datap)[0]
109             );
110 3 50         }PDL_BROADCASTLOOP_END_plsvect_readdata
    50          
111 3           } break;
112 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plsvect: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
113             }
114             #undef PDL_IF_BAD
115 3           return PDL_err;
116             }
117              
118             static pdl_datatypes pdl_plsvect_vtable_gentypes[] = { PDL_D, -1 };
119             static PDL_Indx pdl_plsvect_vtable_realdims[] = { 1, 1, 0 };
120             static char *pdl_plsvect_vtable_parnames[] = { "arrowx","arrowy","fill" };
121             static short pdl_plsvect_vtable_parflags[] = {
122             PDL_PARAM_ISPHYS,
123             PDL_PARAM_ISPHYS,
124             PDL_PARAM_ISTYPED
125             };
126             static pdl_datatypes pdl_plsvect_vtable_partypes[] = { -1, -1, PDL_L };
127             static PDL_Indx pdl_plsvect_vtable_realdims_starts[] = { 0, 1, 2 };
128             static PDL_Indx pdl_plsvect_vtable_realdims_ind_ids[] = { 0, 0 };
129             static char *pdl_plsvect_vtable_indnames[] = { "npts" };
130             pdl_transvtable pdl_plsvect_vtable = {
131             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plsvect_vtable_gentypes, 3, 3, NULL /*CORE21*/,
132             pdl_plsvect_vtable_realdims, pdl_plsvect_vtable_parnames,
133             pdl_plsvect_vtable_parflags, pdl_plsvect_vtable_partypes,
134             pdl_plsvect_vtable_realdims_starts, pdl_plsvect_vtable_realdims_ind_ids, 2,
135             1, pdl_plsvect_vtable_indnames,
136             NULL, pdl_plsvect_readdata, NULL,
137             NULL,
138             0,"PDL::Graphics::PLplot::plsvect"
139             };
140              
141              
142 3           pdl_error pdl_run_plsvect(pdl *arrowx,pdl *arrowy,pdl *fill) {
143 3           pdl_error PDL_err = {0, NULL, 0};
144 3 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
145 3           pdl_trans *__privtrans = PDL->create_trans(&pdl_plsvect_vtable);
146 3 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
147 3           __privtrans->pdls[0] = arrowx;
148 3           __privtrans->pdls[1] = arrowy;
149 3           __privtrans->pdls[2] = fill;
150 3 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
151 3 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
152 3           return PDL_err;
153             }