… | |
… | |
45 | #endif |
45 | #endif |
46 | |
46 | |
47 | /*****************************************************************************/ |
47 | /*****************************************************************************/ |
48 | |
48 | |
49 | #ifndef EV_FEATURES |
49 | #ifndef EV_FEATURES |
50 | # define EV_FEATURES 0x3f |
50 | # define EV_FEATURES 0x7f |
51 | #endif |
51 | #endif |
52 | |
52 | |
53 | #define EV_FEATURE_CODE ((EV_FEATURES) & 1) |
53 | #define EV_FEATURE_CODE ((EV_FEATURES) & 1) |
54 | #define EV_FEATURE_DATA ((EV_FEATURES) & 2) |
54 | #define EV_FEATURE_DATA ((EV_FEATURES) & 2) |
55 | #define EV_FEATURE_CONFIG ((EV_FEATURES) & 4) |
55 | #define EV_FEATURE_CONFIG ((EV_FEATURES) & 4) |
56 | #define EV_FEATURE_API ((EV_FEATURES) & 8) |
56 | #define EV_FEATURE_API ((EV_FEATURES) & 8) |
57 | #define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16) |
57 | #define EV_FEATURE_WATCHERS ((EV_FEATURES) & 16) |
58 | #define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32) |
58 | #define EV_FEATURE_BACKENDS ((EV_FEATURES) & 32) |
59 | #define EV_FEATURE_OS ((EV_FEATURES) & 64) |
59 | #define EV_FEATURE_OS ((EV_FEATURES) & 64) |
60 | |
60 | |
61 | /* these priorities are inclusive, higher priorities will be called earlier */ |
61 | /* these priorities are inclusive, higher priorities will be invoked earlier */ |
62 | #ifndef EV_MINPRI |
62 | #ifndef EV_MINPRI |
63 | # define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0) |
63 | # define EV_MINPRI (EV_FEATURE_CONFIG ? -2 : 0) |
64 | #endif |
64 | #endif |
65 | #ifndef EV_MAXPRI |
65 | #ifndef EV_MAXPRI |
66 | # define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0) |
66 | # define EV_MAXPRI (EV_FEATURE_CONFIG ? +2 : 0) |
… | |
… | |
169 | # define EV_INLINE static inline |
169 | # define EV_INLINE static inline |
170 | #else |
170 | #else |
171 | # define EV_INLINE static |
171 | # define EV_INLINE static |
172 | #endif |
172 | #endif |
173 | |
173 | |
|
|
174 | #ifndef EV_PROTOTYPES |
|
|
175 | # define EV_PROTOTYPES 1 |
|
|
176 | #endif |
|
|
177 | |
174 | /*****************************************************************************/ |
178 | /*****************************************************************************/ |
|
|
179 | |
|
|
180 | #define EV_VERSION_MAJOR 4 |
|
|
181 | #define EV_VERSION_MINOR 0 |
175 | |
182 | |
176 | /* eventmask, revents, events... */ |
183 | /* eventmask, revents, events... */ |
177 | #define EV_UNDEF -1 /* guaranteed to be invalid */ |
184 | #define EV_UNDEF -1 /* guaranteed to be invalid */ |
178 | #define EV_NONE 0x00 /* no events */ |
185 | #define EV_NONE 0x00 /* no events */ |
179 | #define EV_READ 0x01 /* ev_io detected read will not block */ |
186 | #define EV_READ 0x01 /* ev_io detected read will not block */ |
… | |
… | |
197 | |
204 | |
198 | /* can be used to add custom fields to all watchers, while losing binary compatibility */ |
205 | /* can be used to add custom fields to all watchers, while losing binary compatibility */ |
199 | #ifndef EV_COMMON |
206 | #ifndef EV_COMMON |
200 | # define EV_COMMON void *data; |
207 | # define EV_COMMON void *data; |
201 | #endif |
208 | #endif |
202 | #ifndef EV_PROTOTYPES |
|
|
203 | # define EV_PROTOTYPES 1 |
|
|
204 | #endif |
|
|
205 | |
|
|
206 | #define EV_VERSION_MAJOR 3 |
|
|
207 | #define EV_VERSION_MINOR 9 |
|
|
208 | |
209 | |
209 | #ifndef EV_CB_DECLARE |
210 | #ifndef EV_CB_DECLARE |
210 | # define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents); |
211 | # define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents); |
211 | #endif |
212 | #endif |
212 | #ifndef EV_CB_INVOKE |
213 | #ifndef EV_CB_INVOKE |
213 | # define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents)) |
214 | # define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents)) |
214 | #endif |
215 | #endif |
|
|
216 | |
|
|
217 | /* not official, do not use */ |
|
|
218 | #define EV_CB(type,name) void name (EV_P_ struct ev_ ## type *w, int revents) |
215 | |
219 | |
216 | /* |
220 | /* |
217 | * struct member types: |
221 | * struct member types: |
218 | * private: you may look at them, but not change them, |
222 | * private: you may look at them, but not change them, |
219 | * and they might not mean anything to you. |
223 | * and they might not mean anything to you. |
… | |
… | |
230 | * or the array index + 1 in the pendings array. |
234 | * or the array index + 1 in the pendings array. |
231 | */ |
235 | */ |
232 | |
236 | |
233 | #if EV_MINPRI == EV_MAXPRI |
237 | #if EV_MINPRI == EV_MAXPRI |
234 | # define EV_DECL_PRIORITY |
238 | # define EV_DECL_PRIORITY |
235 | #else |
239 | #elif !defined (EV_DECL_PRIORITY) |
236 | # define EV_DECL_PRIORITY int priority; |
240 | # define EV_DECL_PRIORITY int priority; |
237 | #endif |
241 | #endif |
238 | |
242 | |
239 | /* shared by all watchers */ |
243 | /* shared by all watchers */ |
240 | #define EV_WATCHER(type) \ |
244 | #define EV_WATCHER(type) \ |