/* Generated by Pyrex 0.9.4.1 on Mon Dec 4 21:38:54 2006 */ #include "Python.h" #include "structmember.h" #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif __PYX_EXTERN_C double pow(double, double); #include "CoreAudio/AudioHardware.h" #include "CoreFoundation/CFBase.h" #include "CoreFoundation/CFString.h" #include "CoreMIDI/MIDIServices.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; static char **__pyx_f; /* Declarations from CoreMIDI */ static MIDIClientRef __pyx_v_8CoreMIDI_client; static MIDIPortRef __pyx_v_8CoreMIDI_inPort; static MIDIPortRef __pyx_v_8CoreMIDI_outPort; static MIDIEndpointRef __pyx_v_8CoreMIDI_src; static MIDIEndpointRef __pyx_v_8CoreMIDI_dest; static PyThreadState (*__pyx_v_8CoreMIDI_state); static CFStringRef (__pyx_f_8CoreMIDI_pyCFSTR(PyObject *)); /*proto*/ static void (__pyx_f_8CoreMIDI__callback(MIDIPacketList (*),void (*),void (*))); /*proto*/ static void (__pyx_f_8CoreMIDI_call_python_callback(MIDIPacket (*))); /*proto*/ /* Implementation of CoreMIDI */ static char (__pyx_k1[]) = "CoreMIDI.pyx"; static char (__pyx_k2[]) = "Input Port"; static char (__pyx_k3[]) = "Output Port"; static char (__pyx_k4[]) = "CoreMIDI.pyx: no midi destinations found!"; static PyObject *__pyx_n_send; static PyObject *__pyx_n_pyCallback; static PyObject *__pyx_n_n; static PyObject *__pyx_n_i; static PyObject *__pyx_k1p; static PyObject *__pyx_k2p; static PyObject *__pyx_k3p; static PyObject *__pyx_k4p; static CFStringRef __pyx_f_8CoreMIDI_pyCFSTR(PyObject *__pyx_v_s) { char (*__pyx_v_cStr); CFStringRef __pyx_r; Py_INCREF(__pyx_v_s); /* "/Users/michal/midi/CoreMIDI.pyx":184 */ __pyx_v_cStr = PyString_AsString(__pyx_v_s); /* "/Users/michal/midi/CoreMIDI.pyx":185 */ __pyx_r = CFStringCreateWithCString(0,__pyx_v_cStr,0); goto __pyx_L0; goto __pyx_L0; __pyx_L1:; __Pyx_WriteUnraisable("CoreMIDI.pyCFSTR"); __pyx_L0:; Py_DECREF(__pyx_v_s); return __pyx_r; } static PyObject *__pyx_f_8CoreMIDI_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_8CoreMIDI_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_a = 0; PyObject *__pyx_v_b = 0; PyObject *__pyx_v_c = 0; MIDIPacketList __pyx_v_packetList; MIDIPacket (*__pyx_v_packet); Byte __pyx_v_a_; Byte __pyx_v_b_; Byte __pyx_v_c_; PyObject *__pyx_r; Byte __pyx_1; static char *__pyx_argnames[] = {"a","b","c",0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c)) return 0; Py_INCREF(__pyx_v_a); Py_INCREF(__pyx_v_b); Py_INCREF(__pyx_v_c); /* "/Users/michal/midi/CoreMIDI.pyx":195 */ __pyx_1 = PyInt_AsLong(__pyx_v_a); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} __pyx_v_a_ = __pyx_1; /* "/Users/michal/midi/CoreMIDI.pyx":196 */ __pyx_1 = PyInt_AsLong(__pyx_v_b); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} __pyx_v_b_ = __pyx_1; /* "/Users/michal/midi/CoreMIDI.pyx":197 */ __pyx_1 = PyInt_AsLong(__pyx_v_c); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;} __pyx_v_c_ = __pyx_1; /* "/Users/michal/midi/CoreMIDI.pyx":198 */ __pyx_v_packetList.numPackets = 1; /* "/Users/michal/midi/CoreMIDI.pyx":200 */ __pyx_v_packet = (&(__pyx_v_packetList.packet[0])); /* "/Users/michal/midi/CoreMIDI.pyx":201 */ __pyx_v_packet->length = 4; /* "/Users/michal/midi/CoreMIDI.pyx":202 */ __pyx_v_packet->timeStamp = 0; /* "/Users/michal/midi/CoreMIDI.pyx":203 */ (__pyx_v_packet->data[0]) = __pyx_v_a_; /* "/Users/michal/midi/CoreMIDI.pyx":204 */ (__pyx_v_packet->data[1]) = __pyx_v_b_; /* "/Users/michal/midi/CoreMIDI.pyx":205 */ (__pyx_v_packet->data[2]) = __pyx_v_c_; /* "/Users/michal/midi/CoreMIDI.pyx":209 */ MIDISend(__pyx_v_8CoreMIDI_outPort,__pyx_v_8CoreMIDI_dest,(&__pyx_v_packetList)); __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; __Pyx_AddTraceback("CoreMIDI.send"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_a); Py_DECREF(__pyx_v_b); Py_DECREF(__pyx_v_c); return __pyx_r; } static void __pyx_f_8CoreMIDI__callback(MIDIPacketList (*__pyx_v_pktlist),void (*__pyx_v_refCon),void (*__pyx_v_connRefCon)) { PyGILState_STATE __pyx_v_gil; /* "/Users/michal/midi/CoreMIDI.pyx":241 */ __pyx_v_gil = PyGILState_Ensure(); /* "/Users/michal/midi/CoreMIDI.pyx":246 */ __pyx_f_8CoreMIDI_call_python_callback(((MIDIPacket (*))__pyx_v_pktlist->packet)); /* "/Users/michal/midi/CoreMIDI.pyx":248 */ PyGILState_Release(__pyx_v_gil); goto __pyx_L0; __pyx_L1:; __Pyx_WriteUnraisable("CoreMIDI._callback"); __pyx_L0:; } static PyObject *__pyx_n_append; static void __pyx_f_8CoreMIDI_call_python_callback(MIDIPacket (*__pyx_v_packet)) { PyObject *__pyx_v_data; PyObject *__pyx_v_i; PyObject *__pyx_1 = 0; int __pyx_2; long __pyx_3; UInt16 __pyx_4; PyObject *__pyx_5 = 0; PyObject *__pyx_6 = 0; __pyx_v_data = Py_None; Py_INCREF(Py_None); __pyx_v_i = Py_None; Py_INCREF(Py_None); /* "/Users/michal/midi/CoreMIDI.pyx":252 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_pyCallback); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;} __pyx_2 = PyObject_IsTrue(__pyx_1); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; if (__pyx_2) { /* "/Users/michal/midi/CoreMIDI.pyx":253 */ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;} Py_DECREF(__pyx_v_data); __pyx_v_data = __pyx_1; __pyx_1 = 0; /* "/Users/michal/midi/CoreMIDI.pyx":254 */ __pyx_4 = __pyx_v_packet->length; for (__pyx_3 = 0; __pyx_3 < __pyx_4; ++__pyx_3) { __pyx_1 = PyInt_FromLong(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;} Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_1; __pyx_1 = 0; /* "/Users/michal/midi/CoreMIDI.pyx":255 */ __pyx_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;} __pyx_2 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;} __pyx_5 = PyInt_FromLong((__pyx_v_packet->data[__pyx_2])); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;} __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_6, 0, __pyx_5); __pyx_5 = 0; __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_6); __pyx_6 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_L3:; } __pyx_L4:; /* "/Users/michal/midi/CoreMIDI.pyx":256 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_pyCallback); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;} __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;} Py_INCREF(__pyx_v_data); PyTuple_SET_ITEM(__pyx_6, 0, __pyx_v_data); __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_6); __pyx_6 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; goto __pyx_L2; } __pyx_L2:; goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_5); Py_XDECREF(__pyx_6); __Pyx_WriteUnraisable("CoreMIDI.call_python_callback"); __pyx_L0:; Py_DECREF(__pyx_v_data); Py_DECREF(__pyx_v_i); } static PyObject *__pyx_k5p; static char (__pyx_k5[]) = "midi event:"; static PyObject *__pyx_f_8CoreMIDI_pyCallback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_8CoreMIDI_pyCallback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_data = 0; PyObject *__pyx_r; static char *__pyx_argnames[] = {"data",0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_data)) return 0; Py_INCREF(__pyx_v_data); /* "/Users/michal/midi/CoreMIDI.pyx":261 */ if (__Pyx_PrintItem(__pyx_k5p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;} if (__Pyx_PrintItem(__pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;} if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;} __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; __Pyx_AddTraceback("CoreMIDI.pyCallback"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_data); return __pyx_r; } static __Pyx_InternTabEntry __pyx_intern_tab[] = { {&__pyx_n_append, "append"}, {&__pyx_n_i, "i"}, {&__pyx_n_n, "n"}, {&__pyx_n_pyCallback, "pyCallback"}, {&__pyx_n_send, "send"}, {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_k5p, __pyx_k5, sizeof(__pyx_k5)}, {0, 0, 0} }; static struct PyMethodDef __pyx_methods[] = { {"send", (PyCFunction)__pyx_f_8CoreMIDI_send, METH_VARARGS|METH_KEYWORDS, 0}, {"pyCallback", (PyCFunction)__pyx_f_8CoreMIDI_pyCallback, METH_VARARGS|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; static void __pyx_init_filenames(void); /*proto*/ PyMODINIT_FUNC initCoreMIDI(void); /*proto*/ PyMODINIT_FUNC initCoreMIDI(void) { PyObject *__pyx_1 = 0; long __pyx_2; long __pyx_3; int __pyx_4; PyObject *__pyx_5 = 0; __pyx_init_filenames(); __pyx_m = Py_InitModule4("CoreMIDI", __pyx_methods, 0, 0, PYTHON_API_VERSION); if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}; __pyx_b = PyImport_AddModule("__builtin__"); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}; if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}; if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}; /* "/Users/michal/midi/CoreMIDI.pyx":276 */ PyEval_InitThreads(); /* "/Users/michal/midi/CoreMIDI.pyx":277 */ __pyx_v_8CoreMIDI_state = PyEval_SaveThread(); /* "/Users/michal/midi/CoreMIDI.pyx":279 */ MIDIClientCreate(__pyx_f_8CoreMIDI_pyCFSTR(__pyx_k1p),0,0,(&__pyx_v_8CoreMIDI_client)); /* "/Users/michal/midi/CoreMIDI.pyx":280 */ MIDIInputPortCreate(__pyx_v_8CoreMIDI_client,__pyx_f_8CoreMIDI_pyCFSTR(__pyx_k2p),__pyx_f_8CoreMIDI__callback,0,(&__pyx_v_8CoreMIDI_inPort)); /* "/Users/michal/midi/CoreMIDI.pyx":282 */ MIDIOutputPortCreate(__pyx_v_8CoreMIDI_client,__pyx_f_8CoreMIDI_pyCFSTR(__pyx_k3p),(&__pyx_v_8CoreMIDI_outPort)); /* "/Users/michal/midi/CoreMIDI.pyx":284 */ PyEval_RestoreThread(__pyx_v_8CoreMIDI_state); /* "/Users/michal/midi/CoreMIDI.pyx":287 */ __pyx_1 = PyInt_FromLong(MIDIGetNumberOfSources()); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_n, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/michal/midi/CoreMIDI.pyx":288 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_n); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;} __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; for (__pyx_2 = 0; __pyx_2 < __pyx_3; ++__pyx_2) { __pyx_1 = PyInt_FromLong(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_i, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/michal/midi/CoreMIDI.pyx":289 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;} __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_v_8CoreMIDI_src = MIDIGetSource(__pyx_4); /* "/Users/michal/midi/CoreMIDI.pyx":290 */ MIDIPortConnectSource(__pyx_v_8CoreMIDI_inPort,__pyx_v_8CoreMIDI_src,0); __pyx_L2:; } __pyx_L3:; /* "/Users/michal/midi/CoreMIDI.pyx":292 */ __pyx_1 = PyInt_FromLong(MIDIGetNumberOfDestinations()); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; goto __pyx_L1;} if (PyObject_SetAttr(__pyx_m, __pyx_n_n, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/Users/michal/midi/CoreMIDI.pyx":293 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_n); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;} __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;} if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;} __pyx_4 = __pyx_4 < 0; Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; if (__pyx_4) { if (__Pyx_PrintItem(__pyx_k4p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;} if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; /* "/Users/michal/midi/CoreMIDI.pyx":294 */ __pyx_v_8CoreMIDI_dest = MIDIGetDestination(0); return; __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("CoreMIDI"); } static char *__pyx_filenames[] = { "CoreMIDI.pyx", }; /* Runtime support code */ static void __pyx_init_filenames(void) { __pyx_f = __pyx_filenames; } 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 PyObject *__Pyx_GetStdout(void) { PyObject *f = PySys_GetObject("stdout"); if (!f) { PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); } return f; } static int __Pyx_PrintItem(PyObject *v) { PyObject *f; if (!(f = __Pyx_GetStdout())) return -1; if (PyFile_SoftSpace(f, 1)) { if (PyFile_WriteString(" ", f) < 0) return -1; } if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) return -1; if (PyString_Check(v)) { char *s = PyString_AsString(v); int len = PyString_Size(v); if (len > 0 && isspace(Py_CHARMASK(s[len-1])) && s[len-1] != ' ') PyFile_SoftSpace(f, 0); } return 0; } static int __Pyx_PrintNewline(void) { PyObject *f; if (!(f = __Pyx_GetStdout())) return -1; if (PyFile_WriteString("\n", f) < 0) return -1; PyFile_SoftSpace(f, 0); return 0; } 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 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); }