File Coverage

pp-plmeridians.c
Criterion Covered Total %
statement 43 44 97.7
branch 38 70 54.2
condition n/a
subroutine n/a
pod n/a
total 81 114 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-plmeridians.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_plmeridians {
55             #line 56 "pp-plmeridians.c"
56             SV *mapform;
57             } pdl_params_plmeridians;
58              
59              
60             #line 1857 "lib/PDL/PP.pm"
61             pdl_error pdl_plmeridians_readdata(pdl_trans *__privtrans) {
62             pdl_error PDL_err = {0, NULL, 0};
63             #line 64 "pp-plmeridians.c"
64 2           pdl_params_plmeridians *__params = __privtrans->params; (void)__params;
65 2 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in plmeridians:" "broadcast.incs NULL");
66             /* broadcastloop declarations */
67             int __brcloopval;
68             register PDL_Indx __tind0,__tind1; /* counters along dim */
69 2           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
70             /* dims here are how many steps along those dims */
71 2           register PDL_Indx __tinc0_dlong = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
72 2           register PDL_Indx __tinc0_dlat = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
73 2           register PDL_Indx __tinc0_minlong = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
74 2           register PDL_Indx __tinc0_maxlong = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
75 2           register PDL_Indx __tinc0_minlat = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
76 2           register PDL_Indx __tinc0_maxlat = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
77 2           register PDL_Indx __tinc1_dlong = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
78 2           register PDL_Indx __tinc1_dlat = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
79 2           register PDL_Indx __tinc1_minlong = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
80 2           register PDL_Indx __tinc1_maxlong = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
81 2           register PDL_Indx __tinc1_minlat = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
82 2           register PDL_Indx __tinc1_maxlat = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
83             #define PDL_BROADCASTLOOP_START_plmeridians_readdata PDL_BROADCASTLOOP_START( \
84             readdata, \
85             __privtrans->broadcast, \
86             __privtrans->vtable, \
87             dlong_datap += __offsp[0]; \
88             dlat_datap += __offsp[1]; \
89             minlong_datap += __offsp[2]; \
90             maxlong_datap += __offsp[3]; \
91             minlat_datap += __offsp[4]; \
92             maxlat_datap += __offsp[5]; \
93             , \
94             ( ,dlong_datap += __tinc1_dlong - __tinc0_dlong * __tdims0 \
95             ,dlat_datap += __tinc1_dlat - __tinc0_dlat * __tdims0 \
96             ,minlong_datap += __tinc1_minlong - __tinc0_minlong * __tdims0 \
97             ,maxlong_datap += __tinc1_maxlong - __tinc0_maxlong * __tdims0 \
98             ,minlat_datap += __tinc1_minlat - __tinc0_minlat * __tdims0 \
99             ,maxlat_datap += __tinc1_maxlat - __tinc0_maxlat * __tdims0 \
100             ), \
101             ( ,dlong_datap += __tinc0_dlong \
102             ,dlat_datap += __tinc0_dlat \
103             ,minlong_datap += __tinc0_minlong \
104             ,maxlong_datap += __tinc0_maxlong \
105             ,minlat_datap += __tinc0_minlat \
106             ,maxlat_datap += __tinc0_maxlat \
107             ) \
108             )
109             #define PDL_BROADCASTLOOP_END_plmeridians_readdata PDL_BROADCASTLOOP_END( \
110             __privtrans->broadcast, \
111             dlong_datap -= __tinc1_dlong * __tdims1 + __offsp[0]; \
112             dlat_datap -= __tinc1_dlat * __tdims1 + __offsp[1]; \
113             minlong_datap -= __tinc1_minlong * __tdims1 + __offsp[2]; \
114             maxlong_datap -= __tinc1_maxlong * __tdims1 + __offsp[3]; \
115             minlat_datap -= __tinc1_minlat * __tdims1 + __offsp[4]; \
116             maxlat_datap -= __tinc1_maxlat * __tdims1 + __offsp[5]; \
117             )
118             #ifndef PDL_DECLARE_PARAMS_plmeridians_1
119             #define PDL_DECLARE_PARAMS_plmeridians_1(PDL_TYPE_OP,PDL_PPSYM_OP) \
120             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, dlong, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
121             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, dlat, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
122             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, minlong, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
123             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, maxlong, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \
124             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, minlat, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \
125             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, maxlat, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP)
126             #endif
127             #define PDL_IF_BAD(t,f) f
128 2 50         switch (__privtrans->__datatype) { /* Start generic switch */
129 2           case PDL_D: {
130 2 50         PDL_DECLARE_PARAMS_plmeridians_1(PDL_Double,D)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
131 8 50         PDL_BROADCASTLOOP_START_plmeridians_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
132 2           mapform_callback_set(__params->mapform,
133             "plmeridians: mapform must be either 0 or a subroutine pointer");
134 2 100         plmeridians (SvTRUE (__params->mapform) ? mapform_callback : NULL,
135 2 50         (dlong_datap)[0], (dlat_datap)[0], (minlong_datap)[0], (maxlong_datap)[0], (minlat_datap)[0], (maxlat_datap)[0]);}PDL_BROADCASTLOOP_END_plmeridians_readdata
    50          
136 2           } break;
137 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in plmeridians: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
138             }
139             #undef PDL_IF_BAD
140 2           return PDL_err;
141             }
142              
143              
144             #line 1857 "lib/PDL/PP.pm"
145             pdl_error pdl_plmeridians_free(pdl_trans *__privtrans, char destroy) {
146             pdl_error PDL_err = {0, NULL, 0};
147             #line 148 "pp-plmeridians.c"
148 2           pdl_params_plmeridians *__params = __privtrans->params; (void)__params;
149 2 50         PDL_FREE_CODE(__privtrans, destroy, SvREFCNT_dec(__params->mapform); /* CType.get_free */
150 2           , ) return PDL_err;
151             }
152              
153             static pdl_datatypes pdl_plmeridians_vtable_gentypes[] = { PDL_D, -1 };
154             static PDL_Indx pdl_plmeridians_vtable_realdims[] = { 0, 0, 0, 0, 0, 0 };
155             static char *pdl_plmeridians_vtable_parnames[] = { "dlong","dlat","minlong","maxlong","minlat","maxlat" };
156             static short pdl_plmeridians_vtable_parflags[] = {
157             0,
158             0,
159             0,
160             0,
161             0,
162             0
163             };
164             static pdl_datatypes pdl_plmeridians_vtable_partypes[] = { -1, -1, -1, -1, -1, -1 };
165             static PDL_Indx pdl_plmeridians_vtable_realdims_starts[] = { 0, 0, 0, 0, 0, 0 };
166             static PDL_Indx pdl_plmeridians_vtable_realdims_ind_ids[] = { 0 };
167             static char *pdl_plmeridians_vtable_indnames[] = { "" };
168             pdl_transvtable pdl_plmeridians_vtable = {
169             PDL_TRANS_DO_BROADCAST|PDL_TRANS_NO_PARALLEL, 0, pdl_plmeridians_vtable_gentypes, 6, 6, NULL /*CORE21*/,
170             pdl_plmeridians_vtable_realdims, pdl_plmeridians_vtable_parnames,
171             pdl_plmeridians_vtable_parflags, pdl_plmeridians_vtable_partypes,
172             pdl_plmeridians_vtable_realdims_starts, pdl_plmeridians_vtable_realdims_ind_ids, 0,
173             0, pdl_plmeridians_vtable_indnames,
174             NULL, pdl_plmeridians_readdata, NULL,
175             pdl_plmeridians_free,
176             sizeof(pdl_params_plmeridians),"PDL::Graphics::PLplot::plmeridians"
177             };
178              
179              
180 2           pdl_error pdl_run_plmeridians(pdl *dlong,pdl *dlat,pdl *minlong,pdl *maxlong,pdl *minlat,pdl *maxlat,SV *mapform) {
181 2           pdl_error PDL_err = {0, NULL, 0};
182 2 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
183 2           pdl_trans *__privtrans = PDL->create_trans(&pdl_plmeridians_vtable);
184 2 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
185 2           pdl_params_plmeridians *__params = __privtrans->params;
186 2           __privtrans->pdls[0] = dlong;
187 2           __privtrans->pdls[1] = dlat;
188 2           __privtrans->pdls[2] = minlong;
189 2           __privtrans->pdls[3] = maxlong;
190 2           __privtrans->pdls[4] = minlat;
191 2           __privtrans->pdls[5] = maxlat;
192 2 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
193 2           (__params->mapform) = newSVsv(mapform); /* CType.get_copy */
194 2 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
195 2           return PDL_err;
196             }