/* Generated by Pyrex 0.9.3 on Sun Sep 11 23:51:17 2005 */ #include "Python.h" #include "structmember.h" #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #include "event.h" typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/ static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/ static int __Pyx_EndUnpack(PyObject *, int); /*proto*/ static int __Pyx_PrintItem(PyObject *); /*proto*/ static int __Pyx_PrintNewline(void); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static void __Pyx_ReRaise(void); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ static PyObject *__Pyx_GetExcValue(void); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/ static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/ static void __Pyx_WriteUnraisable(char *name); /*proto*/ static void __Pyx_AddTraceback(char *funcname); /*proto*/ static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/ static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static PyObject *__pyx_m; static PyObject *__pyx_b; static int __pyx_lineno; static char *__pyx_filename; staticforward char **__pyx_f; 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"; /* Declarations from event */ staticforward PyTypeObject __pyx_type_5event_event; struct __pyx_obj_5event_event { PyObject_HEAD struct event ev; PyObject *handle; PyObject *evtype; PyObject *callback; PyObject *args; float timeout; struct timeval tv; }; staticforward PyTypeObject __pyx_type_5event_read; struct __pyx_obj_5event_read { struct __pyx_obj_5event_event __pyx_base; }; staticforward PyTypeObject __pyx_type_5event_write; struct __pyx_obj_5event_write { struct __pyx_obj_5event_event __pyx_base; }; staticforward PyTypeObject __pyx_type_5event_signal; struct __pyx_obj_5event_signal { struct __pyx_obj_5event_event __pyx_base; }; staticforward PyTypeObject __pyx_type_5event_timeout; struct __pyx_obj_5event_timeout { struct __pyx_obj_5event_event __pyx_base; }; static PyTypeObject *__pyx_ptype_5event_event = 0; static PyTypeObject *__pyx_ptype_5event_read = 0; static PyTypeObject *__pyx_ptype_5event_write = 0; static PyTypeObject *__pyx_ptype_5event_signal = 0; static PyTypeObject *__pyx_ptype_5event_timeout = 0; static PyObject *__pyx_k9; static short __pyx_k10; static PyObject *__pyx_k11; static PyObject *__pyx_k12; static float __pyx_k13; static PyObject *__pyx_k14; static int (__pyx_f_5event___event_sigcb(void)); /*proto*/ static void (__pyx_f_5event___event_handler(int ,short ,void (*))); /*proto*/ static void (__pyx_f_5event___simple_event_handler(int ,short ,void (*))); /*proto*/ /* Implementation of event */ static char (__pyx_k1[]) = "Dug Song "; static char (__pyx_k2[]) = "Martin Murray "; static char (__pyx_k3[]) = "Copyright (c) 2004 Dug Song"; static char (__pyx_k4[]) = "Copyright (c) 2003 Martin Murray"; static char (__pyx_k6[]) = "http://monkey.org/~dugsong/pyevent/"; static char (__pyx_k7[]) = "0.3"; static PyObject *__pyx_n___author__; static PyObject *__pyx_n___copyright__; static PyObject *__pyx_n___license__; static PyObject *__pyx_n___url__; static PyObject *__pyx_n___version__; static PyObject *__pyx_n_sys; static PyObject *__pyx_n_EV_TIMEOUT; static PyObject *__pyx_n_EV_READ; static PyObject *__pyx_n_EV_WRITE; static PyObject *__pyx_n_EV_SIGNAL; static PyObject *__pyx_n_EV_PERSIST; static PyObject *__pyx_n___event_exc; static PyObject *__pyx_n_init; static PyObject *__pyx_n_dispatch; static PyObject *__pyx_n_loop; static PyObject *__pyx_n_abort; static PyObject *__pyx_n_BSD; static PyObject *__pyx_n_False; static PyObject *__pyx_k1p; static PyObject *__pyx_k2p; static PyObject *__pyx_k3p; static PyObject *__pyx_k4p; static PyObject *__pyx_k6p; static PyObject *__pyx_k7p; static int __pyx_f_5event___event_sigcb(void) { int __pyx_r; /* "/Users/dugsong/projects/pyevent/event.pyx":66 */ __pyx_r = (-1); goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; __Pyx_WriteUnraisable("event.__event_sigcb"); __pyx_L0:; return __pyx_r; } static PyObject *__pyx_n___callback; static void __pyx_f_5event___event_handler(int __pyx_v_fd,short __pyx_v_evtype,void (*__pyx_v_arg)) { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":69 */ __pyx_1 = (PyObject *)__pyx_v_arg; Py_INCREF(__pyx_1); __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n___callback); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); __pyx_1 = 0; __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_WriteUnraisable("event.__event_handler"); __pyx_L0:; } static PyObject *__pyx_n___simple_callback; static void __pyx_f_5event___simple_event_handler(int __pyx_v_fd,short __pyx_v_evtype,void (*__pyx_v_arg)) { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":72 */ __pyx_1 = (PyObject *)__pyx_v_arg; Py_INCREF(__pyx_1); __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n___simple_callback); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); __pyx_1 = 0; __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_WriteUnraisable("event.__simple_event_handler"); __pyx_L0:; } static PyObject *__pyx_n_isinstance; static PyObject *__pyx_n_int; static PyObject *__pyx_n_fileno; static int __pyx_f_5event_5event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5event_5event___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_arg = 0; short __pyx_v_evtype; PyObject *__pyx_v_handle = 0; PyObject *__pyx_v_simple = 0; void ((*__pyx_v_handler)(int ,short ,void (*))); int __pyx_r; PyObject *__pyx_1 = 0; int __pyx_2; int __pyx_3; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; static char *__pyx_argnames[] = {"callback","arg","evtype","handle","simple",0}; __pyx_v_arg = __pyx_k9; __pyx_v_evtype = __pyx_k10; __pyx_v_handle = __pyx_k11; __pyx_v_simple = __pyx_k12; 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; Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_callback); Py_INCREF(__pyx_v_arg); Py_INCREF(__pyx_v_handle); Py_INCREF(__pyx_v_simple); /* "/Users/dugsong/projects/pyevent/event.pyx":96 */ Py_INCREF(__pyx_v_callback); Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->callback); ((struct __pyx_obj_5event_event *)__pyx_v_self)->callback = __pyx_v_callback; /* "/Users/dugsong/projects/pyevent/event.pyx":97 */ Py_INCREF(__pyx_v_arg); Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->args); ((struct __pyx_obj_5event_event *)__pyx_v_self)->args = __pyx_v_arg; /* "/Users/dugsong/projects/pyevent/event.pyx":98 */ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;} Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->evtype); ((struct __pyx_obj_5event_event *)__pyx_v_self)->evtype = __pyx_1; __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":99 */ Py_INCREF(__pyx_v_handle); Py_DECREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->handle); ((struct __pyx_obj_5event_event *)__pyx_v_self)->handle = __pyx_v_handle; /* "/Users/dugsong/projects/pyevent/event.pyx":100 */ __pyx_2 = PyObject_IsTrue(__pyx_v_simple); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;} if (__pyx_2) { /* "/Users/dugsong/projects/pyevent/event.pyx":101 */ __pyx_v_handler = __pyx_f_5event___simple_event_handler; goto __pyx_L2; } /*else*/ { /* "/Users/dugsong/projects/pyevent/event.pyx":103 */ __pyx_v_handler = __pyx_f_5event___event_handler; } __pyx_L2:; /* "/Users/dugsong/projects/pyevent/event.pyx":104 */ __pyx_2 = (__pyx_v_evtype == 0); if (__pyx_2) { __pyx_3 = PyObject_IsTrue(__pyx_v_handle); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;} __pyx_2 = (!__pyx_3); } if (__pyx_2) { /* "/Users/dugsong/projects/pyevent/event.pyx":105 */ evtimer_set((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_v_handler,((void (*))__pyx_v_self)); goto __pyx_L3; } /*else*/ { /* "/Users/dugsong/projects/pyevent/event.pyx":107 */ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} Py_INCREF(__pyx_v_handle); PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_handle); PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4); __pyx_4 = 0; __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_3 = PyObject_IsTrue(__pyx_4); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_2 = (!__pyx_3); if (__pyx_2) { /* "/Users/dugsong/projects/pyevent/event.pyx":108 */ __pyx_1 = PyObject_GetAttr(__pyx_v_handle, __pyx_n_fileno); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;} __pyx_5 = PyTuple_New(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;} __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_v_handle); __pyx_v_handle = __pyx_4; __pyx_4 = 0; goto __pyx_L4; } __pyx_L4:; /* "/Users/dugsong/projects/pyevent/event.pyx":109 */ __pyx_3 = PyInt_AsLong(__pyx_v_handle); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} event_set((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_3,__pyx_v_evtype,__pyx_v_handler,((void (*))__pyx_v_self)); } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("event.event.__init__"); __pyx_r = -1; __pyx_L0:; Py_DECREF(__pyx_v_self); Py_DECREF(__pyx_v_callback); Py_DECREF(__pyx_v_arg); Py_DECREF(__pyx_v_handle); Py_DECREF(__pyx_v_simple); return __pyx_r; } static PyObject *__pyx_n_exc_info; static PyObject *__pyx_f_5event_5event___simple_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_5event_5event___simple_callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { short __pyx_v_evtype; extern int event_gotsig; extern int ((*event_sigcb)(void)); PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; int __pyx_3; PyObject *__pyx_4 = 0; int __pyx_5; short __pyx_6; static char *__pyx_argnames[] = {"evtype",0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "h", __pyx_argnames, &__pyx_v_evtype)) return 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":115 */ /*try:*/ { /* "/Users/dugsong/projects/pyevent/event.pyx":116 */ __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;} __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;} Py_DECREF(__pyx_1); __pyx_1 = 0; if (PyObject_Cmp(__pyx_2, Py_None, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L2;} __pyx_3 = __pyx_3 != 0; Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { /* "/Users/dugsong/projects/pyevent/event.pyx":117 */ __pyx_3 = ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec; if (!__pyx_3) { __pyx_3 = ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_usec; } if (__pyx_3) { /* "/Users/dugsong/projects/pyevent/event.pyx":118 */ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),(&((struct __pyx_obj_5event_event *)__pyx_v_self)->tv)); goto __pyx_L5; } /*else*/ { /* "/Users/dugsong/projects/pyevent/event.pyx":120 */ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),0); } __pyx_L5:; goto __pyx_L4; } __pyx_L4:; } goto __pyx_L3; __pyx_L2:; Py_XDECREF(__pyx_1); __pyx_1 = 0; Py_XDECREF(__pyx_2); __pyx_2 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":121 */ /*except:*/ { __Pyx_AddTraceback("event.__simple_callback"); __pyx_1 = __Pyx_GetExcValue(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":122 */ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_exc_info); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n___event_exc, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":123 */ event_sigcb = __pyx_f_5event___event_sigcb; /* "/Users/dugsong/projects/pyevent/event.pyx":124 */ event_gotsig = 1; goto __pyx_L3; } __pyx_L3:; /* "/Users/dugsong/projects/pyevent/event.pyx":126 */ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} __pyx_4 = PyNumber_And(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_3 = (!__pyx_5); if (__pyx_3) { __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} __pyx_4 = PyNumber_Or(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} __pyx_2 = PyNumber_Or(__pyx_4, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} __pyx_1 = PyNumber_Or(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_6 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = (!event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_6,0)); } if (__pyx_3) { /* "/Users/dugsong/projects/pyevent/event.pyx":128 */ Py_DECREF(__pyx_v_self); goto __pyx_L6; } __pyx_L6:; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("event.event.__simple_callback"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; } static PyObject *__pyx_f_5event_5event___callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_5event_5event___callback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { short __pyx_v_evtype; extern int event_gotsig; extern int ((*event_sigcb)(void)); PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; short __pyx_4; int __pyx_5; static char *__pyx_argnames[] = {"evtype",0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "h", __pyx_argnames, &__pyx_v_evtype)) return 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":134 */ /*try:*/ { /* "/Users/dugsong/projects/pyevent/event.pyx":135 */ __pyx_1 = PyInt_FromLong(__pyx_v_evtype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L2;} __pyx_2 = PyTuple_New(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L2;} Py_INCREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self); Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->handle); PyTuple_SET_ITEM(__pyx_2, 1, ((struct __pyx_obj_5event_event *)__pyx_v_self)->handle); PyTuple_SET_ITEM(__pyx_2, 2, __pyx_1); Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->args); PyTuple_SET_ITEM(__pyx_2, 3, ((struct __pyx_obj_5event_event *)__pyx_v_self)->args); __pyx_1 = 0; __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;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; } goto __pyx_L3; __pyx_L2:; Py_XDECREF(__pyx_2); __pyx_2 = 0; Py_XDECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":136 */ /*except:*/ { __Pyx_AddTraceback("event.__callback"); __pyx_2 = __Pyx_GetExcValue(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":137 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exc_info); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;} __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n___event_exc, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":138 */ event_sigcb = __pyx_f_5event___event_sigcb; /* "/Users/dugsong/projects/pyevent/event.pyx":139 */ event_gotsig = 1; goto __pyx_L3; } __pyx_L3:; /* "/Users/dugsong/projects/pyevent/event.pyx":140 */ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} __pyx_3 = PyNumber_Or(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} __pyx_1 = PyNumber_Or(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} __pyx_2 = PyNumber_Or(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_5 = (!event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_4,0)); if (__pyx_5) { /* "/Users/dugsong/projects/pyevent/event.pyx":141 */ Py_DECREF(__pyx_v_self); goto __pyx_L4; } __pyx_L4:; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("event.event.__callback"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; } static PyObject *__pyx_f_5event_5event_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ 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 "; static PyObject *__pyx_f_5event_5event_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { float __pyx_v_timeout; PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; short __pyx_4; int __pyx_5; static char *__pyx_argnames[] = {"timeout",0}; __pyx_v_timeout = __pyx_k13; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|f", __pyx_argnames, &__pyx_v_timeout)) return 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":150 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} __pyx_3 = PyNumber_Or(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} __pyx_2 = PyNumber_Or(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} __pyx_1 = PyNumber_Or(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_5 = (!event_pending((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),__pyx_4,0)); if (__pyx_5) { /* "/Users/dugsong/projects/pyevent/event.pyx":152 */ Py_INCREF(__pyx_v_self); goto __pyx_L2; } __pyx_L2:; /* "/Users/dugsong/projects/pyevent/event.pyx":153 */ ((struct __pyx_obj_5event_event *)__pyx_v_self)->timeout = __pyx_v_timeout; /* "/Users/dugsong/projects/pyevent/event.pyx":154 */ __pyx_5 = (__pyx_v_timeout >= 0.0); if (__pyx_5) { /* "/Users/dugsong/projects/pyevent/event.pyx":155 */ ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec = ((long )__pyx_v_timeout); /* "/Users/dugsong/projects/pyevent/event.pyx":156 */ ((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); /* "/Users/dugsong/projects/pyevent/event.pyx":157 */ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),(&((struct __pyx_obj_5event_event *)__pyx_v_self)->tv)); goto __pyx_L3; } /*else*/ { /* "/Users/dugsong/projects/pyevent/event.pyx":159 */ ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_sec = 0; ((struct __pyx_obj_5event_event *)__pyx_v_self)->tv.tv_usec = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":160 */ event_add((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev),0); } __pyx_L3:; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("event.event.add"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; } static PyObject *__pyx_f_5event_5event_pending(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5event_5event_pending[] = "Return 1 if the event is scheduled to run, or else 0."; static PyObject *__pyx_f_5event_5event_pending(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; short __pyx_4; static char *__pyx_argnames[] = {0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":164 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_TIMEOUT); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} __pyx_3 = PyNumber_Or(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} __pyx_2 = PyNumber_Or(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} __pyx_1 = PyNumber_Or(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __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;} __pyx_r = __pyx_2; __pyx_2 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("event.event.pending"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; } static PyObject *__pyx_n_pending; static PyObject *__pyx_f_5event_5event_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5event_5event_delete[] = "Remove event from the event queue."; static PyObject *__pyx_f_5event_5event_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; int __pyx_4; static char *__pyx_argnames[] = {0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":168 */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_pending); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;} __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;} __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; if (__pyx_4) { /* "/Users/dugsong/projects/pyevent/event.pyx":169 */ event_del((&((struct __pyx_obj_5event_event *)__pyx_v_self)->ev)); /* "/Users/dugsong/projects/pyevent/event.pyx":170 */ Py_DECREF(__pyx_v_self); goto __pyx_L2; } __pyx_L2:; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("event.event.delete"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; } static PyObject *__pyx_n_delete; static void __pyx_f_5event_5event___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_f_5event_5event___dealloc__(PyObject *__pyx_v_self) { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":173 */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_delete); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;} __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;} __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("event.event.__dealloc__"); __pyx_L0:; Py_DECREF(__pyx_v_self); } static PyObject *__pyx_k15p; static char (__pyx_k15[]) = ""; static PyObject *__pyx_f_5event_5event___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_f_5event_5event___repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; Py_INCREF(__pyx_v_self); /* "/Users/dugsong/projects/pyevent/event.pyx":176 */ __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;} __pyx_2 = PyTuple_New(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->handle); PyTuple_SET_ITEM(__pyx_2, 1, ((struct __pyx_obj_5event_event *)__pyx_v_self)->handle); Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->callback); PyTuple_SET_ITEM(__pyx_2, 2, ((struct __pyx_obj_5event_event *)__pyx_v_self)->callback); Py_INCREF(((struct __pyx_obj_5event_event *)__pyx_v_self)->args); PyTuple_SET_ITEM(__pyx_2, 3, ((struct __pyx_obj_5event_event *)__pyx_v_self)->args); __pyx_1 = 0; __pyx_1 = PyNumber_Remainder(__pyx_k15p, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_r = __pyx_1; __pyx_1 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); __Pyx_AddTraceback("event.event.__repr__"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_self); return __pyx_r; } static PyObject *__pyx_n___init__; static PyObject *__pyx_n_simple; static PyObject *__pyx_n_add; static int __pyx_f_5event_4read___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5event_4read___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_handle = 0; PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_args = 0; int __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; static char *__pyx_argnames[] = {"handle","callback",0}; if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_handle, &__pyx_v_callback)) { Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); Py_XDECREF(__pyx_v_args); return -1; } Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_handle); Py_INCREF(__pyx_v_callback); /* "/Users/dugsong/projects/pyevent/event.pyx":193 */ __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;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_READ); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} __pyx_3 = PyTuple_New(5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} Py_INCREF((PyObject *)__pyx_v_self); PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_self); Py_INCREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_callback); Py_INCREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_args); PyTuple_SET_ITEM(__pyx_3, 3, __pyx_2); Py_INCREF(__pyx_v_handle); PyTuple_SET_ITEM(__pyx_3, 4, __pyx_v_handle); __pyx_2 = 0; __pyx_2 = PyDict_New(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} if (PyDict_SetItem(__pyx_2, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":194 */ Py_INCREF(__pyx_v_args); Py_DECREF(((struct __pyx_obj_5event_read *)__pyx_v_self)->__pyx_base.args); ((struct __pyx_obj_5event_read *)__pyx_v_self)->__pyx_base.args = __pyx_v_args; /* "/Users/dugsong/projects/pyevent/event.pyx":195 */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("event.read.__init__"); __pyx_r = -1; __pyx_L0:; Py_XDECREF(__pyx_v_args); Py_DECREF((PyObject *)__pyx_v_self); Py_DECREF(__pyx_v_handle); Py_DECREF(__pyx_v_callback); Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); return __pyx_r; } static int __pyx_f_5event_5write___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5event_5write___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_handle = 0; PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_args = 0; int __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; static char *__pyx_argnames[] = {"handle","callback",0}; if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_handle, &__pyx_v_callback)) { Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); Py_XDECREF(__pyx_v_args); return -1; } Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_handle); Py_INCREF(__pyx_v_callback); /* "/Users/dugsong/projects/pyevent/event.pyx":211 */ __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;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_WRITE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;} __pyx_3 = PyTuple_New(5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;} Py_INCREF((PyObject *)__pyx_v_self); PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_self); Py_INCREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_callback); Py_INCREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_args); PyTuple_SET_ITEM(__pyx_3, 3, __pyx_2); Py_INCREF(__pyx_v_handle); PyTuple_SET_ITEM(__pyx_3, 4, __pyx_v_handle); __pyx_2 = 0; __pyx_2 = PyDict_New(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;} __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;} if (PyDict_SetItem(__pyx_2, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":212 */ Py_INCREF(__pyx_v_args); Py_DECREF(((struct __pyx_obj_5event_write *)__pyx_v_self)->__pyx_base.args); ((struct __pyx_obj_5event_write *)__pyx_v_self)->__pyx_base.args = __pyx_v_args; /* "/Users/dugsong/projects/pyevent/event.pyx":213 */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;} __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;} __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("event.write.__init__"); __pyx_r = -1; __pyx_L0:; Py_XDECREF(__pyx_v_args); Py_DECREF((PyObject *)__pyx_v_self); Py_DECREF(__pyx_v_handle); Py_DECREF(__pyx_v_callback); Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); return __pyx_r; } static int __pyx_f_5event_6signal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5event_6signal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_sig = 0; PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_args = 0; int __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; static char *__pyx_argnames[] = {"sig","callback",0}; if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_sig, &__pyx_v_callback)) { Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); Py_XDECREF(__pyx_v_args); return -1; } Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_sig); Py_INCREF(__pyx_v_callback); /* "/Users/dugsong/projects/pyevent/event.pyx":230 */ __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;} __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_EV_SIGNAL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_EV_PERSIST); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} __pyx_4 = PyNumber_Or(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_2 = PyTuple_New(5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} Py_INCREF((PyObject *)__pyx_v_self); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self); Py_INCREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_callback); Py_INCREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_args); PyTuple_SET_ITEM(__pyx_2, 3, __pyx_4); Py_INCREF(__pyx_v_sig); PyTuple_SET_ITEM(__pyx_2, 4, __pyx_v_sig); __pyx_4 = 0; __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} if (PyDict_SetItem(__pyx_3, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":232 */ Py_INCREF(__pyx_v_args); Py_DECREF(((struct __pyx_obj_5event_signal *)__pyx_v_self)->__pyx_base.args); ((struct __pyx_obj_5event_signal *)__pyx_v_self)->__pyx_base.args = __pyx_v_args; /* "/Users/dugsong/projects/pyevent/event.pyx":233 */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;} __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;} __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("event.signal.__init__"); __pyx_r = -1; __pyx_L0:; Py_XDECREF(__pyx_v_args); Py_DECREF((PyObject *)__pyx_v_self); Py_DECREF(__pyx_v_sig); Py_DECREF(__pyx_v_callback); Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); return __pyx_r; } static int __pyx_f_5event_7timeout___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5event_7timeout___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_secs = 0; PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_args = 0; int __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; static char *__pyx_argnames[] = {"secs","callback",0}; if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, 0) < 0) return -1; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_secs, &__pyx_v_callback)) { Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); Py_XDECREF(__pyx_v_args); return -1; } Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_secs); Py_INCREF(__pyx_v_callback); /* "/Users/dugsong/projects/pyevent/event.pyx":249 */ __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;} __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;} Py_INCREF((PyObject *)__pyx_v_self); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self); Py_INCREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_callback); Py_INCREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_args); __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;} __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;} if (PyDict_SetItem(__pyx_3, __pyx_n_simple, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":250 */ Py_INCREF(__pyx_v_args); Py_DECREF(((struct __pyx_obj_5event_timeout *)__pyx_v_self)->__pyx_base.args); ((struct __pyx_obj_5event_timeout *)__pyx_v_self)->__pyx_base.args = __pyx_v_args; /* "/Users/dugsong/projects/pyevent/event.pyx":251 */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;} __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;} Py_INCREF(__pyx_v_secs); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_secs); __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("event.timeout.__init__"); __pyx_r = -1; __pyx_L0:; Py_XDECREF(__pyx_v_args); Py_DECREF((PyObject *)__pyx_v_self); Py_DECREF(__pyx_v_secs); Py_DECREF(__pyx_v_callback); Py_XDECREF(__pyx_args); Py_XDECREF(__pyx_kwds); return __pyx_r; } static PyObject *__pyx_f_5event_init(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5event_init[] = "Initialize event queue."; static PyObject *__pyx_f_5event_init(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_r; static char *__pyx_argnames[] = {0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; /* "/Users/dugsong/projects/pyevent/event.pyx":255 */ event_init(); __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; __Pyx_AddTraceback("event.init"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } static PyObject *__pyx_f_5event_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5event_dispatch[] = "Dispatch all events on the event queue."; static PyObject *__pyx_f_5event_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; int __pyx_2; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; PyObject *__pyx_6 = 0; static char *__pyx_argnames[] = {0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; /* "/Users/dugsong/projects/pyevent/event.pyx":260 */ event_dispatch(); /* "/Users/dugsong/projects/pyevent/event.pyx":261 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;} __pyx_2 = PyObject_IsTrue(__pyx_1); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; if (__pyx_2) { /* "/Users/dugsong/projects/pyevent/event.pyx":262 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} __pyx_4 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___event_exc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} __pyx_6 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __Pyx_Raise(__pyx_4, __pyx_5, __pyx_6); Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_6); __pyx_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;} goto __pyx_L2; } __pyx_L2:; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); Py_XDECREF(__pyx_6); __Pyx_AddTraceback("event.dispatch"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } static PyObject *__pyx_f_5event_loop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5event_loop[] = "Dispatch all pending events on queue in a single pass."; static PyObject *__pyx_f_5event_loop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_nonblock = 0; int __pyx_v_flags; PyObject *__pyx_r; int __pyx_1; static char *__pyx_argnames[] = {"nonblock",0}; __pyx_v_nonblock = __pyx_k14; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_nonblock)) return 0; Py_INCREF(__pyx_v_nonblock); /* "/Users/dugsong/projects/pyevent/event.pyx":267 */ __pyx_v_flags = EVLOOP_ONCE; /* "/Users/dugsong/projects/pyevent/event.pyx":268 */ __pyx_1 = PyObject_IsTrue(__pyx_v_nonblock); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;} if (__pyx_1) { /* "/Users/dugsong/projects/pyevent/event.pyx":269 */ __pyx_v_flags = (EVLOOP_ONCE | EVLOOP_NONBLOCK); goto __pyx_L2; } __pyx_L2:; /* "/Users/dugsong/projects/pyevent/event.pyx":270 */ event_loop(__pyx_v_flags); __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; __Pyx_AddTraceback("event.loop"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_nonblock); return __pyx_r; } static PyObject *__pyx_f_5event_abort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5event_abort[] = "Abort event dispatch loop."; static PyObject *__pyx_f_5event_abort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { extern int event_gotsig; extern int ((*event_sigcb)(void)); PyObject *__pyx_r; static char *__pyx_argnames[] = {0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; /* "/Users/dugsong/projects/pyevent/event.pyx":276 */ event_sigcb = __pyx_f_5event___event_sigcb; /* "/Users/dugsong/projects/pyevent/event.pyx":277 */ event_gotsig = 1; __pyx_r = Py_None; Py_INCREF(__pyx_r); goto __pyx_L0; __pyx_L1:; __Pyx_AddTraceback("event.abort"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } static __Pyx_InternTabEntry __pyx_intern_tab[] = { {&__pyx_n_BSD, "BSD"}, {&__pyx_n_EV_PERSIST, "EV_PERSIST"}, {&__pyx_n_EV_READ, "EV_READ"}, {&__pyx_n_EV_SIGNAL, "EV_SIGNAL"}, {&__pyx_n_EV_TIMEOUT, "EV_TIMEOUT"}, {&__pyx_n_EV_WRITE, "EV_WRITE"}, {&__pyx_n_False, "False"}, {&__pyx_n___author__, "__author__"}, {&__pyx_n___callback, "__callback"}, {&__pyx_n___copyright__, "__copyright__"}, {&__pyx_n___event_exc, "__event_exc"}, {&__pyx_n___init__, "__init__"}, {&__pyx_n___license__, "__license__"}, {&__pyx_n___simple_callback, "__simple_callback"}, {&__pyx_n___url__, "__url__"}, {&__pyx_n___version__, "__version__"}, {&__pyx_n_abort, "abort"}, {&__pyx_n_add, "add"}, {&__pyx_n_delete, "delete"}, {&__pyx_n_dispatch, "dispatch"}, {&__pyx_n_exc_info, "exc_info"}, {&__pyx_n_fileno, "fileno"}, {&__pyx_n_init, "init"}, {&__pyx_n_int, "int"}, {&__pyx_n_isinstance, "isinstance"}, {&__pyx_n_loop, "loop"}, {&__pyx_n_pending, "pending"}, {&__pyx_n_simple, "simple"}, {&__pyx_n_sys, "sys"}, {0, 0} }; static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_k1p, __pyx_k1, sizeof(__pyx_k1)}, {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)}, {&__pyx_k3p, __pyx_k3, sizeof(__pyx_k3)}, {&__pyx_k4p, __pyx_k4, sizeof(__pyx_k4)}, {&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6)}, {&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7)}, {&__pyx_k15p, __pyx_k15, sizeof(__pyx_k15)}, {0, 0, 0} }; static PyObject *__pyx_tp_new_5event_event(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o; p->handle = Py_None; Py_INCREF(p->handle); p->evtype = Py_None; Py_INCREF(p->evtype); p->callback = Py_None; Py_INCREF(p->callback); p->args = Py_None; Py_INCREF(p->args); return o; } static void __pyx_tp_dealloc_5event_event(PyObject *o) { struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++o->ob_refcnt; __pyx_f_5event_5event___dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --o->ob_refcnt; PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->handle); Py_XDECREF(p->evtype); Py_XDECREF(p->callback); Py_XDECREF(p->args); (*o->ob_type->tp_free)(o); } static int __pyx_tp_traverse_5event_event(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o; if (p->handle) { e = (*v)(p->handle, a); if (e) return e; } if (p->evtype) { e = (*v)(p->evtype, a); if (e) return e; } if (p->callback) { e = (*v)(p->callback, a); if (e) return e; } if (p->args) { e = (*v)(p->args, a); if (e) return e; } return 0; } static int __pyx_tp_clear_5event_event(PyObject *o) { struct __pyx_obj_5event_event *p = (struct __pyx_obj_5event_event *)o; Py_XDECREF(p->handle); p->handle = Py_None; Py_INCREF(p->handle); Py_XDECREF(p->evtype); p->evtype = Py_None; Py_INCREF(p->evtype); Py_XDECREF(p->callback); p->callback = Py_None; Py_INCREF(p->callback); Py_XDECREF(p->args); p->args = Py_None; Py_INCREF(p->args); return 0; } static struct PyMethodDef __pyx_methods_5event_event[] = { {"__simple_callback", (PyCFunction)__pyx_f_5event_5event___simple_callback, METH_VARARGS|METH_KEYWORDS, 0}, {"__callback", (PyCFunction)__pyx_f_5event_5event___callback, METH_VARARGS|METH_KEYWORDS, 0}, {"add", (PyCFunction)__pyx_f_5event_5event_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_5event_add}, {"pending", (PyCFunction)__pyx_f_5event_5event_pending, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_5event_pending}, {"delete", (PyCFunction)__pyx_f_5event_5event_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_5event_delete}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_event = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ 0, /*nb_divide*/ 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ 0, /*nb_coerce*/ 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ 0, /*nb_oct*/ 0, /*nb_hex*/ 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ }; static PySequenceMethods __pyx_tp_as_sequence_event = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_event = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_event = { 0, /*bf_getreadbuffer*/ 0, /*bf_getwritebuffer*/ 0, /*bf_getsegcount*/ 0, /*bf_getcharbuffer*/ }; statichere PyTypeObject __pyx_type_5event_event = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "event.event", /*tp_name*/ sizeof(struct __pyx_obj_5event_event), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5event_event, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ __pyx_f_5event_5event___repr__, /*tp_repr*/ &__pyx_tp_as_number_event, /*tp_as_number*/ &__pyx_tp_as_sequence_event, /*tp_as_sequence*/ &__pyx_tp_as_mapping_event, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_event, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "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*/ __pyx_tp_traverse_5event_event, /*tp_traverse*/ __pyx_tp_clear_5event_event, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5event_event, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_f_5event_5event___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5event_event, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static PyObject *__pyx_tp_new_5event_read(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k); struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o; return o; } static void __pyx_tp_dealloc_5event_read(PyObject *o) { struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o; __pyx_ptype_5event_event->tp_dealloc(o); } static int __pyx_tp_traverse_5event_read(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o; __pyx_ptype_5event_event->tp_traverse(o, v, a); return 0; } static int __pyx_tp_clear_5event_read(PyObject *o) { struct __pyx_obj_5event_read *p = (struct __pyx_obj_5event_read *)o; __pyx_ptype_5event_event->tp_clear(o); return 0; } static struct PyMethodDef __pyx_methods_5event_read[] = { {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_read = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ 0, /*nb_divide*/ 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ 0, /*nb_coerce*/ 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ 0, /*nb_oct*/ 0, /*nb_hex*/ 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ }; static PySequenceMethods __pyx_tp_as_sequence_read = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_read = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_read = { 0, /*bf_getreadbuffer*/ 0, /*bf_getwritebuffer*/ 0, /*bf_getsegcount*/ 0, /*bf_getcharbuffer*/ }; statichere PyTypeObject __pyx_type_5event_read = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "event.read", /*tp_name*/ sizeof(struct __pyx_obj_5event_read), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5event_read, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_read, /*tp_as_number*/ &__pyx_tp_as_sequence_read, /*tp_as_sequence*/ &__pyx_tp_as_mapping_read, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_read, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ "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*/ __pyx_tp_traverse_5event_read, /*tp_traverse*/ __pyx_tp_clear_5event_read, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5event_read, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_f_5event_4read___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5event_read, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static PyObject *__pyx_tp_new_5event_write(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k); struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o; return o; } static void __pyx_tp_dealloc_5event_write(PyObject *o) { struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o; __pyx_ptype_5event_event->tp_dealloc(o); } static int __pyx_tp_traverse_5event_write(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o; __pyx_ptype_5event_event->tp_traverse(o, v, a); return 0; } static int __pyx_tp_clear_5event_write(PyObject *o) { struct __pyx_obj_5event_write *p = (struct __pyx_obj_5event_write *)o; __pyx_ptype_5event_event->tp_clear(o); return 0; } static struct PyMethodDef __pyx_methods_5event_write[] = { {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_write = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ 0, /*nb_divide*/ 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ 0, /*nb_coerce*/ 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ 0, /*nb_oct*/ 0, /*nb_hex*/ 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ }; static PySequenceMethods __pyx_tp_as_sequence_write = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_write = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_write = { 0, /*bf_getreadbuffer*/ 0, /*bf_getwritebuffer*/ 0, /*bf_getsegcount*/ 0, /*bf_getcharbuffer*/ }; statichere PyTypeObject __pyx_type_5event_write = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "event.write", /*tp_name*/ sizeof(struct __pyx_obj_5event_write), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5event_write, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_write, /*tp_as_number*/ &__pyx_tp_as_sequence_write, /*tp_as_sequence*/ &__pyx_tp_as_mapping_write, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_write, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ "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*/ __pyx_tp_traverse_5event_write, /*tp_traverse*/ __pyx_tp_clear_5event_write, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5event_write, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_f_5event_5write___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5event_write, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static PyObject *__pyx_tp_new_5event_signal(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k); struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o; return o; } static void __pyx_tp_dealloc_5event_signal(PyObject *o) { struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o; __pyx_ptype_5event_event->tp_dealloc(o); } static int __pyx_tp_traverse_5event_signal(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o; __pyx_ptype_5event_event->tp_traverse(o, v, a); return 0; } static int __pyx_tp_clear_5event_signal(PyObject *o) { struct __pyx_obj_5event_signal *p = (struct __pyx_obj_5event_signal *)o; __pyx_ptype_5event_event->tp_clear(o); return 0; } static struct PyMethodDef __pyx_methods_5event_signal[] = { {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_signal = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ 0, /*nb_divide*/ 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ 0, /*nb_coerce*/ 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ 0, /*nb_oct*/ 0, /*nb_hex*/ 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ }; static PySequenceMethods __pyx_tp_as_sequence_signal = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_signal = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_signal = { 0, /*bf_getreadbuffer*/ 0, /*bf_getwritebuffer*/ 0, /*bf_getsegcount*/ 0, /*bf_getcharbuffer*/ }; statichere PyTypeObject __pyx_type_5event_signal = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "event.signal", /*tp_name*/ sizeof(struct __pyx_obj_5event_signal), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5event_signal, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_signal, /*tp_as_number*/ &__pyx_tp_as_sequence_signal, /*tp_as_sequence*/ &__pyx_tp_as_mapping_signal, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_signal, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ "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*/ __pyx_tp_traverse_5event_signal, /*tp_traverse*/ __pyx_tp_clear_5event_signal, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5event_signal, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_f_5event_6signal___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5event_signal, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static PyObject *__pyx_tp_new_5event_timeout(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_ptype_5event_event->tp_new(t, a, k); struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o; return o; } static void __pyx_tp_dealloc_5event_timeout(PyObject *o) { struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o; __pyx_ptype_5event_event->tp_dealloc(o); } static int __pyx_tp_traverse_5event_timeout(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o; __pyx_ptype_5event_event->tp_traverse(o, v, a); return 0; } static int __pyx_tp_clear_5event_timeout(PyObject *o) { struct __pyx_obj_5event_timeout *p = (struct __pyx_obj_5event_timeout *)o; __pyx_ptype_5event_event->tp_clear(o); return 0; } static struct PyMethodDef __pyx_methods_5event_timeout[] = { {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_timeout = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ 0, /*nb_divide*/ 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ 0, /*nb_coerce*/ 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ 0, /*nb_oct*/ 0, /*nb_hex*/ 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ }; static PySequenceMethods __pyx_tp_as_sequence_timeout = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_timeout = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_timeout = { 0, /*bf_getreadbuffer*/ 0, /*bf_getwritebuffer*/ 0, /*bf_getsegcount*/ 0, /*bf_getcharbuffer*/ }; statichere PyTypeObject __pyx_type_5event_timeout = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "event.timeout", /*tp_name*/ sizeof(struct __pyx_obj_5event_timeout), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5event_timeout, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_timeout, /*tp_as_number*/ &__pyx_tp_as_sequence_timeout, /*tp_as_sequence*/ &__pyx_tp_as_mapping_timeout, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_timeout, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ "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*/ __pyx_tp_traverse_5event_timeout, /*tp_traverse*/ __pyx_tp_clear_5event_timeout, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5event_timeout, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_f_5event_7timeout___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5event_timeout, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static struct PyMethodDef __pyx_methods[] = { {"init", (PyCFunction)__pyx_f_5event_init, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_init}, {"dispatch", (PyCFunction)__pyx_f_5event_dispatch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_dispatch}, {"loop", (PyCFunction)__pyx_f_5event_loop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_loop}, {"abort", (PyCFunction)__pyx_f_5event_abort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5event_abort}, {0, 0, 0, 0} }; DL_EXPORT(void) initevent(void); /*proto*/ DL_EXPORT(void) initevent(void) { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; PyObject *__pyx_6 = 0; __pyx_m = Py_InitModule4("event", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}; __pyx_b = PyImport_AddModule("__builtin__"); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}; if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}; if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}; __pyx_type_5event_event.tp_free = _PyObject_GC_Del; if (PyType_Ready(&__pyx_type_5event_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;} if (PyObject_SetAttrString(__pyx_m, "event", (PyObject *)&__pyx_type_5event_event) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;} __pyx_ptype_5event_event = &__pyx_type_5event_event; __pyx_type_5event_read.tp_base = __pyx_ptype_5event_event; if (PyType_Ready(&__pyx_type_5event_read) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;} if (PyObject_SetAttrString(__pyx_m, "read", (PyObject *)&__pyx_type_5event_read) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;} __pyx_ptype_5event_read = &__pyx_type_5event_read; __pyx_type_5event_write.tp_base = __pyx_ptype_5event_event; if (PyType_Ready(&__pyx_type_5event_write) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;} if (PyObject_SetAttrString(__pyx_m, "write", (PyObject *)&__pyx_type_5event_write) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;} __pyx_ptype_5event_write = &__pyx_type_5event_write; __pyx_type_5event_signal.tp_base = __pyx_ptype_5event_event; if (PyType_Ready(&__pyx_type_5event_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;} if (PyObject_SetAttrString(__pyx_m, "signal", (PyObject *)&__pyx_type_5event_signal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;} __pyx_ptype_5event_signal = &__pyx_type_5event_signal; __pyx_type_5event_timeout.tp_base = __pyx_ptype_5event_event; if (PyType_Ready(&__pyx_type_5event_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;} if (PyObject_SetAttrString(__pyx_m, "timeout", (PyObject *)&__pyx_type_5event_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;} __pyx_ptype_5event_timeout = &__pyx_type_5event_timeout; /* "/Users/dugsong/projects/pyevent/event.pyx":18 */ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;} Py_INCREF(__pyx_k1p); PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k1p); Py_INCREF(__pyx_k2p); PyTuple_SET_ITEM(__pyx_1, 1, __pyx_k2p); if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":20 */ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;} Py_INCREF(__pyx_k3p); PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k3p); Py_INCREF(__pyx_k4p); PyTuple_SET_ITEM(__pyx_1, 1, __pyx_k4p); if (PyObject_SetAttr(__pyx_m, __pyx_n___copyright__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":22 */ if (PyObject_SetAttr(__pyx_m, __pyx_n___license__, __pyx_n_BSD) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;} /* "/Users/dugsong/projects/pyevent/event.pyx":23 */ if (PyObject_SetAttr(__pyx_m, __pyx_n___url__, __pyx_k6p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;} /* "/Users/dugsong/projects/pyevent/event.pyx":24 */ if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k7p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;} /* "/Users/dugsong/projects/pyevent/event.pyx":26 */ __pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":57 */ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_TIMEOUT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":58 */ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_READ, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":59 */ __pyx_1 = PyInt_FromLong(4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_WRITE, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":60 */ __pyx_1 = PyInt_FromLong(8); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_SIGNAL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":61 */ __pyx_1 = PyInt_FromLong(16); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_EV_PERSIST, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":63 */ if (PyObject_SetAttr(__pyx_m, __pyx_n___event_exc, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;} /* "/Users/dugsong/projects/pyevent/event.pyx":92 */ Py_INCREF(Py_None); __pyx_k9 = Py_None; __pyx_k10 = 0; __pyx_1 = PyInt_FromLong((-1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;} __pyx_k11 = __pyx_1; __pyx_1 = 0; __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;} __pyx_k12 = __pyx_2; __pyx_2 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":143 */ __pyx_k13 = (-1); /* "/Users/dugsong/projects/pyevent/event.pyx":264 */ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; goto __pyx_L1;} __pyx_k14 = __pyx_3; __pyx_3 = 0; /* "/Users/dugsong/projects/pyevent/event.pyx":280 */ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_init); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;} __pyx_5 = PyTuple_New(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;} __pyx_6 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_6); __pyx_6 = 0; return; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); Py_XDECREF(__pyx_6); __Pyx_AddTraceback("event"); } static char *__pyx_filenames[] = { "event.pyx", }; statichere char **__pyx_f = __pyx_filenames; /* Runtime support code */ static int __Pyx_GetStarArgs( PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2) { PyObject *x = 0, *args1 = 0, *kwds1 = 0; if (args2) *args2 = 0; if (kwds2) *kwds2 = 0; if (args2) { args1 = PyTuple_GetSlice(*args, 0, nargs); if (!args1) goto bad; *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args)); if (!*args2) goto bad; } else { args1 = *args; Py_INCREF(args1); } if (kwds2) { if (*kwds) { char **p; kwds1 = PyDict_New(); if (!kwds) goto bad; *kwds2 = PyDict_Copy(*kwds); if (!*kwds2) goto bad; for (p = kwd_list; *p; p++) { x = PyDict_GetItemString(*kwds, *p); if (x) { if (PyDict_SetItemString(kwds1, *p, x) < 0) goto bad; if (PyDict_DelItemString(*kwds2, *p) < 0) goto bad; } } } else { *kwds2 = PyDict_New(); if (!*kwds2) goto bad; } } else { kwds1 = *kwds; Py_XINCREF(kwds1); } *args = args1; *kwds = kwds1; return 0; bad: Py_XDECREF(args1); Py_XDECREF(kwds1); if (*args2) Py_XDECREF(*args2); if (*kwds2) Py_XDECREF(*kwds2); return -1; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *__import__ = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; module = PyObject_CallFunction(__import__, "OOOO", name, global_dict, empty_dict, list); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); Py_XDECREF(empty_dict); return module; } static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) PyErr_SetObject(PyExc_NameError, name); return result; } static void __Pyx_WriteUnraisable(char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; PyErr_Fetch(&old_exc, &old_val, &old_tb); ctx = PyString_FromString(name); PyErr_Restore(old_exc, old_val, old_tb); if (!ctx) ctx = Py_None; PyErr_WriteUnraisable(ctx); } static PyObject *__Pyx_GetExcValue(void) { PyObject *type = 0, *value = 0, *tb = 0; PyObject *result = 0; PyThreadState *tstate = PyThreadState_Get(); PyErr_Fetch(&type, &value, &tb); PyErr_NormalizeException(&type, &value, &tb); if (PyErr_Occurred()) goto bad; if (!value) { value = Py_None; Py_INCREF(value); } Py_XDECREF(tstate->exc_type); Py_XDECREF(tstate->exc_value); Py_XDECREF(tstate->exc_traceback); tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; result = value; Py_XINCREF(result); type = 0; value = 0; tb = 0; bad: Py_XDECREF(type); Py_XDECREF(value); Py_XDECREF(tb); return result; } static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } /* Next, repeatedly, replace a tuple exception with its first item */ while (PyTuple_Check(type) && PyTuple_Size(type) > 0) { PyObject *tmp = type; type = PyTuple_GET_ITEM(type, 0); Py_INCREF(type); Py_DECREF(tmp); } if (PyString_Check(type)) ; else if (PyClass_Check(type)) ; /*PyErr_NormalizeException(&type, &value, &tb);*/ else if (PyInstance_Check(type)) { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } else { /* Normalize to raise , */ Py_DECREF(value); value = type; type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } } else { /* Not something you can raise. You get an exception anyway, just not what you specified :-) */ PyErr_Format(PyExc_TypeError, "exceptions must be strings, classes, or " "instances, not %s", type->ob_type->tp_name); goto raise_error; } PyErr_Restore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) { while (t->p) { *t->p = PyString_InternFromString(t->s); if (!*t->p) return -1; ++t; } return 0; } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); if (!*t->p) return -1; ++t; } return 0; } #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyObject *empty_tuple = 0; PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_srcfile = PyString_FromString(__pyx_filename); if (!py_srcfile) goto bad; py_funcname = PyString_FromString(funcname); if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; empty_tuple = PyTuple_New(0); if (!empty_tuple) goto bad; empty_string = PyString_FromString(""); if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ empty_string, /*PyObject *code,*/ empty_tuple, /*PyObject *consts,*/ empty_tuple, /*PyObject *names,*/ empty_tuple, /*PyObject *varnames,*/ empty_tuple, /*PyObject *freevars,*/ empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ empty_string /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_Get(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(empty_tuple); Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); }