ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/CoroAPI.h
(Generate patch)

Comparing Coro/Coro/CoroAPI.h (file contents):
Revision 1.15 by root, Tue Oct 9 22:29:26 2007 UTC vs.
Revision 1.16 by root, Wed Oct 10 00:53:18 2007 UTC

18struct CoroAPI { 18struct CoroAPI {
19 I32 ver; 19 I32 ver;
20 I32 rev; 20 I32 rev;
21#define CORO_API_VERSION 6 21#define CORO_API_VERSION 6
22#define CORO_API_REVISION 0 22#define CORO_API_REVISION 0
23 void (*transfer) (SV *prev_sv, SV *next_sv); /* Coro::State */
23 24
24 /* internal */
25 /*struct coro *(*sv_to_coro)(SV *arg, const char *funcname, const char *varname);*/
26
27 /* private API, Coro::State */
28 void (*transfer) (SV *prev_sv, SV *next_sv);
29
30 /* private API, Coro */
31 void (*schedule) (void); 25 void (*schedule) (void); /* Coro */
32 int (*cede) (void); 26 int (*cede) (void);
33 int (*cede_notself) (void); 27 int (*cede_notself) (void);
34 int (*ready) (SV *coro_sv); 28 int (*ready) (SV *coro_sv);
35 int (*is_ready) (SV *coro_sv); 29 int (*is_ready) (SV *coro_sv);
36 int *nready; 30 int *nready;
37 SV *current; 31 SV *current;
38 32
39 SV *(*coro_event_next)(SV *watcher, int cancel, int wantev); 33 SV *(*coro_event_next)(SV *watcher, int cancel, int wantev); /* Coro::Event::next */
40}; 34};
41 35
42static struct CoroAPI *GCoroAPI; 36static struct CoroAPI *GCoroAPI;
43 37
44/* public API macros */ 38/* public API macros */
51#define CORO_NREADY (*GCoroAPI->nready) 45#define CORO_NREADY (*GCoroAPI->nready)
52#define CORO_CURRENT SvRV (GCoroAPI->current) 46#define CORO_CURRENT SvRV (GCoroAPI->current)
53 47
54#define I_CORO_API(YourName) \ 48#define I_CORO_API(YourName) \
55STMT_START { \ 49STMT_START { \
56 SV *sv = perl_get_sv("Coro::API",0); \ 50 SV *sv = perl_get_sv ("Coro::API", 0); \
57 if (!sv) croak("Coro::API not found"); \ 51 if (!sv) croak ("Coro::API not found"); \
58 GCoroAPI = (struct CoroAPI*) SvIV(sv); \ 52 GCoroAPI = (struct CoroAPI*) SvIV (sv); \
59 if (GCoroAPI->ver != CORO_API_VERSION) \ 53 if (GCoroAPI->ver != CORO_API_VERSION \
60 croak("Coro::API version mismatch (%d != %d) -- please recompile %s", \
61 GCoroAPI->ver, CORO_API_VERSION, YourName); \
62 if (GCoroAPI->rev < CORO_API_REVISION) \ 54 || GCoroAPI->rev < CORO_API_REVISION) \
63 croak("Coro::API revision outdated (%d != %d) -- please recompile %s", \ 55 croak ("Coro::API version mismatch (%d.%d vs. %d.%d) -- please recompile %s", \
64 GCoroAPI->rev, CORO_API_REVISION, YourName); \ 56 GCoroAPI->ver, GCoroAPI->rev, CORO_API_VERSION, CORO_API_REVISION, YourName); \
65} STMT_END 57} STMT_END
66 58
67#endif 59#endif
68 60

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines