File Coverage

pp-plstring.c
Criterion Covered Total %
statement 30 31 96.7
branch 24 44 54.5
condition n/a
subroutine n/a
pod n/a
total 54 75 72.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-plstring.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 1846 "lib/PDL/PP.pm"
54             typedef struct pdl_params_plstring {
55             #line 56 "pp-plstring.c"
56             char *string;
57             } pdl_params_plstring;
58              
59              
60             #line 1857 "lib/PDL/PP.pm"
61             pdl_error pdl_plstring_readdata(pdl_trans *__privtrans) {
62             pdl_error PDL_err = {0, NULL, 0};
63             #line 64 "pp-plstring.c"
64 503           pdl_params_plstring *__params = __privtrans->params; (void)__params;
65 503 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plstring:" "broadcast.incs NULL");
66             /* broadcastloop declarations */
67             int __brcloopval;
68             register PDL_Indx __tind0,__tind1; /* counters along dim */
69 503           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
70             /* dims here are how many steps along those dims */
71 503           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
72 503           register PDL_Indx __tinc0_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
73 503           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
74 503           register PDL_Indx __tinc1_y = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
75             #define PDL_BROADCASTLOOP_START_plstring_readdata PDL_BROADCASTLOOP_START( \
76             readdata, \
77             __privtrans->broadcast, \
78             __privtrans->vtable, \
79             x_datap += __offsp[0]; \
80             y_datap += __offsp[1]; \
81             , \
82             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
83             ,y_datap += __tinc1_y - __tinc0_y * __tdims0 \
84             ), \
85             ( ,x_datap += __tinc0_x \
86             ,y_datap += __tinc0_y \
87             ) \
88             )
89             #define PDL_BROADCASTLOOP_END_plstring_readdata PDL_BROADCASTLOOP_END( \
90             __privtrans->broadcast, \
91             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
92             y_datap -= __tinc1_y * __tdims1 + __offsp[1]; \
93             )
94 503           register PDL_Indx __inc_x_na = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_x_na;
95 503           register PDL_Indx __inc_y_na = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_y_na;
96             #ifndef PDL_DECLARE_PARAMS_plstring_1
97             #define PDL_DECLARE_PARAMS_plstring_1(PDL_TYPE_OP,PDL_PPSYM_OP) \
98             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
99             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, y, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP)
100             #endif
101             #define PDL_IF_BAD(t,f) f
102 503 50         switch (__privtrans->__datatype) { /* Start generic switch */
103 503           case PDL_D: {
104 503 50         PDL_DECLARE_PARAMS_plstring_1(PDL_Double,D)
    50          
    50          
    50          
    50          
    50          
105 2012 50         PDL_BROADCASTLOOP_START_plstring_readdata {c_plstring(__privtrans->ind_sizes[0], x_datap, y_datap, __params->string);}PDL_BROADCASTLOOP_END_plstring_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
106 503           } break;
107 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plstring: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
108             }
109             #undef PDL_IF_BAD
110 503           return PDL_err;
111             }
112              
113              
114             #line 1857 "lib/PDL/PP.pm"
115             pdl_error pdl_plstring_free(pdl_trans *__privtrans, char destroy) {
116             pdl_error PDL_err = {0, NULL, 0};
117             #line 118 "pp-plstring.c"
118 503           pdl_params_plstring *__params = __privtrans->params; (void)__params;
119 503 50         PDL_FREE_CODE(__privtrans, destroy, free(__params->string); /* CType.get_free */
120 503           , ) return PDL_err;
121             }
122              
123             static pdl_datatypes pdl_plstring_vtable_gentypes[] = { PDL_D, -1 };
124             static PDL_Indx pdl_plstring_vtable_realdims[] = { 1, 1 };
125             static char *pdl_plstring_vtable_parnames[] = { "x","y" };
126             static short pdl_plstring_vtable_parflags[] = {
127             PDL_PARAM_ISPHYS,
128             PDL_PARAM_ISPHYS
129             };
130             static pdl_datatypes pdl_plstring_vtable_partypes[] = { -1, -1 };
131             static PDL_Indx pdl_plstring_vtable_realdims_starts[] = { 0, 1 };
132             static PDL_Indx pdl_plstring_vtable_realdims_ind_ids[] = { 0, 0 };
133             static char *pdl_plstring_vtable_indnames[] = { "na" };
134             pdl_transvtable pdl_plstring_vtable = {
135             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plstring_vtable_gentypes, 2, 2, NULL /*CORE21*/,
136             pdl_plstring_vtable_realdims, pdl_plstring_vtable_parnames,
137             pdl_plstring_vtable_parflags, pdl_plstring_vtable_partypes,
138             pdl_plstring_vtable_realdims_starts, pdl_plstring_vtable_realdims_ind_ids, 2,
139             1, pdl_plstring_vtable_indnames,
140             NULL, pdl_plstring_readdata, NULL,
141             pdl_plstring_free,
142             sizeof(pdl_params_plstring),"PDL::Graphics::PLplot::plstring"
143             };
144              
145              
146 503           pdl_error pdl_run_plstring(pdl *x,pdl *y,char *string) {
147 503           pdl_error PDL_err = {0, NULL, 0};
148 503 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
149 503           pdl_trans *__privtrans = PDL->create_trans(&pdl_plstring_vtable);
150 503 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
151 503           pdl_params_plstring *__params = __privtrans->params;
152 503           __privtrans->pdls[0] = x;
153 503           __privtrans->pdls[1] = y;
154 503 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
155 503           (__params->string) = malloc(strlen(string)+1); strcpy(__params->string,string); /* CType.get_copy */
156 503 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
157 503           return PDL_err;
158             }