… | |
… | |
64 | #define ARG_MAP(o) DT_MAP , (void *)static_cast<maptile *> (o) |
64 | #define ARG_MAP(o) DT_MAP , (void *)static_cast<maptile *> (o) |
65 | #define ARG_PLAYER(o) DT_PLAYER, (void *)static_cast<player *> (o) |
65 | #define ARG_PLAYER(o) DT_PLAYER, (void *)static_cast<player *> (o) |
66 | #define ARG_ARCH(o) DT_ARCH , (void *)static_cast<archetype *> (o) |
66 | #define ARG_ARCH(o) DT_ARCH , (void *)static_cast<archetype *> (o) |
67 | #define ARG_PARTY(o) DT_PARTY , (void *)static_cast<party *> (o) |
67 | #define ARG_PARTY(o) DT_PARTY , (void *)static_cast<party *> (o) |
68 | #define ARG_REGION(o) DT_REGION, (void *)static_cast<region *> (o) |
68 | #define ARG_REGION(o) DT_REGION, (void *)static_cast<region *> (o) |
69 | #define ARG_SOCKET(o) DT_SOCKET, (void *)static_cast<client_socket *> (o) |
69 | #define ARG_SOCKET(o) DT_SOCKET, (void *)static_cast<client *> (o) |
70 | |
70 | |
71 | // the ", ## __VA_ARGS" is, unfortunately, a gnu-cpp extension |
71 | // the ", ## __VA_ARGS" is, unfortunately, a gnu-cpp extension |
72 | |
72 | |
73 | // all these return true when the normal event processing should be skipped (if any) |
73 | // all these return true when the normal event processing should be skipped (if any) |
74 | #define INVOKE_(event, ...) cfperl_invoke (event, ## __VA_ARGS__, DT_END) |
74 | #define INVOKE_(event, ...) cfperl_invoke (event, ## __VA_ARGS__, DT_END) |
… | |
… | |
355 | |
355 | |
356 | private: |
356 | private: |
357 | void cancel () { GEventAPI->cancel ((pe_watcher *)pe); } // private |
357 | void cancel () { GEventAPI->cancel ((pe_watcher *)pe); } // private |
358 | }; |
358 | }; |
359 | |
359 | |
|
|
360 | struct iw : watcher<pe_idle>, callback<void (iw &)> |
|
|
361 | { |
|
|
362 | template<class O, class M> |
|
|
363 | iw (O object, M method) |
|
|
364 | : callback<void (iw &)> (object, method) |
|
|
365 | { |
|
|
366 | alloc (); |
|
|
367 | } |
|
|
368 | |
|
|
369 | private: |
|
|
370 | void alloc (); |
|
|
371 | }; |
|
|
372 | |
360 | struct iow : watcher<pe_io>, callback<void (iow &, int)> |
373 | struct iow : watcher<pe_io>, callback<void (iow &, int)> |
361 | { |
374 | { |
362 | template<class O, class M> |
375 | template<class O, class M> |
363 | iow (O object, M method) |
376 | iow (O object, M method) |
364 | : callback<void (iow &, int)> (object, method) |
377 | : callback<void (iow &, int)> (object, method) |
365 | { |
378 | { |
366 | alloc (); |
379 | alloc (); |
367 | } |
380 | } |
368 | |
381 | |
369 | iow &fd (int fd); |
382 | void fd (int fd); |
370 | int poll (); |
383 | int poll (); |
371 | iow &poll (int events); |
384 | void poll (int events); |
372 | |
385 | |
373 | private: |
386 | private: |
374 | void alloc (); |
387 | void alloc (); |
375 | }; |
388 | }; |
376 | |
389 | |