… | |
… | |
2 | // cfperl.h perl interface |
2 | // cfperl.h perl interface |
3 | // |
3 | // |
4 | #ifndef CFPERL_H__ |
4 | #ifndef CFPERL_H__ |
5 | #define CFPERL_H__ |
5 | #define CFPERL_H__ |
6 | |
6 | |
|
|
7 | #include <cstdarg> |
7 | #include <cstdio> |
8 | #include <cstdio> |
|
|
9 | #include <bitset> |
8 | |
10 | |
9 | using namespace std; |
11 | using namespace std; |
10 | |
12 | |
11 | #include <EXTERN.h> |
13 | #include <EXTERN.h> |
12 | #include <perl.h> |
14 | #include <perl.h> |
… | |
… | |
87 | # define def(klass,name) EVENT_ ## klass ## _ ## name, |
89 | # define def(klass,name) EVENT_ ## klass ## _ ## name, |
88 | # include "eventinc.h" |
90 | # include "eventinc.h" |
89 | # undef def |
91 | # undef def |
90 | NUM_EVENT_TYPES |
92 | NUM_EVENT_TYPES |
91 | }; |
93 | }; |
|
|
94 | |
|
|
95 | // in which global events or per-type events are we interested |
|
|
96 | extern bitset<NUM_EVENT_TYPES> ev_want_event; |
|
|
97 | extern bitset<NUM_TYPES> ev_want_type; |
92 | |
98 | |
93 | #define ARG_AV(o) DT_AV , static_cast<AV *> (o) |
99 | #define ARG_AV(o) DT_AV , static_cast<AV *> (o) |
94 | #define ARG_INT(v) DT_INT , static_cast<int> (v) |
100 | #define ARG_INT(v) DT_INT , static_cast<int> (v) |
95 | #define ARG_INT64(v) DT_INT64 , static_cast<sint64> (v) |
101 | #define ARG_INT64(v) DT_INT64 , static_cast<sint64> (v) |
96 | #define ARG_DOUBLE(v) DT_DOUBLE, static_cast<double> (v) |
102 | #define ARG_DOUBLE(v) DT_DOUBLE, static_cast<double> (v) |
… | |
… | |
183 | |
189 | |
184 | virtual ~attachable (); |
190 | virtual ~attachable (); |
185 | |
191 | |
186 | attachable &operator =(const attachable &src); |
192 | attachable &operator =(const attachable &src); |
187 | |
193 | |
|
|
194 | bool vinvoke (event_type event, va_list &ap); |
188 | bool invoke (event_type event, ...); |
195 | bool invoke (event_type event, ...) |
|
|
196 | { |
|
|
197 | if (ev_want_event [event] || cb) |
|
|
198 | { |
|
|
199 | va_list ap; |
|
|
200 | va_start (ap, event); |
|
|
201 | vinvoke (event, ap); |
|
|
202 | va_end (ap); |
|
|
203 | } |
|
|
204 | } |
|
|
205 | |
189 | MTH void instantiate (); |
206 | MTH void instantiate (); |
190 | void reattach (); |
207 | void reattach (); |
191 | |
208 | |
192 | protected: |
209 | protected: |
193 | // do the real refcount checking work |
210 | // do the real refcount checking work |