ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV/EVAPI.h
Revision: 1.1
Committed: Mon Oct 29 08:48:07 2007 UTC (16 years, 7 months ago) by root
Content type: text/plain
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #ifndef EV_API_H
2     #define EV_API_H
3    
4     #include "EXTERN.h"
5     #include "perl.h"
6     #include "XSUB.h"
7    
8     #ifndef pTHX_
9     # define pTHX_
10     # define aTHX_
11     # define pTHX
12     # define aTHX
13     #endif
14    
15     #include <event.h>
16    
17     /* private structure, always use the provided macros below */
18     struct EVAPI {
19     I32 ver;
20     I32 rev;
21     #define EV_API_VERSION 6
22     #define EV_API_REVISION 0
23    
24     double (*now)(void);
25     void (*once)(int fd, short events, double timeout, void (*cb)(int, short, void *), void *arg);
26     };
27    
28     static struct EVAPI *GEVAPI;
29    
30     #define I_EV_API(YourName) \
31     STMT_START { \
32     SV *sv = perl_get_sv ("EV::API", 0); \
33     if (!sv) croak ("EV::API not found"); \
34     GEVAPI = (struct CoroAPI*) SvIV (sv); \
35     if (GEVAPI->ver != EV_API_VERSION \
36     || GEVAPI->rev < EV_API_REVISION) \
37     croak ("EV::API version mismatch (%d.%d vs. %d.%d) -- please recompile %s", \
38     GEVAPI->ver, GEVAPI->rev, EV_API_VERSION, EV_API_REVISION, YourName); \
39     } STMT_END
40    
41     #endif
42