collin-lucky7 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. data/README +65 -0
  2. data/Rakefile.rb +55 -0
  3. data/config/environment.rb +9 -0
  4. data/lib/jabs.rb +9 -0
  5. data/lib/jass.rb +23 -0
  6. data/lib/jsspec/example.html.jass +180 -0
  7. data/lib/jsspec/layout.html.haml +14 -0
  8. data/lib/lucky7.rb +5 -0
  9. data/lib/lucky7/builder.rb +140 -0
  10. data/lib/lucky7/renders.rb +9 -0
  11. data/rspec/fixtures/lucky7/build/app/layout.html +4 -0
  12. data/rspec/fixtures/lucky7/src/app/_category.html.haml +2 -0
  13. data/rspec/fixtures/lucky7/src/app/_header.html.haml +7 -0
  14. data/rspec/fixtures/lucky7/src/app/_page_link.html.haml +2 -0
  15. data/rspec/fixtures/lucky7/src/app/_pagination.html.haml +3 -0
  16. data/rspec/fixtures/lucky7/src/app/_result.html.haml +3 -0
  17. data/rspec/fixtures/lucky7/src/app/_result_set.html.haml +4 -0
  18. data/rspec/fixtures/lucky7/src/app/_side_bar.html.haml +3 -0
  19. data/rspec/fixtures/lucky7/src/app/behavior.css.sass +3 -0
  20. data/rspec/fixtures/lucky7/src/app/controller.js.jabs +3 -0
  21. data/rspec/fixtures/lucky7/src/app/fixture_spec.html.jass +6 -0
  22. data/rspec/fixtures/lucky7/src/app/layout.html.haml +4 -0
  23. data/rspec/fixtures/lucky7/src/app/no_results.html.haml +10 -0
  24. data/rspec/fixtures/lucky7/src/app/results.html.haml +5 -0
  25. data/rspec/jabs/jabs_engine_spec.rb +3 -0
  26. data/rspec/jabs/jabs_precompiler_spec.rb +50 -0
  27. data/rspec/jabs_spec.rb +15 -0
  28. data/rspec/jabs_spec_helper.rb +2 -0
  29. data/rspec/jass/jass_engine_spec.rb +1 -0
  30. data/rspec/jass/jass_precompiler_spec.rb +49 -0
  31. data/rspec/jass_spec.rb +15 -0
  32. data/rspec/lucky7/builder_spec.rb +322 -0
  33. data/rspec/lucky7/renders_spec.rb +13 -0
  34. data/rspec/lucky7_spec.rb +19 -0
  35. data/rspec/lucky7_spec_helper.rb +1 -0
  36. data/rspec/spec_helper.rb +3 -0
  37. data/templates/environment/[environment].rb +1 -0
  38. data/templates/skeleton/[application]/README +1 -0
  39. data/templates/skeleton/[application]/Rakefile.rb +1 -0
  40. data/templates/skeleton/[application]/environment/environment.rb +1 -0
  41. data/vendor/jquery/jquery-1.2.6.js +3549 -0
  42. data/vendor/jquery/jquery-1.2.6.min.js +32 -0
  43. data/vendor/jquery/jquery-1.2.6.pack.js.gz +11 -0
  44. data/vendor/jquery/jquery.simulate.js +152 -0
  45. data/vendor/js_spec/JSSpec.css +224 -0
  46. data/vendor/js_spec/JSSpec.js +1548 -0
  47. data/vendor/js_spec/copying +459 -0
  48. data/vendor/js_spec/demo.html +210 -0
  49. data/vendor/js_spec/diff_match_patch.js +1 -0
  50. data/vendor/js_spec/example.spec.html +198 -0
  51. data/vendor/js_spec/exp/build.properties +1 -0
  52. data/vendor/js_spec/exp/build.xml +9 -0
  53. data/vendor/js_spec/exp/lib/diff_match_patch.js +1 -0
  54. data/vendor/js_spec/exp/lib/js.jar +0 -0
  55. data/vendor/js_spec/exp/src/JSSpec2.js +356 -0
  56. data/vendor/js_spec/exp/src/JSSpec2_spec.js +238 -0
  57. data/vendor/js_spec/sample/datetime/String_Parser.html +22 -0
  58. data/vendor/js_spec/sample/datetime/datetime.js +24 -0
  59. data/vendor/orbited/ez_setup.py +272 -0
  60. data/vendor/orbited/pyevent-0.3/Makefile +18 -0
  61. data/vendor/orbited/pyevent-0.3/build/lib.linux-i686-2.5/event.so +0 -0
  62. data/vendor/orbited/pyevent-0.3/build/temp.linux-i686-2.5/event.o +0 -0
  63. data/vendor/orbited/pyevent-0.3/changes +9 -0
  64. data/vendor/orbited/pyevent-0.3/cvs/Entries +9 -0
  65. data/vendor/orbited/pyevent-0.3/cvs/Repository +1 -0
  66. data/vendor/orbited/pyevent-0.3/cvs/Root +1 -0
  67. data/vendor/orbited/pyevent-0.3/event.c +2516 -0
  68. data/vendor/orbited/pyevent-0.3/event.pyx +280 -0
  69. data/vendor/orbited/pyevent-0.3/license +29 -0
  70. data/vendor/orbited/pyevent-0.3/readme +12 -0
  71. data/vendor/orbited/pyevent-0.3/setup.py +61 -0
  72. data/vendor/orbited/pyevent-0.3/test.py +73 -0
  73. data/vendor/orbited/ruby-orbited.rb +84 -0
  74. metadata +188 -0
