|
|
1 | typedef int IOM_CHAINED; |
|
|
2 | |
|
|
3 | static SV * |
|
|
4 | iom_new_ref (HV *hv, const char *klass) |
|
|
5 | { |
|
|
6 | return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); |
|
|
7 | } |
|
|
8 | |
1 | ///////////////////////////////////////////////////////////////////////////// |
9 | ///////////////////////////////////////////////////////////////////////////// |
2 | |
10 | |
3 | #define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, IOM_CLASS "::watcher") |
11 | #define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, IOM_CLASS "::watcher") |
4 | |
12 | |
5 | struct perl_watcher |
13 | struct perl_watcher |
… | |
… | |
48 | PUTBACK; |
56 | PUTBACK; |
49 | FREETMPS; |
57 | FREETMPS; |
50 | LEAVE; |
58 | LEAVE; |
51 | |
59 | |
52 | if (SvTRUE (ERRSV)) |
60 | if (SvTRUE (ERRSV)) |
53 | rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
61 | IOM_WARN ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); |
54 | } |
62 | } |
55 | |
63 | |
56 | #define newSVtimer(timer) new_ref ((timer)->self, IOM_CLASS "::timer") |
64 | #define newSVtimer(timer) iom_new_ref ((timer)->self, IOM_CLASS "::timer") |
57 | #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::timer") |
65 | #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::timer") |
58 | |
66 | |
59 | struct timer : perl_watcher, time_watcher |
67 | struct timer : perl_watcher, time_watcher |
60 | { |
68 | { |
61 | tstamp interval; |
69 | tstamp interval; |
… | |
… | |
72 | |
80 | |
73 | invoke (IOM_CLASS "::timer", newSVtimer (this)); |
81 | invoke (IOM_CLASS "::timer", newSVtimer (this)); |
74 | } |
82 | } |
75 | }; |
83 | }; |
76 | |
84 | |
77 | #define newSViow(iow) new_ref ((iow)->self, IOM_CLASS "::iow") |
85 | #define newSViow(iow) iom_new_ref ((iow)->self, IOM_CLASS "::iow") |
78 | #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iow") |
86 | #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iow") |
79 | |
87 | |
80 | struct iow : perl_watcher, io_watcher |
88 | struct iow : perl_watcher, io_watcher |
81 | { |
89 | { |
82 | iow () |
90 | iow () |
… | |
… | |
88 | { |
96 | { |
89 | invoke (IOM_CLASS "::iow", newSViow (this), revents); |
97 | invoke (IOM_CLASS "::iow", newSViow (this), revents); |
90 | } |
98 | } |
91 | }; |
99 | }; |
92 | |
100 | |
93 | #define newSViw(iw) new_ref ((iw)->self, IOM_CLASS "::iw") |
101 | #define newSViw(iw) iom_new_ref ((iw)->self, IOM_CLASS "::iw") |
94 | #define SvIW(sv) (iw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iw") |
102 | #define SvIW(sv) (iw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iw") |
95 | |
103 | |
96 | struct iw : perl_watcher, idle_watcher |
104 | struct iw : perl_watcher, idle_watcher |
97 | { |
105 | { |
98 | iw () |
106 | iw () |
… | |
… | |
104 | { |
112 | { |
105 | invoke (IOM_CLASS "::iw", newSViw (this)); |
113 | invoke (IOM_CLASS "::iw", newSViw (this)); |
106 | } |
114 | } |
107 | }; |
115 | }; |
108 | |
116 | |
109 | #define newSVpw(pw) new_ref ((pw)->self, IOM_CLASS "::pw") |
117 | #define newSVpw(pw) iom_new_ref ((pw)->self, IOM_CLASS "::pw") |
110 | #define SvPW(sv) (pw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::pw") |
118 | #define SvPW(sv) (pw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::pw") |
111 | |
119 | |
112 | struct pw : perl_watcher, child_watcher |
120 | struct pw : perl_watcher, child_watcher |
113 | { |
121 | { |
114 | pw () |
122 | pw () |