buildtmp/Clipper.c

filter: Statementstmt 78.3% 290 / 370 Branchbran 49.6% 129 / 260 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 66.5% 419 / 630 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/poly2av.h ↑ Summary src/myinit.h »
1 /*
2 * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the
3 * contents of main.xs. Do not edit this file, edit main.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8  
9 #line 1 "buildtmp/main.xs"
10 /*
11 * WARNING: This file was auto-generated. Changes will be lost!
12 */
13  
14 #include <cstring>
15 #include <cstdlib>
16 #include <ostream>
17  
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 #include "EXTERN.h"
22 #include "perl.h"
23 #include "XSUB.h"
24 #include "ppport.h"
25 #undef do_open
26 #undef do_close
27 #ifdef __cplusplus
28 }
29 #endif
30  
31 #line 32 "buildtmp/Clipper.c"
32 #ifndef PERL_UNUSED_VAR
33 # define PERL_UNUSED_VAR(var) if (0) var = var
34 #endif
35  
36 #ifndef dVAR
37 # define dVAR dNOOP
38 #endif
39  
40  
41 /* This stuff is not part of the API! You have been warned. */
42 #ifndef PERL_VERSION_DECIMAL
43 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
44 #endif
45 #ifndef PERL_DECIMAL_VERSION
46 # define PERL_DECIMAL_VERSION \
47 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
48 #endif
49 #ifndef PERL_VERSION_GE
50 # define PERL_VERSION_GE(r,v,s) \
51 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
52 #endif
53 #ifndef PERL_VERSION_LE
54 # define PERL_VERSION_LE(r,v,s) \
55 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
56 #endif
57  
58 /* XS_INTERNAL is the explicit static-linkage variant of the default
59 * XS macro.
60 *
61 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
62 * "static", ie. it exports XSUB symbols. You probably don't want that
63 * for anything but the BOOT XSUB.
64 *
65 * See XSUB.h in core!
66 */
67  
68  
69 /* TODO: This might be compatible further back than 5.10.0. */
70 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
71 # undef XS_EXTERNAL
72 # undef XS_INTERNAL
73 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
74 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
75 # define XS_INTERNAL(name) static XSPROTO(name)
76 # endif
77 # if defined(__SYMBIAN32__)
78 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
79 # define XS_INTERNAL(name) EXPORT_C static XSPROTO(name)
80 # endif
81 # ifndef XS_EXTERNAL
82 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
83 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
84 # define XS_INTERNAL(name) static void name(pTHX_ CV* cv __attribute__unused__)
85 # else
86 # ifdef __cplusplus
87 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
88 # define XS_INTERNAL(name) static XSPROTO(name)
89 # else
90 # define XS_EXTERNAL(name) XSPROTO(name)
91 # define XS_INTERNAL(name) static XSPROTO(name)
92 # endif
93 # endif
94 # endif
95 #endif
96  
97 /* perl >= 5.10.0 && perl <= 5.15.1 */
98  
99  
100 /* The XS_EXTERNAL macro is used for functions that must not be static
101 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
102 * macro defined, the best we can do is assume XS is the same.
103 * Dito for XS_INTERNAL.
104 */
105 #ifndef XS_EXTERNAL
106 # define XS_EXTERNAL(name) XS(name)
107 #endif
108 #ifndef XS_INTERNAL
109 # define XS_INTERNAL(name) XS(name)
110 #endif
111  
112 /* Now, finally, after all this mess, we want an ExtUtils::ParseXS
113 * internal macro that we're free to redefine for varying linkage due
114 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
115 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
116 */
117  
118 #undef XS_EUPXS
119 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
120 # define XS_EUPXS(name) XS_EXTERNAL(name)
121 #else
122 /* default to internal */
123 # define XS_EUPXS(name) XS_INTERNAL(name)
124 #endif
125  
126 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
127 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
128  
129 /* prototype to pass -Wmissing-prototypes */
130 static void
131 S_croak_xs_usage(const CV *const cv, const char *const params);
132  
133 static void
134 S_croak_xs_usage(const CV *const cv, const char *const params)
135 {
136 const GV *const gv = CvGV(cv);
137  
138 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
139  
140 if (gv) {
141 const char *const gvname = GvNAME(gv);
142 const HV *const stash = GvSTASH(gv);
143 const char *const hvname = stash ? HvNAME(stash) : NULL;
144  
145 if (hvname)
146 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
147 else
148 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
149 } else {
150 /* Pants. I don't think that it should be possible to get here. */
151 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
152 }
153 }
154 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
155  
156 #define croak_xs_usage S_croak_xs_usage
157  
158 #endif
159  
160 /* NOTE: the prototype of newXSproto() is different in versions of perls,
161 * so we define a portable version of newXSproto()
162 */
163 #ifdef newXS_flags
164 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
165 #else
166 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
167 #endif /* !defined(newXS_flags) */
168  
169 #if PERL_VERSION_LE(5, 21, 5)
170 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
171 #else
172 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
173 #endif
174  
175 /* simple backcompat versions of the TARGx() macros with no optimisation */
176 #ifndef TARGi
177 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
178 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
179 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
180 #endif
181  
182 #line 183 "buildtmp/Clipper.c"
183  
184 /* INCLUDE_COMMAND: Including output of '/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t "/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt" "/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp"' from 'main.xs' */
185  
186 #include <exception>
187 #undef xsp_constructor_class
188 #define xsp_constructor_class(c) (c)
189 #include <myinit.h>
190  
191 XS_EUPXS(XS_Math__Clipper__constant); /* prototype to pass -Wmissing-prototypes */
192 47 XS_EUPXS(XS_Math__Clipper__constant)
193 {
194 47 dVAR; dXSARGS;
195 47 dXSI32;
196 47 ▶ if (items != 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) 0 47 47
197 0 croak_xs_usage(cv, "");
198 {
199 IV RETVAL;
200 47 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 47 0 47
dXSTARG; 3 44 47
201 #line 33 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
202 RETVAL = ix;
203 #line 204 "buildtmp/Clipper.c"
204 47 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 3 44 47
205 47 ST(0) = TARG;
206 }
207 47 XSRETURN(1);
208 }
209  
210 #undef xsp_constructor_class
211 #define xsp_constructor_class(c) (CLASS)
212  
213 XS_EUPXS(XS_Math__Clipper_new); /* prototype to pass -Wmissing-prototypes */
214 9 XS_EUPXS(XS_Math__Clipper_new)
215 {
216 9 dVAR; dXSARGS;
217 9 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 9 9
218 0 croak_xs_usage(cv, "CLASS");
219 {
220 18 ▶ char * CLASS = (char *)SvPV_nolen(ST(0))
Branch: 1 branch
BranchTrueFalseTotal
char * CLASS = (char *)SvPV_nolen(ST(0)) 9 0 9
221 ;
222 Clipper * RETVAL;
223 #line 47 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
224 try {
225 RETVAL = new Clipper();
226 }
227 catch (std::exception& e) {
228 croak("Caught C++ exception of type or derived from 'std::exception': %s", e.what());
229 }
230 catch (...) {
231 croak("Caught C++ exception of unknown type");
232 }
233 #line 234 "buildtmp/Clipper.c"
234 {
235 SV * RETVALSV;
236 9 RETVALSV = sv_newmortal();
237 9 sv_setref_pv( RETVALSV, CLASS, (void*)RETVAL );
238 9 ST(0) = RETVALSV;
239 }
240 }
241 9 XSRETURN(1);
242 }
243  
244 #undef xsp_constructor_class
245 #define xsp_constructor_class(c) (c)
246  
247 XS_EUPXS(XS_Math__Clipper_DESTROY); /* prototype to pass -Wmissing-prototypes */
248 9 XS_EUPXS(XS_Math__Clipper_DESTROY)
249 {
250 9 dVAR; dXSARGS;
251 9 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 9 9
252 0 croak_xs_usage(cv, "THIS");
253 {
254 Clipper * THIS;
255  
256 9 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 9 0 9
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 9 0 9
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 9 0 9
257 9 THIS = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
258 else{
259 0 warn( "Math::Clipper::DESTROY() -- THIS is not a blessed SV reference" );
260 0 XSRETURN_UNDEF;
261 }
262 ;
263 #line 64 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
264 try {
265 delete THIS;
266 }
267 catch (std::exception& e) {
268 croak("Caught C++ exception of type or derived from 'std::exception': %s", e.what());
269 }
270 catch (...) {
271 croak("Caught C++ exception of unknown type");
272 }
273 #line 274 "buildtmp/Clipper.c"
274 }
275 9 XSRETURN_EMPTY;
276 }
277  
278  
279 XS_EUPXS(XS_Math__Clipper_execute); /* prototype to pass -Wmissing-prototypes */
280 13 XS_EUPXS(XS_Math__Clipper_execute)
281 {
282 13 dVAR; dXSARGS;
283 13 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 13 0 13
if (items < 2 || items > 4) 0 13 13
284 0 croak_xs_usage(cv, "THIS, clipType, subjFillType = pftEvenOdd, clipFillType = pftEvenOdd");
285 {
286 Clipper* THIS;
287 13 ClipType clipType = (ClipType)SvUV(ST(1))
288 ;
289 PolyFillType subjFillType;
290 PolyFillType clipFillType;
291 ClipperLib::Polygons * RETVAL;
292  
293 13 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 13 0 13
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 13 0 13
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 13 0 13
294 13 THIS = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
295 else{
296 0 warn( "Math::Clipper::execute() -- THIS is not a blessed SV reference" );
297 0 XSRETURN_UNDEF;
298 }
299 ;
300  
301 13 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 9 4 13
302 9 subjFillType = pftEvenOdd;
303 else {
304 4 subjFillType = (PolyFillType)SvUV(ST(2))
305 ;
306 }
307  
308 13 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 9 4 13
309 9 clipFillType = pftEvenOdd;
310 else {
311 4 clipFillType = (PolyFillType)SvUV(ST(3))
312 ;
313 }
314 #line 82 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
315 RETVAL = new ClipperLib::Polygons();
316 THIS->Execute(clipType, *RETVAL, subjFillType, clipFillType);
317 #line 318 "buildtmp/Clipper.c"
318 {
319 SV * RETVALSV;
320 13 RETVALSV = polygons2perl(aTHX_ *RETVAL);
321 13 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 13 0 13
322 13 RETVALSV = sv_2mortal(RETVALSV);
323 13 ST(0) = RETVALSV;
324 }
325 }
326 13 XSRETURN(1);
327 }
328  
329  
330 XS_EUPXS(XS_Math__Clipper_ex_execute); /* prototype to pass -Wmissing-prototypes */
331 2 XS_EUPXS(XS_Math__Clipper_ex_execute)
332 {
333 2 dVAR; dXSARGS;
334 2 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 2 0 2
if (items < 2 || items > 4) 0 2 2
335 0 croak_xs_usage(cv, "THIS, clipType, subjFillType = pftEvenOdd, clipFillType = pftEvenOdd");
336 {
337 Clipper* THIS;
338 2 ClipType clipType = (ClipType)SvUV(ST(1))
339 ;
340 PolyFillType subjFillType;
341 PolyFillType clipFillType;
342 ExPolygons * RETVAL;
343  
344 2 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
345 2 THIS = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
346 else{
347 0 warn( "Math::Clipper::ex_execute() -- THIS is not a blessed SV reference" );
348 0 XSRETURN_UNDEF;
349 }
350 ;
351  
352 2 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 2 2
353 0 subjFillType = pftEvenOdd;
354 else {
355 2 subjFillType = (PolyFillType)SvUV(ST(2))
356 ;
357 }
358  
359 2 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 2 2
360 0 clipFillType = pftEvenOdd;
361 else {
362 2 clipFillType = (PolyFillType)SvUV(ST(3))
363 ;
364 }
365 #line 94 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
366 PolyTree* polytree = new ClipperLib::PolyTree();
367 THIS->Execute(clipType, *polytree, subjFillType, clipFillType);
368 RETVAL = new ExPolygons();
369 PolyTreeToExPolygons(*polytree, *RETVAL);
370 delete polytree;
371 #line 372 "buildtmp/Clipper.c"
372 {
373 SV * RETVALSV;
374 2 RETVALSV = expolygons2perl(aTHX_ *RETVAL);
375 2 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 2 0 2
376 2 RETVALSV = sv_2mortal(RETVALSV);
377 2 ST(0) = RETVALSV;
378 }
379 }
380 2 XSRETURN(1);
381 }
382  
383  
384 XS_EUPXS(XS_Math__Clipper_pt_execute); /* prototype to pass -Wmissing-prototypes */
385 2 XS_EUPXS(XS_Math__Clipper_pt_execute)
386 {
387 2 dVAR; dXSARGS;
388 2 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 2 0 2
if (items < 2 || items > 4) 0 2 2
389 0 croak_xs_usage(cv, "THIS, clipType, subjFillType = pftEvenOdd, clipFillType = pftEvenOdd");
390 {
391 Clipper* THIS;
392 2 ClipType clipType = (ClipType)SvUV(ST(1))
393 ;
394 PolyFillType subjFillType;
395 PolyFillType clipFillType;
396 ClipperLib::PolyTree * RETVAL;
397  
398 2 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
399 2 THIS = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
400 else{
401 0 warn( "Math::Clipper::pt_execute() -- THIS is not a blessed SV reference" );
402 0 XSRETURN_UNDEF;
403 }
404 ;
405  
406 2 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 2 0 2
407 2 subjFillType = pftEvenOdd;
408 else {
409 0 subjFillType = (PolyFillType)SvUV(ST(2))
410 ;
411 }
412  
413 2 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 2 0 2
414 2 clipFillType = pftEvenOdd;
415 else {
416 0 clipFillType = (PolyFillType)SvUV(ST(3))
417 ;
418 }
419 #line 109 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
420 RETVAL = new ClipperLib::PolyTree();
421 THIS->Execute(clipType, *RETVAL, subjFillType, clipFillType);
422 #line 423 "buildtmp/Clipper.c"
423 {
424 SV * RETVALSV;
425 2 RETVALSV = polytree2perl(aTHX_ *RETVAL);
426 2 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 2 0 2
427 2 RETVALSV = sv_2mortal(RETVALSV);
428 2 ST(0) = RETVALSV;
429 }
430 }
431 2 XSRETURN(1);
432 }
433  
434  
435 XS_EUPXS(XS_Math__Clipper_add_subject_polygon); /* prototype to pass -Wmissing-prototypes */
436 21 XS_EUPXS(XS_Math__Clipper_add_subject_polygon)
437 {
438 21 dVAR; dXSARGS;
439 21 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 21 21
440 0 croak_xs_usage(cv, "self, poly");
441 PERL_UNUSED_VAR(ax); /* -Wall */
442 21 SP -= items;
443 {
444 Clipper* self;
445 ClipperLib::Polygon* poly;
446  
447 21 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 21 0 21
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 21 0 21
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 21 0 21
448 21 self = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
449 else{
450 0 warn( "Math::Clipper::add_subject_polygon() -- self is not a blessed SV reference" );
451 0 XSRETURN_UNDEF;
452 }
453 ;
454  
455 21 ▶ if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 21 0 21
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 21 0 21
456 21 poly = perl2polygon(aTHX_ (AV*)SvRV(ST(1)));
457 21 ▶ if ((poly) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((poly) == NULL) { 0 21 21
458 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
459 "Math::Clipper::add_subject_polygon",
460 "poly");
461 }
462 }
463 else
464 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
465 "Math::Clipper::add_subject_polygon",
466 "poly")
467 ;
468 #line 130 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
469 self->AddPolygon(*poly, ptSubject);
470 delete poly;
471 #line 472 "buildtmp/Clipper.c"
472 21 PUTBACK;
473 21 return;
474 }
475 }
476  
477  
478 XS_EUPXS(XS_Math__Clipper_add_clip_polygon); /* prototype to pass -Wmissing-prototypes */
479 6 XS_EUPXS(XS_Math__Clipper_add_clip_polygon)
480 {
481 6 dVAR; dXSARGS;
482 6 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 6 6
483 0 croak_xs_usage(cv, "self, poly");
484 PERL_UNUSED_VAR(ax); /* -Wall */
485 6 SP -= items;
486 {
487 Clipper* self;
488 ClipperLib::Polygon* poly;
489  
490 6 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 6 0 6
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 6 0 6
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 6 0 6
491 6 self = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
492 else{
493 0 warn( "Math::Clipper::add_clip_polygon() -- self is not a blessed SV reference" );
494 0 XSRETURN_UNDEF;
495 }
496 ;
497  
498 6 ▶ if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 6 0 6
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 6 0 6
499 6 poly = perl2polygon(aTHX_ (AV*)SvRV(ST(1)));
500 6 ▶ if ((poly) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((poly) == NULL) { 0 6 6
501 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
502 "Math::Clipper::add_clip_polygon",
503 "poly");
504 }
505 }
506 else
507 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
508 "Math::Clipper::add_clip_polygon",
509 "poly")
510 ;
511 #line 138 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
512 self->AddPolygon(*poly, ptClip);
513 delete poly;
514 #line 515 "buildtmp/Clipper.c"
515 6 PUTBACK;
516 6 return;
517 }
518 }
519  
520  
521 XS_EUPXS(XS_Math__Clipper_add_subject_polygons); /* prototype to pass -Wmissing-prototypes */
522 2 XS_EUPXS(XS_Math__Clipper_add_subject_polygons)
523 {
524 2 dVAR; dXSARGS;
525 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
526 0 croak_xs_usage(cv, "self, polys");
527 PERL_UNUSED_VAR(ax); /* -Wall */
528 2 SP -= items;
529 {
530 Clipper* self;
531 ClipperLib::Polygons* polys;
532  
533 2 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 2 0 2
534 2 self = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
535 else{
536 0 warn( "Math::Clipper::add_subject_polygons() -- self is not a blessed SV reference" );
537 0 XSRETURN_UNDEF;
538 }
539 ;
540  
541 2 ▶ if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 2 0 2
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 2 0 2
542 2 polys = perl2polygons(aTHX_ (AV*)SvRV(ST(1)));
543 2 ▶ if ((polys) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polys) == NULL) { 0 2 2
544 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
545 "Math::Clipper::add_subject_polygons",
546 "polys");
547 }
548 }
549 else
550 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
551 "Math::Clipper::add_subject_polygons",
552 "polys")
553 ;
554 #line 146 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
555 self->AddPolygons(*polys, ptSubject);
556 delete polys;
557 #line 558 "buildtmp/Clipper.c"
558 2 PUTBACK;
559 2 return;
560 }
561 }
562  
563  
564 XS_EUPXS(XS_Math__Clipper_add_clip_polygons); /* prototype to pass -Wmissing-prototypes */
565 0 XS_EUPXS(XS_Math__Clipper_add_clip_polygons)
566 {
567 0 dVAR; dXSARGS;
568 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
569 0 croak_xs_usage(cv, "self, polys");
570 PERL_UNUSED_VAR(ax); /* -Wall */
571 0 SP -= items;
572 {
573 Clipper* self;
574 ClipperLib::Polygons* polys;
575  
576 0 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 0 0 0
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 0 0 0
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 0 0 0
577 0 self = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
578 else{
579 0 warn( "Math::Clipper::add_clip_polygons() -- self is not a blessed SV reference" );
580 0 XSRETURN_UNDEF;
581 }
582 ;
583  
584 0 ▶ if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 0 0 0
if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) { 0 0 0
585 0 polys = perl2polygons(aTHX_ (AV*)SvRV(ST(1)));
586 0 ▶ if ((polys) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polys) == NULL) { 0 0 0
587 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
588 "Math::Clipper::add_clip_polygons",
589 "polys");
590 }
591 }
592 else
593 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
594 "Math::Clipper::add_clip_polygons",
595 "polys")
596 ;
597 #line 154 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
598 self->AddPolygons(*polys, ptClip);
599 delete polys;
600 #line 601 "buildtmp/Clipper.c"
601 0 PUTBACK;
602 0 return;
603 }
604 }
605  
606  
607 XS_EUPXS(XS_Math__Clipper_orientation); /* prototype to pass -Wmissing-prototypes */
608 12 XS_EUPXS(XS_Math__Clipper_orientation)
609 {
610 12 dVAR; dXSARGS;
611 12 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 12 12
612 0 croak_xs_usage(cv, "polygon");
613 {
614 ClipperLib::Polygon* polygon;
615 double RETVAL;
616 12 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 12 0 12
617  
618 12 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 12 0 12
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 12 0 12
619 12 polygon = perl2polygon(aTHX_ (AV*)SvRV(ST(0)));
620 12 ▶ if ((polygon) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygon) == NULL) { 0 12 12
621 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
622 "Math::Clipper::orientation",
623 "polygon");
624 }
625 }
626 else
627 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
628 "Math::Clipper::orientation",
629 "polygon")
630 ;
631 #line 161 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
632 RETVAL = ClipperLib::Orientation(*polygon);
633 delete polygon;
634 #line 635 "buildtmp/Clipper.c"
635 12 ▶ TARGn((NV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGn((NV)RETVAL, 1); 3 9 12
636 12 ST(0) = TARG;
637 }
638 12 XSRETURN(1);
639 }
640  
641  
642 XS_EUPXS(XS_Math__Clipper_area); /* prototype to pass -Wmissing-prototypes */
643 25 XS_EUPXS(XS_Math__Clipper_area)
644 {
645 25 dVAR; dXSARGS;
646 25 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 25 25
647 0 croak_xs_usage(cv, "polygon");
648 {
649 ClipperLib::Polygon* polygon;
650 double RETVAL;
651 25 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 25 0 25
652  
653 25 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 25 0 25
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 25 0 25
654 25 polygon = perl2polygon(aTHX_ (AV*)SvRV(ST(0)));
655 25 ▶ if ((polygon) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygon) == NULL) { 0 25 25
656 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
657 "Math::Clipper::area",
658 "polygon");
659 }
660 }
661 else
662 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
663 "Math::Clipper::area",
664 "polygon")
665 ;
666 #line 169 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
667 RETVAL = ClipperLib::Area(*polygon);
668 delete polygon;
669 #line 670 "buildtmp/Clipper.c"
670 25 ▶ TARGn((NV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGn((NV)RETVAL, 1); 0 25 25
671 25 ST(0) = TARG;
672 }
673 25 XSRETURN(1);
674 }
675  
676  
677 XS_EUPXS(XS_Math__Clipper__offset); /* prototype to pass -Wmissing-prototypes */
678 5 XS_EUPXS(XS_Math__Clipper__offset)
679 {
680 5 dVAR; dXSARGS;
681 5 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 5 5
682 0 croak_xs_usage(cv, "polygons, delta, jointype, MiterLimit");
683 {
684 ClipperLib::Polygons* polygons;
685 5 const float delta = (const float)SvNV(ST(1))
686 ;
687 5 JoinType jointype = (JoinType)SvUV(ST(2))
688 ;
689 5 const double MiterLimit = (const double)SvNV(ST(3))
690 ;
691 ClipperLib::Polygons * RETVAL;
692  
693 5 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 5 0 5
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 5 0 5
694 5 polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0)));
695 5 ▶ if ((polygons) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygons) == NULL) { 0 5 5
696 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
697 "Math::Clipper::_offset",
698 "polygons");
699 }
700 }
701 else
702 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
703 "Math::Clipper::_offset",
704 "polygons")
705 ;
706 #line 180 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
707 RETVAL = new ClipperLib::Polygons();
708 ClipperLib::OffsetPolygons(*polygons, *RETVAL, delta, jointype, MiterLimit);
709 delete polygons;
710 #line 711 "buildtmp/Clipper.c"
711 {
712 SV * RETVALSV;
713 5 RETVALSV = polygons2perl(aTHX_ *RETVAL);
714 5 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 5 0 5
715 5 RETVALSV = sv_2mortal(RETVALSV);
716 5 ST(0) = RETVALSV;
717 }
718 }
719 5 XSRETURN(1);
720 }
721  
722  
723 XS_EUPXS(XS_Math__Clipper_int_offset); /* prototype to pass -Wmissing-prototypes */
724 2 XS_EUPXS(XS_Math__Clipper_int_offset)
725 {
726 2 dVAR; dXSARGS;
727 2 ▶ if (items != 5)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 5) 0 2 2
728 0 croak_xs_usage(cv, "polygons, delta, scale, jointype, MiterLimit");
729 {
730 ClipperLib::Polygons* polygons;
731 2 const float delta = (const float)SvNV(ST(1))
732 ;
733 2 const double scale = (const double)SvNV(ST(2))
734 ;
735 2 JoinType jointype = (JoinType)SvUV(ST(3))
736 ;
737 2 const double MiterLimit = (const double)SvNV(ST(4))
738 ;
739 ClipperLib::Polygons * RETVAL;
740  
741 2 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 2 0 2
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 2 0 2
742 2 polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0)));
743 2 ▶ if ((polygons) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygons) == NULL) { 0 2 2
744 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
745 "Math::Clipper::int_offset",
746 "polygons");
747 }
748 }
749 else
750 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
751 "Math::Clipper::int_offset",
752 "polygons")
753 ;
754 #line 194 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
755 RETVAL = _int_offset(polygons, delta, scale, jointype, MiterLimit);
756 delete polygons;
757 #line 758 "buildtmp/Clipper.c"
758 {
759 SV * RETVALSV;
760 2 RETVALSV = polygons2perl(aTHX_ *RETVAL);
761 2 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 2 0 2
762 2 RETVALSV = sv_2mortal(RETVALSV);
763 2 ST(0) = RETVALSV;
764 }
765 }
766 2 XSRETURN(1);
767 }
768  
769  
770 XS_EUPXS(XS_Math__Clipper_int_offset2); /* prototype to pass -Wmissing-prototypes */
771 1 XS_EUPXS(XS_Math__Clipper_int_offset2)
772 {
773 1 dVAR; dXSARGS;
774 1 ▶ if (items != 6)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 6) 0 1 1
775 0 croak_xs_usage(cv, "polygons, delta1, delta2, scale, jointype, MiterLimit");
776 {
777 ClipperLib::Polygons* polygons;
778 1 const float delta1 = (const float)SvNV(ST(1))
779 ;
780 1 const float delta2 = (const float)SvNV(ST(2))
781 ;
782 1 const double scale = (const double)SvNV(ST(3))
783 ;
784 1 JoinType jointype = (JoinType)SvUV(ST(4))
785 ;
786 1 const double MiterLimit = (const double)SvNV(ST(5))
787 ;
788 ClipperLib::Polygons * RETVAL;
789  
790 1 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
791 1 polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0)));
792 1 ▶ if ((polygons) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygons) == NULL) { 0 1 1
793 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
794 "Math::Clipper::int_offset2",
795 "polygons");
796 }
797 }
798 else
799 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
800 "Math::Clipper::int_offset2",
801 "polygons")
802 ;
803 #line 208 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
804 // scale
805 _scale_polygons(polygons, scale);
806  
807 // perform first offset
808 ClipperLib::Polygons* offset1 = new ClipperLib::Polygons();
809 ClipperLib::OffsetPolygons(*polygons, *offset1, (delta1*scale), jointype, MiterLimit);
810  
811 // perform second offset
812 RETVAL = new ClipperLib::Polygons();
813 ClipperLib::OffsetPolygons(*offset1, *RETVAL, (delta2*scale), jointype, MiterLimit);
814  
815 // unscale
816 _scale_polygons(RETVAL, 1/scale);
817  
818 // cleanup
819 delete offset1;
820 delete polygons;
821 #line 822 "buildtmp/Clipper.c"
822 {
823 SV * RETVALSV;
824 1 RETVALSV = polygons2perl(aTHX_ *RETVAL);
825 1 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 1 0 1
826 1 RETVALSV = sv_2mortal(RETVALSV);
827 1 ST(0) = RETVALSV;
828 }
829 }
830 1 XSRETURN(1);
831 }
832  
833  
834 XS_EUPXS(XS_Math__Clipper_ex_int_offset); /* prototype to pass -Wmissing-prototypes */
835 1 XS_EUPXS(XS_Math__Clipper_ex_int_offset)
836 {
837 1 dVAR; dXSARGS;
838 1 ▶ if (items != 5)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 5) 0 1 1
839 0 croak_xs_usage(cv, "polygons, delta, scale, jointype, MiterLimit");
840 {
841 ClipperLib::Polygons* polygons;
842 1 ▶ const float delta = (const float)SvNV(ST(1))
Branch: 1 branch
BranchTrueFalseTotal
const float delta = (const float)SvNV(ST(1)) 1 0 1
843 ;
844 1 ▶ const double scale = (const double)SvNV(ST(2))
Branch: 1 branch
BranchTrueFalseTotal
const double scale = (const double)SvNV(ST(2)) 1 0 1
845 ;
846 1 ▶ JoinType jointype = (JoinType)SvUV(ST(3))
Branch: 1 branch
BranchTrueFalseTotal
JoinType jointype = (JoinType)SvUV(ST(3)) 1 0 1
847 ;
848 1 ▶ const double MiterLimit = (const double)SvNV(ST(4))
Branch: 1 branch
BranchTrueFalseTotal
const double MiterLimit = (const double)SvNV(ST(4)) 1 0 1
849 ;
850 ExPolygons * RETVAL;
851  
852 1 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
853 1 ▶ polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0)));
Branch: 1 branch
BranchTrueFalseTotal
polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0))); 1 0 1
854 1 ▶ if ((polygons) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygons) == NULL) { 0 1 1
855 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
856 "Math::Clipper::ex_int_offset",
857 "polygons");
858 }
859 }
860 else
861 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
862 "Math::Clipper::ex_int_offset",
863 "polygons")
864 ;
865 #line 236 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
866 Clipper clpr;
867 clpr.Clear();
868 ClipperLib::Polygons* offset = _int_offset(polygons, delta, scale, jointype, MiterLimit);
869 clpr.AddPolygons(*offset, ptSubject);
870 PolyTree* polytree = new ClipperLib::PolyTree();
871 clpr.Execute(ctUnion, *polytree, pftEvenOdd, pftEvenOdd); // offset results work with both EvenOdd and NonZero
872  
873 RETVAL = new ExPolygons();
874 PolyTreeToExPolygons(*polytree, *RETVAL);
875  
876 // cleanup
877 delete polygons;
878 delete offset;
879 delete polytree;
880 #line 881 "buildtmp/Clipper.c"
881 {
882 SV * RETVALSV;
883 1 ▶ RETVALSV = expolygons2perl(aTHX_ *RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = expolygons2perl(aTHX_ *RETVAL); 1 0 1
884 1 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 1 0 1
885 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
886 1 ST(0) = RETVALSV;
887 }
888 1 }
889 1 XSRETURN(1);
890 }
891  
892  
893 XS_EUPXS(XS_Math__Clipper_ex_int_offset2); /* prototype to pass -Wmissing-prototypes */
894 1 XS_EUPXS(XS_Math__Clipper_ex_int_offset2)
895 {
896 1 dVAR; dXSARGS;
897 1 ▶ if (items != 6)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 6) 0 1 1
898 0 croak_xs_usage(cv, "polygons, delta1, delta2, scale, jointype, MiterLimit");
899 {
900 ClipperLib::Polygons* polygons;
901 1 ▶ const float delta1 = (const float)SvNV(ST(1))
Branch: 1 branch
BranchTrueFalseTotal
const float delta1 = (const float)SvNV(ST(1)) 1 0 1
902 ;
903 1 ▶ const float delta2 = (const float)SvNV(ST(2))
Branch: 1 branch
BranchTrueFalseTotal
const float delta2 = (const float)SvNV(ST(2)) 1 0 1
904 ;
905 1 ▶ const double scale = (const double)SvNV(ST(3))
Branch: 1 branch
BranchTrueFalseTotal
const double scale = (const double)SvNV(ST(3)) 1 0 1
906 ;
907 1 ▶ JoinType jointype = (JoinType)SvUV(ST(4))
Branch: 1 branch
BranchTrueFalseTotal
JoinType jointype = (JoinType)SvUV(ST(4)) 1 0 1
908 ;
909 1 ▶ const double MiterLimit = (const double)SvNV(ST(5))
Branch: 1 branch
BranchTrueFalseTotal
const double MiterLimit = (const double)SvNV(ST(5)) 1 0 1
910 ;
911 ExPolygons * RETVAL;
912  
913 1 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
914 1 ▶ polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0)));
Branch: 1 branch
BranchTrueFalseTotal
polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0))); 1 0 1
915 1 ▶ if ((polygons) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygons) == NULL) { 0 1 1
916 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
917 "Math::Clipper::ex_int_offset2",
918 "polygons");
919 }
920 }
921 else
922 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
923 "Math::Clipper::ex_int_offset2",
924 "polygons")
925 ;
926 #line 262 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
927 // scale
928 _scale_polygons(polygons, scale);
929  
930 // perform first offset
931 ClipperLib::Polygons* offset1 = new ClipperLib::Polygons();
932 ClipperLib::OffsetPolygons(*polygons, *offset1, (delta1*scale), jointype, MiterLimit);
933  
934 // perform second offset
935 ClipperLib::Polygons* offset2 = new ClipperLib::Polygons();
936 ClipperLib::OffsetPolygons(*offset1, *offset2, (delta2*scale), jointype, MiterLimit);
937  
938 // unscale
939 _scale_polygons(offset2, 1/scale);
940  
941 // perform UNION
942 Clipper clpr;
943 clpr.Clear();
944 clpr.AddPolygons(*offset2, ptSubject);
945 PolyTree* polytree = new ClipperLib::PolyTree();
946 clpr.Execute(ctUnion, *polytree, pftEvenOdd, pftEvenOdd); // offset results work with both EvenOdd and NonZero
947  
948 // convert result to ExPolygons
949 RETVAL = new ExPolygons();
950 PolyTreeToExPolygons(*polytree, *RETVAL);
951  
952 // cleanup
953 delete polygons;
954 delete offset1;
955 delete offset2;
956 delete polytree;
957 #line 958 "buildtmp/Clipper.c"
958 {
959 SV * RETVALSV;
960 1 ▶ RETVALSV = expolygons2perl(aTHX_ *RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = expolygons2perl(aTHX_ *RETVAL); 1 0 1
961 1 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 1 0 1
962 1 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 1 0 1
963 1 ST(0) = RETVALSV;
964 }
965 1 }
966 1 XSRETURN(1);
967 }
968  
969  
970 XS_EUPXS(XS_Math__Clipper_simplify_polygon); /* prototype to pass -Wmissing-prototypes */
971 1 XS_EUPXS(XS_Math__Clipper_simplify_polygon)
972 {
973 1 dVAR; dXSARGS;
974 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
975 0 croak_xs_usage(cv, "polygon, fillType");
976 {
977 ClipperLib::Polygon* polygon;
978 1 PolyFillType fillType = (PolyFillType)SvUV(ST(1))
979 ;
980 ClipperLib::Polygons * RETVAL;
981  
982 1 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
983 1 polygon = perl2polygon(aTHX_ (AV*)SvRV(ST(0)));
984 1 ▶ if ((polygon) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygon) == NULL) { 0 1 1
985 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
986 "Math::Clipper::simplify_polygon",
987 "polygon");
988 }
989 }
990 else
991 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
992 "Math::Clipper::simplify_polygon",
993 "polygon")
994 ;
995 #line 300 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
996 RETVAL = new ClipperLib::Polygons();
997 ClipperLib::SimplifyPolygon(*polygon, *RETVAL, fillType);
998 delete polygon;
999 #line 1000 "buildtmp/Clipper.c"
1000 {
1001 SV * RETVALSV;
1002 1 RETVALSV = polygons2perl(aTHX_ *RETVAL);
1003 1 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 1 0 1
1004 1 RETVALSV = sv_2mortal(RETVALSV);
1005 1 ST(0) = RETVALSV;
1006 }
1007 }
1008 1 XSRETURN(1);
1009 }
1010  
1011  
1012 XS_EUPXS(XS_Math__Clipper_simplify_polygons); /* prototype to pass -Wmissing-prototypes */
1013 1 XS_EUPXS(XS_Math__Clipper_simplify_polygons)
1014 {
1015 1 dVAR; dXSARGS;
1016 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
1017 0 croak_xs_usage(cv, "polygons, fillType");
1018 {
1019 ClipperLib::Polygons* polygons;
1020 1 PolyFillType fillType = (PolyFillType)SvUV(ST(1))
1021 ;
1022 ClipperLib::Polygons * RETVAL;
1023  
1024 1 ▶ if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
if (SvROK(ST(0)) && SvTYPE(SvRV(ST(0)))==SVt_PVAV) { 1 0 1
1025 1 polygons = perl2polygons(aTHX_ (AV*)SvRV(ST(0)));
1026 1 ▶ if ((polygons) == NULL) {
Branch: 1 branch
BranchTrueFalseTotal
if ((polygons) == NULL) { 0 1 1
1027 0 Perl_croak(aTHX_ "%s: %s is not an array reference or contains invalid data",
1028 "Math::Clipper::simplify_polygons",
1029 "polygons");
1030 }
1031 }
1032 else
1033 0 Perl_croak(aTHX_ "%s: %s is not an array reference",
1034 "Math::Clipper::simplify_polygons",
1035 "polygons")
1036 ;
1037 #line 311 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
1038 RETVAL = new ClipperLib::Polygons();
1039 ClipperLib::SimplifyPolygons(*polygons, *RETVAL, fillType);
1040 delete polygons;
1041 #line 1042 "buildtmp/Clipper.c"
1042 {
1043 SV * RETVALSV;
1044 1 RETVALSV = polygons2perl(aTHX_ *RETVAL);
1045 1 ▶ delete RETVAL;
Branch: 1 branch
BranchTrueFalseTotal
delete RETVAL; 1 0 1
1046 1 RETVALSV = sv_2mortal(RETVALSV);
1047 1 ST(0) = RETVALSV;
1048 }
1049 }
1050 1 XSRETURN(1);
1051 }
1052  
1053  
1054 XS_EUPXS(XS_Math__Clipper__floor); /* prototype to pass -Wmissing-prototypes */
1055 39 XS_EUPXS(XS_Math__Clipper__floor)
1056 {
1057 39 dVAR; dXSARGS;
1058 39 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 39 39
1059 0 croak_xs_usage(cv, "x");
1060 {
1061 39 ▶ SV * x = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * x = ST(0) 10 29 39
1062 ;
1063 SV * RETVAL;
1064 #line 321 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
1065 RETVAL = SvNOK(x) ? newSVnv(Perl_floor(SvNV(x))) : newSViv(SvIV(x));
1066 #line 1067 "buildtmp/Clipper.c"
1067 39 RETVAL = sv_2mortal(RETVAL);
1068 39 ST(0) = RETVAL;
1069 }
1070 39 XSRETURN(1);
1071 }
1072  
1073  
1074 XS_EUPXS(XS_Math__Clipper_clear); /* prototype to pass -Wmissing-prototypes */
1075 12 XS_EUPXS(XS_Math__Clipper_clear)
1076 {
1077 12 dVAR; dXSARGS;
1078 12 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 12 12
1079 0 croak_xs_usage(cv, "THIS");
1080 {
1081 Clipper * THIS;
1082  
1083 12 ▶ if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
Branch: 3 branches
BranchTrueFalseTotal
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 12 0 12
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 12 0 12
if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) ) 12 0 12
1084 12 THIS = (Clipper *)SvIV((SV*)SvRV( ST(0) ));
1085 else{
1086 0 warn( "Math::Clipper::clear() -- THIS is not a blessed SV reference" );
1087 0 XSRETURN_UNDEF;
1088 }
1089 ;
1090 #line 330 "/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt\" \"/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp\""
1091 try {
1092 THIS->Clear();
1093 }
1094 catch (std::exception& e) {
1095 croak("Caught C++ exception of type or derived from 'std::exception': %s", e.what());
1096 }
1097 catch (...) {
1098 croak("Caught C++ exception of unknown type");
1099 }
1100 #line 1101 "buildtmp/Clipper.c"
1101 }
1102 12 XSRETURN_EMPTY;
1103 }
1104  
1105  
1106 /* INCLUDE: Returning to 'main.xs' from '/usr/local/bin/perl -MExtUtils::XSpp::Cmd -e xspp -- -t "/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/types.xspt" "/home/cpancover/.cpan/build/Math-Clipper-1.30-0/xsp/Clipper.xsp"' */
1107  
1108 #ifdef __cplusplus
1109 extern "C" {
1110 #endif
1111 XS_EXTERNAL(boot_Math__Clipper); /* prototype to pass -Wmissing-prototypes */
1112 12 XS_EXTERNAL(boot_Math__Clipper)
1113 {
1114 #if PERL_VERSION_LE(5, 21, 5)
1115 dVAR; dXSARGS;
1116 #else
1117 12 dVAR; dXSBOOTARGSXSAPIVERCHK;
1118 #endif
1119 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
1120 char* file = __FILE__;
1121 #else
1122 12 const char* file = __FILE__;
1123 #endif
1124  
1125 PERL_UNUSED_VAR(file);
1126  
1127 PERL_UNUSED_VAR(cv); /* -W */
1128 PERL_UNUSED_VAR(items); /* -W */
1129 #if PERL_VERSION_LE(5, 21, 5)
1130 XS_VERSION_BOOTCHECK;
1131 # ifdef XS_APIVERSION_BOOTCHECK
1132 XS_APIVERSION_BOOTCHECK;
1133 # endif
1134 #endif
1135  
1136 {
1137 CV * cv;
1138  
1139 12 cv = newXS_deffile("Math::Clipper::CT_DIFFERENCE", XS_Math__Clipper__constant);
1140 12 XSANY.any_i32 = ctDifference;
1141 12 cv = newXS_deffile("Math::Clipper::CT_INTERSECTION", XS_Math__Clipper__constant);
1142 12 XSANY.any_i32 = ctIntersection;
1143 12 cv = newXS_deffile("Math::Clipper::CT_UNION", XS_Math__Clipper__constant);
1144 12 XSANY.any_i32 = ctUnion;
1145 12 cv = newXS_deffile("Math::Clipper::CT_XOR", XS_Math__Clipper__constant);
1146 12 XSANY.any_i32 = ctXor;
1147 12 cv = newXS_deffile("Math::Clipper::JT_MITER", XS_Math__Clipper__constant);
1148 12 XSANY.any_i32 = jtMiter;
1149 12 cv = newXS_deffile("Math::Clipper::JT_ROUND", XS_Math__Clipper__constant);
1150 12 XSANY.any_i32 = jtRound;
1151 12 cv = newXS_deffile("Math::Clipper::JT_SQUARE", XS_Math__Clipper__constant);
1152 12 XSANY.any_i32 = jtSquare;
1153 12 cv = newXS_deffile("Math::Clipper::PFT_EVENODD", XS_Math__Clipper__constant);
1154 12 XSANY.any_i32 = pftEvenOdd;
1155 12 cv = newXS_deffile("Math::Clipper::PFT_NEGATIVE", XS_Math__Clipper__constant);
1156 12 XSANY.any_i32 = pftNegative;
1157 12 cv = newXS_deffile("Math::Clipper::PFT_NONZERO", XS_Math__Clipper__constant);
1158 12 XSANY.any_i32 = pftNonZero;
1159 12 cv = newXS_deffile("Math::Clipper::PFT_POSITIVE", XS_Math__Clipper__constant);
1160 12 XSANY.any_i32 = pftPositive;
1161 12 cv = newXS_deffile("Math::Clipper::PT_CLIP", XS_Math__Clipper__constant);
1162 12 XSANY.any_i32 = ptClip;
1163 12 cv = newXS_deffile("Math::Clipper::PT_SUBJECT", XS_Math__Clipper__constant);
1164 12 XSANY.any_i32 = ptSubject;
1165 12 cv = newXS_deffile("Math::Clipper::_constant", XS_Math__Clipper__constant);
1166 12 XSANY.any_i32 = 0;
1167 12 newXS_deffile("Math::Clipper::new", XS_Math__Clipper_new);
1168 12 newXS_deffile("Math::Clipper::DESTROY", XS_Math__Clipper_DESTROY);
1169 12 newXS_deffile("Math::Clipper::execute", XS_Math__Clipper_execute);
1170 12 newXS_deffile("Math::Clipper::ex_execute", XS_Math__Clipper_ex_execute);
1171 12 newXS_deffile("Math::Clipper::pt_execute", XS_Math__Clipper_pt_execute);
1172 12 newXS_deffile("Math::Clipper::add_subject_polygon", XS_Math__Clipper_add_subject_polygon);
1173 12 newXS_deffile("Math::Clipper::add_clip_polygon", XS_Math__Clipper_add_clip_polygon);
1174 12 newXS_deffile("Math::Clipper::add_subject_polygons", XS_Math__Clipper_add_subject_polygons);
1175 12 newXS_deffile("Math::Clipper::add_clip_polygons", XS_Math__Clipper_add_clip_polygons);
1176 12 newXS_deffile("Math::Clipper::orientation", XS_Math__Clipper_orientation);
1177 12 newXS_deffile("Math::Clipper::area", XS_Math__Clipper_area);
1178 12 newXS_deffile("Math::Clipper::_offset", XS_Math__Clipper__offset);
1179 12 newXS_deffile("Math::Clipper::int_offset", XS_Math__Clipper_int_offset);
1180 12 newXS_deffile("Math::Clipper::int_offset2", XS_Math__Clipper_int_offset2);
1181 12 newXS_deffile("Math::Clipper::ex_int_offset", XS_Math__Clipper_ex_int_offset);
1182 12 newXS_deffile("Math::Clipper::ex_int_offset2", XS_Math__Clipper_ex_int_offset2);
1183 12 newXS_deffile("Math::Clipper::simplify_polygon", XS_Math__Clipper_simplify_polygon);
1184 12 newXS_deffile("Math::Clipper::simplify_polygons", XS_Math__Clipper_simplify_polygons);
1185 12 newXS_deffile("Math::Clipper::_floor", XS_Math__Clipper__floor);
1186 12 newXS_deffile("Math::Clipper::clear", XS_Math__Clipper_clear);
1187 }
1188 #if PERL_VERSION_LE(5, 21, 5)
1189 # if PERL_VERSION_GE(5, 9, 0)
1190 if (PL_unitcheckav)
1191 call_list(PL_scopestack_ix, PL_unitcheckav);
1192 # endif
1193 XSRETURN_YES;
1194 #else
1195 12 Perl_xs_boot_epilog(aTHX_ ax);
1196 #endif
1197 12 }
1198  
1199 #ifdef __cplusplus
1200 }
1201 #endif
« src/poly2av.h ↑ Summary src/myinit.h »