XS.xs

filter: Statementstmt 76.7% 33 / 43 Branchbran 68.1% 15 / 22 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 73.8% 48 / 65 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« const-xs.inc ↑ Summary
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4  
5 #include "ppport.h"
6  
7 #include "const-c.inc"
8  
9 6 int _mycall (char* methodname, SV* args[], int argc)
10 6 {
11 int i;
12 int result_count;
13
14 6 ▶ if (! sv_isobject(args[0]))
Branch: 1 branch
BranchTrueFalseTotal
if (! sv_isobject(args[0])) 2 4 6
15 {
16 2 return 0;
17 }
18
19 4 dSP;
20 4 SP -= argc;
21
22 // Prepare to call method
23 4 ENTER;
24 4 SAVETMPS;
25 4 ▶ PUSHMARK(SP);
Branch: 1 branch
BranchTrueFalseTotal
PUSHMARK(SP); 0 4 4
26 12 ▶ for (i=0; i<argc; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i=0; i<argc; i++) 8 4 12
27 {
28 8 ▶ XPUSHs(args[i]);
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(args[i]); 0 8 8
29 }
30 4 PUTBACK;
31
32 // Call method
33 4 result_count = call_method(methodname, GIMME_V);
34 4 SPAGAIN;
35
36 // Unpack return results
37 4 SV* ret[result_count];
38 8 ▶ for (i=0; i<result_count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i=0; i<result_count; i++) 4 4 8
39 {
40 4 ret[i] = POPs;
41 }
42 4 PUTBACK;
43
44 // Return results
45 8 ▶ for (i=result_count-1; i>=0; i--)
Branch: 1 branch
BranchTrueFalseTotal
for (i=result_count-1; i>=0; i--) 4 4 8
46 {
47 4 ▶ XPUSHs(ret[i]);
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(ret[i]); 0 4 4
48 }
49 4 PUTBACK;
50 // FREETMPS;
51 4 LEAVE;
52
53 4 return result_count;
54 }
55  
56 MODULE = Safe::Isa::XS PACKAGE = Safe::Isa::XS
57  
58 INCLUDE: const-xs.inc
59  
60 void
61 _isa (obj, ...)
62 SV *obj
63 PPCODE:
64 3 {
65 3 SV* args[items];
66 int i;
67 9 ▶ for (i = 0; i < items; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < items; i++) { 6 3 9
68 6 args[i] = ST(i);
69 }
70 3 XSRETURN( _mycall("isa", args, items) );
71 }
72  
73 void
74 _can (obj, ...)
75 SV *obj
76 PPCODE:
77 3 {
78 3 SV* args[items];
79 int i;
80 9 ▶ for (i = 0; i < items; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < items; i++) { 6 3 9
81 6 args[i] = ST(i);
82 }
83 3 XSRETURN( _mycall("can", args, items) );
84 }
85  
86 void
87 _does (obj, ...)
88 SV *obj
89 PPCODE:
90 0 {
91 0 SV* args[items];
92 int i;
93 0 ▶ for (i = 0; i < items; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < items; i++) { 0 0 0
94 0 args[i] = ST(i);
95 }
96 0 XSRETURN( _mycall("does", args, items) );
97 }
98  
99 void
100 _DOES (obj, ...)
101 SV *obj
102 PPCODE:
103 0 {
104 0 SV* args[items];
105 int i;
106 0 ▶ for (i = 0; i < items; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < items; i++) { 0 0 0
107 0 args[i] = ST(i);
108 }
109 0 XSRETURN( _mycall("DOES", args, items) );
110 }
« const-xs.inc ↑ Summary