File Coverage

Framework.xs
Criterion Covered Total %
statement 42 43 97.6
branch 60 104 57.6
condition n/a
subroutine n/a
pod n/a
total 102 147 69.3


line stmt bran cond sub pod time code
1             #include
2             #include
3              
4             using namespace xs;
5             using panda::ErrorCode;
6              
7             MODULE = XS::Framework PACKAGE = XS::Framework
8             PROTOTYPES: DISABLE
9              
10             BOOT {
11 36           xs::typemap::object::init();
12             }
13              
14             void __at_perl_destroy () {
15 36           xs::__call_at_perl_destroy();
16             }
17              
18             void __at_thread_create () {
19 0           xs::__call_at_thread_create();
20             }
21              
22             void sv_payload_attach (Scalar sv, SV* payload) {
23 2 50         sv.payload_detach(Sv::default_marker());
    50          
24 2 50         sv.payload_attach(payload, Sv::default_marker());
    50          
25             }
26            
27             bool sv_payload_exists (Scalar sv) {
28 5 50         RETVAL = sv.payload_exists(Sv::default_marker());
29             }
30            
31             void sv_payload (Scalar sv) {
32 3 50         SV* ret = sv.payload(Sv::default_marker()).obj;
33 3 50         if (!ret) XSRETURN_UNDEF;
34 3           ST(0) = ret;
35 3           XSRETURN(1);
36             }
37              
38             int sv_payload_detach (Scalar sv) {
39 1 50         RETVAL = sv.payload_detach(Sv::default_marker());
    50          
40             }
41              
42             void rv_payload_attach (Ref rv, SV* payload) {
43 2 50         if (!rv) throw "argument is not a reference";
44 2 50         rv.value().payload_detach(Sv::default_marker());
    50          
45 2 50         rv.value().payload_attach(payload, Sv::default_marker());
    50          
46             }
47            
48             bool rv_payload_exists (Ref rv) {
49 5 50         if (!rv) throw "argument is not a reference";
50 5 50         RETVAL = rv.value().payload_exists(Sv::default_marker());
51             }
52            
53             void rv_payload (Ref rv) {
54 3 50         if (!rv) throw "argument is not a reference";
55 3 50         SV* ret = rv.value().payload(Sv::default_marker()).obj;
56 3 50         if (!ret) XSRETURN_UNDEF;
57 3           ST(0) = ret;
58 3           XSRETURN(1);
59             }
60              
61             int rv_payload_detach (Ref rv) {
62 1 50         if (!rv) throw "argument is not a reference";
63 1 50         RETVAL = rv.value().payload_detach(Sv::default_marker());
    50          
64             }
65              
66             void any_payload_attach (Sv sv, SV* payload) {
67 4 100         if (sv.is_ref()) sv = Ref(sv).value();
    50          
68 4 50         sv.payload_detach(Sv::default_marker());
    50          
69 4 50         sv.payload_attach(payload, Sv::default_marker());
    50          
70             }
71            
72             bool any_payload_exists (Sv sv) {
73 10 100         if (sv.is_ref()) sv = Ref(sv).value();
    50          
74 10 50         RETVAL = sv.payload_exists(Sv::default_marker());
75             }
76            
77             SV* any_payload (Sv sv) {
78 3 100         if (sv.is_ref()) sv = Ref(sv).value();
    50          
79 3 50         SV* ret = sv.payload(Sv::default_marker()).obj;
80 3 50         if (!ret) XSRETURN_UNDEF;
81 3           ST(0) = ret;
82 3 50         XSRETURN(1);
83             }
84              
85             int any_payload_detach (Sv sv) {
86 2 100         if (sv.is_ref()) sv = Ref(sv).value();
    50          
87 2 50         RETVAL = sv.payload_detach(Sv::default_marker());
    50          
88             }
89              
90             void obj2hv (Ref rv) {
91 6 50         if (!rv) throw "argument is not a reference";
92 12           auto sv = rv.value();
93 6 100         if (SvOK(sv)) throw "only references to undefs can be upgraded";
    50          
    50          
    100          
94 4 50         sv.upgrade(SVt_PVHV);
95             }
96              
97             void obj2av (Ref rv) {
98 2 50         if (!rv) throw "argument is not a reference";
99 4           auto sv = rv.value();
100 2 100         if (SvOK(sv)) throw "only references to undefs can be upgraded";
    50          
    50          
    100          
101 1 50         sv.upgrade(SVt_PVAV);
102             }
103              
104             INCLUDE: Error.xsi
105              
106             INCLUDE: CallbackDispatcher.xsi