c/tied.c

filter: Statementstmt 12.6% 10 / 79 Branchbran 0.0% 0 / 64 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 6.9% 10 / 143 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Event/MakeMaker.pm ↑ Summary Event.xs »
1 static struct pe_watcher_vtbl pe_tied_vtbl;
2  
3 0 static pe_watcher *pe_tied_allocate(HV *stash, SV *temple) {
4 pe_tied *ev;
5 0 EvNew(6, ev, 1, pe_tied);
6 0 ev->base.vtbl = &pe_tied_vtbl;
7 0 ▶ if (!stash) croak("tied_allocate(0)");
Branch: 1 branch
BranchTrueFalseTotal
if (!stash) croak("tied_allocate(0)"); 0 0 0
8 0 pe_watcher_init(&ev->base, stash, temple);
9 0 PE_RING_INIT(&ev->tm.ring, ev);
10 0 return (pe_watcher*) ev;
11 }
12  
13 0 static void pe_tied_dtor(pe_watcher *ev) {
14 0 pe_watcher_dtor(ev);
15 0 EvFree(6, ev);
16 0 }
17  
18 0 static char *pe_tied_start(pe_watcher *ev, int repeat) {
19 0 HV *stash = SvSTASH(SvRV(ev->mysv));
20 GV *gv;
21 0 dSP;
22 assert(stash);
23 0 ▶ PUSHMARK(SP);
Branch: 1 branch
BranchTrueFalseTotal
PUSHMARK(SP); 0 0 0
24 0 ▶ XPUSHs(watcher_2sv(ev));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(watcher_2sv(ev)); 0 0 0
25 0 ▶ XPUSHs(boolSV(repeat));
Branch: 2 branches
BranchTrueFalseTotal
XPUSHs(boolSV(repeat)); 0 0 0
XPUSHs(boolSV(repeat)); 0 0 0
26 0 PUTBACK;
27 0 gv = gv_fetchmethod(stash, "_start");
28 0 ▶ if (!gv)
Branch: 1 branch
BranchTrueFalseTotal
if (!gv) 0 0 0
29 0 ▶ croak("Cannot find %s->_start()", HvNAME(stash));
Branch: 6 branches
BranchTrueFalseTotal
croak("Cannot find %s->_start()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_start()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_start()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_start()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_start()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_start()", HvNAME(stash)); 0 0 0
30 0 perl_call_sv((SV*)GvCV(gv), G_DISCARD);
31 /* allow return of error! XXX */
32 0 return 0;
33 }
34  
35 0 static void pe_tied_stop(pe_watcher *ev) {
36 0 HV *stash = SvSTASH(SvRV(ev->mysv));
37 0 GV *gv = gv_fetchmethod(stash, "_stop");
38 0 pe_timeable_stop(&((pe_tied*)ev)->tm);
39 0 ▶ if (gv) {
Branch: 1 branch
BranchTrueFalseTotal
if (gv) { 0 0 0
40 0 dSP;
41 0 ▶ PUSHMARK(SP);
Branch: 1 branch
BranchTrueFalseTotal
PUSHMARK(SP); 0 0 0
42 0 ▶ XPUSHs(watcher_2sv(ev));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(watcher_2sv(ev)); 0 0 0
43 0 PUTBACK;
44 0 perl_call_sv((SV*)GvCV(gv), G_DISCARD);
45 }
46 0 }
47  
48 0 static void pe_tied_alarm(pe_watcher *ev, pe_timeable *_ign) {
49 0 HV *stash = SvSTASH(SvRV(ev->mysv));
50 GV *gv;
51 0 dSP;
52 0 ▶ PUSHMARK(SP);
Branch: 1 branch
BranchTrueFalseTotal
PUSHMARK(SP); 0 0 0
53 0 ▶ XPUSHs(watcher_2sv(ev));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(watcher_2sv(ev)); 0 0 0
54 0 PUTBACK;
55 0 gv = gv_fetchmethod(stash, "_alarm");
56 0 ▶ if (!gv)
Branch: 1 branch
BranchTrueFalseTotal
if (!gv) 0 0 0
57 0 ▶ croak("Cannot find %s->_alarm()", HvNAME(stash));
Branch: 6 branches
BranchTrueFalseTotal
croak("Cannot find %s->_alarm()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_alarm()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_alarm()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_alarm()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_alarm()", HvNAME(stash)); 0 0 0
croak("Cannot find %s->_alarm()", HvNAME(stash)); 0 0 0
58 0 perl_call_sv((SV*)GvCV(gv), G_DISCARD);
59 0 }
60  
61 0 WKEYMETH(_tied_at) {
62 0 pe_tied *tp = (pe_tied*) ev;
63 0 ▶ if (nval) {
Branch: 1 branch
BranchTrueFalseTotal
if (nval) { 0 0 0
64 0 pe_timeable_stop(&tp->tm);
65 0 ▶ if (SvOK(nval)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvOK(nval)) { 0 0 0
66 0 tp->tm.at = SvNV(nval);
67 0 pe_timeable_start(&tp->tm);
68 }
69 }
70 {
71 0 dSP;
72 0 ▶ XPUSHs(sv_2mortal(newSVnv(tp->tm.at)));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(sv_2mortal(newSVnv(tp->tm.at))); 0 0 0
73 0 PUTBACK;
74 }
75 0 }
76  
77 0 WKEYMETH(_tied_flags) {
78 0 ▶ if (nval) {
Branch: 1 branch
BranchTrueFalseTotal
if (nval) { 0 0 0
79 0 IV nflags = SvIV(nval);
80 0 IV flip = nflags ^ ev->flags;
81 0 IV other = flip & ~(PE_INVOKE1);
82 0 ▶ if (flip & PE_INVOKE1) {
Branch: 1 branch
BranchTrueFalseTotal
if (flip & PE_INVOKE1) { 0 0 0
83 0 ▶ if (nflags & PE_INVOKE1) WaINVOKE1_on(ev); else WaINVOKE1_off(ev);
Branch: 1 branch
BranchTrueFalseTotal
if (nflags & PE_INVOKE1) WaINVOKE1_on(ev); else WaINVOKE1_off(ev); 0 0 0
84 }
85 0 ▶ if (other)
Branch: 1 branch
BranchTrueFalseTotal
if (other) 0 0 0
86 0 warn("Other flags (0x%x) cannot be changed", other);
87 }
88 {
89 0 dSP;
90 0 ▶ XPUSHs(sv_2mortal(newSViv(ev->flags & PE_VISIBLE_FLAGS)));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(sv_2mortal(newSViv(ev->flags & PE_VISIBLE_FLAGS))); 0 0 0
91 0 PUTBACK;
92 }
93 0 }
94  
95 25 static void boot_tied() {
96 25 pe_watcher_vtbl *vt = &pe_tied_vtbl;
97 25 memcpy(vt, &pe_watcher_base_vtbl, sizeof(pe_watcher_base_vtbl));
98 25 vt->did_require = 1; /* otherwise tries to autoload Event::Event! */
99 25 vt->dtor = pe_tied_dtor;
100 25 vt->start = pe_tied_start;
101 25 vt->stop = pe_tied_stop;
102 25 vt->alarm = pe_tied_alarm;
103 25 pe_register_vtbl(vt, gv_stashpv("Event::Watcher::Tied",1), &event_vtbl);
104 25 }
« blib/lib/Event/MakeMaker.pm ↑ Summary Event.xs »