File Coverage

pp-plmtex3.c
Criterion Covered Total %
statement 32 33 96.9
branch 27 50 54.0
condition n/a
subroutine n/a
pod n/a
total 59 83 71.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-plmtex3.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_plmtex3 {
41             #line 42 "pp-plmtex3.c"
42             char *side;
43             char *text;
44             } pdl_params_plmtex3;
45              
46              
47             #line 1857 "lib/PDL/PP.pm"
48             pdl_error pdl_plmtex3_readdata(pdl_trans *__privtrans) {
49             pdl_error PDL_err = {0, NULL, 0};
50             #line 51 "pp-plmtex3.c"
51 12           pdl_params_plmtex3 *__params = __privtrans->params; (void)__params;
52 12 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plmtex3:" "broadcast.incs NULL");
53             /* broadcastloop declarations */
54             int __brcloopval;
55             register PDL_Indx __tind0,__tind1; /* counters along dim */
56 12           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
57             /* dims here are how many steps along those dims */
58 12           register PDL_Indx __tinc0_disp = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
59 12           register PDL_Indx __tinc0_pos = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
60 12           register PDL_Indx __tinc0_just = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
61 12           register PDL_Indx __tinc1_disp = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
62 12           register PDL_Indx __tinc1_pos = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
63 12           register PDL_Indx __tinc1_just = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
64             #define PDL_BROADCASTLOOP_START_plmtex3_readdata PDL_BROADCASTLOOP_START( \
65             readdata, \
66             __privtrans->broadcast, \
67             __privtrans->vtable, \
68             disp_datap += __offsp[0]; \
69             pos_datap += __offsp[1]; \
70             just_datap += __offsp[2]; \
71             , \
72             ( ,disp_datap += __tinc1_disp - __tinc0_disp * __tdims0 \
73             ,pos_datap += __tinc1_pos - __tinc0_pos * __tdims0 \
74             ,just_datap += __tinc1_just - __tinc0_just * __tdims0 \
75             ), \
76             ( ,disp_datap += __tinc0_disp \
77             ,pos_datap += __tinc0_pos \
78             ,just_datap += __tinc0_just \
79             ) \
80             )
81             #define PDL_BROADCASTLOOP_END_plmtex3_readdata PDL_BROADCASTLOOP_END( \
82             __privtrans->broadcast, \
83             disp_datap -= __tinc1_disp * __tdims1 + __offsp[0]; \
84             pos_datap -= __tinc1_pos * __tdims1 + __offsp[1]; \
85             just_datap -= __tinc1_just * __tdims1 + __offsp[2]; \
86             )
87             #ifndef PDL_DECLARE_PARAMS_plmtex3_1
88             #define PDL_DECLARE_PARAMS_plmtex3_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_disp,PDL_PPSYM_PARAM_disp,PDL_TYPE_PARAM_pos,PDL_PPSYM_PARAM_pos,PDL_TYPE_PARAM_just,PDL_PPSYM_PARAM_just) \
89             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_disp, disp, (__privtrans->pdls[0]), 1, PDL_PPSYM_PARAM_disp) \
90             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_pos, pos, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_pos) \
91             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_just, just, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_just)
92             #endif
93             #define PDL_IF_BAD(t,f) f
94 12 50         switch (__privtrans->__datatype) { /* Start generic switch */
95 12           case PDL_D: {
96 12 50         PDL_DECLARE_PARAMS_plmtex3_1(PDL_Double,D,PDL_Double,D,PDL_Double,D,PDL_Double,D)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
97 48 50         PDL_BROADCASTLOOP_START_plmtex3_readdata {c_plmtex3(__params->side,(disp_datap)[0],(pos_datap)[0],(just_datap)[0],__params->text);}PDL_BROADCASTLOOP_END_plmtex3_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
98 12           } break;
99 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plmtex3: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
100             }
101             #undef PDL_IF_BAD
102 12           return PDL_err;
103             }
104              
105              
106             #line 1857 "lib/PDL/PP.pm"
107             pdl_error pdl_plmtex3_free(pdl_trans *__privtrans, char destroy) {
108             pdl_error PDL_err = {0, NULL, 0};
109             #line 110 "pp-plmtex3.c"
110 12           pdl_params_plmtex3 *__params = __privtrans->params; (void)__params;
111 12 50         PDL_FREE_CODE(__privtrans, destroy, free(__params->side); /* CType.get_free */
112             free(__params->text); /* CType.get_free */
113 12           , ) return PDL_err;
114             }
115              
116             static pdl_datatypes pdl_plmtex3_vtable_gentypes[] = { PDL_D, -1 };
117             static PDL_Indx pdl_plmtex3_vtable_realdims[] = { 0, 0, 0 };
118             static char *pdl_plmtex3_vtable_parnames[] = { "disp","pos","just" };
119             static short pdl_plmtex3_vtable_parflags[] = {
120             PDL_PARAM_ISTYPED,
121             PDL_PARAM_ISTYPED,
122             PDL_PARAM_ISTYPED
123             };
124             static pdl_datatypes pdl_plmtex3_vtable_partypes[] = { PDL_D, PDL_D, PDL_D };
125             static PDL_Indx pdl_plmtex3_vtable_realdims_starts[] = { 0, 0, 0 };
126             static PDL_Indx pdl_plmtex3_vtable_realdims_ind_ids[] = { 0 };
127             static char *pdl_plmtex3_vtable_indnames[] = { "" };
128             pdl_transvtable pdl_plmtex3_vtable = {
129             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plmtex3_vtable_gentypes, 3, 3, NULL /*CORE21*/,
130             pdl_plmtex3_vtable_realdims, pdl_plmtex3_vtable_parnames,
131             pdl_plmtex3_vtable_parflags, pdl_plmtex3_vtable_partypes,
132             pdl_plmtex3_vtable_realdims_starts, pdl_plmtex3_vtable_realdims_ind_ids, 0,
133             0, pdl_plmtex3_vtable_indnames,
134             NULL, pdl_plmtex3_readdata, NULL,
135             pdl_plmtex3_free,
136             sizeof(pdl_params_plmtex3),"PDL::Graphics::PLplot::plmtex3"
137             };
138              
139              
140 12           pdl_error pdl_run_plmtex3(pdl *disp,pdl *pos,pdl *just,char *side,char *text) {
141 12           pdl_error PDL_err = {0, NULL, 0};
142 12 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
143 12           pdl_trans *__privtrans = PDL->create_trans(&pdl_plmtex3_vtable);
144 12 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
145 12           pdl_params_plmtex3 *__params = __privtrans->params;
146 12           __privtrans->pdls[0] = disp;
147 12           __privtrans->pdls[1] = pos;
148 12           __privtrans->pdls[2] = just;
149 12 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
150 12           (__params->side) = malloc(strlen(side)+1); strcpy(__params->side,side); /* CType.get_copy */
151 12           (__params->text) = malloc(strlen(text)+1); strcpy(__params->text,text); /* CType.get_copy */
152 12 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
153 12           return PDL_err;
154             }