@@ -0,0 +1,18 @@
1
+
2
+ all: event.c
3
+ python setup.py build
4
+
5
+ event.c: event.pyx
6
+ pyrexc event.pyx
7
+
8
+ install:
9
+ python setup.py install
10
+
11
+ test:
12
+ python test.py
13
+
14
+ clean:
15
+ rm -rf build dist
16
+
17
+ cleandir distclean: clean
18
+ rm -f *.c *~
@@ -0,0 +1,9 @@
1
+
2
+ event-0.3:
3
+
4
+ - fix reference counting for callback arguments passed via
5
+ "simple" interface
6
+
7
+ - fix self decref for persistent signal event
8
+
9
+ # $Id: CHANGES,v 1.1 2005/09/12 03:03:36 dugsong Exp $
@@ -0,0 +1,9 @@
1
+ /CHANGES/1.1/Mon Sep 12 03:03:36 2005//
2
+ /LICENSE/1.1.1.1/Thu Jul 15 05:25:01 2004//
3
+ /Makefile/1.3/Mon Sep 12 03:17:35 2005//
4
+ /README/1.2/Wed Jan 26 03:38:43 2005//
5
+ /event.c/1.8/Mon Sep 12 03:16:58 2005//
6
+ /event.pyx/1.12/Mon Sep 12 03:16:15 2005//
7
+ /setup.py/1.7/Mon Sep 12 03:44:04 2005//
8
+ /test.py/1.2/Wed Jan 26 01:43:24 2005//
9
+ D
@@ -0,0 +1 @@
1
+ pyevent
@@ -0,0 +1 @@
1
+ cvs.monkey.org:/cvs
@@ -0,0 +1,2516 @@
1
+ /* Generated by Pyrex 0.9.3 on Sun Sep 11 23:51:17 2005 */
2
+
3
+ #include "Python.h"
4
+ #include "structmember.h"
5
+ #ifndef PY_LONG_LONG
6
+ #define PY_LONG_LONG LONG_LONG
7
+ #endif
8
+ #include "event.h"
9
+
10
+
11
+ typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
12
+ typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
13
+ static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
14
+ static int __Pyx_EndUnpack(PyObject *, int); /*proto*/
15
+ static int __Pyx_PrintItem(PyObject *); /*proto*/
16
+ static int __Pyx_PrintNewline(void); /*proto*/
17
+ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
18
+ static void __Pyx_ReRaise(void); /*proto*/
19
+ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
20
+ static PyObject *__Pyx_GetExcValue(void); /*proto*/
21
+ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
22
+ static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
23
+ static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/
24
+ static void __Pyx_WriteUnraisable(char *name); /*proto*/
25
+ static void __Pyx_AddTraceback(char *funcname); /*proto*/
26
+ static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
27
+ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
28
+ static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
29
+ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
30
+ static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
31
+ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
32
+ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
33
+
34
+ static PyObject *__pyx_m;
35
+ static PyObject *__pyx_b;
36
+ static int __pyx_lineno;
37
+ static char *__pyx_filename;
38
+ staticforward char **__pyx_f;
39
+
40
+ static char __pyx_mdoc[] = "event library\n\nThis module provides a mechanism to execute a function when a\nspecific event on a file handle, file descriptor, or signal occurs,\nor after a given time has passed.\n";
41
+
42
+ /* Declarations from event */
43
+
44
+ staticforward PyTypeObject __pyx_type_5event_event;
45
+
46
+ struct __pyx_obj_5event_event {
47
+ PyObject_HEAD
48
+ struct event ev;
49
+ PyObject *handle;
50
+ PyObject *evtype;
51
+ PyObject *callback;
52
+ PyObject *args;
53
+ float timeout;
54
+ struct timeval tv;
55
+ };
56
+
57
+ staticforward PyTypeObject __pyx_type_5event_read;
58
+
59
+ struct __pyx_obj_5event_read {
60
+ struct __pyx_obj_5event_event __pyx_base;
61
+ };
62
+
63
+ staticforward PyTypeObject __pyx_type_5event_write;
64
+
65
+ struct __pyx_obj_5event_write {
66
+ struct __pyx_obj_5event_event __pyx_base;
67
+ };
68
+
69
+ staticforward PyTypeObject __pyx_type_5event_signal;
70
+
71
+ struct __pyx_obj_5event_signal {
72
+ struct __pyx_obj_5event_event __pyx_base;
73
+ };
74
+
75
+ staticforward PyTypeObject __pyx_type_5event_timeout;
76
+
77
+ struct __pyx_obj_5event_timeout {
78
+ struct __pyx_obj_5event_event __pyx_base;
79
+ };
80
+
81
+ static PyTypeObject *__pyx_ptype_5event_event = 0;
82
+ static PyTypeObject *__pyx_ptype_5event_read = 0;
83
+ static PyTypeObject *__pyx_ptype_5event_write = 0;
84
+ static PyTypeObject *__pyx_ptype_5event_signal = 0;
85
+ static PyTypeObject *__pyx_ptype_5event_timeout = 0;
86
+ static PyObject *__pyx_k9;
87
+ static short __pyx_k10;
88
+ static PyObject *__pyx_k11;
89
+ static PyObject *__pyx_k12;
90
+ static float __pyx_k13;
91
+ static PyObject *__pyx_k14;
92
+ static int (__pyx_f_5event___event_sigcb(void)); /*proto*/
93
+ static void (__pyx_f_5event___event_handler(int ,short ,void (*))); /*proto*/
94
+ static void (__pyx_f_5event___simple_event_handler(int ,short ,void (*))); /*proto*/
95
+
96
+ /* Implementation of event */
97
+
98
+ static char (__pyx_k1[]) = "Dug Song <dugsong@monkey.org>";
99
+ static char (__pyx_k2[]) = "Martin Murray <mmurray@monkey.org>";
100
+ static char (__pyx_k3[]) = "Copyright (c) 2004 Dug Song";
101
+ static char (__pyx_k4[]) = "Copyright (c) 2003 Martin Murray";
102
+ static char (__pyx_k6[]) = "http://monkey.org/~dugsong/pyevent/";
103
+ static char (__pyx_k7[]) = "0.3";
104
+
105
+ static PyObject *__pyx_n___author__;
106
+ static PyObject *__pyx_n___copyright__;
107
+ static PyObject *__pyx_n___license__;
108
+ static PyObject *__pyx_n___url__;
109
+ static PyObject *__pyx_n___version__;
110
+ static PyObject *__pyx_n_sys;
111
+ static PyObject *__pyx_n_EV_TIMEOUT;
112
+ static PyObject *__pyx_n_EV_READ;
113
+ static PyObject *__pyx_n_EV_WRITE;
114
+ static PyObject *__pyx_n_EV_SIGNAL;
115
+ static PyObject *__pyx_n_EV_PERSIST;
116
+ static PyObject *__pyx_n___event_exc;
117
+ static PyObject *__pyx_n_init;
118
+ static PyObject *__pyx_n_dispatch;
119
+ static PyObject *__pyx_n_loop;
120
+ static PyObject *__pyx_n_abort;
121
+ static PyObject *__pyx_n_BSD;
122
+ static PyObject *__pyx_n_False;
123
+
124
+ static PyObject *__pyx_k1p;
125
+ static PyObject *__pyx_k2p;
126
+ static PyObject *__pyx_k3p;
127
+ static PyObject *__pyx_k4p;
128
+ static PyObject *__pyx_k6p;
129
+ static PyObject *__pyx_k7p;
130
+
131
+ static int __pyx_f_5event___event_sigcb(void) {
132
+ int __pyx_r;
133
+
134
+ /* "/Users/dugsong/projects/pyevent/event.pyx":66 */
135
+ __pyx_r = (-1);
136
+ goto __pyx_L0;
137
+
138
+ __pyx_r = 0;
139
+ goto __pyx_L0;
140
+ __pyx_L1:;
141
+ __Pyx_WriteUnraisable("event.__event_sigcb");
142
+ __pyx_L0:;
143
+ return __pyx_r;
144
+ }
145
+
146
+ static PyObject *__pyx_n___callback;
147
+
148
+ static void __pyx_f_5event___event_handler(int __pyx_v_fd,short __pyx_v_evtype,void (*__pyx_v_arg)) {
149
+ PyObject *__pyx_1 = 0;
150
+ PyObject *__pyx_2 = 0;
151
+ PyObject *__pyx_3 = 0;
152
+
153
+ /* "/Users/dugsong/projects/pyevent/event.pyx":69 */
154
+ __pyx_1 = (PyObject *)__pyx_v_arg;
155
+ Py_INCREF(__pyx_1);
156
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n___callback); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
157
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
158
+ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
159
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
160
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
161
+ __pyx_1 = 0;
162
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
163
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
164
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
165
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
166
+
167
+ goto __pyx_L0;
168
+ __pyx_L1:;
169
+ Py_XDECREF(__pyx_1);
170
+ Py_XDECREF(__pyx_2);
171
+ Py_XDECREF(__pyx_3);
172
+ __Pyx_WriteUnraisable("event.__event_handler");
173
+ __pyx_L0:;
174
+ }
175
+
176
+ static PyObject *__pyx_n___simple_callback;
177
+
178
+ static void __pyx_f_5event___simple_event_handler(int __pyx_v_fd,short __pyx_v_evtype,void (*__pyx_v_arg)) {
179
+ PyObject *__pyx_1 = 0;
180
+ PyObject *__pyx_2 = 0;
181
+ PyObject *__pyx_3 = 0;
182
+
183
+ /* "/Users/dugsong/projects/pyevent/event.pyx":72 */
184
+ __pyx_1 = (PyObject *)__pyx_v_arg;
185
+ Py_INCREF(__pyx_1);
186
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n___simple_callback); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
187
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
188
+ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
189
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
190
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
191
+ __pyx_1 = 0;
192
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
193
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
194
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
195
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
196
+
197
+ goto __pyx_L0;
198
+ __pyx_L1:;
199
+ Py_XDECREF(__pyx_1);
200
+ Py_XDECREF(__pyx_2);
201
+ Py_XDECREF(__pyx_3);
202
+ __Pyx_WriteUnraisable("event.__simple_event_handler");
203
+ __pyx_L0:;
204
+ }
205
+
206
+ static PyObject *__pyx_n_isinstance;
207
+ static PyObject *__pyx_n_int;
208
+ static PyObject *__pyx_n_fileno;
209
+
210
+ static int __pyx_f_5event_5event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
211
+ static int __pyx_f_5event_5event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
212
+ PyObject *__pyx_v_callback = 0;
213
+ PyObject *__pyx_v_arg = 0;
214
+ short __pyx_v_evtype;
215
+ PyObject *__pyx_v_handle = 0;
216
+ PyObject *__pyx_v_simple = 0;
217
+ void ((*__pyx_v_handler)(int ,short ,void (*)));
218
+ int __pyx_r;
219
+ PyObject *__pyx_1 = 0;
220
+ int __pyx_2;
221
+ int __pyx_3;
222
+ PyObject *__pyx_4 = 0;
223
+ PyObject *__pyx_5 = 0;
224
+ static char *__pyx_argnames[] = {"callback","arg","evtype","handle","simple",0};
225
+ __pyx_v_arg = __pyx_k9;
226
+ __pyx_v_evtype = __pyx_k10;
227
+ __pyx_v_handle = __pyx_k11;
228
+ __pyx_v_simple = __pyx_k12;
229
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|OhOO", __pyx_argnames, &__pyx_v_callback, &__pyx_v_arg, &__pyx_v_evtype, &__pyx_v_handle, &__pyx_v_simple)) return -1;
230
+ Py_INCREF(__pyx_v_self);
231
+ Py_INCREF(__pyx_v_callback);
232
+ Py_INCREF(__pyx_v_arg);
233
+ Py_INCREF(__pyx_v_handle);
234
+ Py_INCREF(__pyx_v_simple);
235
+
236
+ /* "/Users/dugsong/projects/pyevent/event.pyx":96 */
237
+ Py_INCREF(__pyx_v_callback);
238
+ Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->callback);
239
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->callback = __pyx_v_callback;
240
+
241
+ /* "/Users/dugsong/projects/pyevent/event.pyx":97 */
242
+ Py_INCREF(__pyx_v_arg);
243
+ Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->args);
244
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->args = __pyx_v_arg;
245
+
246
+ /* "/Users/dugsong/projects/pyevent/event.pyx":98 */
247
+ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
248
+ Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->evtype);
249
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->evtype = __pyx_1;
250
+ __pyx_1 = 0;
251
+
252
+ /* "/Users/dugsong/projects/pyevent/event.pyx":99 */
253
+ Py_INCREF(__pyx_v_handle);
254
+ Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->handle);
255
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->handle = __pyx_v_handle;
256
+
257
+ /* "/Users/dugsong/projects/pyevent/event.pyx":100 */
258
+ __pyx_2 = PyObject_IsTrue(__pyx_v_simple); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
259
+ if (__pyx_2) {
260
+
261
+ /* "/Users/dugsong/projects/pyevent/event.pyx":101 */
262
+ __pyx_v_handler = __pyx_f_5event___simple_event_handler;
263
+ goto __pyx_L2;
264
+ }
265
+ /*else*/ {
266
+
267
+ /* "/Users/dugsong/projects/pyevent/event.pyx":103 */
268
+ __pyx_v_handler = __pyx_f_5event___event_handler;
269
+ }
270
+ __pyx_L2:;
271
+
272
+ /* "/Users/dugsong/projects/pyevent/event.pyx":104 */
273
+ __pyx_2 = (__pyx_v_evtype == 0);
274
+ if (__pyx_2) {
275
+ __pyx_3 = PyObject_IsTrue(__pyx_v_handle); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
276
+ __pyx_2 = (!__pyx_3);
277
+ }
278
+ if (__pyx_2) {
279
+
280
+ /* "/Users/dugsong/projects/pyevent/event.pyx":105 */
281
+ evtimer_set((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_v_handler,((void (*))__pyx_v_self));
282
+ goto __pyx_L3;
283
+ }
284
+ /*else*/ {
285
+
286
+ /* "/Users/dugsong/projects/pyevent/event.pyx":107 */
287
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
288
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
289
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
290
+ Py_INCREF(__pyx_v_handle);
291
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_handle);
292
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
293
+ __pyx_4 = 0;
294
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
295
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
296
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
297
+ __pyx_3 = PyObject_IsTrue(__pyx_4); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
298
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
299
+ __pyx_2 = (!__pyx_3);
300
+ if (__pyx_2) {
301
+
302
+ /* "/Users/dugsong/projects/pyevent/event.pyx":108 */
303
+ __pyx_1 = PyObject_GetAttr(__pyx_v_handle, __pyx_n_fileno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
304
+ __pyx_5 = PyTuple_New(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
305
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
306
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
307
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
308
+ Py_DECREF(__pyx_v_handle);
309
+ __pyx_v_handle = __pyx_4;
310
+ __pyx_4 = 0;
311
+ goto __pyx_L4;
312
+ }
313
+ __pyx_L4:;
314
+
315
+ /* "/Users/dugsong/projects/pyevent/event.pyx":109 */
316
+ __pyx_3 = PyInt_AsLong(__pyx_v_handle); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
317
+ event_set((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_3,__pyx_v_evtype,__pyx_v_handler,((void (*))__pyx_v_self));
318
+ }
319
+ __pyx_L3:;
320
+
321
+ __pyx_r = 0;
322
+ goto __pyx_L0;
323
+ __pyx_L1:;
324
+ Py_XDECREF(__pyx_1);
325
+ Py_XDECREF(__pyx_4);
326
+ Py_XDECREF(__pyx_5);
327
+ __Pyx_AddTraceback("event.event.__init__");
328
+ __pyx_r = -1;
329
+ __pyx_L0:;
330
+ Py_DECREF(__pyx_v_self);
331
+ Py_DECREF(__pyx_v_callback);
332
+ Py_DECREF(__pyx_v_arg);
333
+ Py_DECREF(__pyx_v_handle);
334
+ Py_DECREF(__pyx_v_simple);
335
+ return __pyx_r;
336
+ }
337
+
338
+ static PyObject *__pyx_n_exc_info;
339
+
340
+ static PyObject *__pyx_f_5event_5event___simple_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
341
+ static PyObject *__pyx_f_5event_5event___simple_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
342
+ short __pyx_v_evtype;
343
+ extern int event_gotsig;
344
+ extern int ((*event_sigcb)(void));
345
+ PyObject *__pyx_r;
346
+ PyObject *__pyx_1 = 0;
347
+ PyObject *__pyx_2 = 0;
348
+ int __pyx_3;
349
+ PyObject *__pyx_4 = 0;
350
+ int __pyx_5;
351
+ short __pyx_6;
352
+ static char *__pyx_argnames[] = {"evtype",0};
353
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "h", __pyx_argnames, &__pyx_v_evtype)) return 0;
354
+ Py_INCREF(__pyx_v_self);
355
+
356
+ /* "/Users/dugsong/projects/pyevent/event.pyx":115 */
357
+ /*try:*/ {
358
+
359
+ /* "/Users/dugsong/projects/pyevent/event.pyx":116 */
360
+ __pyx_1 = PySequence_Tuple(((struct __pyx_obj_5event_event *)__pyx_v_self)->args); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L2;}
361
+ __pyx_2 = PyObject_CallObject(((struct __pyx_obj_5event_event *)__pyx_v_self)->callback, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L2;}
362
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
363
+ if (PyObject_Cmp(__pyx_2, Py_None, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L2;}
364
+ __pyx_3 = __pyx_3 != 0;
365
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
366
+ if (__pyx_3) {
367
+
368
+ /* "/Users/dugsong/projects/pyevent/event.pyx":117 */
369
+ __pyx_3 = ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec;
370
+ if (!__pyx_3) {
371
+ __pyx_3 = ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_usec;
372
+ }
373
+ if (__pyx_3) {
374
+
375
+ /* "/Users/dugsong/projects/pyevent/event.pyx":118 */
376
+ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),(&((struct __pyx_obj_5event_event *)__pyx_v_self)->tv));
377
+ goto __pyx_L5;
378
+ }
379
+ /*else*/ {
380
+
381
+ /* "/Users/dugsong/projects/pyevent/event.pyx":120 */
382
+ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),0);
383
+ }
384
+ __pyx_L5:;
385
+ goto __pyx_L4;
386
+ }
387
+ __pyx_L4:;
388
+ }
389
+ goto __pyx_L3;
390
+ __pyx_L2:;
391
+ Py_XDECREF(__pyx_1); __pyx_1 = 0;
392
+ Py_XDECREF(__pyx_2); __pyx_2 = 0;
393
+
394
+ /* "/Users/dugsong/projects/pyevent/event.pyx":121 */
395
+ /*except:*/ {
396
+ __Pyx_AddTraceback("event.__simple_callback");
397
+ __pyx_1 = __Pyx_GetExcValue(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
398
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
399
+
400
+ /* "/Users/dugsong/projects/pyevent/event.pyx":122 */
401
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
402
+ __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_exc_info); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
403
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
404
+ __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
405
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
406
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
407
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
408
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___event_exc, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
409
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
410
+
411
+ /* "/Users/dugsong/projects/pyevent/event.pyx":123 */
412
+ event_sigcb = __pyx_f_5event___event_sigcb;
413
+
414
+ /* "/Users/dugsong/projects/pyevent/event.pyx":124 */
415
+ event_gotsig = 1;
416
+ goto __pyx_L3;
417
+ }
418
+ __pyx_L3:;
419
+
420
+ /* "/Users/dugsong/projects/pyevent/event.pyx":126 */
421
+ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
422
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
423
+ __pyx_4 = PyNumber_And(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
424
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
425
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
426
+ __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
427
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
428
+ __pyx_3 = (!__pyx_5);
429
+ if (__pyx_3) {
430
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
431
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
432
+ __pyx_4 = PyNumber_Or(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
433
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
434
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
435
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
436
+ __pyx_2 = PyNumber_Or(__pyx_4, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
437
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
438
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
439
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
440
+ __pyx_1 = PyNumber_Or(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
441
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
442
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
443
+ __pyx_6 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
444
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
445
+ __pyx_3 = (!event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_6,0));
446
+ }
447
+ if (__pyx_3) {
448
+
449
+ /* "/Users/dugsong/projects/pyevent/event.pyx":128 */
450
+ Py_DECREF(__pyx_v_self);
451
+ goto __pyx_L6;
452
+ }
453
+ __pyx_L6:;
454
+
455
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
456
+ goto __pyx_L0;
457
+ __pyx_L1:;
458
+ Py_XDECREF(__pyx_1);
459
+ Py_XDECREF(__pyx_2);
460
+ Py_XDECREF(__pyx_4);
461
+ __Pyx_AddTraceback("event.event.__simple_callback");
462
+ __pyx_r = 0;
463
+ __pyx_L0:;
464
+ Py_DECREF(__pyx_v_self);
465
+ return __pyx_r;
466
+ }
467
+
468
+ static PyObject *__pyx_f_5event_5event___callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
469
+ static PyObject *__pyx_f_5event_5event___callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
470
+ short __pyx_v_evtype;
471
+ extern int event_gotsig;
472
+ extern int ((*event_sigcb)(void));
473
+ PyObject *__pyx_r;
474
+ PyObject *__pyx_1 = 0;
475
+ PyObject *__pyx_2 = 0;
476
+ PyObject *__pyx_3 = 0;
477
+ short __pyx_4;
478
+ int __pyx_5;
479
+ static char *__pyx_argnames[] = {"evtype",0};
480
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "h", __pyx_argnames, &__pyx_v_evtype)) return 0;
481
+ Py_INCREF(__pyx_v_self);
482
+
483
+ /* "/Users/dugsong/projects/pyevent/event.pyx":134 */
484
+ /*try:*/ {
485
+
486
+ /* "/Users/dugsong/projects/pyevent/event.pyx":135 */
487
+ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L2;}
488
+ __pyx_2 = PyTuple_New(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L2;}
489
+ Py_INCREF(__pyx_v_self);
490
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
491
+ Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->handle);
492
+ PyTuple_SET_ITEM(__pyx_2, 1, ((struct __pyx_obj_5event_event *)__pyx_v_self)->handle);
493
+ PyTuple_SET_ITEM(__pyx_2, 2, __pyx_1);
494
+ Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->args);
495
+ PyTuple_SET_ITEM(__pyx_2, 3, ((struct __pyx_obj_5event_event *)__pyx_v_self)->args);
496
+ __pyx_1 = 0;
497
+ __pyx_1 = PyObject_CallObject(((struct __pyx_obj_5event_event *)__pyx_v_self)->callback, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L2;}
498
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
499
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
500
+ }
501
+ goto __pyx_L3;
502
+ __pyx_L2:;
503
+ Py_XDECREF(__pyx_2); __pyx_2 = 0;
504
+ Py_XDECREF(__pyx_1); __pyx_1 = 0;
505
+
506
+ /* "/Users/dugsong/projects/pyevent/event.pyx":136 */
507
+ /*except:*/ {
508
+ __Pyx_AddTraceback("event.__callback");
509
+ __pyx_2 = __Pyx_GetExcValue(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; goto __pyx_L1;}
510
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
511
+
512
+ /* "/Users/dugsong/projects/pyevent/event.pyx":137 */
513
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;}
514
+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exc_info); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;}
515
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
516
+ __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;}
517
+ __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;}
518
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
519
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
520
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___event_exc, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;}
521
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
522
+
523
+ /* "/Users/dugsong/projects/pyevent/event.pyx":138 */
524
+ event_sigcb = __pyx_f_5event___event_sigcb;
525
+
526
+ /* "/Users/dugsong/projects/pyevent/event.pyx":139 */
527
+ event_gotsig = 1;
528
+ goto __pyx_L3;
529
+ }
530
+ __pyx_L3:;
531
+
532
+ /* "/Users/dugsong/projects/pyevent/event.pyx":140 */
533
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
534
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
535
+ __pyx_3 = PyNumber_Or(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
536
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
537
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
538
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
539
+ __pyx_1 = PyNumber_Or(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
540
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
541
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
542
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
543
+ __pyx_2 = PyNumber_Or(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
544
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
545
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
546
+ __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
547
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
548
+ __pyx_5 = (!event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_4,0));
549
+ if (__pyx_5) {
550
+
551
+ /* "/Users/dugsong/projects/pyevent/event.pyx":141 */
552
+ Py_DECREF(__pyx_v_self);
553
+ goto __pyx_L4;
554
+ }
555
+ __pyx_L4:;
556
+
557
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
558
+ goto __pyx_L0;
559
+ __pyx_L1:;
560
+ Py_XDECREF(__pyx_1);
561
+ Py_XDECREF(__pyx_2);
562
+ Py_XDECREF(__pyx_3);
563
+ __Pyx_AddTraceback("event.event.__callback");
564
+ __pyx_r = 0;
565
+ __pyx_L0:;
566
+ Py_DECREF(__pyx_v_self);
567
+ return __pyx_r;
568
+ }
569
+
570
+ static PyObject *__pyx_f_5event_5event_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
571
+ static char __pyx_doc_5event_5event_add[] = "Add event to be executed after an optional timeout.\n\n Arguments:\n \n timeout -- seconds after which the event will be executed\n ";
572
+ static PyObject *__pyx_f_5event_5event_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
573
+ float __pyx_v_timeout;
574
+ PyObject *__pyx_r;
575
+ PyObject *__pyx_1 = 0;
576
+ PyObject *__pyx_2 = 0;
577
+ PyObject *__pyx_3 = 0;
578
+ short __pyx_4;
579
+ int __pyx_5;
580
+ static char *__pyx_argnames[] = {"timeout",0};
581
+ __pyx_v_timeout = __pyx_k13;
582
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|f", __pyx_argnames, &__pyx_v_timeout)) return 0;
583
+ Py_INCREF(__pyx_v_self);
584
+
585
+ /* "/Users/dugsong/projects/pyevent/event.pyx":150 */
586
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
587
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
588
+ __pyx_3 = PyNumber_Or(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
589
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
590
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
591
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
592
+ __pyx_2 = PyNumber_Or(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
593
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
594
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
595
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
596
+ __pyx_1 = PyNumber_Or(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
597
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
598
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
599
+ __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
600
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
601
+ __pyx_5 = (!event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_4,0));
602
+ if (__pyx_5) {
603
+
604
+ /* "/Users/dugsong/projects/pyevent/event.pyx":152 */
605
+ Py_INCREF(__pyx_v_self);
606
+ goto __pyx_L2;
607
+ }
608
+ __pyx_L2:;
609
+
610
+ /* "/Users/dugsong/projects/pyevent/event.pyx":153 */
611
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->timeout = __pyx_v_timeout;
612
+
613
+ /* "/Users/dugsong/projects/pyevent/event.pyx":154 */
614
+ __pyx_5 = (__pyx_v_timeout >= 0.0);
615
+ if (__pyx_5) {
616
+
617
+ /* "/Users/dugsong/projects/pyevent/event.pyx":155 */
618
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec = ((long )__pyx_v_timeout);
619
+
620
+ /* "/Users/dugsong/projects/pyevent/event.pyx":156 */
621
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_usec = ((__pyx_v_timeout - ((float )((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec)) * 1000000.0);
622
+
623
+ /* "/Users/dugsong/projects/pyevent/event.pyx":157 */
624
+ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),(&((struct __pyx_obj_5event_event *)__pyx_v_self)->tv));
625
+ goto __pyx_L3;
626
+ }
627
+ /*else*/ {
628
+
629
+ /* "/Users/dugsong/projects/pyevent/event.pyx":159 */
630
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec = 0;
631
+ ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_usec = 0;
632
+
633
+ /* "/Users/dugsong/projects/pyevent/event.pyx":160 */
634
+ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),0);
635
+ }
636
+ __pyx_L3:;
637
+
638
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
639
+ goto __pyx_L0;
640
+ __pyx_L1:;
641
+ Py_XDECREF(__pyx_1);
642
+ Py_XDECREF(__pyx_2);
643
+ Py_XDECREF(__pyx_3);
644
+ __Pyx_AddTraceback("event.event.add");
645
+ __pyx_r = 0;
646
+ __pyx_L0:;
647
+ Py_DECREF(__pyx_v_self);
648
+ return __pyx_r;
649
+ }
650
+
651
+ static PyObject *__pyx_f_5event_5event_pending(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
652
+ static char __pyx_doc_5event_5event_pending[] = "Return 1 if the event is scheduled to run, or else 0.";
653
+ static PyObject *__pyx_f_5event_5event_pending(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
654
+ PyObject *__pyx_r;
655
+ PyObject *__pyx_1 = 0;
656
+ PyObject *__pyx_2 = 0;
657
+ PyObject *__pyx_3 = 0;
658
+ short __pyx_4;
659
+ static char *__pyx_argnames[] = {0};
660
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
661
+ Py_INCREF(__pyx_v_self);
662
+
663
+ /* "/Users/dugsong/projects/pyevent/event.pyx":164 */
664
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
665
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
666
+ __pyx_3 = PyNumber_Or(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
667
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
668
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
669
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
670
+ __pyx_2 = PyNumber_Or(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
671
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
672
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
673
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
674
+ __pyx_1 = PyNumber_Or(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
675
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
676
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
677
+ __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
678
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
679
+ __pyx_2 = PyInt_FromLong(event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_4,0)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
680
+ __pyx_r = __pyx_2;
681
+ __pyx_2 = 0;
682
+ goto __pyx_L0;
683
+
684
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
685
+ goto __pyx_L0;
686
+ __pyx_L1:;
687
+ Py_XDECREF(__pyx_1);
688
+ Py_XDECREF(__pyx_2);
689
+ Py_XDECREF(__pyx_3);
690
+ __Pyx_AddTraceback("event.event.pending");
691
+ __pyx_r = 0;
692
+ __pyx_L0:;
693
+ Py_DECREF(__pyx_v_self);
694
+ return __pyx_r;
695
+ }
696
+
697
+ static PyObject *__pyx_n_pending;
698
+
699
+ static PyObject *__pyx_f_5event_5event_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
700
+ static char __pyx_doc_5event_5event_delete[] = "Remove event from the event queue.";
701
+ static PyObject *__pyx_f_5event_5event_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
702
+ PyObject *__pyx_r;
703
+ PyObject *__pyx_1 = 0;
704
+ PyObject *__pyx_2 = 0;
705
+ PyObject *__pyx_3 = 0;
706
+ int __pyx_4;
707
+ static char *__pyx_argnames[] = {0};
708
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
709
+ Py_INCREF(__pyx_v_self);
710
+
711
+ /* "/Users/dugsong/projects/pyevent/event.pyx":168 */
712
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_pending); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
713
+ __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
714
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
715
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
716
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
717
+ __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
718
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
719
+ if (__pyx_4) {
720
+
721
+ /* "/Users/dugsong/projects/pyevent/event.pyx":169 */
722
+ event_del((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev));
723
+
724
+ /* "/Users/dugsong/projects/pyevent/event.pyx":170 */
725
+ Py_DECREF(__pyx_v_self);
726
+ goto __pyx_L2;
727
+ }
728
+ __pyx_L2:;
729
+
730
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
731
+ goto __pyx_L0;
732
+ __pyx_L1:;
733
+ Py_XDECREF(__pyx_1);
734
+ Py_XDECREF(__pyx_2);
735
+ Py_XDECREF(__pyx_3);
736
+ __Pyx_AddTraceback("event.event.delete");
737
+ __pyx_r = 0;
738
+ __pyx_L0:;
739
+ Py_DECREF(__pyx_v_self);
740
+ return __pyx_r;
741
+ }
742
+
743
+ static PyObject *__pyx_n_delete;
744
+
745
+ static void __pyx_f_5event_5event___dealloc__(PyObject *__pyx_v_self); /*proto*/
746
+ static void __pyx_f_5event_5event___dealloc__(PyObject *__pyx_v_self) {
747
+ PyObject *__pyx_1 = 0;
748
+ PyObject *__pyx_2 = 0;
749
+ PyObject *__pyx_3 = 0;
750
+ Py_INCREF(__pyx_v_self);
751
+
752
+ /* "/Users/dugsong/projects/pyevent/event.pyx":173 */
753
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_delete); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
754
+ __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
755
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
756
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
757
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
758
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
759
+
760
+ goto __pyx_L0;
761
+ __pyx_L1:;
762
+ Py_XDECREF(__pyx_1);
763
+ Py_XDECREF(__pyx_2);
764
+ Py_XDECREF(__pyx_3);
765
+ __Pyx_AddTraceback("event.event.__dealloc__");
766
+ __pyx_L0:;
767
+ Py_DECREF(__pyx_v_self);
768
+ }
769
+
770
+ static PyObject *__pyx_k15p;
771
+
772
+ static char (__pyx_k15[]) = "<event flags=0x%x, handle=%s, callback=%s, arg=%s>";
773
+
774
+ static PyObject *__pyx_f_5event_5event___repr__(PyObject *__pyx_v_self); /*proto*/
775
+ static PyObject *__pyx_f_5event_5event___repr__(PyObject *__pyx_v_self) {
776
+ PyObject *__pyx_r;
777
+ PyObject *__pyx_1 = 0;
778
+ PyObject *__pyx_2 = 0;
779
+ Py_INCREF(__pyx_v_self);
780
+
781
+ /* "/Users/dugsong/projects/pyevent/event.pyx":176 */
782
+ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_5event_event *)__pyx_v_self)->ev.ev_flags); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
783
+ __pyx_2 = PyTuple_New(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
784
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
785
+ Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->handle);
786
+ PyTuple_SET_ITEM(__pyx_2, 1, ((struct __pyx_obj_5event_event *)__pyx_v_self)->handle);
787
+ Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->callback);
788
+ PyTuple_SET_ITEM(__pyx_2, 2, ((struct __pyx_obj_5event_event *)__pyx_v_self)->callback);
789
+ Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->args);
790
+ PyTuple_SET_ITEM(__pyx_2, 3, ((struct __pyx_obj_5event_event *)__pyx_v_self)->args);
791
+ __pyx_1 = 0;
792
+ __pyx_1 = PyNumber_Remainder(__pyx_k15p, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
793
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
794
+ __pyx_r = __pyx_1;
795
+ __pyx_1 = 0;
796
+ goto __pyx_L0;
797
+
798
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
799
+ goto __pyx_L0;
800
+ __pyx_L1:;
801
+ Py_XDECREF(__pyx_1);
802
+ Py_XDECREF(__pyx_2);
803
+ __Pyx_AddTraceback("event.event.__repr__");
804
+ __pyx_r = 0;
805
+ __pyx_L0:;
806
+ Py_DECREF(__pyx_v_self);
807
+ return __pyx_r;
808
+ }
809
+
810
+ static PyObject *__pyx_n___init__;
811
+ static PyObject *__pyx_n_simple;
812
+ static PyObject *__pyx_n_add;
813
+
814
+
815
+ static int __pyx_f_5event_4read___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
816
+ static int __pyx_f_5event_4read___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
817
+ PyObject *__pyx_v_handle = 0;
818
+ PyObject *__pyx_v_callback = 0;
819
+ PyObject *__pyx_v_args = 0;
820
+ int __pyx_r;
821
+ PyObject *__pyx_1 = 0;
822
+ PyObject *__pyx_2 = 0;
823
+ PyObject *__pyx_3 = 0;
824
+ PyObject *__pyx_4 = 0;
825
+ static char *__pyx_argnames[] = {"handle","callback",0};
826
+ if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1;
827
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_handle, &__pyx_v_callback)) {
828
+ Py_XDECREF(__pyx_args);
829
+ Py_XDECREF(__pyx_kwds);
830
+ Py_XDECREF(__pyx_v_args);
831
+ return -1;
832
+ }
833
+ Py_INCREF((PyObject *)__pyx_v_self);
834
+ Py_INCREF(__pyx_v_handle);
835
+ Py_INCREF(__pyx_v_callback);
836
+
837
+ /* "/Users/dugsong/projects/pyevent/event.pyx":193 */
838
+ __pyx_1 = PyObject_GetAttr(((PyObject*)__pyx_ptype_5event_event), __pyx_n___init__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
839
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
840
+ __pyx_3 = PyTuple_New(5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
841
+ Py_INCREF((PyObject *)__pyx_v_self);
842
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_self);
843
+ Py_INCREF(__pyx_v_callback);
844
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_callback);
845
+ Py_INCREF(__pyx_v_args);
846
+ PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_args);
847
+ PyTuple_SET_ITEM(__pyx_3, 3, __pyx_2);
848
+ Py_INCREF(__pyx_v_handle);
849
+ PyTuple_SET_ITEM(__pyx_3, 4, __pyx_v_handle);
850
+ __pyx_2 = 0;
851
+ __pyx_2 = PyDict_New(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
852
+ __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
853
+ if (PyDict_SetItem(__pyx_2, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
854
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
855
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
856
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
857
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
858
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
859
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
860
+
861
+ /* "/Users/dugsong/projects/pyevent/event.pyx":194 */
862
+ Py_INCREF(__pyx_v_args);
863
+ Py_DECREF(((struct __pyx_obj_5event_read *)__pyx_v_self)->__pyx_base.args);
864
+ ((struct __pyx_obj_5event_read *)__pyx_v_self)->__pyx_base.args = __pyx_v_args;
865
+
866
+ /* "/Users/dugsong/projects/pyevent/event.pyx":195 */
867
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
868
+ __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
869
+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
870
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
871
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
872
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
873
+
874
+ __pyx_r = 0;
875
+ goto __pyx_L0;
876
+ __pyx_L1:;
877
+ Py_XDECREF(__pyx_1);
878
+ Py_XDECREF(__pyx_2);
879
+ Py_XDECREF(__pyx_3);
880
+ Py_XDECREF(__pyx_4);
881
+ __Pyx_AddTraceback("event.read.__init__");
882
+ __pyx_r = -1;
883
+ __pyx_L0:;
884
+ Py_XDECREF(__pyx_v_args);
885
+ Py_DECREF((PyObject *)__pyx_v_self);
886
+ Py_DECREF(__pyx_v_handle);
887
+ Py_DECREF(__pyx_v_callback);
888
+ Py_XDECREF(__pyx_args);
889
+ Py_XDECREF(__pyx_kwds);
890
+ return __pyx_r;
891
+ }
892
+
893
+
894
+ static int __pyx_f_5event_5write___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
895
+ static int __pyx_f_5event_5write___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
896
+ PyObject *__pyx_v_handle = 0;
897
+ PyObject *__pyx_v_callback = 0;
898
+ PyObject *__pyx_v_args = 0;
899
+ int __pyx_r;
900
+ PyObject *__pyx_1 = 0;
901
+ PyObject *__pyx_2 = 0;
902
+ PyObject *__pyx_3 = 0;
903
+ PyObject *__pyx_4 = 0;
904
+ static char *__pyx_argnames[] = {"handle","callback",0};
905
+ if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1;
906
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_handle, &__pyx_v_callback)) {
907
+ Py_XDECREF(__pyx_args);
908
+ Py_XDECREF(__pyx_kwds);
909
+ Py_XDECREF(__pyx_v_args);
910
+ return -1;
911
+ }
912
+ Py_INCREF((PyObject *)__pyx_v_self);
913
+ Py_INCREF(__pyx_v_handle);
914
+ Py_INCREF(__pyx_v_callback);
915
+
916
+ /* "/Users/dugsong/projects/pyevent/event.pyx":211 */
917
+ __pyx_1 = PyObject_GetAttr(((PyObject*)__pyx_ptype_5event_event), __pyx_n___init__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
918
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
919
+ __pyx_3 = PyTuple_New(5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
920
+ Py_INCREF((PyObject *)__pyx_v_self);
921
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_self);
922
+ Py_INCREF(__pyx_v_callback);
923
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_callback);
924
+ Py_INCREF(__pyx_v_args);
925
+ PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_args);
926
+ PyTuple_SET_ITEM(__pyx_3, 3, __pyx_2);
927
+ Py_INCREF(__pyx_v_handle);
928
+ PyTuple_SET_ITEM(__pyx_3, 4, __pyx_v_handle);
929
+ __pyx_2 = 0;
930
+ __pyx_2 = PyDict_New(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
931
+ __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
932
+ if (PyDict_SetItem(__pyx_2, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
933
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
934
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
935
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
936
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
937
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
938
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
939
+
940
+ /* "/Users/dugsong/projects/pyevent/event.pyx":212 */
941
+ Py_INCREF(__pyx_v_args);
942
+ Py_DECREF(((struct __pyx_obj_5event_write *)__pyx_v_self)->__pyx_base.args);
943
+ ((struct __pyx_obj_5event_write *)__pyx_v_self)->__pyx_base.args = __pyx_v_args;
944
+
945
+ /* "/Users/dugsong/projects/pyevent/event.pyx":213 */
946
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
947
+ __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
948
+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
949
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
950
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
951
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
952
+
953
+ __pyx_r = 0;
954
+ goto __pyx_L0;
955
+ __pyx_L1:;
956
+ Py_XDECREF(__pyx_1);
957
+ Py_XDECREF(__pyx_2);
958
+ Py_XDECREF(__pyx_3);
959
+ Py_XDECREF(__pyx_4);
960
+ __Pyx_AddTraceback("event.write.__init__");
961
+ __pyx_r = -1;
962
+ __pyx_L0:;
963
+ Py_XDECREF(__pyx_v_args);
964
+ Py_DECREF((PyObject *)__pyx_v_self);
965
+ Py_DECREF(__pyx_v_handle);
966
+ Py_DECREF(__pyx_v_callback);
967
+ Py_XDECREF(__pyx_args);
968
+ Py_XDECREF(__pyx_kwds);
969
+ return __pyx_r;
970
+ }
971
+
972
+
973
+ static int __pyx_f_5event_6signal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
974
+ static int __pyx_f_5event_6signal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
975
+ PyObject *__pyx_v_sig = 0;
976
+ PyObject *__pyx_v_callback = 0;
977
+ PyObject *__pyx_v_args = 0;
978
+ int __pyx_r;
979
+ PyObject *__pyx_1 = 0;
980
+ PyObject *__pyx_2 = 0;
981
+ PyObject *__pyx_3 = 0;
982
+ PyObject *__pyx_4 = 0;
983
+ static char *__pyx_argnames[] = {"sig","callback",0};
984
+ if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1;
985
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_sig, &__pyx_v_callback)) {
986
+ Py_XDECREF(__pyx_args);
987
+ Py_XDECREF(__pyx_kwds);
988
+ Py_XDECREF(__pyx_v_args);
989
+ return -1;
990
+ }
991
+ Py_INCREF((PyObject *)__pyx_v_self);
992
+ Py_INCREF(__pyx_v_sig);
993
+ Py_INCREF(__pyx_v_callback);
994
+
995
+ /* "/Users/dugsong/projects/pyevent/event.pyx":230 */
996
+ __pyx_1 = PyObject_GetAttr(((PyObject*)__pyx_ptype_5event_event), __pyx_n___init__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
997
+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
998
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_PERSIST); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
999
+ __pyx_4 = PyNumber_Or(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1000
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
1001
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1002
+ __pyx_2 = PyTuple_New(5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1003
+ Py_INCREF((PyObject *)__pyx_v_self);
1004
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
1005
+ Py_INCREF(__pyx_v_callback);
1006
+ PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_callback);
1007
+ Py_INCREF(__pyx_v_args);
1008
+ PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_args);
1009
+ PyTuple_SET_ITEM(__pyx_2, 3, __pyx_4);
1010
+ Py_INCREF(__pyx_v_sig);
1011
+ PyTuple_SET_ITEM(__pyx_2, 4, __pyx_v_sig);
1012
+ __pyx_4 = 0;
1013
+ __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1014
+ __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
1015
+ if (PyDict_SetItem(__pyx_3, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1016
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
1017
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
1018
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1019
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
1020
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1021
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
1022
+
1023
+ /* "/Users/dugsong/projects/pyevent/event.pyx":232 */
1024
+ Py_INCREF(__pyx_v_args);
1025
+ Py_DECREF(((struct __pyx_obj_5event_signal *)__pyx_v_self)->__pyx_base.args);
1026
+ ((struct __pyx_obj_5event_signal *)__pyx_v_self)->__pyx_base.args = __pyx_v_args;
1027
+
1028
+ /* "/Users/dugsong/projects/pyevent/event.pyx":233 */
1029
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
1030
+ __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
1031
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
1032
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1033
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
1034
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1035
+
1036
+ __pyx_r = 0;
1037
+ goto __pyx_L0;
1038
+ __pyx_L1:;
1039
+ Py_XDECREF(__pyx_1);
1040
+ Py_XDECREF(__pyx_2);
1041
+ Py_XDECREF(__pyx_3);
1042
+ Py_XDECREF(__pyx_4);
1043
+ __Pyx_AddTraceback("event.signal.__init__");
1044
+ __pyx_r = -1;
1045
+ __pyx_L0:;
1046
+ Py_XDECREF(__pyx_v_args);
1047
+ Py_DECREF((PyObject *)__pyx_v_self);
1048
+ Py_DECREF(__pyx_v_sig);
1049
+ Py_DECREF(__pyx_v_callback);
1050
+ Py_XDECREF(__pyx_args);
1051
+ Py_XDECREF(__pyx_kwds);
1052
+ return __pyx_r;
1053
+ }
1054
+
1055
+
1056
+ static int __pyx_f_5event_7timeout___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1057
+ static int __pyx_f_5event_7timeout___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1058
+ PyObject *__pyx_v_secs = 0;
1059
+ PyObject *__pyx_v_callback = 0;
1060
+ PyObject *__pyx_v_args = 0;
1061
+ int __pyx_r;
1062
+ PyObject *__pyx_1 = 0;
1063
+ PyObject *__pyx_2 = 0;
1064
+ PyObject *__pyx_3 = 0;
1065
+ PyObject *__pyx_4 = 0;
1066
+ static char *__pyx_argnames[] = {"secs","callback",0};
1067
+ if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1;
1068
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_secs, &__pyx_v_callback)) {
1069
+ Py_XDECREF(__pyx_args);
1070
+ Py_XDECREF(__pyx_kwds);
1071
+ Py_XDECREF(__pyx_v_args);
1072
+ return -1;
1073
+ }
1074
+ Py_INCREF((PyObject *)__pyx_v_self);
1075
+ Py_INCREF(__pyx_v_secs);
1076
+ Py_INCREF(__pyx_v_callback);
1077
+
1078
+ /* "/Users/dugsong/projects/pyevent/event.pyx":249 */
1079
+ __pyx_1 = PyObject_GetAttr(((PyObject*)__pyx_ptype_5event_event), __pyx_n___init__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
1080
+ __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
1081
+ Py_INCREF((PyObject *)__pyx_v_self);
1082
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
1083
+ Py_INCREF(__pyx_v_callback);
1084
+ PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_callback);
1085
+ Py_INCREF(__pyx_v_args);
1086
+ PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_args);
1087
+ __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
1088
+ __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
1089
+ if (PyDict_SetItem(__pyx_3, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
1090
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
1091
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
1092
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1093
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
1094
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1095
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
1096
+
1097
+ /* "/Users/dugsong/projects/pyevent/event.pyx":250 */
1098
+ Py_INCREF(__pyx_v_args);
1099
+ Py_DECREF(((struct __pyx_obj_5event_timeout *)__pyx_v_self)->__pyx_base.args);
1100
+ ((struct __pyx_obj_5event_timeout *)__pyx_v_self)->__pyx_base.args = __pyx_v_args;
1101
+
1102
+ /* "/Users/dugsong/projects/pyevent/event.pyx":251 */
1103
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
1104
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
1105
+ Py_INCREF(__pyx_v_secs);
1106
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_secs);
1107
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
1108
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1109
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
1110
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1111
+
1112
+ __pyx_r = 0;
1113
+ goto __pyx_L0;
1114
+ __pyx_L1:;
1115
+ Py_XDECREF(__pyx_1);
1116
+ Py_XDECREF(__pyx_2);
1117
+ Py_XDECREF(__pyx_3);
1118
+ Py_XDECREF(__pyx_4);
1119
+ __Pyx_AddTraceback("event.timeout.__init__");
1120
+ __pyx_r = -1;
1121
+ __pyx_L0:;
1122
+ Py_XDECREF(__pyx_v_args);
1123
+ Py_DECREF((PyObject *)__pyx_v_self);
1124
+ Py_DECREF(__pyx_v_secs);
1125
+ Py_DECREF(__pyx_v_callback);
1126
+ Py_XDECREF(__pyx_args);
1127
+ Py_XDECREF(__pyx_kwds);
1128
+ return __pyx_r;
1129
+ }
1130
+
1131
+ static PyObject *__pyx_f_5event_init(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1132
+ static char __pyx_doc_5event_init[] = "Initialize event queue.";
1133
+ static PyObject *__pyx_f_5event_init(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1134
+ PyObject *__pyx_r;
1135
+ static char *__pyx_argnames[] = {0};
1136
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
1137
+
1138
+ /* "/Users/dugsong/projects/pyevent/event.pyx":255 */
1139
+ event_init();
1140
+
1141
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
1142
+ goto __pyx_L0;
1143
+ __pyx_L1:;
1144
+ __Pyx_AddTraceback("event.init");
1145
+ __pyx_r = 0;
1146
+ __pyx_L0:;
1147
+ return __pyx_r;
1148
+ }
1149
+
1150
+ static PyObject *__pyx_f_5event_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1151
+ static char __pyx_doc_5event_dispatch[] = "Dispatch all events on the event queue.";
1152
+ static PyObject *__pyx_f_5event_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1153
+ PyObject *__pyx_r;
1154
+ PyObject *__pyx_1 = 0;
1155
+ int __pyx_2;
1156
+ PyObject *__pyx_3 = 0;
1157
+ PyObject *__pyx_4 = 0;
1158
+ PyObject *__pyx_5 = 0;
1159
+ PyObject *__pyx_6 = 0;
1160
+ static char *__pyx_argnames[] = {0};
1161
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
1162
+
1163
+ /* "/Users/dugsong/projects/pyevent/event.pyx":260 */
1164
+ event_dispatch();
1165
+
1166
+ /* "/Users/dugsong/projects/pyevent/event.pyx":261 */
1167
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}
1168
+ __pyx_2 = PyObject_IsTrue(__pyx_1); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}
1169
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1170
+ if (__pyx_2) {
1171
+
1172
+ /* "/Users/dugsong/projects/pyevent/event.pyx":262 */
1173
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1174
+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1175
+ __pyx_4 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1176
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1177
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1178
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1179
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1180
+ __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1181
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1182
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1183
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1184
+ __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1185
+ __pyx_6 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1186
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
1187
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
1188
+ __Pyx_Raise(__pyx_4, __pyx_5, __pyx_6);
1189
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
1190
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
1191
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
1192
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}
1193
+ goto __pyx_L2;
1194
+ }
1195
+ __pyx_L2:;
1196
+
1197
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
1198
+ goto __pyx_L0;
1199
+ __pyx_L1:;
1200
+ Py_XDECREF(__pyx_1);
1201
+ Py_XDECREF(__pyx_3);
1202
+ Py_XDECREF(__pyx_4);
1203
+ Py_XDECREF(__pyx_5);
1204
+ Py_XDECREF(__pyx_6);
1205
+ __Pyx_AddTraceback("event.dispatch");
1206
+ __pyx_r = 0;
1207
+ __pyx_L0:;
1208
+ return __pyx_r;
1209
+ }
1210
+
1211
+ static PyObject *__pyx_f_5event_loop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1212
+ static char __pyx_doc_5event_loop[] = "Dispatch all pending events on queue in a single pass.";
1213
+ static PyObject *__pyx_f_5event_loop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1214
+ PyObject *__pyx_v_nonblock = 0;
1215
+ int __pyx_v_flags;
1216
+ PyObject *__pyx_r;
1217
+ int __pyx_1;
1218
+ static char *__pyx_argnames[] = {"nonblock",0};
1219
+ __pyx_v_nonblock = __pyx_k14;
1220
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_nonblock)) return 0;
1221
+ Py_INCREF(__pyx_v_nonblock);
1222
+
1223
+ /* "/Users/dugsong/projects/pyevent/event.pyx":267 */
1224
+ __pyx_v_flags = EVLOOP_ONCE;
1225
+
1226
+ /* "/Users/dugsong/projects/pyevent/event.pyx":268 */
1227
+ __pyx_1 = PyObject_IsTrue(__pyx_v_nonblock); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
1228
+ if (__pyx_1) {
1229
+
1230
+ /* "/Users/dugsong/projects/pyevent/event.pyx":269 */
1231
+ __pyx_v_flags = (EVLOOP_ONCE | EVLOOP_NONBLOCK);
1232
+ goto __pyx_L2;
1233
+ }
1234
+ __pyx_L2:;
1235
+
1236
+ /* "/Users/dugsong/projects/pyevent/event.pyx":270 */
1237
+ event_loop(__pyx_v_flags);
1238
+
1239
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
1240
+ goto __pyx_L0;
1241
+ __pyx_L1:;
1242
+ __Pyx_AddTraceback("event.loop");
1243
+ __pyx_r = 0;
1244
+ __pyx_L0:;
1245
+ Py_DECREF(__pyx_v_nonblock);
1246
+ return __pyx_r;
1247
+ }
1248
+
1249
+ static PyObject *__pyx_f_5event_abort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1250
+ static char __pyx_doc_5event_abort[] = "Abort event dispatch loop.";
1251
+ static PyObject *__pyx_f_5event_abort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1252
+ extern int event_gotsig;
1253
+ extern int ((*event_sigcb)(void));
1254
+ PyObject *__pyx_r;
1255
+ static char *__pyx_argnames[] = {0};
1256
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
1257
+
1258
+ /* "/Users/dugsong/projects/pyevent/event.pyx":276 */
1259
+ event_sigcb = __pyx_f_5event___event_sigcb;
1260
+
1261
+ /* "/Users/dugsong/projects/pyevent/event.pyx":277 */
1262
+ event_gotsig = 1;
1263
+
1264
+ __pyx_r = Py_None; Py_INCREF(__pyx_r);
1265
+ goto __pyx_L0;
1266
+ __pyx_L1:;
1267
+ __Pyx_AddTraceback("event.abort");
1268
+ __pyx_r = 0;
1269
+ __pyx_L0:;
1270
+ return __pyx_r;
1271
+ }
1272
+
1273
+ static __Pyx_InternTabEntry __pyx_intern_tab[] = {
1274
+ {&__pyx_n_BSD, "BSD"},
1275
+ {&__pyx_n_EV_PERSIST, "EV_PERSIST"},
1276
+ {&__pyx_n_EV_READ, "EV_READ"},
1277
+ {&__pyx_n_EV_SIGNAL, "EV_SIGNAL"},
1278
+ {&__pyx_n_EV_TIMEOUT, "EV_TIMEOUT"},
1279
+ {&__pyx_n_EV_WRITE, "EV_WRITE"},
1280
+ {&__pyx_n_False, "False"},
1281
+ {&__pyx_n___author__, "__author__"},
1282
+ {&__pyx_n___callback, "__callback"},
1283
+ {&__pyx_n___copyright__, "__copyright__"},
1284
+ {&__pyx_n___event_exc, "__event_exc"},
1285
+ {&__pyx_n___init__, "__init__"},
1286
+ {&__pyx_n___license__, "__license__"},
1287
+ {&__pyx_n___simple_callback, "__simple_callback"},
1288
+ {&__pyx_n___url__, "__url__"},
1289
+ {&__pyx_n___version__, "__version__"},
1290
+ {&__pyx_n_abort, "abort"},
1291
+ {&__pyx_n_add, "add"},
1292
+ {&__pyx_n_delete, "delete"},
1293
+ {&__pyx_n_dispatch, "dispatch"},
1294
+ {&__pyx_n_exc_info, "exc_info"},
1295
+ {&__pyx_n_fileno, "fileno"},
1296
+ {&__pyx_n_init, "init"},
1297
+ {&__pyx_n_int, "int"},
1298
+ {&__pyx_n_isinstance, "isinstance"},
1299
+ {&__pyx_n_loop, "loop"},
1300
+ {&__pyx_n_pending, "pending"},
1301
+ {&__pyx_n_simple, "simple"},
1302
+ {&__pyx_n_sys, "sys"},
1303
+ {0, 0}
1304
+ };
1305
+
1306
+ static __Pyx_StringTabEntry __pyx_string_tab[] = {
1307
+ {&__pyx_k1p, __pyx_k1, sizeof(__pyx_k1)},
1308
+ {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
1309
+ {&__pyx_k3p, __pyx_k3, sizeof(__pyx_k3)},
1310
+ {&__pyx_k4p, __pyx_k4, sizeof(__pyx_k4)},
1311
+ {&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6)},
1312
+ {&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7)},
1313
+ {&__pyx_k15p, __pyx_k15, sizeof(__pyx_k15)},
1314
+ {0, 0, 0}
1315
+ };
1316
+
1317
+ static PyObject *__pyx_tp_new_5event_event(PyTypeObject *t, PyObject *a, PyObject *k) {
1318
+ PyObject *o = (*t->tp_alloc)(t, 0);
1319
+ struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o;
1320
+ p->handle = Py_None; Py_INCREF(p->handle);
1321
+ p->evtype = Py_None; Py_INCREF(p->evtype);
1322
+ p->callback = Py_None; Py_INCREF(p->callback);
1323
+ p->args = Py_None; Py_INCREF(p->args);
1324
+ return o;
1325
+ }
1326
+
1327
+ static void __pyx_tp_dealloc_5event_event(PyObject *o) {
1328
+ struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o;
1329
+ {
1330
+ PyObject *etype, *eval, *etb;
1331
+ PyErr_Fetch(&etype, &eval, &etb);
1332
+ ++o->ob_refcnt;
1333
+ __pyx_f_5event_5event___dealloc__(o);
1334
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
1335
+ --o->ob_refcnt;
1336
+ PyErr_Restore(etype, eval, etb);
1337
+ }
1338
+ Py_XDECREF(p->handle);
1339
+ Py_XDECREF(p->evtype);
1340
+ Py_XDECREF(p->callback);
1341
+ Py_XDECREF(p->args);
1342
+ (*o->ob_type->tp_free)(o);
1343
+ }
1344
+
1345
+ static int __pyx_tp_traverse_5event_event(PyObject *o, visitproc v, void *a) {
1346
+ int e;
1347
+ struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o;
1348
+ if (p->handle) {
1349
+ e = (*v)(p->handle, a); if (e) return e;
1350
+ }
1351
+ if (p->evtype) {
1352
+ e = (*v)(p->evtype, a); if (e) return e;
1353
+ }
1354
+ if (p->callback) {
1355
+ e = (*v)(p->callback, a); if (e) return e;
1356
+ }
1357
+ if (p->args) {
1358
+ e = (*v)(p->args, a); if (e) return e;
1359
+ }
1360
+ return 0;
1361
+ }
1362
+
1363
+ static int __pyx_tp_clear_5event_event(PyObject *o) {
1364
+ struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o;
1365
+ Py_XDECREF(p->handle);
1366
+ p->handle = Py_None; Py_INCREF(p->handle);
1367
+ Py_XDECREF(p->evtype);
1368
+ p->evtype = Py_None; Py_INCREF(p->evtype);
1369
+ Py_XDECREF(p->callback);
1370
+ p->callback = Py_None; Py_INCREF(p->callback);
1371
+ Py_XDECREF(p->args);
1372
+ p->args = Py_None; Py_INCREF(p->args);
1373
+ return 0;
1374
+ }
1375
+
1376
+ static struct PyMethodDef __pyx_methods_5event_event[] = {
1377
+ {"__simple_callback", (PyCFunction)__pyx_f_5event_5event___simple_callback, METH_VARARGS|METH_KEYWORDS, 0},
1378
+ {"__callback", (PyCFunction)__pyx_f_5event_5event___callback, METH_VARARGS|METH_KEYWORDS, 0},
1379
+ {"add", (PyCFunction)__pyx_f_5event_5event_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_5event_add},
1380
+ {"pending", (PyCFunction)__pyx_f_5event_5event_pending, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_5event_pending},
1381
+ {"delete", (PyCFunction)__pyx_f_5event_5event_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_5event_delete},
1382
+ {0, 0, 0, 0}
1383
+ };
1384
+
1385
+ static PyNumberMethods __pyx_tp_as_number_event = {
1386
+ 0, /*nb_add*/
1387
+ 0, /*nb_subtract*/
1388
+ 0, /*nb_multiply*/
1389
+ 0, /*nb_divide*/
1390
+ 0, /*nb_remainder*/
1391
+ 0, /*nb_divmod*/
1392
+ 0, /*nb_power*/
1393
+ 0, /*nb_negative*/
1394
+ 0, /*nb_positive*/
1395
+ 0, /*nb_absolute*/
1396
+ 0, /*nb_nonzero*/
1397
+ 0, /*nb_invert*/
1398
+ 0, /*nb_lshift*/
1399
+ 0, /*nb_rshift*/
1400
+ 0, /*nb_and*/
1401
+ 0, /*nb_xor*/
1402
+ 0, /*nb_or*/
1403
+ 0, /*nb_coerce*/
1404
+ 0, /*nb_int*/
1405
+ 0, /*nb_long*/
1406
+ 0, /*nb_float*/
1407
+ 0, /*nb_oct*/
1408
+ 0, /*nb_hex*/
1409
+ 0, /*nb_inplace_add*/
1410
+ 0, /*nb_inplace_subtract*/
1411
+ 0, /*nb_inplace_multiply*/
1412
+ 0, /*nb_inplace_divide*/
1413
+ 0, /*nb_inplace_remainder*/
1414
+ 0, /*nb_inplace_power*/
1415
+ 0, /*nb_inplace_lshift*/
1416
+ 0, /*nb_inplace_rshift*/
1417
+ 0, /*nb_inplace_and*/
1418
+ 0, /*nb_inplace_xor*/
1419
+ 0, /*nb_inplace_or*/
1420
+ 0, /*nb_floor_divide*/
1421
+ 0, /*nb_true_divide*/
1422
+ 0, /*nb_inplace_floor_divide*/
1423
+ 0, /*nb_inplace_true_divide*/
1424
+ };
1425
+
1426
+ static PySequenceMethods __pyx_tp_as_sequence_event = {
1427
+ 0, /*sq_length*/
1428
+ 0, /*sq_concat*/
1429
+ 0, /*sq_repeat*/
1430
+ 0, /*sq_item*/
1431
+ 0, /*sq_slice*/
1432
+ 0, /*sq_ass_item*/
1433
+ 0, /*sq_ass_slice*/
1434
+ 0, /*sq_contains*/
1435
+ 0, /*sq_inplace_concat*/
1436
+ 0, /*sq_inplace_repeat*/
1437
+ };
1438
+
1439
+ static PyMappingMethods __pyx_tp_as_mapping_event = {
1440
+ 0, /*mp_length*/
1441
+ 0, /*mp_subscript*/
1442
+ 0, /*mp_ass_subscript*/
1443
+ };
1444
+
1445
+ static PyBufferProcs __pyx_tp_as_buffer_event = {
1446
+ 0, /*bf_getreadbuffer*/
1447
+ 0, /*bf_getwritebuffer*/
1448
+ 0, /*bf_getsegcount*/
1449
+ 0, /*bf_getcharbuffer*/
1450
+ };
1451
+
1452
+ statichere PyTypeObject __pyx_type_5event_event = {
1453
+ PyObject_HEAD_INIT(0)
1454
+ 0, /*ob_size*/
1455
+ "event.event", /*tp_name*/
1456
+ sizeof(struct __pyx_obj_5event_event), /*tp_basicsize*/
1457
+ 0, /*tp_itemsize*/
1458
+ __pyx_tp_dealloc_5event_event, /*tp_dealloc*/
1459
+ 0, /*tp_print*/
1460
+ 0, /*tp_getattr*/
1461
+ 0, /*tp_setattr*/
1462
+ 0, /*tp_compare*/
1463
+ __pyx_f_5event_5event___repr__, /*tp_repr*/
1464
+ &__pyx_tp_as_number_event, /*tp_as_number*/
1465
+ &__pyx_tp_as_sequence_event, /*tp_as_sequence*/
1466
+ &__pyx_tp_as_mapping_event, /*tp_as_mapping*/
1467
+ 0, /*tp_hash*/
1468
+ 0, /*tp_call*/
1469
+ 0, /*tp_str*/
1470
+ 0, /*tp_getattro*/
1471
+ 0, /*tp_setattro*/
1472
+ &__pyx_tp_as_buffer_event, /*tp_as_buffer*/
1473
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
1474
+ "event(callback, arg=None, evtype=0, handle=None) -> event object\n \n Create a new event object with a user callback.\n\n Arguments:\n\n callback -- user callback with (ev, handle, evtype, arg) prototype\n arg -- optional callback arguments\n evtype -- bitmask of EV_READ or EV_WRITE, or EV_SIGNAL\n handle -- for EV_READ or EV_WRITE, a file handle, descriptor, or socket\n for EV_SIGNAL, a signal number\n ", /*tp_doc*/
1475
+ __pyx_tp_traverse_5event_event, /*tp_traverse*/
1476
+ __pyx_tp_clear_5event_event, /*tp_clear*/
1477
+ 0, /*tp_richcompare*/
1478
+ 0, /*tp_weaklistoffset*/
1479
+ 0, /*tp_iter*/
1480
+ 0, /*tp_iternext*/
1481
+ __pyx_methods_5event_event, /*tp_methods*/
1482
+ 0, /*tp_members*/
1483
+ 0, /*tp_getset*/
1484
+ 0, /*tp_base*/
1485
+ 0, /*tp_dict*/
1486
+ 0, /*tp_descr_get*/
1487
+ 0, /*tp_descr_set*/
1488
+ 0, /*tp_dictoffset*/
1489
+ __pyx_f_5event_5event___init__, /*tp_init*/
1490
+ 0, /*tp_alloc*/
1491
+ __pyx_tp_new_5event_event, /*tp_new*/
1492
+ 0, /*tp_free*/
1493
+ 0, /*tp_is_gc*/
1494
+ 0, /*tp_bases*/
1495
+ 0, /*tp_mro*/
1496
+ 0, /*tp_cache*/
1497
+ 0, /*tp_subclasses*/
1498
+ 0, /*tp_weaklist*/
1499
+ };
1500
+
1501
+ static PyObject *__pyx_tp_new_5event_read(PyTypeObject *t, PyObject *a, PyObject *k) {
1502
+ PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k);
1503
+ struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o;
1504
+ return o;
1505
+ }
1506
+
1507
+ static void __pyx_tp_dealloc_5event_read(PyObject *o) {
1508
+ struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o;
1509
+ __pyx_ptype_5event_event->tp_dealloc(o);
1510
+ }
1511
+
1512
+ static int __pyx_tp_traverse_5event_read(PyObject *o, visitproc v, void *a) {
1513
+ int e;
1514
+ struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o;
1515
+ __pyx_ptype_5event_event->tp_traverse(o, v, a);
1516
+ return 0;
1517
+ }
1518
+
1519
+ static int __pyx_tp_clear_5event_read(PyObject *o) {
1520
+ struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o;
1521
+ __pyx_ptype_5event_event->tp_clear(o);
1522
+ return 0;
1523
+ }
1524
+
1525
+ static struct PyMethodDef __pyx_methods_5event_read[] = {
1526
+ {0, 0, 0, 0}
1527
+ };
1528
+
1529
+ static PyNumberMethods __pyx_tp_as_number_read = {
1530
+ 0, /*nb_add*/
1531
+ 0, /*nb_subtract*/
1532
+ 0, /*nb_multiply*/
1533
+ 0, /*nb_divide*/
1534
+ 0, /*nb_remainder*/
1535
+ 0, /*nb_divmod*/
1536
+ 0, /*nb_power*/
1537
+ 0, /*nb_negative*/
1538
+ 0, /*nb_positive*/
1539
+ 0, /*nb_absolute*/
1540
+ 0, /*nb_nonzero*/
1541
+ 0, /*nb_invert*/
1542
+ 0, /*nb_lshift*/
1543
+ 0, /*nb_rshift*/
1544
+ 0, /*nb_and*/
1545
+ 0, /*nb_xor*/
1546
+ 0, /*nb_or*/
1547
+ 0, /*nb_coerce*/
1548
+ 0, /*nb_int*/
1549
+ 0, /*nb_long*/
1550
+ 0, /*nb_float*/
1551
+ 0, /*nb_oct*/
1552
+ 0, /*nb_hex*/
1553
+ 0, /*nb_inplace_add*/
1554
+ 0, /*nb_inplace_subtract*/
1555
+ 0, /*nb_inplace_multiply*/
1556
+ 0, /*nb_inplace_divide*/
1557
+ 0, /*nb_inplace_remainder*/
1558
+ 0, /*nb_inplace_power*/
1559
+ 0, /*nb_inplace_lshift*/
1560
+ 0, /*nb_inplace_rshift*/
1561
+ 0, /*nb_inplace_and*/
1562
+ 0, /*nb_inplace_xor*/
1563
+ 0, /*nb_inplace_or*/
1564
+ 0, /*nb_floor_divide*/
1565
+ 0, /*nb_true_divide*/
1566
+ 0, /*nb_inplace_floor_divide*/
1567
+ 0, /*nb_inplace_true_divide*/
1568
+ };
1569
+
1570
+ static PySequenceMethods __pyx_tp_as_sequence_read = {
1571
+ 0, /*sq_length*/
1572
+ 0, /*sq_concat*/
1573
+ 0, /*sq_repeat*/
1574
+ 0, /*sq_item*/
1575
+ 0, /*sq_slice*/
1576
+ 0, /*sq_ass_item*/
1577
+ 0, /*sq_ass_slice*/
1578
+ 0, /*sq_contains*/
1579
+ 0, /*sq_inplace_concat*/
1580
+ 0, /*sq_inplace_repeat*/
1581
+ };
1582
+
1583
+ static PyMappingMethods __pyx_tp_as_mapping_read = {
1584
+ 0, /*mp_length*/
1585
+ 0, /*mp_subscript*/
1586
+ 0, /*mp_ass_subscript*/
1587
+ };
1588
+
1589
+ static PyBufferProcs __pyx_tp_as_buffer_read = {
1590
+ 0, /*bf_getreadbuffer*/
1591
+ 0, /*bf_getwritebuffer*/
1592
+ 0, /*bf_getsegcount*/
1593
+ 0, /*bf_getcharbuffer*/
1594
+ };
1595
+
1596
+ statichere PyTypeObject __pyx_type_5event_read = {
1597
+ PyObject_HEAD_INIT(0)
1598
+ 0, /*ob_size*/
1599
+ "event.read", /*tp_name*/
1600
+ sizeof(struct __pyx_obj_5event_read), /*tp_basicsize*/
1601
+ 0, /*tp_itemsize*/
1602
+ __pyx_tp_dealloc_5event_read, /*tp_dealloc*/
1603
+ 0, /*tp_print*/
1604
+ 0, /*tp_getattr*/
1605
+ 0, /*tp_setattr*/
1606
+ 0, /*tp_compare*/
1607
+ 0, /*tp_repr*/
1608
+ &__pyx_tp_as_number_read, /*tp_as_number*/
1609
+ &__pyx_tp_as_sequence_read, /*tp_as_sequence*/
1610
+ &__pyx_tp_as_mapping_read, /*tp_as_mapping*/
1611
+ 0, /*tp_hash*/
1612
+ 0, /*tp_call*/
1613
+ 0, /*tp_str*/
1614
+ 0, /*tp_getattro*/
1615
+ 0, /*tp_setattro*/
1616
+ &__pyx_tp_as_buffer_read, /*tp_as_buffer*/
1617
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
1618
+ "read(handle, callback, *args) -> event object\n \n Simplified event interface:\n Create a new read event, and add it to the event queue.\n \n Arguments:\n\n handle -- file handle, descriptor, or socket\n callback -- user callback with (*args) prototype, which can return\n a non-None value to be rescheduled\n *args -- optional callback arguments\n ", /*tp_doc*/
1619
+ __pyx_tp_traverse_5event_read, /*tp_traverse*/
1620
+ __pyx_tp_clear_5event_read, /*tp_clear*/
1621
+ 0, /*tp_richcompare*/
1622
+ 0, /*tp_weaklistoffset*/
1623
+ 0, /*tp_iter*/
1624
+ 0, /*tp_iternext*/
1625
+ __pyx_methods_5event_read, /*tp_methods*/
1626
+ 0, /*tp_members*/
1627
+ 0, /*tp_getset*/
1628
+ 0, /*tp_base*/
1629
+ 0, /*tp_dict*/
1630
+ 0, /*tp_descr_get*/
1631
+ 0, /*tp_descr_set*/
1632
+ 0, /*tp_dictoffset*/
1633
+ __pyx_f_5event_4read___init__, /*tp_init*/
1634
+ 0, /*tp_alloc*/
1635
+ __pyx_tp_new_5event_read, /*tp_new*/
1636
+ 0, /*tp_free*/
1637
+ 0, /*tp_is_gc*/
1638
+ 0, /*tp_bases*/
1639
+ 0, /*tp_mro*/
1640
+ 0, /*tp_cache*/
1641
+ 0, /*tp_subclasses*/
1642
+ 0, /*tp_weaklist*/
1643
+ };
1644
+
1645
+ static PyObject *__pyx_tp_new_5event_write(PyTypeObject *t, PyObject *a, PyObject *k) {
1646
+ PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k);
1647
+ struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o;
1648
+ return o;
1649
+ }
1650
+
1651
+ static void __pyx_tp_dealloc_5event_write(PyObject *o) {
1652
+ struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o;
1653
+ __pyx_ptype_5event_event->tp_dealloc(o);
1654
+ }
1655
+
1656
+ static int __pyx_tp_traverse_5event_write(PyObject *o, visitproc v, void *a) {
1657
+ int e;
1658
+ struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o;
1659
+ __pyx_ptype_5event_event->tp_traverse(o, v, a);
1660
+ return 0;
1661
+ }
1662
+
1663
+ static int __pyx_tp_clear_5event_write(PyObject *o) {
1664
+ struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o;
1665
+ __pyx_ptype_5event_event->tp_clear(o);
1666
+ return 0;
1667
+ }
1668
+
1669
+ static struct PyMethodDef __pyx_methods_5event_write[] = {
1670
+ {0, 0, 0, 0}
1671
+ };
1672
+
1673
+ static PyNumberMethods __pyx_tp_as_number_write = {
1674
+ 0, /*nb_add*/
1675
+ 0, /*nb_subtract*/
1676
+ 0, /*nb_multiply*/
1677
+ 0, /*nb_divide*/
1678
+ 0, /*nb_remainder*/
1679
+ 0, /*nb_divmod*/
1680
+ 0, /*nb_power*/
1681
+ 0, /*nb_negative*/
1682
+ 0, /*nb_positive*/
1683
+ 0, /*nb_absolute*/
1684
+ 0, /*nb_nonzero*/
1685
+ 0, /*nb_invert*/
1686
+ 0, /*nb_lshift*/
1687
+ 0, /*nb_rshift*/
1688
+ 0, /*nb_and*/
1689
+ 0, /*nb_xor*/
1690
+ 0, /*nb_or*/
1691
+ 0, /*nb_coerce*/
1692
+ 0, /*nb_int*/
1693
+ 0, /*nb_long*/
1694
+ 0, /*nb_float*/
1695
+ 0, /*nb_oct*/
1696
+ 0, /*nb_hex*/
1697
+ 0, /*nb_inplace_add*/
1698
+ 0, /*nb_inplace_subtract*/
1699
+ 0, /*nb_inplace_multiply*/
1700
+ 0, /*nb_inplace_divide*/
1701
+ 0, /*nb_inplace_remainder*/
1702
+ 0, /*nb_inplace_power*/
1703
+ 0, /*nb_inplace_lshift*/
1704
+ 0, /*nb_inplace_rshift*/
1705
+ 0, /*nb_inplace_and*/
1706
+ 0, /*nb_inplace_xor*/
1707
+ 0, /*nb_inplace_or*/
1708
+ 0, /*nb_floor_divide*/
1709
+ 0, /*nb_true_divide*/
1710
+ 0, /*nb_inplace_floor_divide*/
1711
+ 0, /*nb_inplace_true_divide*/
1712
+ };
1713
+
1714
+ static PySequenceMethods __pyx_tp_as_sequence_write = {
1715
+ 0, /*sq_length*/
1716
+ 0, /*sq_concat*/
1717
+ 0, /*sq_repeat*/
1718
+ 0, /*sq_item*/
1719
+ 0, /*sq_slice*/
1720
+ 0, /*sq_ass_item*/
1721
+ 0, /*sq_ass_slice*/
1722
+ 0, /*sq_contains*/
1723
+ 0, /*sq_inplace_concat*/
1724
+ 0, /*sq_inplace_repeat*/
1725
+ };
1726
+
1727
+ static PyMappingMethods __pyx_tp_as_mapping_write = {
1728
+ 0, /*mp_length*/
1729
+ 0, /*mp_subscript*/
1730
+ 0, /*mp_ass_subscript*/
1731
+ };
1732
+
1733
+ static PyBufferProcs __pyx_tp_as_buffer_write = {
1734
+ 0, /*bf_getreadbuffer*/
1735
+ 0, /*bf_getwritebuffer*/
1736
+ 0, /*bf_getsegcount*/
1737
+ 0, /*bf_getcharbuffer*/
1738
+ };
1739
+
1740
+ statichere PyTypeObject __pyx_type_5event_write = {
1741
+ PyObject_HEAD_INIT(0)
1742
+ 0, /*ob_size*/
1743
+ "event.write", /*tp_name*/
1744
+ sizeof(struct __pyx_obj_5event_write), /*tp_basicsize*/
1745
+ 0, /*tp_itemsize*/
1746
+ __pyx_tp_dealloc_5event_write, /*tp_dealloc*/
1747
+ 0, /*tp_print*/
1748
+ 0, /*tp_getattr*/
1749
+ 0, /*tp_setattr*/
1750
+ 0, /*tp_compare*/
1751
+ 0, /*tp_repr*/
1752
+ &__pyx_tp_as_number_write, /*tp_as_number*/
1753
+ &__pyx_tp_as_sequence_write, /*tp_as_sequence*/
1754
+ &__pyx_tp_as_mapping_write, /*tp_as_mapping*/
1755
+ 0, /*tp_hash*/
1756
+ 0, /*tp_call*/
1757
+ 0, /*tp_str*/
1758
+ 0, /*tp_getattro*/
1759
+ 0, /*tp_setattro*/
1760
+ &__pyx_tp_as_buffer_write, /*tp_as_buffer*/
1761
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
1762
+ "write(handle, callback, *args) -> event object\n\n Simplified event interface:\n Create a new write event, and add it to the event queue.\n \n Arguments:\n\n handle -- file handle, descriptor, or socket\n callback -- user callback with (*args) prototype, which can return\n a non-None value to be rescheduled\n *args -- optional callback arguments\n ", /*tp_doc*/
1763
+ __pyx_tp_traverse_5event_write, /*tp_traverse*/
1764
+ __pyx_tp_clear_5event_write, /*tp_clear*/
1765
+ 0, /*tp_richcompare*/
1766
+ 0, /*tp_weaklistoffset*/
1767
+ 0, /*tp_iter*/
1768
+ 0, /*tp_iternext*/
1769
+ __pyx_methods_5event_write, /*tp_methods*/
1770
+ 0, /*tp_members*/
1771
+ 0, /*tp_getset*/
1772
+ 0, /*tp_base*/
1773
+ 0, /*tp_dict*/
1774
+ 0, /*tp_descr_get*/
1775
+ 0, /*tp_descr_set*/
1776
+ 0, /*tp_dictoffset*/
1777
+ __pyx_f_5event_5write___init__, /*tp_init*/
1778
+ 0, /*tp_alloc*/
1779
+ __pyx_tp_new_5event_write, /*tp_new*/
1780
+ 0, /*tp_free*/
1781
+ 0, /*tp_is_gc*/
1782
+ 0, /*tp_bases*/
1783
+ 0, /*tp_mro*/
1784
+ 0, /*tp_cache*/
1785
+ 0, /*tp_subclasses*/
1786
+ 0, /*tp_weaklist*/
1787
+ };
1788
+
1789
+ static PyObject *__pyx_tp_new_5event_signal(PyTypeObject *t, PyObject *a, PyObject *k) {
1790
+ PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k);
1791
+ struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o;
1792
+ return o;
1793
+ }
1794
+
1795
+ static void __pyx_tp_dealloc_5event_signal(PyObject *o) {
1796
+ struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o;
1797
+ __pyx_ptype_5event_event->tp_dealloc(o);
1798
+ }
1799
+
1800
+ static int __pyx_tp_traverse_5event_signal(PyObject *o, visitproc v, void *a) {
1801
+ int e;
1802
+ struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o;
1803
+ __pyx_ptype_5event_event->tp_traverse(o, v, a);
1804
+ return 0;
1805
+ }
1806
+
1807
+ static int __pyx_tp_clear_5event_signal(PyObject *o) {
1808
+ struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o;
1809
+ __pyx_ptype_5event_event->tp_clear(o);
1810
+ return 0;
1811
+ }
1812
+
1813
+ static struct PyMethodDef __pyx_methods_5event_signal[] = {
1814
+ {0, 0, 0, 0}
1815
+ };
1816
+
1817
+ static PyNumberMethods __pyx_tp_as_number_signal = {
1818
+ 0, /*nb_add*/
1819
+ 0, /*nb_subtract*/
1820
+ 0, /*nb_multiply*/
1821
+ 0, /*nb_divide*/
1822
+ 0, /*nb_remainder*/
1823
+ 0, /*nb_divmod*/
1824
+ 0, /*nb_power*/
1825
+ 0, /*nb_negative*/
1826
+ 0, /*nb_positive*/
1827
+ 0, /*nb_absolute*/
1828
+ 0, /*nb_nonzero*/
1829
+ 0, /*nb_invert*/
1830
+ 0, /*nb_lshift*/
1831
+ 0, /*nb_rshift*/
1832
+ 0, /*nb_and*/
1833
+ 0, /*nb_xor*/
1834
+ 0, /*nb_or*/
1835
+ 0, /*nb_coerce*/
1836
+ 0, /*nb_int*/
1837
+ 0, /*nb_long*/
1838
+ 0, /*nb_float*/
1839
+ 0, /*nb_oct*/
1840
+ 0, /*nb_hex*/
1841
+ 0, /*nb_inplace_add*/
1842
+ 0, /*nb_inplace_subtract*/
1843
+ 0, /*nb_inplace_multiply*/
1844
+ 0, /*nb_inplace_divide*/
1845
+ 0, /*nb_inplace_remainder*/
1846
+ 0, /*nb_inplace_power*/
1847
+ 0, /*nb_inplace_lshift*/
1848
+ 0, /*nb_inplace_rshift*/
1849
+ 0, /*nb_inplace_and*/
1850
+ 0, /*nb_inplace_xor*/
1851
+ 0, /*nb_inplace_or*/
1852
+ 0, /*nb_floor_divide*/
1853
+ 0, /*nb_true_divide*/
1854
+ 0, /*nb_inplace_floor_divide*/
1855
+ 0, /*nb_inplace_true_divide*/
1856
+ };
1857
+
1858
+ static PySequenceMethods __pyx_tp_as_sequence_signal = {
1859
+ 0, /*sq_length*/
1860
+ 0, /*sq_concat*/
1861
+ 0, /*sq_repeat*/
1862
+ 0, /*sq_item*/
1863
+ 0, /*sq_slice*/
1864
+ 0, /*sq_ass_item*/
1865
+ 0, /*sq_ass_slice*/
1866
+ 0, /*sq_contains*/
1867
+ 0, /*sq_inplace_concat*/
1868
+ 0, /*sq_inplace_repeat*/
1869
+ };
1870
+
1871
+ static PyMappingMethods __pyx_tp_as_mapping_signal = {
1872
+ 0, /*mp_length*/
1873
+ 0, /*mp_subscript*/
1874
+ 0, /*mp_ass_subscript*/
1875
+ };
1876
+
1877
+ static PyBufferProcs __pyx_tp_as_buffer_signal = {
1878
+ 0, /*bf_getreadbuffer*/
1879
+ 0, /*bf_getwritebuffer*/
1880
+ 0, /*bf_getsegcount*/
1881
+ 0, /*bf_getcharbuffer*/
1882
+ };
1883
+
1884
+ statichere PyTypeObject __pyx_type_5event_signal = {
1885
+ PyObject_HEAD_INIT(0)
1886
+ 0, /*ob_size*/
1887
+ "event.signal", /*tp_name*/
1888
+ sizeof(struct __pyx_obj_5event_signal), /*tp_basicsize*/
1889
+ 0, /*tp_itemsize*/
1890
+ __pyx_tp_dealloc_5event_signal, /*tp_dealloc*/
1891
+ 0, /*tp_print*/
1892
+ 0, /*tp_getattr*/
1893
+ 0, /*tp_setattr*/
1894
+ 0, /*tp_compare*/
1895
+ 0, /*tp_repr*/
1896
+ &__pyx_tp_as_number_signal, /*tp_as_number*/
1897
+ &__pyx_tp_as_sequence_signal, /*tp_as_sequence*/
1898
+ &__pyx_tp_as_mapping_signal, /*tp_as_mapping*/
1899
+ 0, /*tp_hash*/
1900
+ 0, /*tp_call*/
1901
+ 0, /*tp_str*/
1902
+ 0, /*tp_getattro*/
1903
+ 0, /*tp_setattro*/
1904
+ &__pyx_tp_as_buffer_signal, /*tp_as_buffer*/
1905
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
1906
+ "signal(sig, callback, *args) -> event object\n\n Simplified event interface:\n Create a new signal event, and add it to the event queue.\n XXX - persistent event is added with EV_PERSIST, like signal_set()\n \n Arguments:\n\n sig -- signal number\n callback -- user callback with (*args) prototype, which can return\n a non-None value to be rescheduled\n *args -- optional callback arguments\n ", /*tp_doc*/
1907
+ __pyx_tp_traverse_5event_signal, /*tp_traverse*/
1908
+ __pyx_tp_clear_5event_signal, /*tp_clear*/
1909
+ 0, /*tp_richcompare*/
1910
+ 0, /*tp_weaklistoffset*/
1911
+ 0, /*tp_iter*/
1912
+ 0, /*tp_iternext*/
1913
+ __pyx_methods_5event_signal, /*tp_methods*/
1914
+ 0, /*tp_members*/
1915
+ 0, /*tp_getset*/
1916
+ 0, /*tp_base*/
1917
+ 0, /*tp_dict*/
1918
+ 0, /*tp_descr_get*/
1919
+ 0, /*tp_descr_set*/
1920
+ 0, /*tp_dictoffset*/
1921
+ __pyx_f_5event_6signal___init__, /*tp_init*/
1922
+ 0, /*tp_alloc*/
1923
+ __pyx_tp_new_5event_signal, /*tp_new*/
1924
+ 0, /*tp_free*/
1925
+ 0, /*tp_is_gc*/
1926
+ 0, /*tp_bases*/
1927
+ 0, /*tp_mro*/
1928
+ 0, /*tp_cache*/
1929
+ 0, /*tp_subclasses*/
1930
+ 0, /*tp_weaklist*/
1931
+ };
1932
+
1933
+ static PyObject *__pyx_tp_new_5event_timeout(PyTypeObject *t, PyObject *a, PyObject *k) {
1934
+ PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k);
1935
+ struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o;
1936
+ return o;
1937
+ }
1938
+
1939
+ static void __pyx_tp_dealloc_5event_timeout(PyObject *o) {
1940
+ struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o;
1941
+ __pyx_ptype_5event_event->tp_dealloc(o);
1942
+ }
1943
+
1944
+ static int __pyx_tp_traverse_5event_timeout(PyObject *o, visitproc v, void *a) {
1945
+ int e;
1946
+ struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o;
1947
+ __pyx_ptype_5event_event->tp_traverse(o, v, a);
1948
+ return 0;
1949
+ }
1950
+
1951
+ static int __pyx_tp_clear_5event_timeout(PyObject *o) {
1952
+ struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o;
1953
+ __pyx_ptype_5event_event->tp_clear(o);
1954
+ return 0;
1955
+ }
1956
+
1957
+ static struct PyMethodDef __pyx_methods_5event_timeout[] = {
1958
+ {0, 0, 0, 0}
1959
+ };
1960
+
1961
+ static PyNumberMethods __pyx_tp_as_number_timeout = {
1962
+ 0, /*nb_add*/
1963
+ 0, /*nb_subtract*/
1964
+ 0, /*nb_multiply*/
1965
+ 0, /*nb_divide*/
1966
+ 0, /*nb_remainder*/
1967
+ 0, /*nb_divmod*/
1968
+ 0, /*nb_power*/
1969
+ 0, /*nb_negative*/
1970
+ 0, /*nb_positive*/
1971
+ 0, /*nb_absolute*/
1972
+ 0, /*nb_nonzero*/
1973
+ 0, /*nb_invert*/
1974
+ 0, /*nb_lshift*/
1975
+ 0, /*nb_rshift*/
1976
+ 0, /*nb_and*/
1977
+ 0, /*nb_xor*/
1978
+ 0, /*nb_or*/
1979
+ 0, /*nb_coerce*/
1980
+ 0, /*nb_int*/
1981
+ 0, /*nb_long*/
1982
+ 0, /*nb_float*/
1983
+ 0, /*nb_oct*/
1984
+ 0, /*nb_hex*/
1985
+ 0, /*nb_inplace_add*/
1986
+ 0, /*nb_inplace_subtract*/
1987
+ 0, /*nb_inplace_multiply*/
1988
+ 0, /*nb_inplace_divide*/
1989
+ 0, /*nb_inplace_remainder*/
1990
+ 0, /*nb_inplace_power*/
1991
+ 0, /*nb_inplace_lshift*/
1992
+ 0, /*nb_inplace_rshift*/
1993
+ 0, /*nb_inplace_and*/
1994
+ 0, /*nb_inplace_xor*/
1995
+ 0, /*nb_inplace_or*/
1996
+ 0, /*nb_floor_divide*/
1997
+ 0, /*nb_true_divide*/
1998
+ 0, /*nb_inplace_floor_divide*/
1999
+ 0, /*nb_inplace_true_divide*/
2000
+ };
2001
+
2002
+ static PySequenceMethods __pyx_tp_as_sequence_timeout = {
2003
+ 0, /*sq_length*/
2004
+ 0, /*sq_concat*/
2005
+ 0, /*sq_repeat*/
2006
+ 0, /*sq_item*/
2007
+ 0, /*sq_slice*/
2008
+ 0, /*sq_ass_item*/
2009
+ 0, /*sq_ass_slice*/
2010
+ 0, /*sq_contains*/
2011
+ 0, /*sq_inplace_concat*/
2012
+ 0, /*sq_inplace_repeat*/
2013
+ };
2014
+
2015
+ static PyMappingMethods __pyx_tp_as_mapping_timeout = {
2016
+ 0, /*mp_length*/
2017
+ 0, /*mp_subscript*/
2018
+ 0, /*mp_ass_subscript*/
2019
+ };
2020
+
2021
+ static PyBufferProcs __pyx_tp_as_buffer_timeout = {
2022
+ 0, /*bf_getreadbuffer*/
2023
+ 0, /*bf_getwritebuffer*/
2024
+ 0, /*bf_getsegcount*/
2025
+ 0, /*bf_getcharbuffer*/
2026
+ };
2027
+
2028
+ statichere PyTypeObject __pyx_type_5event_timeout = {
2029
+ PyObject_HEAD_INIT(0)
2030
+ 0, /*ob_size*/
2031
+ "event.timeout", /*tp_name*/
2032
+ sizeof(struct __pyx_obj_5event_timeout), /*tp_basicsize*/
2033
+ 0, /*tp_itemsize*/
2034
+ __pyx_tp_dealloc_5event_timeout, /*tp_dealloc*/
2035
+ 0, /*tp_print*/
2036
+ 0, /*tp_getattr*/
2037
+ 0, /*tp_setattr*/
2038
+ 0, /*tp_compare*/
2039
+ 0, /*tp_repr*/
2040
+ &__pyx_tp_as_number_timeout, /*tp_as_number*/
2041
+ &__pyx_tp_as_sequence_timeout, /*tp_as_sequence*/
2042
+ &__pyx_tp_as_mapping_timeout, /*tp_as_mapping*/
2043
+ 0, /*tp_hash*/
2044
+ 0, /*tp_call*/
2045
+ 0, /*tp_str*/
2046
+ 0, /*tp_getattro*/
2047
+ 0, /*tp_setattro*/
2048
+ &__pyx_tp_as_buffer_timeout, /*tp_as_buffer*/
2049
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
2050
+ "timeout(secs, callback, *args) -> event object\n\n Simplified event interface:\n Create a new timer event, and add it to the event queue.\n\n Arguments:\n\n secs -- event timeout in seconds\n callback -- user callback with (*args) prototype, which can return\n a non-None value to be rescheduled\n *args -- optional callback arguments\n ", /*tp_doc*/
2051
+ __pyx_tp_traverse_5event_timeout, /*tp_traverse*/
2052
+ __pyx_tp_clear_5event_timeout, /*tp_clear*/
2053
+ 0, /*tp_richcompare*/
2054
+ 0, /*tp_weaklistoffset*/
2055
+ 0, /*tp_iter*/
2056
+ 0, /*tp_iternext*/
2057
+ __pyx_methods_5event_timeout, /*tp_methods*/
2058
+ 0, /*tp_members*/
2059
+ 0, /*tp_getset*/
2060
+ 0, /*tp_base*/
2061
+ 0, /*tp_dict*/
2062
+ 0, /*tp_descr_get*/
2063
+ 0, /*tp_descr_set*/
2064
+ 0, /*tp_dictoffset*/
2065
+ __pyx_f_5event_7timeout___init__, /*tp_init*/
2066
+ 0, /*tp_alloc*/
2067
+ __pyx_tp_new_5event_timeout, /*tp_new*/
2068
+ 0, /*tp_free*/
2069
+ 0, /*tp_is_gc*/
2070
+ 0, /*tp_bases*/
2071
+ 0, /*tp_mro*/
2072
+ 0, /*tp_cache*/
2073
+ 0, /*tp_subclasses*/
2074
+ 0, /*tp_weaklist*/
2075
+ };
2076
+
2077
+ static struct PyMethodDef __pyx_methods[] = {
2078
+ {"init", (PyCFunction)__pyx_f_5event_init, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_init},
2079
+ {"dispatch", (PyCFunction)__pyx_f_5event_dispatch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_dispatch},
2080
+ {"loop", (PyCFunction)__pyx_f_5event_loop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_loop},
2081
+ {"abort", (PyCFunction)__pyx_f_5event_abort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_abort},
2082
+ {0, 0, 0, 0}
2083
+ };
2084
+
2085
+ DL_EXPORT(void) initevent(void); /*proto*/
2086
+ DL_EXPORT(void) initevent(void) {
2087
+ PyObject *__pyx_1 = 0;
2088
+ PyObject *__pyx_2 = 0;
2089
+ PyObject *__pyx_3 = 0;
2090
+ PyObject *__pyx_4 = 0;
2091
+ PyObject *__pyx_5 = 0;
2092
+ PyObject *__pyx_6 = 0;
2093
+ __pyx_m = Py_InitModule4("event", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
2094
+ if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;};
2095
+ __pyx_b = PyImport_AddModule("__builtin__");
2096
+ if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;};
2097
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;};
2098
+ if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;};
2099
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;};
2100
+ __pyx_type_5event_event.tp_free = _PyObject_GC_Del;
2101
+ if (PyType_Ready(&__pyx_type_5event_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
2102
+ if (PyObject_SetAttrString(__pyx_m, "event", (PyObject *)&__pyx_type_5event_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
2103
+ __pyx_ptype_5event_event = &__pyx_type_5event_event;
2104
+ __pyx_type_5event_read.tp_base = __pyx_ptype_5event_event;
2105
+ if (PyType_Ready(&__pyx_type_5event_read) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
2106
+ if (PyObject_SetAttrString(__pyx_m, "read", (PyObject *)&__pyx_type_5event_read) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
2107
+ __pyx_ptype_5event_read = &__pyx_type_5event_read;
2108
+ __pyx_type_5event_write.tp_base = __pyx_ptype_5event_event;
2109
+ if (PyType_Ready(&__pyx_type_5event_write) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
2110
+ if (PyObject_SetAttrString(__pyx_m, "write", (PyObject *)&__pyx_type_5event_write) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
2111
+ __pyx_ptype_5event_write = &__pyx_type_5event_write;
2112
+ __pyx_type_5event_signal.tp_base = __pyx_ptype_5event_event;
2113
+ if (PyType_Ready(&__pyx_type_5event_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
2114
+ if (PyObject_SetAttrString(__pyx_m, "signal", (PyObject *)&__pyx_type_5event_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
2115
+ __pyx_ptype_5event_signal = &__pyx_type_5event_signal;
2116
+ __pyx_type_5event_timeout.tp_base = __pyx_ptype_5event_event;
2117
+ if (PyType_Ready(&__pyx_type_5event_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
2118
+ if (PyObject_SetAttrString(__pyx_m, "timeout", (PyObject *)&__pyx_type_5event_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
2119
+ __pyx_ptype_5event_timeout = &__pyx_type_5event_timeout;
2120
+
2121
+ /* "/Users/dugsong/projects/pyevent/event.pyx":18 */
2122
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
2123
+ Py_INCREF(__pyx_k1p);
2124
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k1p);
2125
+ Py_INCREF(__pyx_k2p);
2126
+ PyTuple_SET_ITEM(__pyx_1, 1, __pyx_k2p);
2127
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
2128
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2129
+
2130
+ /* "/Users/dugsong/projects/pyevent/event.pyx":20 */
2131
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
2132
+ Py_INCREF(__pyx_k3p);
2133
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k3p);
2134
+ Py_INCREF(__pyx_k4p);
2135
+ PyTuple_SET_ITEM(__pyx_1, 1, __pyx_k4p);
2136
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
2137
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2138
+
2139
+ /* "/Users/dugsong/projects/pyevent/event.pyx":22 */
2140
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_n_BSD) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
2141
+
2142
+ /* "/Users/dugsong/projects/pyevent/event.pyx":23 */
2143
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___url__, __pyx_k6p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
2144
+
2145
+ /* "/Users/dugsong/projects/pyevent/event.pyx":24 */
2146
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k7p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}
2147
+
2148
+ /* "/Users/dugsong/projects/pyevent/event.pyx":26 */
2149
+ __pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
2150
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
2151
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2152
+
2153
+ /* "/Users/dugsong/projects/pyevent/event.pyx":57 */
2154
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
2155
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_TIMEOUT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
2156
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2157
+
2158
+ /* "/Users/dugsong/projects/pyevent/event.pyx":58 */
2159
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
2160
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_READ, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
2161
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2162
+
2163
+ /* "/Users/dugsong/projects/pyevent/event.pyx":59 */
2164
+ __pyx_1 = PyInt_FromLong(4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
2165
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_WRITE, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
2166
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2167
+
2168
+ /* "/Users/dugsong/projects/pyevent/event.pyx":60 */
2169
+ __pyx_1 = PyInt_FromLong(8); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
2170
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_SIGNAL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
2171
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2172
+
2173
+ /* "/Users/dugsong/projects/pyevent/event.pyx":61 */
2174
+ __pyx_1 = PyInt_FromLong(16); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
2175
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_PERSIST, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
2176
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
2177
+
2178
+ /* "/Users/dugsong/projects/pyevent/event.pyx":63 */
2179
+ if (PyObject_SetAttr(__pyx_m, __pyx_n___event_exc, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
2180
+
2181
+ /* "/Users/dugsong/projects/pyevent/event.pyx":92 */
2182
+ Py_INCREF(Py_None);
2183
+ __pyx_k9 = Py_None;
2184
+ __pyx_k10 = 0;
2185
+ __pyx_1 = PyInt_FromLong((-1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
2186
+ __pyx_k11 = __pyx_1;
2187
+ __pyx_1 = 0;
2188
+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
2189
+ __pyx_k12 = __pyx_2;
2190
+ __pyx_2 = 0;
2191
+
2192
+ /* "/Users/dugsong/projects/pyevent/event.pyx":143 */
2193
+ __pyx_k13 = (-1);
2194
+
2195
+ /* "/Users/dugsong/projects/pyevent/event.pyx":264 */
2196
+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; goto __pyx_L1;}
2197
+ __pyx_k14 = __pyx_3;
2198
+ __pyx_3 = 0;
2199
+
2200
+ /* "/Users/dugsong/projects/pyevent/event.pyx":280 */
2201
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_init); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
2202
+ __pyx_5 = PyTuple_New(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
2203
+ __pyx_6 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
2204
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
2205
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
2206
+ Py_DECREF(__pyx_6); __pyx_6 = 0;
2207
+ return;
2208
+ __pyx_L1:;
2209
+ Py_XDECREF(__pyx_1);
2210
+ Py_XDECREF(__pyx_2);
2211
+ Py_XDECREF(__pyx_3);
2212
+ Py_XDECREF(__pyx_4);
2213
+ Py_XDECREF(__pyx_5);
2214
+ Py_XDECREF(__pyx_6);
2215
+ __Pyx_AddTraceback("event");
2216
+ }
2217
+
2218
+ static char *__pyx_filenames[] = {
2219
+ "event.pyx",
2220
+ };
2221
+ statichere char **__pyx_f = __pyx_filenames;
2222
+
2223
+ /* Runtime support code */
2224
+
2225
+ static int __Pyx_GetStarArgs(
2226
+ PyObject **args,
2227
+ PyObject **kwds,
2228
+ char *kwd_list[],
2229
+ int nargs,
2230
+ PyObject **args2,
2231
+ PyObject **kwds2)
2232
+ {
2233
+ PyObject *x = 0, *args1 = 0, *kwds1 = 0;
2234
+
2235
+ if (args2)
2236
+ *args2 = 0;
2237
+ if (kwds2)
2238
+ *kwds2 = 0;
2239
+
2240
+ if (args2) {
2241
+ args1 = PyTuple_GetSlice(*args, 0, nargs);
2242
+ if (!args1)
2243
+ goto bad;
2244
+ *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));
2245
+ if (!*args2)
2246
+ goto bad;
2247
+ }
2248
+ else {
2249
+ args1 = *args;
2250
+ Py_INCREF(args1);
2251
+ }
2252
+
2253
+ if (kwds2) {
2254
+ if (*kwds) {
2255
+ char **p;
2256
+ kwds1 = PyDict_New();
2257
+ if (!kwds)
2258
+ goto bad;
2259
+ *kwds2 = PyDict_Copy(*kwds);
2260
+ if (!*kwds2)
2261
+ goto bad;
2262
+ for (p = kwd_list; *p; p++) {
2263
+ x = PyDict_GetItemString(*kwds, *p);
2264
+ if (x) {
2265
+ if (PyDict_SetItemString(kwds1, *p, x) < 0)
2266
+ goto bad;
2267
+ if (PyDict_DelItemString(*kwds2, *p) < 0)
2268
+ goto bad;
2269
+ }
2270
+ }
2271
+ }
2272
+ else {
2273
+ *kwds2 = PyDict_New();
2274
+ if (!*kwds2)
2275
+ goto bad;
2276
+ }
2277
+ }
2278
+ else {
2279
+ kwds1 = *kwds;
2280
+ Py_XINCREF(kwds1);
2281
+ }
2282
+
2283
+ *args = args1;
2284
+ *kwds = kwds1;
2285
+ return 0;
2286
+ bad:
2287
+ Py_XDECREF(args1);
2288
+ Py_XDECREF(kwds1);
2289
+ if (*args2)
2290
+ Py_XDECREF(*args2);
2291
+ if (*kwds2)
2292
+ Py_XDECREF(*kwds2);
2293
+ return -1;
2294
+ }
2295
+
2296
+ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
2297
+ PyObject *__import__ = 0;
2298
+ PyObject *empty_list = 0;
2299
+ PyObject *module = 0;
2300
+ PyObject *global_dict = 0;
2301
+ PyObject *empty_dict = 0;
2302
+ PyObject *list;
2303
+ __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
2304
+ if (!__import__)
2305
+ goto bad;
2306
+ if (from_list)
2307
+ list = from_list;
2308
+ else {
2309
+ empty_list = PyList_New(0);
2310
+ if (!empty_list)
2311
+ goto bad;
2312
+ list = empty_list;
2313
+ }
2314
+ global_dict = PyModule_GetDict(__pyx_m);
2315
+ if (!global_dict)
2316
+ goto bad;
2317
+ empty_dict = PyDict_New();
2318
+ if (!empty_dict)
2319
+ goto bad;
2320
+ module = PyObject_CallFunction(__import__, "OOOO",
2321
+ name, global_dict, empty_dict, list);
2322
+ bad:
2323
+ Py_XDECREF(empty_list);
2324
+ Py_XDECREF(__import__);
2325
+ Py_XDECREF(empty_dict);
2326
+ return module;
2327
+ }
2328
+
2329
+ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
2330
+ PyObject *result;
2331
+ result = PyObject_GetAttr(dict, name);
2332
+ if (!result)
2333
+ PyErr_SetObject(PyExc_NameError, name);
2334
+ return result;
2335
+ }
2336
+
2337
+ static void __Pyx_WriteUnraisable(char *name) {
2338
+ PyObject *old_exc, *old_val, *old_tb;
2339
+ PyObject *ctx;
2340
+ PyErr_Fetch(&old_exc, &old_val, &old_tb);
2341
+ ctx = PyString_FromString(name);
2342
+ PyErr_Restore(old_exc, old_val, old_tb);
2343
+ if (!ctx)
2344
+ ctx = Py_None;
2345
+ PyErr_WriteUnraisable(ctx);
2346
+ }
2347
+
2348
+ static PyObject *__Pyx_GetExcValue(void) {
2349
+ PyObject *type = 0, *value = 0, *tb = 0;
2350
+ PyObject *result = 0;
2351
+ PyThreadState *tstate = PyThreadState_Get();
2352
+ PyErr_Fetch(&type, &value, &tb);
2353
+ PyErr_NormalizeException(&type, &value, &tb);
2354
+ if (PyErr_Occurred())
2355
+ goto bad;
2356
+ if (!value) {
2357
+ value = Py_None;
2358
+ Py_INCREF(value);
2359
+ }
2360
+ Py_XDECREF(tstate->exc_type);
2361
+ Py_XDECREF(tstate->exc_value);
2362
+ Py_XDECREF(tstate->exc_traceback);
2363
+ tstate->exc_type = type;
2364
+ tstate->exc_value = value;
2365
+ tstate->exc_traceback = tb;
2366
+ result = value;
2367
+ Py_XINCREF(result);
2368
+ type = 0;
2369
+ value = 0;
2370
+ tb = 0;
2371
+ bad:
2372
+ Py_XDECREF(type);
2373
+ Py_XDECREF(value);
2374
+ Py_XDECREF(tb);
2375
+ return result;
2376
+ }
2377
+
2378
+ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
2379
+ Py_XINCREF(type);
2380
+ Py_XINCREF(value);
2381
+ Py_XINCREF(tb);
2382
+ /* First, check the traceback argument, replacing None with NULL. */
2383
+ if (tb == Py_None) {
2384
+ Py_DECREF(tb);
2385
+ tb = 0;
2386
+ }
2387
+ else if (tb != NULL && !PyTraceBack_Check(tb)) {
2388
+ PyErr_SetString(PyExc_TypeError,
2389
+ "raise: arg 3 must be a traceback or None");
2390
+ goto raise_error;
2391
+ }
2392
+ /* Next, replace a missing value with None */
2393
+ if (value == NULL) {
2394
+ value = Py_None;
2395
+ Py_INCREF(value);
2396
+ }
2397
+ /* Next, repeatedly, replace a tuple exception with its first item */
2398
+ while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
2399
+ PyObject *tmp = type;
2400
+ type = PyTuple_GET_ITEM(type, 0);
2401
+ Py_INCREF(type);
2402
+ Py_DECREF(tmp);
2403
+ }
2404
+ if (PyString_Check(type))
2405
+ ;
2406
+ else if (PyClass_Check(type))
2407
+ ; /*PyErr_NormalizeException(&type, &value, &tb);*/
2408
+ else if (PyInstance_Check(type)) {
2409
+ /* Raising an instance. The value should be a dummy. */
2410
+ if (value != Py_None) {
2411
+ PyErr_SetString(PyExc_TypeError,
2412
+ "instance exception may not have a separate value");
2413
+ goto raise_error;
2414
+ }
2415
+ else {
2416
+ /* Normalize to raise <class>, <instance> */
2417
+ Py_DECREF(value);
2418
+ value = type;
2419
+ type = (PyObject*) ((PyInstanceObject*)type)->in_class;
2420
+ Py_INCREF(type);
2421
+ }
2422
+ }
2423
+ else {
2424
+ /* Not something you can raise. You get an exception
2425
+ anyway, just not what you specified :-) */
2426
+ PyErr_Format(PyExc_TypeError,
2427
+ "exceptions must be strings, classes, or "
2428
+ "instances, not %s", type->ob_type->tp_name);
2429
+ goto raise_error;
2430
+ }
2431
+ PyErr_Restore(type, value, tb);
2432
+ return;
2433
+ raise_error:
2434
+ Py_XDECREF(value);
2435
+ Py_XDECREF(type);
2436
+ Py_XDECREF(tb);
2437
+ return;
2438
+ }
2439
+
2440
+ static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
2441
+ while (t->p) {
2442
+ *t->p = PyString_InternFromString(t->s);
2443
+ if (!*t->p)
2444
+ return -1;
2445
+ ++t;
2446
+ }
2447
+ return 0;
2448
+ }
2449
+
2450
+ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
2451
+ while (t->p) {
2452
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
2453
+ if (!*t->p)
2454
+ return -1;
2455
+ ++t;
2456
+ }
2457
+ return 0;
2458
+ }
2459
+
2460
+ #include "compile.h"
2461
+ #include "frameobject.h"
2462
+ #include "traceback.h"
2463
+
2464
+ static void __Pyx_AddTraceback(char *funcname) {
2465
+ PyObject *py_srcfile = 0;
2466
+ PyObject *py_funcname = 0;
2467
+ PyObject *py_globals = 0;
2468
+ PyObject *empty_tuple = 0;
2469
+ PyObject *empty_string = 0;
2470
+ PyCodeObject *py_code = 0;
2471
+ PyFrameObject *py_frame = 0;
2472
+
2473
+ py_srcfile = PyString_FromString(__pyx_filename);
2474
+ if (!py_srcfile) goto bad;
2475
+ py_funcname = PyString_FromString(funcname);
2476
+ if (!py_funcname) goto bad;
2477
+ py_globals = PyModule_GetDict(__pyx_m);
2478
+ if (!py_globals) goto bad;
2479
+ empty_tuple = PyTuple_New(0);
2480
+ if (!empty_tuple) goto bad;
2481
+ empty_string = PyString_FromString("");
2482
+ if (!empty_string) goto bad;
2483
+ py_code = PyCode_New(
2484
+ 0, /*int argcount,*/
2485
+ 0, /*int nlocals,*/
2486
+ 0, /*int stacksize,*/
2487
+ 0, /*int flags,*/
2488
+ empty_string, /*PyObject *code,*/
2489
+ empty_tuple, /*PyObject *consts,*/
2490
+ empty_tuple, /*PyObject *names,*/
2491
+ empty_tuple, /*PyObject *varnames,*/
2492
+ empty_tuple, /*PyObject *freevars,*/
2493
+ empty_tuple, /*PyObject *cellvars,*/
2494
+ py_srcfile, /*PyObject *filename,*/
2495
+ py_funcname, /*PyObject *name,*/
2496
+ __pyx_lineno, /*int firstlineno,*/
2497
+ empty_string /*PyObject *lnotab*/
2498
+ );
2499
+ if (!py_code) goto bad;
2500
+ py_frame = PyFrame_New(
2501
+ PyThreadState_Get(), /*PyThreadState *tstate,*/
2502
+ py_code, /*PyCodeObject *code,*/
2503
+ py_globals, /*PyObject *globals,*/
2504
+ 0 /*PyObject *locals*/
2505
+ );
2506
+ if (!py_frame) goto bad;
2507
+ py_frame->f_lineno = __pyx_lineno;
2508
+ PyTraceBack_Here(py_frame);
2509
+ bad:
2510
+ Py_XDECREF(py_srcfile);
2511
+ Py_XDECREF(py_funcname);
2512
+ Py_XDECREF(empty_tuple);
2513
+ Py_XDECREF(empty_string);
2514
+ Py_XDECREF(py_code);
2515
+ Py_XDECREF(py_frame);
2516
+ }