… | |
… | |
27 | int (*cede_notself) (void); |
27 | int (*cede_notself) (void); |
28 | int (*ready) (SV *coro_sv); |
28 | int (*ready) (SV *coro_sv); |
29 | int (*is_ready) (SV *coro_sv); |
29 | int (*is_ready) (SV *coro_sv); |
30 | int *nready; |
30 | int *nready; |
31 | SV *current; |
31 | SV *current; |
32 | |
|
|
33 | SV *(*coro_event_next)(SV *watcher, int cancel, int wantev); /* Coro::Event::next */ |
|
|
34 | }; |
32 | }; |
35 | |
33 | |
36 | static struct CoroAPI *GCoroAPI; |
34 | static struct CoroAPI *GCoroAPI; |
37 | |
35 | |
38 | /* public API macros */ |
36 | /* public API macros */ |
… | |
… | |
43 | #define CORO_READY(coro) GCoroAPI->ready (coro) |
41 | #define CORO_READY(coro) GCoroAPI->ready (coro) |
44 | #define CORO_IS_READY(coro) GCoroAPI->is_ready (coro) |
42 | #define CORO_IS_READY(coro) GCoroAPI->is_ready (coro) |
45 | #define CORO_NREADY (*GCoroAPI->nready) |
43 | #define CORO_NREADY (*GCoroAPI->nready) |
46 | #define CORO_CURRENT SvRV (GCoroAPI->current) |
44 | #define CORO_CURRENT SvRV (GCoroAPI->current) |
47 | |
45 | |
48 | #define I_CORO_API(YourName) \ |
46 | #define I_CORO_API(YourName) \ |
49 | STMT_START { \ |
47 | STMT_START { \ |
50 | SV *sv = perl_get_sv ("Coro::API", 0); \ |
48 | SV *sv = perl_get_sv ("Coro::API", 0); \ |
51 | if (!sv) croak ("Coro::API not found"); \ |
49 | if (!sv) croak ("Coro::API not found"); \ |
52 | GCoroAPI = (struct CoroAPI*) SvIV (sv); \ |
50 | GCoroAPI = (struct CoroAPI*) SvIV (sv); \ |
53 | if (GCoroAPI->ver != CORO_API_VERSION \ |
51 | if (GCoroAPI->ver != CORO_API_VERSION \ |
54 | || GCoroAPI->rev < CORO_API_REVISION) \ |
52 | || GCoroAPI->rev < CORO_API_REVISION) \ |
55 | croak ("Coro::API version mismatch (%d.%d vs. %d.%d) -- please recompile %s", \ |
53 | croak ("Coro::API version mismatch (%d.%d vs. %d.%d) -- please recompile %s", \ |
56 | GCoroAPI->ver, GCoroAPI->rev, CORO_API_VERSION, CORO_API_REVISION, YourName); \ |
54 | GCoroAPI->ver, GCoroAPI->rev, CORO_API_VERSION, CORO_API_REVISION, YourName); \ |
57 | } STMT_END |
55 | } STMT_END |
58 | |
56 | |
59 | #endif |
57 | #endif |