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.1 by root, Sat Aug 25 15:14:03 2001 UTC vs.
Revision 1.3 by root, Tue Nov 27 01:41:41 2001 UTC

4#include "EXTERN.h" 4#include "EXTERN.h"
5#include "perl.h" 5#include "perl.h"
6#include "XSUB.h" 6#include "XSUB.h"
7 7
8/* perl-related */ 8/* perl-related */
9#define TRANSFER_SAVE_DEFAV 0x00000001 9#define TRANSFER_SAVE_DEFAV 0x00000001 /* @_ */
10#define TRANSFER_SAVE_DEFSV 0x00000002 10#define TRANSFER_SAVE_DEFSV 0x00000002 /* $_ */
11#define TRANSFER_SAVE_ERRSV 0x00000004 11#define TRANSFER_SAVE_ERRSV 0x00000004 /* $@ */
12#define TRANSFER_SAVE_CURPM 0x00000008 /* regex results */
12/* c-related */ 13/* c-related */
13#define TRANSFER_SAVE_CCTXT 0x00000008 14#define TRANSFER_SAVE_CCTXT 0x00000100
14#ifdef CORO_LAZY_STACK 15#ifdef CORO_LAZY_STACK
15# define TRANSFER_LAZY_STACK 0x00000010 16# define TRANSFER_LAZY_STACK 0x00000200
16#else 17#else
17# define TRANSFER_LAZY_STACK 0x00000000 18# define TRANSFER_LAZY_STACK 0x00000000
18#endif 19#endif
19 20
20#define TRANSFER_SAVE_ALL (TRANSFER_SAVE_DEFAV|TRANSFER_SAVE_DEFSV \ 21#define TRANSFER_SAVE_ALL (TRANSFER_SAVE_DEFAV|TRANSFER_SAVE_DEFSV \
21 |TRANSFER_SAVE_ERRSV|TRANSFER_SAVE_CCTXT) 22 |TRANSFER_SAVE_ERRSV|TRANSFER_SAVE_CURPM \
23 |TRANSFER_SAVE_CCTXT)
22 24
23struct coro; /* opaque */ 25struct coro; /* opaque */
24 26
25struct CoroAPI { 27struct CoroAPI {
26 I32 ver; 28 I32 ver;
31 33
32 /* public, state */ 34 /* public, state */
33 void (*transfer)(pTHX_ SV *prev, SV *next, int flags); 35 void (*transfer)(pTHX_ SV *prev, SV *next, int flags);
34 36
35 /* public, coro */ 37 /* public, coro */
36 void (*schedule)(int cede); 38 void (*schedule)(void);
39 void (*cede)(void);
37 void (*ready)(SV *sv); 40 void (*ready)(SV *sv);
38 int *nready; 41 int *nready;
39 GV *current; 42 GV *current;
40}; 43};
41 44
42static struct CoroAPI *GCoroAPI; 45static struct CoroAPI *GCoroAPI;
43 46
44#define CORO_TRANSFER(prev,next) GCoroAPI->transfer(aTHX_ (prev),(next)) 47#define CORO_TRANSFER(prev,next) GCoroAPI->transfer(aTHX_ (prev),(next))
45#define CORO_SCHEDULE GCoroAPI->schedule(0) 48#define CORO_SCHEDULE GCoroAPI->schedule()
46#define CORO_CEDE GCoroAPI->schedule(1) 49#define CORO_CEDE GCoroAPI->cede()
47#define CORO_READY(coro) GCoroAPI->ready(coro) 50#define CORO_READY(coro) GCoroAPI->ready(coro)
48#define CORO_NREADY (*GCoroAPI->nready) 51#define CORO_NREADY (*GCoroAPI->nready)
49#define CORO_CURRENT GvSV(GCoroAPI->current) 52#define CORO_CURRENT SvRV(GvSV(GCoroAPI->current))
50 53
51#define I_CORO_API(YourName) \ 54#define I_CORO_API(YourName) \
52STMT_START { \ 55STMT_START { \
53 SV *sv = perl_get_sv("Coro::API",0); \ 56 SV *sv = perl_get_sv("Coro::API",0); \
54 if (!sv) croak("Coro::API not found"); \ 57 if (!sv) croak("Coro::API not found"); \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines