From d9cc2b219a11fbd6ecf44a4ddce886d34534ddca Mon Sep 17 00:00:00 2001 From: Benn Snyder Date: Mon, 28 Apr 2014 23:39:59 -0400 Subject: [PATCH] wrappers/python: update freenect.c - fixes #326 Signed-off-by: Benn Snyder --- README.md | 9 + wrappers/python/freenect.c | 8383 ++++++++++++++++++++++-------------- 2 files changed, 5154 insertions(+), 3238 deletions(-) diff --git a/README.md b/README.md index 85912e0c..f599e4f6 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,15 @@ Wrappers are not guaranteed to be API stable or up to date. - actionscript - Java (JNA) +## Python + + cd wrappers/python + # if you have cython and want to rebuild the binding + # cython freenect.pyx + python2 setup.py build_ext --inplace + +For example, start with [demo_cv_async.py](https://gihub.com/OpenKinect/libfreenect/tree/master/wrappers/python/devmo_cv_async.py). + # Maintainers diff --git a/wrappers/python/freenect.c b/wrappers/python/freenect.c index dce306be..0ec633f9 100644 --- a/wrappers/python/freenect.c +++ b/wrappers/python/freenect.c @@ -1,16 +1,28 @@ -/* Generated by Cython 0.14.1 on Thu Nov 10 13:32:00 2011 */ +/* Generated by Cython 0.19.1 on Mon Apr 28 23:37:38 2014 */ #define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +34,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +82,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +95,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +104,47 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +152,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +170,14 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +185,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,20 +202,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -186,11 +231,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -200,7 +243,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -208,45 +250,80 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__freenect #define __PYX_HAVE_API__freenect #include "stdint.h" +#include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "libfreenect.h" #include "libfreenect_sync.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif - -/* inline attribute */ -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -/* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -254,47 +331,153 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif - -typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - - -/* Type Conversion Predeclarations */ - -#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ - + static PyObject *__pyx_m; +static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; @@ -303,7 +486,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -313,7 +495,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -321,55 +502,206 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "freenect.pyx", "numpy.pxd", + "type.pxd", }; +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -390,50 +722,81 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ +struct __pyx_obj_8freenect_CtxPtr; +struct __pyx_obj_8freenect_StatePtr; +struct __pyx_obj_8freenect_DevPtr; + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "freenect.pyx":165 +/* "freenect.pyx":169 * * * cdef class CtxPtr: # <<<<<<<<<<<<<< * cdef freenect_context* _ptr * def __repr__(self): */ - struct __pyx_obj_8freenect_CtxPtr { PyObject_HEAD freenect_context *_ptr; }; -/* "freenect.pyx":176 + +/* "freenect.pyx":180 * return "" * * cdef class StatePtr: # <<<<<<<<<<<<<< * cdef freenect_raw_tilt_state* _ptr * def __repr__(self): */ - struct __pyx_obj_8freenect_StatePtr { PyObject_HEAD freenect_raw_tilt_state *_ptr; }; -/* "freenect.pyx":170 + +/* "freenect.pyx":174 * return "" * * cdef class DevPtr: # <<<<<<<<<<<<<< * cdef freenect_device* _ptr * cdef CtxPtr ctx */ - struct __pyx_obj_8freenect_DevPtr { PyObject_HEAD freenect_device *_ptr; @@ -443,7 +806,6 @@ struct __pyx_obj_8freenect_DevPtr { #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -454,82 +816,120 @@ struct __pyx_obj_8freenect_DevPtr { void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); /*proto*/ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, - PyObject *modname); /*proto*/ + PyObject *qualname, PyObject *modname); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int16_t(int16_t); static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int8_t(int8_t); static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ -#if PY_MAJOR_VERSION >= 3 +#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 static PyObject* __pyx_print = 0; static PyObject* __pyx_print_kwargs = 0; #endif @@ -538,14 +938,6 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); -#ifndef __PYX_FORCE_INIT_THREADS - #if PY_VERSION_HEX < 0x02040200 - #define __PYX_FORCE_INIT_THREADS 1 - #else - #define __PYX_FORCE_INIT_THREADS 0 - #endif -#endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) @@ -558,7 +950,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -677,63 +1068,129 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ +static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from libc.stdint */ -/* Module declarations from cpython.buffer */ -/* Module declarations from cpython.ref */ +/* Module declarations from 'libc.stdint' */ -/* Module declarations from libc.stdio */ +/* Module declarations from 'cpython.buffer' */ -/* Module declarations from cpython.object */ +/* Module declarations from 'cpython.ref' */ -/* Module declarations from libc.stdlib */ +/* Module declarations from 'libc.string' */ -/* Module declarations from numpy */ +/* Module declarations from 'libc.stdio' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from freenect */ +/* Module declarations from 'freenect' */ static PyTypeObject *__pyx_ptype_8freenect_CtxPtr = 0; -static PyTypeObject *__pyx_ptype_8freenect_DevPtr = 0; static PyTypeObject *__pyx_ptype_8freenect_StatePtr = 0; +static PyTypeObject *__pyx_ptype_8freenect_DevPtr = 0; static PyObject *__pyx_f_8freenect_init(int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPtr *, int, int __pyx_skip_dispatch); /*proto*/ static void __pyx_f_8freenect_depth_cb(freenect_device *, void *, uint32_t); /*proto*/ static void __pyx_f_8freenect_video_cb(freenect_device *, void *, uint32_t); /*proto*/ #define __Pyx_MODULE_NAME "freenect" -static int __pyx_module_is_main_freenect = 0; +int __pyx_module_is_main_freenect = 0; -/* Implementation of freenect */ +/* Implementation of 'freenect' */ static PyObject *__pyx_builtin_property; static PyObject *__pyx_builtin_Exception; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_8freenect_6CtxPtr___repr__(CYTHON_UNUSED struct __pyx_obj_8freenect_CtxPtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_6DevPtr___repr__(CYTHON_UNUSED struct __pyx_obj_8freenect_DevPtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_8StatePtr___repr__(CYTHON_UNUSED struct __pyx_obj_8freenect_StatePtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accelx(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_accely(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_8StatePtr_6_get_accelz(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_8StatePtr_8_get_tilt_angle(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_8StatePtr_10_get_tilt_status(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8freenect_set_depth_mode(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, int __pyx_v_res, int __pyx_v_mode); /* proto */ +static PyObject *__pyx_pf_8freenect_2set_video_mode(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, int __pyx_v_res, int __pyx_v_mode); /* proto */ +static PyObject *__pyx_pf_8freenect_4start_depth(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_6start_video(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_8stop_depth(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_10stop_video(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_12shutdown(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx); /* proto */ +static PyObject *__pyx_pf_8freenect_14process_events(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx); /* proto */ +static PyObject *__pyx_pf_8freenect_16num_devices(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx); /* proto */ +static PyObject *__pyx_pf_8freenect_18close_device(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_20set_tilt_degs(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, float __pyx_v_angle); /* proto */ +static PyObject *__pyx_pf_8freenect_22set_led(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, freenect_led_options __pyx_v_option); /* proto */ +static PyObject *__pyx_pf_8freenect_24update_tilt_state(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_26get_tilt_state(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_28get_mks_accel(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_StatePtr *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_8freenect_30get_accel(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_32get_tilt_degs(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_StatePtr *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_8freenect_34error_open_device(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_8freenect_36init(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_8freenect_38open_device(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx, int __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_8freenect_40set_depth_callback(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, PyObject *__pyx_v_cb); /* proto */ +static PyObject *__pyx_pf_8freenect_42set_video_callback(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, PyObject *__pyx_v_cb); /* proto */ +static PyObject *__pyx_pf_8freenect_44runloop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_depth, PyObject *__pyx_v_video, PyObject *__pyx_v_body, PyObject *__pyx_v_dev); /* proto */ +static PyObject *__pyx_pf_8freenect_46base_runloop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx, PyObject *__pyx_v_body); /* proto */ +static PyObject *__pyx_pf_8freenect_48_depth_cb_np(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev, PyObject *__pyx_v_string, PyObject *__pyx_v_timestamp); /* proto */ +static PyObject *__pyx_pf_8freenect_50_video_cb_np(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev, PyObject *__pyx_v_string, PyObject *__pyx_v_timestamp); /* proto */ +static PyObject *__pyx_pf_8freenect_52sync_get_depth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_index, PyObject *__pyx_v_format); /* proto */ +static PyObject *__pyx_pf_8freenect_54sync_get_video(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_index, PyObject *__pyx_v_format); /* proto */ +static PyObject *__pyx_pf_8freenect_56sync_stop(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static PyObject *__pyx_tp_new_8freenect_CtxPtr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_8freenect_StatePtr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_8freenect_DevPtr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_1[] = ""; static char __pyx_k_2[] = ""; static char __pyx_k_3[] = ""; @@ -747,7 +1204,8 @@ static char __pyx_k_19[] = "Format string allocated too short, see comment in nu static char __pyx_k_22[] = "Format string allocated too short."; static char __pyx_k_24[] = "VIDEO_IR_10BIT_PACKED"; static char __pyx_k_25[] = "LED_BLINK_RED_YELLOW"; -static char __pyx_k_26[] = "This kills the runloop, raise from the body only"; +static char __pyx_k_28[] = "/home/benn/code/libfreenect-upstream/wrappers/python/freenect.pyx"; +static char __pyx_k_66[] = "This kills the runloop, raise from the body only"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -762,34 +1220,39 @@ static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__cb[] = "cb"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; static char __pyx_k__ctx[] = "ctx"; static char __pyx_k__dev[] = "dev"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__out[] = "out"; static char __pyx_k__res[] = "res"; static char __pyx_k__Kill[] = "Kill"; -static char __pyx_k___ptr[] = "_ptr"; -static char __pyx_k__base[] = "base"; static char __pyx_k__body[] = "body"; +static char __pyx_k__ctxp[] = "ctxp"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__devp[] = "devp"; +static char __pyx_k__dims[] = "dims"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__mdev[] = "mdev"; static char __pyx_k__mode[] = "mode"; -static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__angle[] = "angle"; static char __pyx_k__depth[] = "depth"; -static char __pyx_k__descr[] = "descr"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__index[] = "index"; -static char __pyx_k__names[] = "names"; static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__print[] = "print"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; +static char __pyx_k__state[] = "state"; static char __pyx_k__uint8[] = "uint8"; static char __pyx_k__video[] = "video"; -static char __pyx_k__fields[] = "fields"; +static char __pyx_k___index[] = "_index"; static char __pyx_k__format[] = "format"; static char __pyx_k__option[] = "option"; static char __pyx_k__resize[] = "resize"; @@ -797,33 +1260,33 @@ static char __pyx_k__string[] = "string"; static char __pyx_k__uint16[] = "uint16"; static char __pyx_k__LED_OFF[] = "LED_OFF"; static char __pyx_k__LED_RED[] = "LED_RED"; +static char __pyx_k___format[] = "_format"; static char __pyx_k__runloop[] = "runloop"; static char __pyx_k__set_led[] = "set_led"; -static char __pyx_k__strides[] = "strides"; +static char __pyx_k__DEPTH_MM[] = "DEPTH_MM"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__freenect[] = "freenect"; -static char __pyx_k__itemsize[] = "itemsize"; static char __pyx_k__property[] = "property"; -static char __pyx_k__readonly[] = "readonly"; static char __pyx_k__shutdown[] = "shutdown"; -static char __pyx_k__type_num[] = "type_num"; static char __pyx_k__Exception[] = "Exception"; static char __pyx_k__LED_GREEN[] = "LED_GREEN"; static char __pyx_k__TypeError[] = "TypeError"; static char __pyx_k__VIDEO_RGB[] = "VIDEO_RGB"; +static char __pyx_k____class__[] = "__class__"; static char __pyx_k___depth_cb[] = "_depth_cb"; static char __pyx_k___video_cb[] = "_video_cb"; -static char __pyx_k__byteorder[] = "byteorder"; static char __pyx_k__get_accel[] = "get_accel"; +static char __pyx_k__state_out[] = "state_out"; static char __pyx_k__sync_stop[] = "sync_stop"; static char __pyx_k__timestamp[] = "timestamp"; static char __pyx_k__LED_YELLOW[] = "LED_YELLOW"; static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k____module__[] = "__module__"; static char __pyx_k__fromstring[] = "fromstring"; static char __pyx_k__stop_depth[] = "stop_depth"; static char __pyx_k__stop_video[] = "stop_video"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k__tilt_angle[] = "tilt_angle"; static char __pyx_k__DEPTH_10BIT[] = "DEPTH_10BIT"; static char __pyx_k__DEPTH_11BIT[] = "DEPTH_11BIT"; @@ -838,6 +1301,7 @@ static char __pyx_k__tilt_status[] = "tilt_status"; static char __pyx_k__DEVICE_AUDIO[] = "DEVICE_AUDIO"; static char __pyx_k__DEVICE_MOTOR[] = "DEVICE_MOTOR"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k____qualname__[] = "__qualname__"; static char __pyx_k___depth_cb_np[] = "_depth_cb_np"; static char __pyx_k___video_cb_np[] = "_video_cb_np"; static char __pyx_k__base_runloop[] = "base_runloop"; @@ -846,6 +1310,7 @@ static char __pyx_k__DEVICE_CAMERA[] = "DEVICE_CAMERA"; static char __pyx_k__VIDEO_IR_8BIT[] = "VIDEO_IR_8BIT"; static char __pyx_k__VIDEO_YUV_RAW[] = "VIDEO_YUV_RAW"; static char __pyx_k__VIDEO_YUV_RGB[] = "VIDEO_YUV_RGB"; +static char __pyx_k____metaclass__[] = "__metaclass__"; static char __pyx_k__get_mks_accel[] = "get_mks_accel"; static char __pyx_k__get_tilt_degs[] = "get_tilt_degs"; static char __pyx_k__set_tilt_degs[] = "set_tilt_degs"; @@ -863,6 +1328,7 @@ static char __pyx_k___get_tilt_angle[] = "_get_tilt_angle"; static char __pyx_k__accelerometer_x[] = "accelerometer_x"; static char __pyx_k__accelerometer_y[] = "accelerometer_y"; static char __pyx_k__accelerometer_z[] = "accelerometer_z"; +static char __pyx_k__DEPTH_REGISTERED[] = "DEPTH_REGISTERED"; static char __pyx_k___get_tilt_status[] = "_get_tilt_status"; static char __pyx_k__RESOLUTION_MEDIUM[] = "RESOLUTION_MEDIUM"; static char __pyx_k__error_open_device[] = "error_open_device"; @@ -882,13 +1348,16 @@ static PyObject *__pyx_kp_s_2; static PyObject *__pyx_kp_u_22; static PyObject *__pyx_n_s_24; static PyObject *__pyx_n_s_25; -static PyObject *__pyx_kp_s_26; +static PyObject *__pyx_kp_s_28; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_66; static PyObject *__pyx_n_s__DEPTH_10BIT; static PyObject *__pyx_n_s__DEPTH_10BIT_PACKED; static PyObject *__pyx_n_s__DEPTH_11BIT; static PyObject *__pyx_n_s__DEPTH_11BIT_PACKED; +static PyObject *__pyx_n_s__DEPTH_MM; +static PyObject *__pyx_n_s__DEPTH_REGISTERED; static PyObject *__pyx_n_s__DEVICE_AUDIO; static PyObject *__pyx_n_s__DEVICE_CAMERA; static PyObject *__pyx_n_s__DEVICE_MOTOR; @@ -911,36 +1380,43 @@ static PyObject *__pyx_n_s__VIDEO_RGB; static PyObject *__pyx_n_s__VIDEO_YUV_RAW; static PyObject *__pyx_n_s__VIDEO_YUV_RGB; static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____class__; +static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____metaclass__; +static PyObject *__pyx_n_s____module__; +static PyObject *__pyx_n_s____qualname__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___depth_cb; static PyObject *__pyx_n_s___depth_cb_np; +static PyObject *__pyx_n_s___format; static PyObject *__pyx_n_s___get_accelx; static PyObject *__pyx_n_s___get_accely; static PyObject *__pyx_n_s___get_accelz; static PyObject *__pyx_n_s___get_tilt_angle; static PyObject *__pyx_n_s___get_tilt_status; -static PyObject *__pyx_n_s___ptr; +static PyObject *__pyx_n_s___index; static PyObject *__pyx_n_s___video_cb; static PyObject *__pyx_n_s___video_cb_np; static PyObject *__pyx_n_s__accelerometer_x; static PyObject *__pyx_n_s__accelerometer_y; static PyObject *__pyx_n_s__accelerometer_z; static PyObject *__pyx_n_s__angle; -static PyObject *__pyx_n_s__base; static PyObject *__pyx_n_s__base_runloop; static PyObject *__pyx_n_s__body; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__cb; static PyObject *__pyx_n_s__close_device; static PyObject *__pyx_n_s__ctx; +static PyObject *__pyx_n_s__ctxp; +static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__depth; -static PyObject *__pyx_n_s__descr; static PyObject *__pyx_n_s__dev; +static PyObject *__pyx_n_s__devp; +static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__end; static PyObject *__pyx_n_s__error_open_device; -static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__file; static PyObject *__pyx_n_s__format; static PyObject *__pyx_n_s__freenect; static PyObject *__pyx_n_s__fromstring; @@ -949,19 +1425,17 @@ static PyObject *__pyx_n_s__get_mks_accel; static PyObject *__pyx_n_s__get_tilt_degs; static PyObject *__pyx_n_s__get_tilt_state; static PyObject *__pyx_n_s__index; -static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__mdev; static PyObject *__pyx_n_s__mode; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__num_devices; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__option; +static PyObject *__pyx_n_s__out; +static PyObject *__pyx_n_s__print; static PyObject *__pyx_n_s__process_events; static PyObject *__pyx_n_s__property; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; static PyObject *__pyx_n_s__res; static PyObject *__pyx_n_s__resize; static PyObject *__pyx_n_s__runloop; @@ -971,26 +1445,27 @@ static PyObject *__pyx_n_s__set_led; static PyObject *__pyx_n_s__set_tilt_degs; static PyObject *__pyx_n_s__set_video_callback; static PyObject *__pyx_n_s__set_video_mode; -static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__shutdown; static PyObject *__pyx_n_s__start_depth; static PyObject *__pyx_n_s__start_video; +static PyObject *__pyx_n_s__state; +static PyObject *__pyx_n_s__state_out; static PyObject *__pyx_n_s__stop_depth; static PyObject *__pyx_n_s__stop_video; -static PyObject *__pyx_n_s__strides; static PyObject *__pyx_n_s__string; -static PyObject *__pyx_n_s__suboffsets; static PyObject *__pyx_n_s__sync_get_depth; static PyObject *__pyx_n_s__sync_get_video; static PyObject *__pyx_n_s__sync_stop; static PyObject *__pyx_n_s__tilt_angle; static PyObject *__pyx_n_s__tilt_status; static PyObject *__pyx_n_s__timestamp; -static PyObject *__pyx_n_s__type_num; static PyObject *__pyx_n_s__uint16; static PyObject *__pyx_n_s__uint8; static PyObject *__pyx_n_s__update_tilt_state; static PyObject *__pyx_n_s__video; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__z; static PyObject *__pyx_int_0; static PyObject *__pyx_int_3; static PyObject *__pyx_int_15; @@ -1008,21 +1483,84 @@ static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_20; static PyObject *__pyx_k_tuple_21; static PyObject *__pyx_k_tuple_23; - -/* "freenect.pyx":167 - * cdef class CtxPtr: +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_29; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_33; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_37; +static PyObject *__pyx_k_tuple_39; +static PyObject *__pyx_k_tuple_41; +static PyObject *__pyx_k_tuple_43; +static PyObject *__pyx_k_tuple_45; +static PyObject *__pyx_k_tuple_47; +static PyObject *__pyx_k_tuple_49; +static PyObject *__pyx_k_tuple_51; +static PyObject *__pyx_k_tuple_53; +static PyObject *__pyx_k_tuple_55; +static PyObject *__pyx_k_tuple_57; +static PyObject *__pyx_k_tuple_59; +static PyObject *__pyx_k_tuple_62; +static PyObject *__pyx_k_tuple_64; +static PyObject *__pyx_k_tuple_67; +static PyObject *__pyx_k_tuple_69; +static PyObject *__pyx_k_tuple_71; +static PyObject *__pyx_k_tuple_73; +static PyObject *__pyx_k_tuple_75; +static PyObject *__pyx_k_tuple_77; +static PyObject *__pyx_k_codeobj_27; +static PyObject *__pyx_k_codeobj_30; +static PyObject *__pyx_k_codeobj_32; +static PyObject *__pyx_k_codeobj_34; +static PyObject *__pyx_k_codeobj_36; +static PyObject *__pyx_k_codeobj_38; +static PyObject *__pyx_k_codeobj_40; +static PyObject *__pyx_k_codeobj_42; +static PyObject *__pyx_k_codeobj_44; +static PyObject *__pyx_k_codeobj_46; +static PyObject *__pyx_k_codeobj_48; +static PyObject *__pyx_k_codeobj_50; +static PyObject *__pyx_k_codeobj_52; +static PyObject *__pyx_k_codeobj_54; +static PyObject *__pyx_k_codeobj_56; +static PyObject *__pyx_k_codeobj_58; +static PyObject *__pyx_k_codeobj_60; +static PyObject *__pyx_k_codeobj_61; +static PyObject *__pyx_k_codeobj_63; +static PyObject *__pyx_k_codeobj_65; +static PyObject *__pyx_k_codeobj_68; +static PyObject *__pyx_k_codeobj_70; +static PyObject *__pyx_k_codeobj_72; +static PyObject *__pyx_k_codeobj_74; +static PyObject *__pyx_k_codeobj_76; +static PyObject *__pyx_k_codeobj_78; +static PyObject *__pyx_k_codeobj_79; + +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_6CtxPtr_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_8freenect_6CtxPtr_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_6CtxPtr___repr__(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":171 + * cdef class CtxPtr: * cdef freenect_context* _ptr * def __repr__(self): # <<<<<<<<<<<<<< * return "" * */ -static PyObject *__pyx_pf_8freenect_6CtxPtr___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_8freenect_6CtxPtr___repr__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_8freenect_6CtxPtr___repr__(CYTHON_UNUSED struct __pyx_obj_8freenect_CtxPtr *__pyx_v_self) { PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__repr__"); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "freenect.pyx":168 + /* "freenect.pyx":172 * cdef freenect_context* _ptr * def __repr__(self): * return "" # <<<<<<<<<<<<<< @@ -1041,7 +1579,18 @@ static PyObject *__pyx_pf_8freenect_6CtxPtr___repr__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "freenect.pyx":173 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_6DevPtr_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_8freenect_6DevPtr_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_6DevPtr___repr__(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":177 * cdef freenect_device* _ptr * cdef CtxPtr ctx * def __repr__(self): # <<<<<<<<<<<<<< @@ -1049,12 +1598,12 @@ static PyObject *__pyx_pf_8freenect_6CtxPtr___repr__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_8freenect_6DevPtr___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_8freenect_6DevPtr___repr__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_8freenect_6DevPtr___repr__(CYTHON_UNUSED struct __pyx_obj_8freenect_DevPtr *__pyx_v_self) { PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__repr__"); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "freenect.pyx":174 + /* "freenect.pyx":178 * cdef CtxPtr ctx * def __repr__(self): * return "" # <<<<<<<<<<<<<< @@ -1073,7 +1622,18 @@ static PyObject *__pyx_pf_8freenect_6DevPtr___repr__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "freenect.pyx":178 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_8StatePtr_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_8freenect_8StatePtr_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_8StatePtr___repr__(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":182 * cdef class StatePtr: * cdef freenect_raw_tilt_state* _ptr * def __repr__(self): # <<<<<<<<<<<<<< @@ -1081,12 +1641,12 @@ static PyObject *__pyx_pf_8freenect_6DevPtr___repr__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_8freenect_8StatePtr___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_8freenect_8StatePtr___repr__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_8freenect_8StatePtr___repr__(CYTHON_UNUSED struct __pyx_obj_8freenect_StatePtr *__pyx_v_self) { PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__repr__"); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "freenect.pyx":179 + /* "freenect.pyx":183 * cdef freenect_raw_tilt_state* _ptr * def __repr__(self): * return "" # <<<<<<<<<<<<<< @@ -1105,7 +1665,18 @@ static PyObject *__pyx_pf_8freenect_8StatePtr___repr__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "freenect.pyx":181 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_8StatePtr_3_get_accelx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8freenect_8StatePtr_3_get_accelx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_accelx (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_8StatePtr_2_get_accelx(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":185 * return "" * * def _get_accelx(self): # <<<<<<<<<<<<<< @@ -1113,14 +1684,17 @@ static PyObject *__pyx_pf_8freenect_8StatePtr___repr__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_8freenect_8StatePtr_1_get_accelx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8freenect_8StatePtr_1_get_accelx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accelx(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_get_accelx"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_accelx", 0); - /* "freenect.pyx":182 + /* "freenect.pyx":186 * * def _get_accelx(self): * return int(self._ptr.accelerometer_x) # <<<<<<<<<<<<<< @@ -1128,14 +1702,14 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_1_get_accelx(PyObject *__pyx_v_sel * def _get_accely(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(__pyx_v_self->_ptr->accelerometer_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1147,7 +1721,7 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_1_get_accelx(PyObject *__pyx_v_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.StatePtr._get_accelx"); + __Pyx_AddTraceback("freenect.StatePtr._get_accelx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1155,7 +1729,18 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_1_get_accelx(PyObject *__pyx_v_sel return __pyx_r; } -/* "freenect.pyx":184 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_8StatePtr_5_get_accely(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8freenect_8StatePtr_5_get_accely(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_accely (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_8StatePtr_4_get_accely(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":188 * return int(self._ptr.accelerometer_x) * * def _get_accely(self): # <<<<<<<<<<<<<< @@ -1163,14 +1748,17 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_1_get_accelx(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accely(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accely(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_accely(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_get_accely"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_accely", 0); - /* "freenect.pyx":185 + /* "freenect.pyx":189 * * def _get_accely(self): * return int(self._ptr.accelerometer_y) # <<<<<<<<<<<<<< @@ -1178,14 +1766,14 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accely(PyObject *__pyx_v_sel * def _get_accelz(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(__pyx_v_self->_ptr->accelerometer_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1197,7 +1785,7 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accely(PyObject *__pyx_v_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.StatePtr._get_accely"); + __Pyx_AddTraceback("freenect.StatePtr._get_accely", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1205,7 +1793,18 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accely(PyObject *__pyx_v_sel return __pyx_r; } -/* "freenect.pyx":187 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_8StatePtr_7_get_accelz(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8freenect_8StatePtr_7_get_accelz(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_accelz (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_8StatePtr_6_get_accelz(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":191 * return int(self._ptr.accelerometer_y) * * def _get_accelz(self): # <<<<<<<<<<<<<< @@ -1213,14 +1812,17 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_2_get_accely(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_8freenect_8StatePtr_3_get_accelz(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8freenect_8StatePtr_3_get_accelz(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_8StatePtr_6_get_accelz(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_get_accelz"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_accelz", 0); - /* "freenect.pyx":188 + /* "freenect.pyx":192 * * def _get_accelz(self): * return int(self._ptr.accelerometer_z) # <<<<<<<<<<<<<< @@ -1228,14 +1830,14 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_3_get_accelz(PyObject *__pyx_v_sel * def _get_tilt_angle(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->accelerometer_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int16_t(__pyx_v_self->_ptr->accelerometer_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1247,7 +1849,7 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_3_get_accelz(PyObject *__pyx_v_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.StatePtr._get_accelz"); + __Pyx_AddTraceback("freenect.StatePtr._get_accelz", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1255,7 +1857,18 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_3_get_accelz(PyObject *__pyx_v_sel return __pyx_r; } -/* "freenect.pyx":190 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_8StatePtr_9_get_tilt_angle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8freenect_8StatePtr_9_get_tilt_angle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_tilt_angle (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_8StatePtr_8_get_tilt_angle(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":194 * return int(self._ptr.accelerometer_z) * * def _get_tilt_angle(self): # <<<<<<<<<<<<<< @@ -1263,14 +1876,17 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_3_get_accelz(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_8StatePtr_8_get_tilt_angle(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_get_tilt_angle"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_tilt_angle", 0); - /* "freenect.pyx":191 + /* "freenect.pyx":195 * * def _get_tilt_angle(self): * return int(self._ptr.tilt_angle) # <<<<<<<<<<<<<< @@ -1278,14 +1894,14 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle(PyObject *__pyx_v * def _get_tilt_status(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int8_t(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int8_t(__pyx_v_self->_ptr->tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1297,7 +1913,7 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle(PyObject *__pyx_v __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.StatePtr._get_tilt_angle"); + __Pyx_AddTraceback("freenect.StatePtr._get_tilt_angle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1305,7 +1921,18 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle(PyObject *__pyx_v return __pyx_r; } -/* "freenect.pyx":193 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_8StatePtr_11_get_tilt_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8freenect_8StatePtr_11_get_tilt_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_tilt_status (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_8StatePtr_10_get_tilt_status(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":197 * return int(self._ptr.tilt_angle) * * def _get_tilt_status(self): # <<<<<<<<<<<<<< @@ -1313,14 +1940,17 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_8freenect_8StatePtr_5_get_tilt_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8freenect_8StatePtr_5_get_tilt_status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_8StatePtr_10_get_tilt_status(struct __pyx_obj_8freenect_StatePtr *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_get_tilt_status"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_tilt_status", 0); - /* "freenect.pyx":194 + /* "freenect.pyx":198 * * def _get_tilt_status(self): * return int(self._ptr.tilt_status) # <<<<<<<<<<<<<< @@ -1328,14 +1958,14 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_5_get_tilt_status(PyObject *__pyx_ * accelerometer_x = property(_get_accelx) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_self)->_ptr->tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_ptr->tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -1347,7 +1977,7 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_5_get_tilt_status(PyObject *__pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.StatePtr._get_tilt_status"); + __Pyx_AddTraceback("freenect.StatePtr._get_tilt_status", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1355,77 +1985,98 @@ static PyObject *__pyx_pf_8freenect_8StatePtr_5_get_tilt_status(PyObject *__pyx_ return __pyx_r; } -/* "freenect.pyx":202 - * tilt_status = property(_get_tilt_status) - * - * def set_depth_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< - * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) - * - */ - -static PyObject *__pyx_pf_8freenect_set_depth_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_set_depth_mode = {__Pyx_NAMESTR("set_depth_mode"), (PyCFunction)__pyx_pf_8freenect_set_depth_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_set_depth_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_1set_depth_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_1set_depth_mode = {__Pyx_NAMESTR("set_depth_mode"), (PyCFunction)__pyx_pw_8freenect_1set_depth_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_1set_depth_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; int __pyx_v_res; int __pyx_v_mode; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__res,&__pyx_n_s__mode,0}; - __Pyx_RefNannySetupContext("set_depth_mode"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_depth_mode (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__res,&__pyx_n_s__mode,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_depth_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_depth_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_res = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_depth_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.set_depth_mode"); + __Pyx_AddTraceback("freenect.set_depth_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_set_depth_mode(__pyx_self, __pyx_v_dev, __pyx_v_res, __pyx_v_mode); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "freenect.pyx":203 +/* "freenect.pyx":206 + * tilt_status = property(_get_tilt_status) + * + * def set_depth_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< + * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) + * + */ + +static PyObject *__pyx_pf_8freenect_set_depth_mode(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, int __pyx_v_res, int __pyx_v_mode) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_depth_mode", 0); + + /* "freenect.pyx":207 * * def set_depth_mode(DevPtr dev, int res, int mode): * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) # <<<<<<<<<<<<<< @@ -1433,7 +2084,7 @@ static PyObject *__pyx_pf_8freenect_set_depth_mode(PyObject *__pyx_self, PyObjec * def set_video_mode(DevPtr dev, int res, int mode): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_set_depth_mode(__pyx_v_dev->_ptr, freenect_find_depth_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_set_depth_mode(__pyx_v_dev->_ptr, freenect_find_depth_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1443,7 +2094,7 @@ static PyObject *__pyx_pf_8freenect_set_depth_mode(PyObject *__pyx_self, PyObjec goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.set_depth_mode"); + __Pyx_AddTraceback("freenect.set_depth_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1451,77 +2102,98 @@ static PyObject *__pyx_pf_8freenect_set_depth_mode(PyObject *__pyx_self, PyObjec return __pyx_r; } -/* "freenect.pyx":205 - * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) - * - * def set_video_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< - * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) - * - */ - -static PyObject *__pyx_pf_8freenect_1set_video_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_1set_video_mode = {__Pyx_NAMESTR("set_video_mode"), (PyCFunction)__pyx_pf_8freenect_1set_video_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_1set_video_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_3set_video_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_3set_video_mode = {__Pyx_NAMESTR("set_video_mode"), (PyCFunction)__pyx_pw_8freenect_3set_video_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_3set_video_mode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; int __pyx_v_res; int __pyx_v_mode; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__res,&__pyx_n_s__mode,0}; - __Pyx_RefNannySetupContext("set_video_mode"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_video_mode (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__res,&__pyx_n_s__mode,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_video_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_video_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_res = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_res = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_video_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.set_video_mode"); + __Pyx_AddTraceback("freenect.set_video_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_2set_video_mode(__pyx_self, __pyx_v_dev, __pyx_v_res, __pyx_v_mode); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "freenect.pyx":206 +/* "freenect.pyx":209 + * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) + * + * def set_video_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< + * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) + * + */ + +static PyObject *__pyx_pf_8freenect_2set_video_mode(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, int __pyx_v_res, int __pyx_v_mode) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_video_mode", 0); + + /* "freenect.pyx":210 * * def set_video_mode(DevPtr dev, int res, int mode): * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) # <<<<<<<<<<<<<< @@ -1529,7 +2201,7 @@ static PyObject *__pyx_pf_8freenect_1set_video_mode(PyObject *__pyx_self, PyObje * def start_depth(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_set_video_mode(__pyx_v_dev->_ptr, freenect_find_video_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_set_video_mode(__pyx_v_dev->_ptr, freenect_find_video_mode(__pyx_v_res, __pyx_v_mode))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1539,7 +2211,7 @@ static PyObject *__pyx_pf_8freenect_1set_video_mode(PyObject *__pyx_self, PyObje goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.set_video_mode"); + __Pyx_AddTraceback("freenect.set_video_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1547,7 +2219,27 @@ static PyObject *__pyx_pf_8freenect_1set_video_mode(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "freenect.pyx":208 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_5start_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_5start_depth = {__Pyx_NAMESTR("start_depth"), (PyCFunction)__pyx_pw_8freenect_5start_depth, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_5start_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start_depth (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_4start_depth(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":212 * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) * * def start_depth(DevPtr dev): # <<<<<<<<<<<<<< @@ -1555,16 +2247,16 @@ static PyObject *__pyx_pf_8freenect_1set_video_mode(PyObject *__pyx_self, PyObje * */ -static PyObject *__pyx_pf_8freenect_2start_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_2start_depth = {__Pyx_NAMESTR("start_depth"), (PyCFunction)__pyx_pf_8freenect_2start_depth, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_2start_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_4start_depth(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("start_depth"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start_depth", 0); - /* "freenect.pyx":209 + /* "freenect.pyx":213 * * def start_depth(DevPtr dev): * return freenect_start_depth(dev._ptr) # <<<<<<<<<<<<<< @@ -1572,7 +2264,7 @@ static PyObject *__pyx_pf_8freenect_2start_depth(PyObject *__pyx_self, PyObject * def start_video(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_start_depth(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_start_depth(__pyx_v_dev->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1582,7 +2274,7 @@ static PyObject *__pyx_pf_8freenect_2start_depth(PyObject *__pyx_self, PyObject goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.start_depth"); + __Pyx_AddTraceback("freenect.start_depth", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1590,7 +2282,27 @@ static PyObject *__pyx_pf_8freenect_2start_depth(PyObject *__pyx_self, PyObject return __pyx_r; } -/* "freenect.pyx":211 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_7start_video(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_7start_video = {__Pyx_NAMESTR("start_video"), (PyCFunction)__pyx_pw_8freenect_7start_video, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_7start_video(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start_video (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_6start_video(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":215 * return freenect_start_depth(dev._ptr) * * def start_video(DevPtr dev): # <<<<<<<<<<<<<< @@ -1598,16 +2310,16 @@ static PyObject *__pyx_pf_8freenect_2start_depth(PyObject *__pyx_self, PyObject * */ -static PyObject *__pyx_pf_8freenect_3start_video(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_3start_video = {__Pyx_NAMESTR("start_video"), (PyCFunction)__pyx_pf_8freenect_3start_video, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_3start_video(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_6start_video(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("start_video"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start_video", 0); - /* "freenect.pyx":212 + /* "freenect.pyx":216 * * def start_video(DevPtr dev): * return freenect_start_video(dev._ptr) # <<<<<<<<<<<<<< @@ -1615,7 +2327,7 @@ static PyObject *__pyx_pf_8freenect_3start_video(PyObject *__pyx_self, PyObject * def stop_depth(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_start_video(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_start_video(__pyx_v_dev->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1625,7 +2337,7 @@ static PyObject *__pyx_pf_8freenect_3start_video(PyObject *__pyx_self, PyObject goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.start_video"); + __Pyx_AddTraceback("freenect.start_video", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1633,7 +2345,27 @@ static PyObject *__pyx_pf_8freenect_3start_video(PyObject *__pyx_self, PyObject return __pyx_r; } -/* "freenect.pyx":214 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_9stop_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_9stop_depth = {__Pyx_NAMESTR("stop_depth"), (PyCFunction)__pyx_pw_8freenect_9stop_depth, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_9stop_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop_depth (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_8stop_depth(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":218 * return freenect_start_video(dev._ptr) * * def stop_depth(DevPtr dev): # <<<<<<<<<<<<<< @@ -1641,16 +2373,16 @@ static PyObject *__pyx_pf_8freenect_3start_video(PyObject *__pyx_self, PyObject * */ -static PyObject *__pyx_pf_8freenect_4stop_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_4stop_depth = {__Pyx_NAMESTR("stop_depth"), (PyCFunction)__pyx_pf_8freenect_4stop_depth, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_4stop_depth(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_8stop_depth(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("stop_depth"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop_depth", 0); - /* "freenect.pyx":215 + /* "freenect.pyx":219 * * def stop_depth(DevPtr dev): * return freenect_stop_depth(dev._ptr) # <<<<<<<<<<<<<< @@ -1658,7 +2390,7 @@ static PyObject *__pyx_pf_8freenect_4stop_depth(PyObject *__pyx_self, PyObject * * def stop_video(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_stop_depth(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_stop_depth(__pyx_v_dev->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1668,7 +2400,7 @@ static PyObject *__pyx_pf_8freenect_4stop_depth(PyObject *__pyx_self, PyObject * goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.stop_depth"); + __Pyx_AddTraceback("freenect.stop_depth", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1676,7 +2408,27 @@ static PyObject *__pyx_pf_8freenect_4stop_depth(PyObject *__pyx_self, PyObject * return __pyx_r; } -/* "freenect.pyx":217 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_11stop_video(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_11stop_video = {__Pyx_NAMESTR("stop_video"), (PyCFunction)__pyx_pw_8freenect_11stop_video, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_11stop_video(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop_video (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_10stop_video(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":221 * return freenect_stop_depth(dev._ptr) * * def stop_video(DevPtr dev): # <<<<<<<<<<<<<< @@ -1684,16 +2436,16 @@ static PyObject *__pyx_pf_8freenect_4stop_depth(PyObject *__pyx_self, PyObject * * */ -static PyObject *__pyx_pf_8freenect_5stop_video(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_5stop_video = {__Pyx_NAMESTR("stop_video"), (PyCFunction)__pyx_pf_8freenect_5stop_video, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_5stop_video(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_10stop_video(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("stop_video"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop_video", 0); - /* "freenect.pyx":218 + /* "freenect.pyx":222 * * def stop_video(DevPtr dev): * return freenect_stop_video(dev._ptr) # <<<<<<<<<<<<<< @@ -1701,7 +2453,7 @@ static PyObject *__pyx_pf_8freenect_5stop_video(PyObject *__pyx_self, PyObject * * def shutdown(CtxPtr ctx): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_stop_video(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_stop_video(__pyx_v_dev->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1711,7 +2463,7 @@ static PyObject *__pyx_pf_8freenect_5stop_video(PyObject *__pyx_self, PyObject * goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.stop_video"); + __Pyx_AddTraceback("freenect.stop_video", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1719,7 +2471,27 @@ static PyObject *__pyx_pf_8freenect_5stop_video(PyObject *__pyx_self, PyObject * return __pyx_r; } -/* "freenect.pyx":220 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_13shutdown(PyObject *__pyx_self, PyObject *__pyx_v_ctx); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_13shutdown = {__Pyx_NAMESTR("shutdown"), (PyCFunction)__pyx_pw_8freenect_13shutdown, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_13shutdown(PyObject *__pyx_self, PyObject *__pyx_v_ctx) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("shutdown (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_12shutdown(__pyx_self, ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":224 * return freenect_stop_video(dev._ptr) * * def shutdown(CtxPtr ctx): # <<<<<<<<<<<<<< @@ -1727,16 +2499,16 @@ static PyObject *__pyx_pf_8freenect_5stop_video(PyObject *__pyx_self, PyObject * * */ -static PyObject *__pyx_pf_8freenect_6shutdown(PyObject *__pyx_self, PyObject *__pyx_v_ctx); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_6shutdown = {__Pyx_NAMESTR("shutdown"), (PyCFunction)__pyx_pf_8freenect_6shutdown, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_6shutdown(PyObject *__pyx_self, PyObject *__pyx_v_ctx) { +static PyObject *__pyx_pf_8freenect_12shutdown(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("shutdown"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("shutdown", 0); - /* "freenect.pyx":221 + /* "freenect.pyx":225 * * def shutdown(CtxPtr ctx): * return freenect_shutdown(ctx._ptr) # <<<<<<<<<<<<<< @@ -1744,7 +2516,7 @@ static PyObject *__pyx_pf_8freenect_6shutdown(PyObject *__pyx_self, PyObject *__ * def process_events(CtxPtr ctx): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_shutdown(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_shutdown(__pyx_v_ctx->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1754,7 +2526,7 @@ static PyObject *__pyx_pf_8freenect_6shutdown(PyObject *__pyx_self, PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.shutdown"); + __Pyx_AddTraceback("freenect.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1762,7 +2534,27 @@ static PyObject *__pyx_pf_8freenect_6shutdown(PyObject *__pyx_self, PyObject *__ return __pyx_r; } -/* "freenect.pyx":223 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_15process_events(PyObject *__pyx_self, PyObject *__pyx_v_ctx); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_15process_events = {__Pyx_NAMESTR("process_events"), (PyCFunction)__pyx_pw_8freenect_15process_events, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_15process_events(PyObject *__pyx_self, PyObject *__pyx_v_ctx) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("process_events (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_14process_events(__pyx_self, ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":227 * return freenect_shutdown(ctx._ptr) * * def process_events(CtxPtr ctx): # <<<<<<<<<<<<<< @@ -1770,16 +2562,16 @@ static PyObject *__pyx_pf_8freenect_6shutdown(PyObject *__pyx_self, PyObject *__ * */ -static PyObject *__pyx_pf_8freenect_7process_events(PyObject *__pyx_self, PyObject *__pyx_v_ctx); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_7process_events = {__Pyx_NAMESTR("process_events"), (PyCFunction)__pyx_pf_8freenect_7process_events, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_7process_events(PyObject *__pyx_self, PyObject *__pyx_v_ctx) { +static PyObject *__pyx_pf_8freenect_14process_events(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("process_events"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("process_events", 0); - /* "freenect.pyx":224 + /* "freenect.pyx":228 * * def process_events(CtxPtr ctx): * return freenect_process_events(ctx._ptr) # <<<<<<<<<<<<<< @@ -1787,7 +2579,7 @@ static PyObject *__pyx_pf_8freenect_7process_events(PyObject *__pyx_self, PyObje * def num_devices(CtxPtr ctx): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_process_events(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_process_events(__pyx_v_ctx->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1797,7 +2589,7 @@ static PyObject *__pyx_pf_8freenect_7process_events(PyObject *__pyx_self, PyObje goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.process_events"); + __Pyx_AddTraceback("freenect.process_events", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1805,7 +2597,27 @@ static PyObject *__pyx_pf_8freenect_7process_events(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "freenect.pyx":226 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_17num_devices(PyObject *__pyx_self, PyObject *__pyx_v_ctx); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_17num_devices = {__Pyx_NAMESTR("num_devices"), (PyCFunction)__pyx_pw_8freenect_17num_devices, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_17num_devices(PyObject *__pyx_self, PyObject *__pyx_v_ctx) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_devices (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_16num_devices(__pyx_self, ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":230 * return freenect_process_events(ctx._ptr) * * def num_devices(CtxPtr ctx): # <<<<<<<<<<<<<< @@ -1813,16 +2625,16 @@ static PyObject *__pyx_pf_8freenect_7process_events(PyObject *__pyx_self, PyObje * */ -static PyObject *__pyx_pf_8freenect_8num_devices(PyObject *__pyx_self, PyObject *__pyx_v_ctx); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_8num_devices = {__Pyx_NAMESTR("num_devices"), (PyCFunction)__pyx_pf_8freenect_8num_devices, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_8num_devices(PyObject *__pyx_self, PyObject *__pyx_v_ctx) { +static PyObject *__pyx_pf_8freenect_16num_devices(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("num_devices"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("num_devices", 0); - /* "freenect.pyx":227 + /* "freenect.pyx":231 * * def num_devices(CtxPtr ctx): * return freenect_num_devices(ctx._ptr) # <<<<<<<<<<<<<< @@ -1830,7 +2642,7 @@ static PyObject *__pyx_pf_8freenect_8num_devices(PyObject *__pyx_self, PyObject * def close_device(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_num_devices(((struct __pyx_obj_8freenect_CtxPtr *)__pyx_v_ctx)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_num_devices(__pyx_v_ctx->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1840,7 +2652,7 @@ static PyObject *__pyx_pf_8freenect_8num_devices(PyObject *__pyx_self, PyObject goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.num_devices"); + __Pyx_AddTraceback("freenect.num_devices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1848,7 +2660,27 @@ static PyObject *__pyx_pf_8freenect_8num_devices(PyObject *__pyx_self, PyObject return __pyx_r; } -/* "freenect.pyx":229 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_19close_device(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_19close_device = {__Pyx_NAMESTR("close_device"), (PyCFunction)__pyx_pw_8freenect_19close_device, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_19close_device(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close_device (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_18close_device(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":233 * return freenect_num_devices(ctx._ptr) * * def close_device(DevPtr dev): # <<<<<<<<<<<<<< @@ -1856,16 +2688,16 @@ static PyObject *__pyx_pf_8freenect_8num_devices(PyObject *__pyx_self, PyObject * */ -static PyObject *__pyx_pf_8freenect_9close_device(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_9close_device = {__Pyx_NAMESTR("close_device"), (PyCFunction)__pyx_pf_8freenect_9close_device, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_9close_device(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_18close_device(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("close_device"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("close_device", 0); - /* "freenect.pyx":230 + /* "freenect.pyx":234 * * def close_device(DevPtr dev): * return freenect_close_device(dev._ptr) # <<<<<<<<<<<<<< @@ -1873,7 +2705,7 @@ static PyObject *__pyx_pf_8freenect_9close_device(PyObject *__pyx_self, PyObject * def set_tilt_degs(DevPtr dev, float angle): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_close_device(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_close_device(__pyx_v_dev->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1883,7 +2715,7 @@ static PyObject *__pyx_pf_8freenect_9close_device(PyObject *__pyx_self, PyObject goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.close_device"); + __Pyx_AddTraceback("freenect.close_device", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1891,66 +2723,85 @@ static PyObject *__pyx_pf_8freenect_9close_device(PyObject *__pyx_self, PyObject return __pyx_r; } -/* "freenect.pyx":232 - * return freenect_close_device(dev._ptr) - * - * def set_tilt_degs(DevPtr dev, float angle): # <<<<<<<<<<<<<< - * freenect_set_tilt_degs(dev._ptr, angle) - * - */ - -static PyObject *__pyx_pf_8freenect_10set_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_10set_tilt_degs = {__Pyx_NAMESTR("set_tilt_degs"), (PyCFunction)__pyx_pf_8freenect_10set_tilt_degs, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_10set_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_21set_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_21set_tilt_degs = {__Pyx_NAMESTR("set_tilt_degs"), (PyCFunction)__pyx_pw_8freenect_21set_tilt_degs, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_21set_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; float __pyx_v_angle; - PyObject *__pyx_r = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__angle,0}; - __Pyx_RefNannySetupContext("set_tilt_degs"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_tilt_degs (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__angle,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__angle); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_tilt_degs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__angle)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_tilt_degs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_angle = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_angle = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_angle = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_tilt_degs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.set_tilt_degs"); + __Pyx_AddTraceback("freenect.set_tilt_degs", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_20set_tilt_degs(__pyx_self, __pyx_v_dev, __pyx_v_angle); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "freenect.pyx":233 +/* "freenect.pyx":236 + * return freenect_close_device(dev._ptr) + * + * def set_tilt_degs(DevPtr dev, float angle): # <<<<<<<<<<<<<< + * freenect_set_tilt_degs(dev._ptr, angle) + * + */ + +static PyObject *__pyx_pf_8freenect_20set_tilt_degs(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, float __pyx_v_angle) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_tilt_degs", 0); + + /* "freenect.pyx":237 * * def set_tilt_degs(DevPtr dev, float angle): * freenect_set_tilt_degs(dev._ptr, angle) # <<<<<<<<<<<<<< @@ -1960,77 +2811,94 @@ static PyObject *__pyx_pf_8freenect_10set_tilt_degs(PyObject *__pyx_self, PyObje freenect_set_tilt_degs(__pyx_v_dev->_ptr, __pyx_v_angle); __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("freenect.set_tilt_degs"); - __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":235 - * freenect_set_tilt_degs(dev._ptr, angle) - * - * def set_led(DevPtr dev, freenect_led_options option): # <<<<<<<<<<<<<< - * return freenect_set_led(dev._ptr, option) - * - */ - -static PyObject *__pyx_pf_8freenect_11set_led(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_11set_led = {__Pyx_NAMESTR("set_led"), (PyCFunction)__pyx_pf_8freenect_11set_led, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_11set_led(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_23set_led(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_23set_led = {__Pyx_NAMESTR("set_led"), (PyCFunction)__pyx_pw_8freenect_23set_led, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_23set_led(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; freenect_led_options __pyx_v_option; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__option,0}; - __Pyx_RefNannySetupContext("set_led"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_led (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__option,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_led") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_led") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); - __pyx_v_option = PyInt_AsLong(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_option = PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_option = ((freenect_led_options)PyInt_AsLong(values[1])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_led", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.set_led"); + __Pyx_AddTraceback("freenect.set_led", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_22set_led(__pyx_self, __pyx_v_dev, __pyx_v_option); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "freenect.pyx":236 +/* "freenect.pyx":239 + * freenect_set_tilt_degs(dev._ptr, angle) + * + * def set_led(DevPtr dev, freenect_led_options option): # <<<<<<<<<<<<<< + * return freenect_set_led(dev._ptr, option) + * + */ + +static PyObject *__pyx_pf_8freenect_22set_led(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, freenect_led_options __pyx_v_option) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_led", 0); + + /* "freenect.pyx":240 * * def set_led(DevPtr dev, freenect_led_options option): * return freenect_set_led(dev._ptr, option) # <<<<<<<<<<<<<< @@ -2038,7 +2906,7 @@ static PyObject *__pyx_pf_8freenect_11set_led(PyObject *__pyx_self, PyObject *__ * def update_tilt_state(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_set_led(__pyx_v_dev->_ptr, __pyx_v_option)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_set_led(__pyx_v_dev->_ptr, __pyx_v_option)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2048,7 +2916,7 @@ static PyObject *__pyx_pf_8freenect_11set_led(PyObject *__pyx_self, PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.set_led"); + __Pyx_AddTraceback("freenect.set_led", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2056,24 +2924,44 @@ static PyObject *__pyx_pf_8freenect_11set_led(PyObject *__pyx_self, PyObject *__ return __pyx_r; } -/* "freenect.pyx":238 - * return freenect_set_led(dev._ptr, option) +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_25update_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_25update_tilt_state = {__Pyx_NAMESTR("update_tilt_state"), (PyCFunction)__pyx_pw_8freenect_25update_tilt_state, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_25update_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_tilt_state (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_24update_tilt_state(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":242 + * return freenect_set_led(dev._ptr, option) * * def update_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_update_tilt_state(dev._ptr) * */ -static PyObject *__pyx_pf_8freenect_12update_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_12update_tilt_state = {__Pyx_NAMESTR("update_tilt_state"), (PyCFunction)__pyx_pf_8freenect_12update_tilt_state, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_12update_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_24update_tilt_state(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("update_tilt_state"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_tilt_state", 0); - /* "freenect.pyx":239 + /* "freenect.pyx":243 * * def update_tilt_state(DevPtr dev): * return freenect_update_tilt_state(dev._ptr) # <<<<<<<<<<<<<< @@ -2081,7 +2969,7 @@ static PyObject *__pyx_pf_8freenect_12update_tilt_state(PyObject *__pyx_self, Py * def get_tilt_state(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(freenect_update_tilt_state(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(freenect_update_tilt_state(__pyx_v_dev->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2091,7 +2979,7 @@ static PyObject *__pyx_pf_8freenect_12update_tilt_state(PyObject *__pyx_self, Py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.update_tilt_state"); + __Pyx_AddTraceback("freenect.update_tilt_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2099,7 +2987,27 @@ static PyObject *__pyx_pf_8freenect_12update_tilt_state(PyObject *__pyx_self, Py return __pyx_r; } -/* "freenect.pyx":241 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_27get_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_27get_tilt_state = {__Pyx_NAMESTR("get_tilt_state"), (PyCFunction)__pyx_pw_8freenect_27get_tilt_state, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_27get_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_tilt_state (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_26get_tilt_state(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":245 * return freenect_update_tilt_state(dev._ptr) * * def get_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< @@ -2107,41 +3015,39 @@ static PyObject *__pyx_pf_8freenect_12update_tilt_state(PyObject *__pyx_self, Py * cdef StatePtr state_out */ -static PyObject *__pyx_pf_8freenect_13get_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_13get_tilt_state = {__Pyx_NAMESTR("get_tilt_state"), (PyCFunction)__pyx_pf_8freenect_13get_tilt_state, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_13get_tilt_state(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_26get_tilt_state(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { freenect_raw_tilt_state *__pyx_v_state; - struct __pyx_obj_8freenect_StatePtr *__pyx_v_state_out; + struct __pyx_obj_8freenect_StatePtr *__pyx_v_state_out = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_tilt_state"); - __pyx_self = __pyx_self; - __pyx_v_state_out = ((struct __pyx_obj_8freenect_StatePtr *)Py_None); __Pyx_INCREF(Py_None); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_tilt_state", 0); - /* "freenect.pyx":242 + /* "freenect.pyx":246 * * def get_tilt_state(DevPtr dev): * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) # <<<<<<<<<<<<<< * cdef StatePtr state_out * state_out = StatePtr() */ - __pyx_v_state = freenect_get_tilt_state(((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)->_ptr); + __pyx_v_state = freenect_get_tilt_state(__pyx_v_dev->_ptr); - /* "freenect.pyx":244 + /* "freenect.pyx":248 * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) * cdef StatePtr state_out * state_out = StatePtr() # <<<<<<<<<<<<<< * state_out._ptr = state * return state_out */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_StatePtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_StatePtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_state_out)); __pyx_v_state_out = ((struct __pyx_obj_8freenect_StatePtr *)__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":245 + /* "freenect.pyx":249 * cdef StatePtr state_out * state_out = StatePtr() * state_out._ptr = state # <<<<<<<<<<<<<< @@ -2150,7 +3056,7 @@ static PyObject *__pyx_pf_8freenect_13get_tilt_state(PyObject *__pyx_self, PyObj */ __pyx_v_state_out->_ptr = __pyx_v_state; - /* "freenect.pyx":246 + /* "freenect.pyx":250 * state_out = StatePtr() * state_out._ptr = state * return state_out # <<<<<<<<<<<<<< @@ -2166,16 +3072,36 @@ static PyObject *__pyx_pf_8freenect_13get_tilt_state(PyObject *__pyx_self, PyObj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.get_tilt_state"); + __Pyx_AddTraceback("freenect.get_tilt_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_state_out); + __Pyx_XDECREF((PyObject *)__pyx_v_state_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":248 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_29get_mks_accel(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_29get_mks_accel = {__Pyx_NAMESTR("get_mks_accel"), (PyCFunction)__pyx_pw_8freenect_29get_mks_accel, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_29get_mks_accel(PyObject *__pyx_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_mks_accel (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_28get_mks_accel(__pyx_self, ((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":252 * return state_out * * def get_mks_accel(StatePtr state): # <<<<<<<<<<<<<< @@ -2183,31 +3109,31 @@ static PyObject *__pyx_pf_8freenect_13get_tilt_state(PyObject *__pyx_self, PyObj * freenect_get_mks_accel(state._ptr, &x, &y, &z) */ -static PyObject *__pyx_pf_8freenect_14get_mks_accel(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_14get_mks_accel = {__Pyx_NAMESTR("get_mks_accel"), (PyCFunction)__pyx_pf_8freenect_14get_mks_accel, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_14get_mks_accel(PyObject *__pyx_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_8freenect_28get_mks_accel(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_StatePtr *__pyx_v_state) { double __pyx_v_x; double __pyx_v_y; double __pyx_v_z; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("get_mks_accel"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_mks_accel", 0); - /* "freenect.pyx":250 + /* "freenect.pyx":254 * def get_mks_accel(StatePtr state): * cdef double x, y, z * freenect_get_mks_accel(state._ptr, &x, &y, &z) # <<<<<<<<<<<<<< * return x, y, z * */ - freenect_get_mks_accel(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)->_ptr, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z)); + freenect_get_mks_accel(__pyx_v_state->_ptr, (&__pyx_v_x), (&__pyx_v_y), (&__pyx_v_z)); - /* "freenect.pyx":251 + /* "freenect.pyx":255 * cdef double x, y, z * freenect_get_mks_accel(state._ptr, &x, &y, &z) * return x, y, z # <<<<<<<<<<<<<< @@ -2215,14 +3141,14 @@ static PyObject *__pyx_pf_8freenect_14get_mks_accel(PyObject *__pyx_self, PyObje * def get_accel(DevPtr dev): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); @@ -2243,7 +3169,7 @@ static PyObject *__pyx_pf_8freenect_14get_mks_accel(PyObject *__pyx_self, PyObje __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("freenect.get_mks_accel"); + __Pyx_AddTraceback("freenect.get_mks_accel", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2251,7 +3177,28 @@ static PyObject *__pyx_pf_8freenect_14get_mks_accel(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "freenect.pyx":253 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_31get_accel(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ +static char __pyx_doc_8freenect_30get_accel[] = "MKS Accelerometer helper\n\n Args:\n dev:\n\n Returns:\n (x, y, z) accelerometer values\n "; +static PyMethodDef __pyx_mdef_8freenect_31get_accel = {__Pyx_NAMESTR("get_accel"), (PyCFunction)__pyx_pw_8freenect_31get_accel, METH_O, __Pyx_DOCSTR(__pyx_doc_8freenect_30get_accel)}; +static PyObject *__pyx_pw_8freenect_31get_accel(PyObject *__pyx_self, PyObject *__pyx_v_dev) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_accel (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_30get_accel(__pyx_self, ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":257 * return x, y, z * * def get_accel(DevPtr dev): # <<<<<<<<<<<<<< @@ -2259,40 +3206,39 @@ static PyObject *__pyx_pf_8freenect_14get_mks_accel(PyObject *__pyx_self, PyObje * */ -static PyObject *__pyx_pf_8freenect_15get_accel(PyObject *__pyx_self, PyObject *__pyx_v_dev); /*proto*/ -static char __pyx_doc_8freenect_15get_accel[] = "MKS Accelerometer helper\n\n Args:\n dev:\n\n Returns:\n (x, y, z) accelerometer values\n "; -static PyMethodDef __pyx_mdef_8freenect_15get_accel = {__Pyx_NAMESTR("get_accel"), (PyCFunction)__pyx_pf_8freenect_15get_accel, METH_O, __Pyx_DOCSTR(__pyx_doc_8freenect_15get_accel)}; -static PyObject *__pyx_pf_8freenect_15get_accel(PyObject *__pyx_self, PyObject *__pyx_v_dev) { +static PyObject *__pyx_pf_8freenect_30get_accel(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("get_accel"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_accel", 0); - /* "freenect.pyx":262 + /* "freenect.pyx":266 * (x, y, z) accelerometer values * """ * update_tilt_state(dev) # <<<<<<<<<<<<<< * return get_mks_accel(get_tilt_state(dev)) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__update_tilt_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__update_tilt_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_v_dev); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dev); - __Pyx_GIVEREF(__pyx_v_dev); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_dev)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_dev)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dev)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":263 + /* "freenect.pyx":267 * """ * update_tilt_state(dev) * return get_mks_accel(get_tilt_state(dev)) # <<<<<<<<<<<<<< @@ -2300,25 +3246,25 @@ static PyObject *__pyx_pf_8freenect_15get_accel(PyObject *__pyx_self, PyObject * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_mks_accel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__get_mks_accel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_tilt_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__get_tilt_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_dev); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dev); - __Pyx_GIVEREF(__pyx_v_dev); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_dev)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dev)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dev)); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -2333,7 +3279,7 @@ static PyObject *__pyx_pf_8freenect_15get_accel(PyObject *__pyx_self, PyObject * __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("freenect.get_accel"); + __Pyx_AddTraceback("freenect.get_accel", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2341,7 +3287,27 @@ static PyObject *__pyx_pf_8freenect_15get_accel(PyObject *__pyx_self, PyObject * return __pyx_r; } -/* "freenect.pyx":266 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_33get_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_33get_tilt_degs = {__Pyx_NAMESTR("get_tilt_degs"), (PyCFunction)__pyx_pw_8freenect_33get_tilt_degs, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_33get_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_tilt_degs (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_32get_tilt_degs(__pyx_self, ((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":270 * * * def get_tilt_degs(StatePtr state): # <<<<<<<<<<<<<< @@ -2349,16 +3315,16 @@ static PyObject *__pyx_pf_8freenect_15get_accel(PyObject *__pyx_self, PyObject * * */ -static PyObject *__pyx_pf_8freenect_16get_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_v_state); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_16get_tilt_degs = {__Pyx_NAMESTR("get_tilt_degs"), (PyCFunction)__pyx_pf_8freenect_16get_tilt_degs, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_16get_tilt_degs(PyObject *__pyx_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_8freenect_32get_tilt_degs(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_StatePtr *__pyx_v_state) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_tilt_degs"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_8freenect_StatePtr, 1, "state", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_tilt_degs", 0); - /* "freenect.pyx":267 + /* "freenect.pyx":271 * * def get_tilt_degs(StatePtr state): * return freenect_get_tilt_degs(state._ptr) # <<<<<<<<<<<<<< @@ -2366,7 +3332,7 @@ static PyObject *__pyx_pf_8freenect_16get_tilt_degs(PyObject *__pyx_self, PyObje * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(freenect_get_tilt_degs(((struct __pyx_obj_8freenect_StatePtr *)__pyx_v_state)->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(freenect_get_tilt_degs(__pyx_v_state->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2376,7 +3342,7 @@ static PyObject *__pyx_pf_8freenect_16get_tilt_degs(PyObject *__pyx_self, PyObje goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.get_tilt_degs"); + __Pyx_AddTraceback("freenect.get_tilt_degs", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2384,7 +3350,19 @@ static PyObject *__pyx_pf_8freenect_16get_tilt_degs(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "freenect.pyx":270 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_35error_open_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_35error_open_device = {__Pyx_NAMESTR("error_open_device"), (PyCFunction)__pyx_pw_8freenect_35error_open_device, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_35error_open_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("error_open_device (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_34error_open_device(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":274 * * * def error_open_device(): # <<<<<<<<<<<<<< @@ -2392,26 +3370,27 @@ static PyObject *__pyx_pf_8freenect_16get_tilt_degs(PyObject *__pyx_self, PyObje * */ -static PyObject *__pyx_pf_8freenect_17error_open_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_17error_open_device = {__Pyx_NAMESTR("error_open_device"), (PyCFunction)__pyx_pf_8freenect_17error_open_device, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_17error_open_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_34error_open_device(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("error_open_device"); - __pyx_self = __pyx_self; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("error_open_device", 0); - /* "freenect.pyx":271 + /* "freenect.pyx":275 * * def error_open_device(): * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") # <<<<<<<<<<<<<< * * cpdef init(): */ - if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("freenect.error_open_device"); + __Pyx_AddTraceback("freenect.error_open_device", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2419,7 +3398,7 @@ static PyObject *__pyx_pf_8freenect_17error_open_device(PyObject *__pyx_self, CY return __pyx_r; } -/* "freenect.pyx":273 +/* "freenect.pyx":277 * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") * * cpdef init(): # <<<<<<<<<<<<<< @@ -2427,27 +3406,30 @@ static PyObject *__pyx_pf_8freenect_17error_open_device(PyObject *__pyx_self, CY * if freenect_init(&ctx, NULL) < 0: */ -static PyObject *__pyx_pf_8freenect_18init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_8freenect_init(int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_8freenect_37init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_8freenect_init(CYTHON_UNUSED int __pyx_skip_dispatch) { freenect_context *__pyx_v_ctx; - struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx_out; + struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx_out = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("init"); - __pyx_v_ctx_out = ((struct __pyx_obj_8freenect_CtxPtr *)Py_None); __Pyx_INCREF(Py_None); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init", 0); - /* "freenect.pyx":275 + /* "freenect.pyx":279 * cpdef init(): * cdef freenect_context* ctx * if freenect_init(&ctx, NULL) < 0: # <<<<<<<<<<<<<< * return * # We take both the motor and camera devices here, since we provide access */ - __pyx_t_1 = (freenect_init((&__pyx_v_ctx), NULL) < 0); + __pyx_t_1 = ((freenect_init((&__pyx_v_ctx), NULL) < 0) != 0); if (__pyx_t_1) { - /* "freenect.pyx":276 + /* "freenect.pyx":280 * cdef freenect_context* ctx * if freenect_init(&ctx, NULL) < 0: * return # <<<<<<<<<<<<<< @@ -2461,29 +3443,28 @@ static PyObject *__pyx_f_8freenect_init(int __pyx_skip_dispatch) { } __pyx_L3:; - /* "freenect.pyx":281 + /* "freenect.pyx":285 * # Also, we don't support audio in the python wrapper yet, so no sense claiming * # the device. - * freenect_select_subdevices(ctx, FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA) # <<<<<<<<<<<<<< + * freenect_select_subdevices(ctx, (FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)) # <<<<<<<<<<<<<< * cdef CtxPtr ctx_out * ctx_out = CtxPtr() */ - freenect_select_subdevices(__pyx_v_ctx, (FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)); + freenect_select_subdevices(__pyx_v_ctx, ((freenect_device_flags)(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA))); - /* "freenect.pyx":283 - * freenect_select_subdevices(ctx, FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA) + /* "freenect.pyx":287 + * freenect_select_subdevices(ctx, (FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)) * cdef CtxPtr ctx_out * ctx_out = CtxPtr() # <<<<<<<<<<<<<< * ctx_out._ptr = ctx * return ctx_out */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_CtxPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_CtxPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_v_ctx_out)); __pyx_v_ctx_out = ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":284 + /* "freenect.pyx":288 * cdef CtxPtr ctx_out * ctx_out = CtxPtr() * ctx_out._ptr = ctx # <<<<<<<<<<<<<< @@ -2492,7 +3473,7 @@ static PyObject *__pyx_f_8freenect_init(int __pyx_skip_dispatch) { */ __pyx_v_ctx_out->_ptr = __pyx_v_ctx; - /* "freenect.pyx":285 + /* "freenect.pyx":289 * ctx_out = CtxPtr() * ctx_out._ptr = ctx * return ctx_out # <<<<<<<<<<<<<< @@ -2508,16 +3489,27 @@ static PyObject *__pyx_f_8freenect_init(int __pyx_skip_dispatch) { goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.init"); + __Pyx_AddTraceback("freenect.init", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_ctx_out); + __Pyx_XDECREF((PyObject *)__pyx_v_ctx_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":273 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_37init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8freenect_37init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("init (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_36init(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":277 * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") * * cpdef init(): # <<<<<<<<<<<<<< @@ -2525,14 +3517,16 @@ static PyObject *__pyx_f_8freenect_init(int __pyx_skip_dispatch) { * if freenect_init(&ctx, NULL) < 0: */ -static PyObject *__pyx_pf_8freenect_18init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8freenect_18init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_36init(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("init"); - __pyx_self = __pyx_self; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2542,7 +3536,7 @@ static PyObject *__pyx_pf_8freenect_18init(PyObject *__pyx_self, CYTHON_UNUSED P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.init"); + __Pyx_AddTraceback("freenect.init", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2550,7 +3544,7 @@ static PyObject *__pyx_pf_8freenect_18init(PyObject *__pyx_self, CYTHON_UNUSED P return __pyx_r; } -/* "freenect.pyx":287 +/* "freenect.pyx":291 * return ctx_out * * cpdef open_device(CtxPtr ctx, int index): # <<<<<<<<<<<<<< @@ -2558,27 +3552,30 @@ static PyObject *__pyx_pf_8freenect_18init(PyObject *__pyx_self, CYTHON_UNUSED P * if freenect_open_device(ctx._ptr, &dev, index) < 0: */ -static PyObject *__pyx_pf_8freenect_19open_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx, int __pyx_v_index, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_8freenect_39open_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx, int __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { freenect_device *__pyx_v_dev; - struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev_out; + struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev_out = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("open_device"); - __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("open_device", 0); - /* "freenect.pyx":289 + /* "freenect.pyx":293 * cpdef open_device(CtxPtr ctx, int index): * cdef freenect_device* dev * if freenect_open_device(ctx._ptr, &dev, index) < 0: # <<<<<<<<<<<<<< * return * cdef DevPtr dev_out */ - __pyx_t_1 = (freenect_open_device(__pyx_v_ctx->_ptr, (&__pyx_v_dev), __pyx_v_index) < 0); + __pyx_t_1 = ((freenect_open_device(__pyx_v_ctx->_ptr, (&__pyx_v_dev), __pyx_v_index) < 0) != 0); if (__pyx_t_1) { - /* "freenect.pyx":290 + /* "freenect.pyx":294 * cdef freenect_device* dev * if freenect_open_device(ctx._ptr, &dev, index) < 0: * return # <<<<<<<<<<<<<< @@ -2592,20 +3589,19 @@ static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPt } __pyx_L3:; - /* "freenect.pyx":292 + /* "freenect.pyx":296 * return * cdef DevPtr dev_out * dev_out = DevPtr() # <<<<<<<<<<<<<< * dev_out._ptr = dev * dev_out.ctx = ctx */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_v_dev_out)); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":293 + /* "freenect.pyx":297 * cdef DevPtr dev_out * dev_out = DevPtr() * dev_out._ptr = dev # <<<<<<<<<<<<<< @@ -2614,7 +3610,7 @@ static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPt */ __pyx_v_dev_out->_ptr = __pyx_v_dev; - /* "freenect.pyx":294 + /* "freenect.pyx":298 * dev_out = DevPtr() * dev_out._ptr = dev * dev_out.ctx = ctx # <<<<<<<<<<<<<< @@ -2627,7 +3623,7 @@ static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPt __Pyx_DECREF(((PyObject *)__pyx_v_dev_out->ctx)); __pyx_v_dev_out->ctx = __pyx_v_ctx; - /* "freenect.pyx":295 + /* "freenect.pyx":299 * dev_out._ptr = dev * dev_out.ctx = ctx * return dev_out # <<<<<<<<<<<<<< @@ -2643,75 +3639,97 @@ static PyObject *__pyx_f_8freenect_open_device(struct __pyx_obj_8freenect_CtxPt goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("freenect.open_device"); + __Pyx_AddTraceback("freenect.open_device", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_dev_out); + __Pyx_XDECREF((PyObject *)__pyx_v_dev_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":287 - * return ctx_out - * - * cpdef open_device(CtxPtr ctx, int index): # <<<<<<<<<<<<<< - * cdef freenect_device* dev - * if freenect_open_device(ctx._ptr, &dev, index) < 0: - */ - -static PyObject *__pyx_pf_8freenect_19open_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_8freenect_19open_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_39open_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_8freenect_39open_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx = 0; int __pyx_v_index; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx,&__pyx_n_s__index,0}; - __Pyx_RefNannySetupContext("open_device"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("open_device (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx,&__pyx_n_s__index,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "open_device") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open_device") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)values[0]); - __pyx_v_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("open_device", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.open_device"); + __Pyx_AddTraceback("freenect.open_device", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_38open_device(__pyx_self, __pyx_v_ctx, __pyx_v_index); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":291 + * return ctx_out + * + * cpdef open_device(CtxPtr ctx, int index): # <<<<<<<<<<<<<< + * cdef freenect_device* dev + * if freenect_open_device(ctx._ptr, &dev, index) < 0: + */ + +static PyObject *__pyx_pf_8freenect_38open_device(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx, int __pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("open_device", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_8freenect_open_device(__pyx_v_ctx, __pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_8freenect_open_device(__pyx_v_ctx, __pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2721,7 +3739,7 @@ static PyObject *__pyx_pf_8freenect_19open_device(PyObject *__pyx_self, PyObject goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("freenect.open_device"); + __Pyx_AddTraceback("freenect.open_device", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2729,7 +3747,7 @@ static PyObject *__pyx_pf_8freenect_19open_device(PyObject *__pyx_self, PyObject return __pyx_r; } -/* "freenect.pyx":299 +/* "freenect.pyx":303 * _depth_cb, _video_cb = None, None * * cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: # <<<<<<<<<<<<<< @@ -2737,22 +3755,25 @@ static PyObject *__pyx_pf_8freenect_19open_device(PyObject *__pyx_self, PyObject * cdef DevPtr dev_out */ -static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__pyx_v_data, uint32_t __pyx_v_timestamp) { +static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__pyx_v_data, uint32_t __pyx_v_timestamp) { long __pyx_v_nbytes; - struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev_out; + struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev_out = 0; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - __Pyx_RefNannySetupContext("depth_cb"); - __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); + __Pyx_RefNannySetupContext("depth_cb", 0); - /* "freenect.pyx":300 + /* "freenect.pyx":304 * * cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: * nbytes = 614400 # 480 * 640 * 2 # <<<<<<<<<<<<<< @@ -2761,20 +3782,19 @@ static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__py */ __pyx_v_nbytes = 614400; - /* "freenect.pyx":302 + /* "freenect.pyx":306 * nbytes = 614400 # 480 * 640 * 2 * cdef DevPtr dev_out * dev_out = DevPtr() # <<<<<<<<<<<<<< * dev_out._ptr = dev * if _depth_cb: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_dev_out)); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":303 + /* "freenect.pyx":307 * cdef DevPtr dev_out * dev_out = DevPtr() * dev_out._ptr = dev # <<<<<<<<<<<<<< @@ -2783,36 +3803,36 @@ static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__py */ __pyx_v_dev_out->_ptr = __pyx_v_dev; - /* "freenect.pyx":304 + /* "freenect.pyx":308 * dev_out = DevPtr() * dev_out._ptr = dev * if _depth_cb: # <<<<<<<<<<<<<< * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "freenect.pyx":305 + /* "freenect.pyx":309 * dev_out._ptr = dev * if _depth_cb: * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) # <<<<<<<<<<<<<< * * cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___depth_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___depth_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s___depth_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyBytes_FromStringAndSize(((char *)__pyx_v_data) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_data) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_v_dev_out)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_dev_out)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dev_out)); @@ -2822,14 +3842,14 @@ static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__py __Pyx_GIVEREF(__pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -2845,16 +3865,16 @@ static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__py __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("freenect.depth_cb"); + __Pyx_WriteUnraisable("freenect.depth_cb", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_dev_out); + __Pyx_XDECREF((PyObject *)__pyx_v_dev_out); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(_save); + PyGILState_Release(__pyx_gilstate_save); #endif } -/* "freenect.pyx":307 +/* "freenect.pyx":311 * _depth_cb(*_depth_cb_np(dev_out, (data)[:nbytes], timestamp)) * * cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: # <<<<<<<<<<<<<< @@ -2862,22 +3882,25 @@ static void __pyx_f_8freenect_depth_cb(freenect_device *__pyx_v_dev, void *__py * cdef DevPtr dev_out */ -static void __pyx_f_8freenect_video_cb(freenect_device *__pyx_v_dev, void *__pyx_v_data, uint32_t __pyx_v_timestamp) { +static void __pyx_f_8freenect_video_cb(freenect_device *__pyx_v_dev, void *__pyx_v_data, uint32_t __pyx_v_timestamp) { long __pyx_v_nbytes; - struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev_out; + struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev_out = 0; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD - PyGILState_STATE _save = PyGILState_Ensure(); + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - __Pyx_RefNannySetupContext("video_cb"); - __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); + __Pyx_RefNannySetupContext("video_cb", 0); - /* "freenect.pyx":308 + /* "freenect.pyx":312 * * cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil: * nbytes = 921600 # 480 * 640 * 3 # <<<<<<<<<<<<<< @@ -2886,20 +3909,19 @@ static void __pyx_f_8freenect_video_cb(freenect_device *__pyx_v_dev, void *__py */ __pyx_v_nbytes = 921600; - /* "freenect.pyx":310 + /* "freenect.pyx":314 * nbytes = 921600 # 480 * 640 * 3 * cdef DevPtr dev_out * dev_out = DevPtr() # <<<<<<<<<<<<<< * dev_out._ptr = dev * if _video_cb: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8freenect_DevPtr)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_dev_out)); __pyx_v_dev_out = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":311 + /* "freenect.pyx":315 * cdef DevPtr dev_out * dev_out = DevPtr() * dev_out._ptr = dev # <<<<<<<<<<<<<< @@ -2908,36 +3930,36 @@ static void __pyx_f_8freenect_video_cb(freenect_device *__pyx_v_dev, void *__py */ __pyx_v_dev_out->_ptr = __pyx_v_dev; - /* "freenect.pyx":312 + /* "freenect.pyx":316 * dev_out = DevPtr() * dev_out._ptr = dev * if _video_cb: # <<<<<<<<<<<<<< * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "freenect.pyx":313 + /* "freenect.pyx":317 * dev_out._ptr = dev * if _video_cb: * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) # <<<<<<<<<<<<<< * * def set_depth_callback(DevPtr dev, cb): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___video_cb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___video_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s___video_cb_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyBytes_FromStringAndSize(((char *)__pyx_v_data) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_data) + 0, __pyx_v_nbytes - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_v_dev_out)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_dev_out)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dev_out)); @@ -2947,14 +3969,14 @@ static void __pyx_f_8freenect_video_cb(freenect_device *__pyx_v_dev, void *__py __Pyx_GIVEREF(__pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -2970,76 +3992,99 @@ static void __pyx_f_8freenect_video_cb(freenect_device *__pyx_v_dev, void *__py __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("freenect.video_cb"); + __Pyx_WriteUnraisable("freenect.video_cb", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_dev_out); + __Pyx_XDECREF((PyObject *)__pyx_v_dev_out); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD - PyGILState_Release(_save); + PyGILState_Release(__pyx_gilstate_save); #endif } -/* "freenect.pyx":315 - * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) - * - * def set_depth_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< - * global _depth_cb - * if cb is not None: - */ - -static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_20set_depth_callback = {__Pyx_NAMESTR("set_depth_callback"), (PyCFunction)__pyx_pf_8freenect_20set_depth_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_41set_depth_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_41set_depth_callback = {__Pyx_NAMESTR("set_depth_callback"), (PyCFunction)__pyx_pw_8freenect_41set_depth_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_41set_depth_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; PyObject *__pyx_v_cb = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__cb,0}; - __Pyx_RefNannySetupContext("set_depth_callback"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_depth_callback (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__cb,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cb); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_depth_callback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_depth_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_depth_callback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_depth_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); __pyx_v_cb = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_cb = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_depth_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_depth_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.set_depth_callback"); + __Pyx_AddTraceback("freenect.set_depth_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_40set_depth_callback(__pyx_self, __pyx_v_dev, __pyx_v_cb); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":319 + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) + * + * def set_depth_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _depth_cb + * if cb is not None: + */ + +static PyObject *__pyx_pf_8freenect_40set_depth_callback(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, PyObject *__pyx_v_cb) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_depth_callback", 0); - /* "freenect.pyx":317 + /* "freenect.pyx":321 * def set_depth_callback(DevPtr dev, cb): * global _depth_cb * if cb is not None: # <<<<<<<<<<<<<< @@ -3047,18 +4092,19 @@ static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, P * freenect_set_depth_callback(dev._ptr, depth_cb) */ __pyx_t_1 = (__pyx_v_cb != Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "freenect.pyx":318 + /* "freenect.pyx":322 * global _depth_cb * if cb is not None: * _depth_cb = cb # <<<<<<<<<<<<<< * freenect_set_depth_callback(dev._ptr, depth_cb) * else: */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___depth_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":319 + /* "freenect.pyx":323 * if cb is not None: * _depth_cb = cb * freenect_set_depth_callback(dev._ptr, depth_cb) # <<<<<<<<<<<<<< @@ -3066,20 +4112,20 @@ static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, P * _depth_cb = None */ freenect_set_depth_callback(__pyx_v_dev->_ptr, __pyx_f_8freenect_depth_cb); - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "freenect.pyx":321 + /* "freenect.pyx":325 * freenect_set_depth_callback(dev._ptr, depth_cb) * else: * _depth_cb = None # <<<<<<<<<<<<<< * freenect_set_depth_callback(dev._ptr, NULL) * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___depth_cb, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":322 + /* "freenect.pyx":326 * else: * _depth_cb = None * freenect_set_depth_callback(dev._ptr, NULL) # <<<<<<<<<<<<<< @@ -3088,12 +4134,12 @@ static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, P */ freenect_set_depth_callback(__pyx_v_dev->_ptr, NULL); } - __pyx_L6:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("freenect.set_depth_callback"); + __Pyx_AddTraceback("freenect.set_depth_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3101,67 +4147,90 @@ static PyObject *__pyx_pf_8freenect_20set_depth_callback(PyObject *__pyx_self, P return __pyx_r; } -/* "freenect.pyx":324 - * freenect_set_depth_callback(dev._ptr, NULL) - * - * def set_video_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< - * global _video_cb - * if cb is not None: - */ - -static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8freenect_21set_video_callback = {__Pyx_NAMESTR("set_video_callback"), (PyCFunction)__pyx_pf_8freenect_21set_video_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_43set_video_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8freenect_43set_video_callback = {__Pyx_NAMESTR("set_video_callback"), (PyCFunction)__pyx_pw_8freenect_43set_video_callback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_8freenect_43set_video_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev = 0; PyObject *__pyx_v_cb = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__cb,0}; - __Pyx_RefNannySetupContext("set_video_callback"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_video_callback (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__cb,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cb); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_video_callback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_video_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_video_callback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_video_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)values[0]); __pyx_v_cb = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = ((struct __pyx_obj_8freenect_DevPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_cb = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_video_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set_video_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.set_video_callback"); + __Pyx_AddTraceback("freenect.set_video_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dev), __pyx_ptype_8freenect_DevPtr, 1, "dev", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_42set_video_callback(__pyx_self, __pyx_v_dev, __pyx_v_cb); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":328 + * freenect_set_depth_callback(dev._ptr, NULL) + * + * def set_video_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _video_cb + * if cb is not None: + */ + +static PyObject *__pyx_pf_8freenect_42set_video_callback(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_DevPtr *__pyx_v_dev, PyObject *__pyx_v_cb) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_video_callback", 0); - /* "freenect.pyx":326 + /* "freenect.pyx":330 * def set_video_callback(DevPtr dev, cb): * global _video_cb * if cb is not None: # <<<<<<<<<<<<<< @@ -3169,18 +4238,19 @@ static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, P * freenect_set_video_callback(dev._ptr, video_cb) */ __pyx_t_1 = (__pyx_v_cb != Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "freenect.pyx":327 + /* "freenect.pyx":331 * global _video_cb * if cb is not None: * _video_cb = cb # <<<<<<<<<<<<<< * freenect_set_video_callback(dev._ptr, video_cb) * else: */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___video_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":328 + /* "freenect.pyx":332 * if cb is not None: * _video_cb = cb * freenect_set_video_callback(dev._ptr, video_cb) # <<<<<<<<<<<<<< @@ -3188,20 +4258,20 @@ static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, P * _video_cb = None */ freenect_set_video_callback(__pyx_v_dev->_ptr, __pyx_f_8freenect_video_cb); - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "freenect.pyx":330 + /* "freenect.pyx":334 * freenect_set_video_callback(dev._ptr, video_cb) * else: * _video_cb = None # <<<<<<<<<<<<<< * freenect_set_video_callback(dev._ptr, NULL) * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___video_cb, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "freenect.pyx":331 + /* "freenect.pyx":335 * else: * _video_cb = None * freenect_set_video_callback(dev._ptr, NULL) # <<<<<<<<<<<<<< @@ -3210,12 +4280,12 @@ static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, P */ freenect_set_video_callback(__pyx_v_dev->_ptr, NULL); } - __pyx_L6:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("freenect.set_video_callback"); + __Pyx_AddTraceback("freenect.set_video_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3223,149 +4293,168 @@ static PyObject *__pyx_pf_8freenect_21set_video_callback(PyObject *__pyx_self, P return __pyx_r; } -/* "freenect.pyx":338 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_45runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_44runloop[] = "Sets up the kinect and maintains a runloop\n\n This is where most of the action happens. You can get the dev pointer from the callback\n and let this function do all of the setup for you. You may want to use threads to perform\n computation externally as the callbacks should really just be used for copying data.\n\n Args:\n depth: A function that takes (dev, depth, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for depth.\n video: A function that takes (dev, video, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for video.\n body: A function that takes (dev, ctx) and is called in the body of process_events\n dev: Optional freenect device context. If supplied, this function will use it instead\n of creating and destroying its own..\n "; +static PyMethodDef __pyx_mdef_8freenect_45runloop = {__Pyx_NAMESTR("runloop"), (PyCFunction)__pyx_pw_8freenect_45runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_44runloop)}; +static PyObject *__pyx_pw_8freenect_45runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_depth = 0; + PyObject *__pyx_v_video = 0; + PyObject *__pyx_v_body = 0; + PyObject *__pyx_v_dev = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("runloop (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__depth,&__pyx_n_s__video,&__pyx_n_s__body,&__pyx_n_s__dev,0}; + PyObject* values[4] = {0,0,0,0}; + + /* "freenect.pyx":342 * * * def runloop(depth=None, video=None, body=None, dev=None): # <<<<<<<<<<<<<< * """Sets up the kinect and maintains a runloop * */ - -static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_22runloop[] = "Sets up the kinect and maintains a runloop\n\n This is where most of the action happens. You can get the dev pointer from the callback\n and let this function do all of the setup for you. You may want to use threads to perform\n computation externally as the callbacks should really just be used for copying data.\n\n Args:\n depth: A function that takes (dev, depth, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for depth.\n video: A function that takes (dev, video, timestamp), corresponding to C function.\n If None (default), then you won't get a callback for video.\n body: A function that takes (dev, ctx) and is called in the body of process_events\n dev: Optional freenect device context. If supplied, this function will use it instead\n of creating and destroying its own..\n "; -static PyMethodDef __pyx_mdef_8freenect_22runloop = {__Pyx_NAMESTR("runloop"), (PyCFunction)__pyx_pf_8freenect_22runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_22runloop)}; -static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_depth = 0; - PyObject *__pyx_v_video = 0; - PyObject *__pyx_v_body = 0; - PyObject *__pyx_v_dev = 0; - struct __pyx_obj_8freenect_DevPtr *__pyx_v_mdev; - struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx; - freenect_device *__pyx_v_devp; - freenect_context *__pyx_v_ctxp; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__depth,&__pyx_n_s__video,&__pyx_n_s__body,&__pyx_n_s__dev,0}; - __Pyx_RefNannySetupContext("runloop"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); values[3] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__depth); - if (value) { values[0] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__video); - if (value) { values[1] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__depth); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__video); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); + if (value) { values[3] = value; kw_args--; } + } } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); - if (value) { values[2] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (value) { values[3] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_depth = values[0]; __pyx_v_video = values[1]; __pyx_v_body = values[2]; __pyx_v_dev = values[3]; - } else { - __pyx_v_depth = ((PyObject *)Py_None); - __pyx_v_video = ((PyObject *)Py_None); - __pyx_v_body = ((PyObject *)Py_None); - __pyx_v_dev = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: __pyx_v_dev = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: __pyx_v_body = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: __pyx_v_video = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_depth = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("runloop", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("runloop", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.runloop"); + __Pyx_AddTraceback("freenect.runloop", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_8freenect_44runloop(__pyx_self, __pyx_v_depth, __pyx_v_video, __pyx_v_body, __pyx_v_dev); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "freenect.pyx":355 +static PyObject *__pyx_pf_8freenect_44runloop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_depth, PyObject *__pyx_v_video, PyObject *__pyx_v_body, PyObject *__pyx_v_dev) { + struct __pyx_obj_8freenect_DevPtr *__pyx_v_mdev = 0; + struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx = 0; + freenect_device *__pyx_v_devp; + freenect_context *__pyx_v_ctxp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + freenect_device *__pyx_t_5; + freenect_context *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("runloop", 0); + + /* "freenect.pyx":359 * """ * global _depth_cb, _video_cb * if depth: # <<<<<<<<<<<<<< * _depth_cb = depth * if video: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_depth); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_depth); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "freenect.pyx":356 + /* "freenect.pyx":360 * global _depth_cb, _video_cb * if depth: * _depth_cb = depth # <<<<<<<<<<<<<< * if video: * _video_cb = video */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_v_depth) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___depth_cb, __pyx_v_depth) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "freenect.pyx":357 + /* "freenect.pyx":361 * if depth: * _depth_cb = depth * if video: # <<<<<<<<<<<<<< * _video_cb = video * cdef DevPtr mdev */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_video); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_video); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "freenect.pyx":358 + /* "freenect.pyx":362 * _depth_cb = depth * if video: * _video_cb = video # <<<<<<<<<<<<<< * cdef DevPtr mdev * cdef CtxPtr ctx */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_v_video) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + if (PyDict_SetItem(__pyx_d, __pyx_n_s___video_cb, __pyx_v_video) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "freenect.pyx":363 + /* "freenect.pyx":367 * cdef freenect_device* devp * cdef freenect_context* ctxp * if dev is None: # <<<<<<<<<<<<<< @@ -3373,48 +4462,48 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ * if not ctx: */ __pyx_t_1 = (__pyx_v_dev == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "freenect.pyx":364 + /* "freenect.pyx":368 * cdef freenect_context* ctxp * if dev is None: * ctx = init() # <<<<<<<<<<<<<< * if not ctx: * error_open_device() */ - __pyx_t_2 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8freenect_CtxPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_ctx)); - __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = __pyx_f_8freenect_init(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8freenect_CtxPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)__pyx_t_3); + __pyx_t_3 = 0; - /* "freenect.pyx":365 + /* "freenect.pyx":369 * if dev is None: * ctx = init() * if not ctx: # <<<<<<<<<<<<<< * error_open_device() * return */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ctx)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = (!__pyx_t_1); - if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ctx)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((!__pyx_t_2) != 0); + if (__pyx_t_1) { - /* "freenect.pyx":366 + /* "freenect.pyx":370 * ctx = init() * if not ctx: * error_open_device() # <<<<<<<<<<<<<< * return * mdev = open_device(ctx, 0) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":367 + /* "freenect.pyx":371 * if not ctx: * error_open_device() * return # <<<<<<<<<<<<<< @@ -3424,179 +4513,209 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "freenect.pyx":368 + /* "freenect.pyx":372 * error_open_device() * return * mdev = open_device(ctx, 0) # <<<<<<<<<<<<<< * if not mdev: * error_open_device() */ - __pyx_t_4 = __pyx_f_8freenect_open_device(__pyx_v_ctx, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_f_8freenect_open_device(__pyx_v_ctx, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_mdev)); + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":369 + /* "freenect.pyx":373 * return * mdev = open_device(ctx, 0) * if not mdev: # <<<<<<<<<<<<<< * error_open_device() * return */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_mdev)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = (!__pyx_t_3); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_mdev)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { - /* "freenect.pyx":370 + /* "freenect.pyx":374 * mdev = open_device(ctx, 0) * if not mdev: * error_open_device() # <<<<<<<<<<<<<< * return - * else: + * if depth is not None: */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__error_open_device); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":371 + /* "freenect.pyx":375 * if not mdev: * error_open_device() * return # <<<<<<<<<<<<<< - * else: - * mdev = dev + * if depth is not None: + * freenect_set_depth_mode(mdev._ptr, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L10; + goto __pyx_L7; + } + __pyx_L7:; + + /* "freenect.pyx":376 + * error_open_device() + * return + * if depth is not None: # <<<<<<<<<<<<<< + * freenect_set_depth_mode(mdev._ptr, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) + * if video is not None: + */ + __pyx_t_2 = (__pyx_v_depth != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "freenect.pyx":377 + * return + * if depth is not None: + * freenect_set_depth_mode(mdev._ptr, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) # <<<<<<<<<<<<<< + * if video is not None: + * freenect_set_video_mode(mdev._ptr, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) + */ + freenect_set_depth_mode(__pyx_v_mdev->_ptr, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)); + goto __pyx_L8; + } + __pyx_L8:; + + /* "freenect.pyx":378 + * if depth is not None: + * freenect_set_depth_mode(mdev._ptr, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) + * if video is not None: # <<<<<<<<<<<<<< + * freenect_set_video_mode(mdev._ptr, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) + * + */ + __pyx_t_1 = (__pyx_v_video != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "freenect.pyx":379 + * freenect_set_depth_mode(mdev._ptr, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) + * if video is not None: + * freenect_set_video_mode(mdev._ptr, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) # <<<<<<<<<<<<<< + * + * else: + */ + freenect_set_video_mode(__pyx_v_mdev->_ptr, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)); + goto __pyx_L9; } - __pyx_L10:; - goto __pyx_L8; + __pyx_L9:; + goto __pyx_L5; } /*else*/ { - /* "freenect.pyx":373 - * return + /* "freenect.pyx":382 + * * else: * mdev = dev # <<<<<<<<<<<<<< * devp = mdev._ptr * ctxp = mdev.ctx._ptr */ - if (!(likely(((__pyx_v_dev) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dev, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_dev) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dev, __pyx_ptype_8freenect_DevPtr))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_dev); - __Pyx_DECREF(((PyObject *)__pyx_v_mdev)); __pyx_v_mdev = ((struct __pyx_obj_8freenect_DevPtr *)__pyx_v_dev); } - __pyx_L8:; + __pyx_L5:; - /* "freenect.pyx":374 + /* "freenect.pyx":383 * else: * mdev = dev * devp = mdev._ptr # <<<<<<<<<<<<<< * ctxp = mdev.ctx._ptr * if depth is not None: */ - __pyx_v_devp = __pyx_v_mdev->_ptr; + __pyx_t_5 = __pyx_v_mdev->_ptr; + __pyx_v_devp = __pyx_t_5; - /* "freenect.pyx":375 + /* "freenect.pyx":384 * mdev = dev * devp = mdev._ptr * ctxp = mdev.ctx._ptr # <<<<<<<<<<<<<< * if depth is not None: - * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) + * freenect_start_depth(devp) */ - __pyx_v_ctxp = __pyx_v_mdev->ctx->_ptr; + __pyx_t_6 = __pyx_v_mdev->ctx->_ptr; + __pyx_v_ctxp = __pyx_t_6; - /* "freenect.pyx":376 + /* "freenect.pyx":385 * devp = mdev._ptr * ctxp = mdev.ctx._ptr * if depth is not None: # <<<<<<<<<<<<<< - * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) * freenect_start_depth(devp) + * freenect_set_depth_callback(devp, depth_cb) */ - __pyx_t_1 = (__pyx_v_depth != Py_None); + __pyx_t_2 = (__pyx_v_depth != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "freenect.pyx":377 + /* "freenect.pyx":386 * ctxp = mdev.ctx._ptr * if depth is not None: - * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) # <<<<<<<<<<<<<< - * freenect_start_depth(devp) - * freenect_set_depth_callback(devp, depth_cb) - */ - freenect_set_depth_mode(__pyx_v_devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)); - - /* "freenect.pyx":378 - * if depth is not None: - * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) * freenect_start_depth(devp) # <<<<<<<<<<<<<< * freenect_set_depth_callback(devp, depth_cb) * if video is not None: */ freenect_start_depth(__pyx_v_devp); - /* "freenect.pyx":379 - * freenect_set_depth_mode(devp, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT)) + /* "freenect.pyx":387 + * if depth is not None: * freenect_start_depth(devp) * freenect_set_depth_callback(devp, depth_cb) # <<<<<<<<<<<<<< * if video is not None: - * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) + * freenect_start_video(devp) */ freenect_set_depth_callback(__pyx_v_devp, __pyx_f_8freenect_depth_cb); - goto __pyx_L11; + goto __pyx_L10; } - __pyx_L11:; + __pyx_L10:; - /* "freenect.pyx":380 + /* "freenect.pyx":388 * freenect_start_depth(devp) * freenect_set_depth_callback(devp, depth_cb) * if video is not None: # <<<<<<<<<<<<<< - * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) * freenect_start_video(devp) + * freenect_set_video_callback(devp, video_cb) */ __pyx_t_1 = (__pyx_v_video != Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "freenect.pyx":381 + /* "freenect.pyx":389 * freenect_set_depth_callback(devp, depth_cb) * if video is not None: - * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) # <<<<<<<<<<<<<< - * freenect_start_video(devp) - * freenect_set_video_callback(devp, video_cb) - */ - freenect_set_video_mode(__pyx_v_devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)); - - /* "freenect.pyx":382 - * if video is not None: - * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) * freenect_start_video(devp) # <<<<<<<<<<<<<< * freenect_set_video_callback(devp, video_cb) * try: */ freenect_start_video(__pyx_v_devp); - /* "freenect.pyx":383 - * freenect_set_video_mode(devp, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB)) + /* "freenect.pyx":390 + * if video is not None: * freenect_start_video(devp) * freenect_set_video_callback(devp, video_cb) # <<<<<<<<<<<<<< * try: * while True: */ freenect_set_video_callback(__pyx_v_devp, __pyx_f_8freenect_video_cb); - goto __pyx_L12; + goto __pyx_L11; } - __pyx_L12:; + __pyx_L11:; - /* "freenect.pyx":384 + /* "freenect.pyx":391 * freenect_start_video(devp) * freenect_set_video_callback(devp, video_cb) * try: # <<<<<<<<<<<<<< @@ -3604,14 +4723,13 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ * with nogil: */ { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - /* "freenect.pyx":385 + /* "freenect.pyx":392 * freenect_set_video_callback(devp, video_cb) * try: * while True: # <<<<<<<<<<<<<< @@ -3621,7 +4739,7 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ while (1) { if (!1) break; - /* "freenect.pyx":386 + /* "freenect.pyx":393 * try: * while True: * with nogil: # <<<<<<<<<<<<<< @@ -3629,127 +4747,129 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ * break */ { - #ifdef WITH_THREAD - PyThreadState *_save; - #endif - Py_UNBLOCK_THREADS - /*try:*/ { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { - /* "freenect.pyx":387 + /* "freenect.pyx":394 * while True: * with nogil: * if freenect_process_events(ctxp) < 0: # <<<<<<<<<<<<<< * break * if body: */ - __pyx_t_1 = (freenect_process_events(__pyx_v_ctxp) < 0); - if (__pyx_t_1) { + __pyx_t_2 = ((freenect_process_events(__pyx_v_ctxp) < 0) != 0); + if (__pyx_t_2) { - /* "freenect.pyx":388 + /* "freenect.pyx":395 * with nogil: * if freenect_process_events(ctxp) < 0: * break # <<<<<<<<<<<<<< * if body: * body(mdev, mdev.ctx) */ - goto __pyx_L24; - goto __pyx_L28; + goto __pyx_L23; + goto __pyx_L27; + } + __pyx_L27:; } - __pyx_L28:; - } - /* "freenect.pyx":386 + /* "freenect.pyx":393 * try: * while True: * with nogil: # <<<<<<<<<<<<<< * if freenect_process_events(ctxp) < 0: * break */ - /*finally:*/ { - int __pyx_why; - __pyx_why = 0; goto __pyx_L27; - __pyx_L24: __pyx_why = 2; goto __pyx_L27; - __pyx_L27:; - Py_BLOCK_THREADS - switch (__pyx_why) { - case 2: goto __pyx_L22_break; + /*finally:*/ { + int __pyx_why; + __pyx_why = 0; goto __pyx_L26; + __pyx_L23: __pyx_why = 2; goto __pyx_L26; + __pyx_L26:; + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + switch (__pyx_why) { + case 2: goto __pyx_L21_break; + } } - } } - /* "freenect.pyx":389 + /* "freenect.pyx":396 * if freenect_process_events(ctxp) < 0: * break * if body: # <<<<<<<<<<<<<< * body(mdev, mdev.ctx) * except Kill: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L13_error;} - if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + if (__pyx_t_2) { - /* "freenect.pyx":390 + /* "freenect.pyx":397 * break * if body: * body(mdev, mdev.ctx) # <<<<<<<<<<<<<< * except Kill: * pass */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_mdev)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mdev)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_mdev)); __Pyx_GIVEREF(((PyObject *)__pyx_v_mdev)); __Pyx_INCREF(((PyObject *)__pyx_v_mdev->ctx)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_mdev->ctx)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_mdev->ctx)); __Pyx_GIVEREF(((PyObject *)__pyx_v_mdev->ctx)); - __pyx_t_4 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_4 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L12_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L29; + goto __pyx_L28; } - __pyx_L29:; + __pyx_L28:; } - __pyx_L22_break:; + __pyx_L21_break:; } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L20_try_end; - __pyx_L13_error:; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L19_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "freenect.pyx":391 + /* "freenect.pyx":398 * if body: * body(mdev, mdev.ctx) * except Kill: # <<<<<<<<<<<<<< * pass * freenect_stop_depth(devp) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Kill); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__Kill); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyErr_ExceptionMatches(__pyx_t_4); + __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { + if (__pyx_t_10) { PyErr_Restore(0,0,0); - goto __pyx_L14_exception_handled; + goto __pyx_L13_exception_handled; } - __pyx_L15_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L14_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; - __pyx_L14_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L20_try_end:; + __pyx_L13_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L19_try_end:; } - /* "freenect.pyx":393 + /* "freenect.pyx":400 * except Kill: * pass * freenect_stop_depth(devp) # <<<<<<<<<<<<<< @@ -3758,7 +4878,7 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ */ freenect_stop_depth(__pyx_v_devp); - /* "freenect.pyx":394 + /* "freenect.pyx":401 * pass * freenect_stop_depth(devp) * freenect_stop_video(devp) # <<<<<<<<<<<<<< @@ -3767,17 +4887,18 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ */ freenect_stop_video(__pyx_v_devp); - /* "freenect.pyx":395 + /* "freenect.pyx":402 * freenect_stop_depth(devp) * freenect_stop_video(devp) * if dev is None: # <<<<<<<<<<<<<< * freenect_close_device(devp) * freenect_shutdown(ctxp) */ - __pyx_t_1 = (__pyx_v_dev == Py_None); + __pyx_t_2 = (__pyx_v_dev == Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "freenect.pyx":396 + /* "freenect.pyx":403 * freenect_stop_video(devp) * if dev is None: * freenect_close_device(devp) # <<<<<<<<<<<<<< @@ -3786,7 +4907,7 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ */ freenect_close_device(__pyx_v_devp); - /* "freenect.pyx":397 + /* "freenect.pyx":404 * if dev is None: * freenect_close_device(devp) * freenect_shutdown(ctxp) # <<<<<<<<<<<<<< @@ -3794,103 +4915,130 @@ static PyObject *__pyx_pf_8freenect_22runloop(PyObject *__pyx_self, PyObject *__ * def base_runloop(CtxPtr ctx, body=None): */ freenect_shutdown(__pyx_v_ctxp); - goto __pyx_L30; + goto __pyx_L29; } - __pyx_L30:; + __pyx_L29:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("freenect.runloop"); + __Pyx_AddTraceback("freenect.runloop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_mdev); - __Pyx_DECREF((PyObject *)__pyx_v_ctx); + __Pyx_XDECREF((PyObject *)__pyx_v_mdev); + __Pyx_XDECREF((PyObject *)__pyx_v_ctx); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":399 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_47base_runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_46base_runloop[] = "Starts a runloop\n\n This function can be used instead of runloop() to allow the Python code to\n perform all setup steps independently. This simply calls process_events in\n a loop, optionally calling a body function in between. Raise the Kill\n exception to break out of the runloop.\n\n Args:\n ctx: Freenect library context\n body: A function that takes (ctx) and is called in the body of process_events\n "; +static PyMethodDef __pyx_mdef_8freenect_47base_runloop = {__Pyx_NAMESTR("base_runloop"), (PyCFunction)__pyx_pw_8freenect_47base_runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_46base_runloop)}; +static PyObject *__pyx_pw_8freenect_47base_runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx = 0; + PyObject *__pyx_v_body = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("base_runloop (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx,&__pyx_n_s__body,0}; + PyObject* values[2] = {0,0}; + + /* "freenect.pyx":406 * freenect_shutdown(ctxp) * * def base_runloop(CtxPtr ctx, body=None): # <<<<<<<<<<<<<< * """Starts a runloop * */ - -static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_23base_runloop[] = "Starts a runloop\n\n This function can be used instead of runloop() to allow the Python code to\n perform all setup steps independently. This simply calls process_events in\n a loop, optionally calling a body function in between. Raise the Kill\n exception to break out of the runloop.\n\n Args:\n ctx: Freenect library context\n body: A function that takes (ctx) and is called in the body of process_events\n "; -static PyMethodDef __pyx_mdef_8freenect_23base_runloop = {__Pyx_NAMESTR("base_runloop"), (PyCFunction)__pyx_pf_8freenect_23base_runloop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_23base_runloop)}; -static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx = 0; - PyObject *__pyx_v_body = 0; - freenect_context *__pyx_v_ctxp; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx,&__pyx_n_s__body,0}; - __Pyx_RefNannySetupContext("base_runloop"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; values[1] = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); - if (value) { values[1] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__body); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "base_runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "base_runloop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)values[0]); __pyx_v_body = values[1]; - } else { - __pyx_v_body = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_body = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_ctx = ((struct __pyx_obj_8freenect_CtxPtr *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("base_runloop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("base_runloop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.base_runloop"); + __Pyx_AddTraceback("freenect.base_runloop", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ctx), __pyx_ptype_8freenect_CtxPtr, 1, "ctx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8freenect_46base_runloop(__pyx_self, __pyx_v_ctx, __pyx_v_body); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8freenect_46base_runloop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8freenect_CtxPtr *__pyx_v_ctx, PyObject *__pyx_v_body) { + freenect_context *__pyx_v_ctxp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + freenect_context *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("base_runloop", 0); - /* "freenect.pyx":412 + /* "freenect.pyx":419 * """ * cdef freenect_context* ctxp * ctxp = ctx._ptr # <<<<<<<<<<<<<< * try: * while True: */ - __pyx_v_ctxp = __pyx_v_ctx->_ptr; + __pyx_t_1 = __pyx_v_ctx->_ptr; + __pyx_v_ctxp = __pyx_t_1; - /* "freenect.pyx":413 + /* "freenect.pyx":420 * cdef freenect_context* ctxp * ctxp = ctx._ptr * try: # <<<<<<<<<<<<<< @@ -3898,14 +5046,13 @@ static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObjec * with nogil: */ { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "freenect.pyx":414 + /* "freenect.pyx":421 * ctxp = ctx._ptr * try: * while True: # <<<<<<<<<<<<<< @@ -3915,7 +5062,7 @@ static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObjec while (1) { if (!1) break; - /* "freenect.pyx":415 + /* "freenect.pyx":422 * try: * while True: * with nogil: # <<<<<<<<<<<<<< @@ -3923,129 +5070,131 @@ static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObjec * break */ { - #ifdef WITH_THREAD - PyThreadState *_save; - #endif - Py_UNBLOCK_THREADS - /*try:*/ { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { - /* "freenect.pyx":416 + /* "freenect.pyx":423 * while True: * with nogil: * if freenect_process_events(ctxp) < 0: # <<<<<<<<<<<<<< * break * if body: */ - __pyx_t_1 = (freenect_process_events(__pyx_v_ctxp) < 0); - if (__pyx_t_1) { + __pyx_t_5 = ((freenect_process_events(__pyx_v_ctxp) < 0) != 0); + if (__pyx_t_5) { - /* "freenect.pyx":417 + /* "freenect.pyx":424 * with nogil: * if freenect_process_events(ctxp) < 0: * break # <<<<<<<<<<<<<< * if body: * body(ctx) */ - goto __pyx_L17; - goto __pyx_L21; + goto __pyx_L14; + goto __pyx_L18; + } + __pyx_L18:; } - __pyx_L21:; - } - /* "freenect.pyx":415 + /* "freenect.pyx":422 * try: * while True: * with nogil: # <<<<<<<<<<<<<< * if freenect_process_events(ctxp) < 0: * break */ - /*finally:*/ { - int __pyx_why; - __pyx_why = 0; goto __pyx_L20; - __pyx_L17: __pyx_why = 2; goto __pyx_L20; - __pyx_L20:; - Py_BLOCK_THREADS - switch (__pyx_why) { - case 2: goto __pyx_L15_break; + /*finally:*/ { + int __pyx_why; + __pyx_why = 0; goto __pyx_L17; + __pyx_L14: __pyx_why = 2; goto __pyx_L17; + __pyx_L17:; + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + switch (__pyx_why) { + case 2: goto __pyx_L12_break; + } } - } } - /* "freenect.pyx":418 + /* "freenect.pyx":425 * if freenect_process_events(ctxp) < 0: * break * if body: # <<<<<<<<<<<<<< * body(ctx) * except Kill: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - if (__pyx_t_1) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (__pyx_t_5) { - /* "freenect.pyx":419 + /* "freenect.pyx":426 * break * if body: * body(ctx) # <<<<<<<<<<<<<< * except Kill: * pass */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_v_ctx)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ctx)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_ctx)); __Pyx_GIVEREF(((PyObject *)__pyx_v_ctx)); - __pyx_t_3 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L22; + __pyx_t_7 = PyObject_Call(__pyx_v_body, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L19; } - __pyx_L22:; + __pyx_L19:; } - __pyx_L15_break:; + __pyx_L12_break:; } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L13_try_end; - __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L10_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "freenect.pyx":420 + /* "freenect.pyx":427 * if body: * body(ctx) * except Kill: # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Kill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__Kill); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_8) { PyErr_Restore(0,0,0); - goto __pyx_L7_exception_handled; + goto __pyx_L4_exception_handled; } - __pyx_L8_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L1_error; - __pyx_L7_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L13_try_end:; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + __pyx_L10_try_end:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("freenect.base_runloop"); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("freenect.base_runloop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4053,132 +5202,147 @@ static PyObject *__pyx_pf_8freenect_23base_runloop(PyObject *__pyx_self, PyObjec return __pyx_r; } -/* "freenect.pyx":423 - * pass - * - * def _depth_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< - * """Converts the raw depth data into a numpy array for your function - * - */ - -static PyObject *__pyx_pf_8freenect_24_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_24_depth_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the depth data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; -static PyMethodDef __pyx_mdef_8freenect_24_depth_cb_np = {__Pyx_NAMESTR("_depth_cb_np"), (PyCFunction)__pyx_pf_8freenect_24_depth_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_24_depth_cb_np)}; -static PyObject *__pyx_pf_8freenect_24_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_49_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_48_depth_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the depth data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; +static PyMethodDef __pyx_mdef_8freenect_49_depth_cb_np = {__Pyx_NAMESTR("_depth_cb_np"), (PyCFunction)__pyx_pw_8freenect_49_depth_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_48_depth_cb_np)}; +static PyObject *__pyx_pw_8freenect_49_depth_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dev = 0; PyObject *__pyx_v_string = 0; PyObject *__pyx_v_timestamp = 0; - PyObject *__pyx_v_data; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__string,&__pyx_n_s__timestamp,0}; - __Pyx_RefNannySetupContext("_depth_cb_np"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_depth_cb_np (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__string,&__pyx_n_s__timestamp,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timestamp)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timestamp); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_depth_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_depth_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_dev = values[0]; __pyx_v_string = values[1]; __pyx_v_timestamp = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_string = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_timestamp = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_depth_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect._depth_cb_np"); + __Pyx_AddTraceback("freenect._depth_cb_np", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_8freenect_48_depth_cb_np(__pyx_self, __pyx_v_dev, __pyx_v_string, __pyx_v_timestamp); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":430 + * pass + * + * def _depth_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< + * """Converts the raw depth data into a numpy array for your function + * + */ + +static PyObject *__pyx_pf_8freenect_48_depth_cb_np(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev, PyObject *__pyx_v_string, PyObject *__pyx_v_timestamp) { + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_depth_cb_np", 0); - /* "freenect.pyx":434 + /* "freenect.pyx":441 * (dev, data, timestamp) where data is a 2D numpy array * """ * data = np.fromstring(string, dtype=np.uint16) # <<<<<<<<<<<<<< * data.resize((480, 640)) * return dev, data, timestamp */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_string); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_string); __Pyx_GIVEREF(__pyx_v_string); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__uint16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_5; __pyx_t_5 = 0; - /* "freenect.pyx":435 + /* "freenect.pyx":442 * """ * data = np.fromstring(string, dtype=np.uint16) * data.resize((480, 640)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":436 + /* "freenect.pyx":443 * data = np.fromstring(string, dtype=np.uint16) * data.resize((480, 640)) * return dev, data, timestamp # <<<<<<<<<<<<<< @@ -4186,8 +5350,8 @@ static PyObject *__pyx_pf_8freenect_24_depth_cb_np(PyObject *__pyx_self, PyObjec * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_dev); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dev); __Pyx_GIVEREF(__pyx_v_dev); @@ -4209,141 +5373,156 @@ static PyObject *__pyx_pf_8freenect_24_depth_cb_np(PyObject *__pyx_self, PyObjec __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("freenect._depth_cb_np"); + __Pyx_AddTraceback("freenect._depth_cb_np", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_data); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":439 - * - * - * def _video_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< - * """Converts the raw depth data into a numpy array for your function - * - */ - -static PyObject *__pyx_pf_8freenect_25_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_25_video_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the video data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; -static PyMethodDef __pyx_mdef_8freenect_25_video_cb_np = {__Pyx_NAMESTR("_video_cb_np"), (PyCFunction)__pyx_pf_8freenect_25_video_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_25_video_cb_np)}; -static PyObject *__pyx_pf_8freenect_25_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_51_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_50_video_cb_np[] = "Converts the raw depth data into a numpy array for your function\n\n Args:\n dev: DevPtr object\n string: A python string with the video data\n timestamp: An int representing the time\n\n Returns:\n (dev, data, timestamp) where data is a 2D numpy array\n "; +static PyMethodDef __pyx_mdef_8freenect_51_video_cb_np = {__Pyx_NAMESTR("_video_cb_np"), (PyCFunction)__pyx_pw_8freenect_51_video_cb_np, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_50_video_cb_np)}; +static PyObject *__pyx_pw_8freenect_51_video_cb_np(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dev = 0; PyObject *__pyx_v_string = 0; PyObject *__pyx_v_timestamp = 0; - PyObject *__pyx_v_data; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__string,&__pyx_n_s__timestamp,0}; - __Pyx_RefNannySetupContext("_video_cb_np"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_video_cb_np (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dev,&__pyx_n_s__string,&__pyx_n_s__timestamp,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dev)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timestamp)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timestamp); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_video_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_video_cb_np") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_dev = values[0]; __pyx_v_string = values[1]; __pyx_v_timestamp = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_dev = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_string = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_timestamp = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_video_cb_np", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect._video_cb_np"); + __Pyx_AddTraceback("freenect._video_cb_np", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_8freenect_50_video_cb_np(__pyx_self, __pyx_v_dev, __pyx_v_string, __pyx_v_timestamp); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":446 + * + * + * def _video_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< + * """Converts the raw depth data into a numpy array for your function + * + */ + +static PyObject *__pyx_pf_8freenect_50_video_cb_np(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dev, PyObject *__pyx_v_string, PyObject *__pyx_v_timestamp) { + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_video_cb_np", 0); - /* "freenect.pyx":450 + /* "freenect.pyx":457 * (dev, data, timestamp) where data is a 2D numpy array * """ * data = np.fromstring(string, dtype=np.uint8) # <<<<<<<<<<<<<< * data.resize((480, 640, 3)) * return dev, data, timestamp */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_string); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_string); __Pyx_GIVEREF(__pyx_v_string); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__uint8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_5; __pyx_t_5 = 0; - /* "freenect.pyx":451 + /* "freenect.pyx":458 * """ * data = np.fromstring(string, dtype=np.uint8) * data.resize((480, 640, 3)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "freenect.pyx":452 + /* "freenect.pyx":459 * data = np.fromstring(string, dtype=np.uint8) * data.resize((480, 640, 3)) * return dev, data, timestamp # <<<<<<<<<<<<<< @@ -4351,8 +5530,8 @@ static PyObject *__pyx_pf_8freenect_25_video_cb_np(PyObject *__pyx_self, PyObjec * import_array() */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_dev); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dev); __Pyx_GIVEREF(__pyx_v_dev); @@ -4374,115 +5553,135 @@ static PyObject *__pyx_pf_8freenect_25_video_cb_np(PyObject *__pyx_self, PyObjec __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("freenect._video_cb_np"); + __Pyx_AddTraceback("freenect._video_cb_np", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_data); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "freenect.pyx":456 - * import_array() - * - * def sync_get_depth(index=0, format=DEPTH_11BIT): # <<<<<<<<<<<<<< - * """Get the next available depth frame from the kinect, as a numpy array. - * - */ - -static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_26sync_get_depth[] = "Get the next available depth frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: DEPTH_11BIT)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(640,480) dtype:np.uint16\n timestamp: int representing the time\n "; -static PyMethodDef __pyx_mdef_8freenect_26sync_get_depth = {__Pyx_NAMESTR("sync_get_depth"), (PyCFunction)__pyx_pf_8freenect_26sync_get_depth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_26sync_get_depth)}; -static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_53sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_52sync_get_depth[] = "Get the next available depth frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: DEPTH_11BIT)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(640,480) dtype:np.uint16\n timestamp: int representing the time\n "; +static PyMethodDef __pyx_mdef_8freenect_53sync_get_depth = {__Pyx_NAMESTR("sync_get_depth"), (PyCFunction)__pyx_pw_8freenect_53sync_get_depth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_52sync_get_depth)}; +static PyObject *__pyx_pw_8freenect_53sync_get_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_index = 0; PyObject *__pyx_v_format = 0; - void *__pyx_v_data; - uint32_t __pyx_v_timestamp; - npy_intp __pyx_v_dims[2]; - int __pyx_v_out; - int __pyx_v__index; - freenect_depth_format __pyx_v__format; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - freenect_depth_format __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - npy_intp __pyx_t_6; - npy_intp __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__format,0}; - __Pyx_RefNannySetupContext("sync_get_depth"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sync_get_depth (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__format,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)__pyx_int_0); values[1] = __pyx_k_9; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); - if (value) { values[0] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); - if (value) { values[1] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sync_get_depth") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sync_get_depth") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_index = values[0]; __pyx_v_format = values[1]; - } else { - __pyx_v_index = ((PyObject *)__pyx_int_0); - __pyx_v_format = __pyx_k_9; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_format = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sync_get_depth", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sync_get_depth", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("freenect.sync_get_depth"); + __Pyx_AddTraceback("freenect.sync_get_depth", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8freenect_52sync_get_depth(__pyx_self, __pyx_v_index, __pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "freenect.pyx":472 - * cdef npc.npy_intp dims[2] +/* "freenect.pyx":463 + * import_array() + * + * def sync_get_depth(index=0, format=DEPTH_11BIT): # <<<<<<<<<<<<<< + * """Get the next available depth frame from the kinect, as a numpy array. + * + */ + +static PyObject *__pyx_pf_8freenect_52sync_get_depth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_index, PyObject *__pyx_v_format) { + void *__pyx_v_data; + uint32_t __pyx_v_timestamp; + npy_intp __pyx_v_dims[2]; + int __pyx_v_out; + int __pyx_v__index; + freenect_depth_format __pyx_v__format; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + freenect_depth_format __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + npy_intp __pyx_t_9; + npy_intp __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sync_get_depth", 0); + + /* "freenect.pyx":479 + * cdef npc.npy_intp dims[2] * cdef int out * cdef int _index = index # <<<<<<<<<<<<<< * cdef freenect_depth_format _format = format * with nogil: */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v__index = __pyx_t_1; - /* "freenect.pyx":473 + /* "freenect.pyx":480 * cdef int out * cdef int _index = index * cdef freenect_depth_format _format = format # <<<<<<<<<<<<<< * with nogil: * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) */ - __pyx_t_2 = ((freenect_depth_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((freenect_depth_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v__format = __pyx_t_2; - /* "freenect.pyx":474 + /* "freenect.pyx":481 * cdef int _index = index * cdef freenect_depth_format _format = format * with nogil: # <<<<<<<<<<<<<< @@ -4490,156 +5689,195 @@ static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObj * if out: */ { - #ifdef WITH_THREAD - PyThreadState *_save; - #endif - Py_UNBLOCK_THREADS - /*try:*/ { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { - /* "freenect.pyx":475 + /* "freenect.pyx":482 * cdef freenect_depth_format _format = format * with nogil: * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) # <<<<<<<<<<<<<< * if out: * error_open_device() */ - __pyx_v_out = freenect_sync_get_depth((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_v__index, __pyx_v__format); - } + __pyx_v_out = freenect_sync_get_depth((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_v__index, __pyx_v__format); + } - /* "freenect.pyx":474 + /* "freenect.pyx":481 * cdef int _index = index * cdef freenect_depth_format _format = format * with nogil: # <<<<<<<<<<<<<< * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: */ - /*finally:*/ { - Py_BLOCK_THREADS - } + /*finally:*/ { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + } } - /* "freenect.pyx":476 + /* "freenect.pyx":483 * with nogil: * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: # <<<<<<<<<<<<<< * error_open_device() * return */ - if (__pyx_v_out) { + __pyx_t_3 = (__pyx_v_out != 0); + if (__pyx_t_3) { - /* "freenect.pyx":477 + /* "freenect.pyx":484 * out = freenect_sync_get_depth(&data, ×tamp, _index, _format) * if out: * error_open_device() # <<<<<<<<<<<<<< * return - * if format == DEPTH_11BIT: + * if format in [DEPTH_11BIT, DEPTH_10BIT, DEPTH_MM, DEPTH_REGISTERED]: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__error_open_device); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "freenect.pyx":478 + /* "freenect.pyx":485 * if out: * error_open_device() * return # <<<<<<<<<<<<<< - * if format == DEPTH_11BIT: + * if format in [DEPTH_11BIT, DEPTH_10BIT, DEPTH_MM, DEPTH_REGISTERED]: * dims[0], dims[1] = 480, 640 */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "freenect.pyx":479 + /* "freenect.pyx":486 * error_open_device() * return - * if format == DEPTH_11BIT: # <<<<<<<<<<<<<< + * if format in [DEPTH_11BIT, DEPTH_10BIT, DEPTH_MM, DEPTH_REGISTERED]: # <<<<<<<<<<<<<< * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_format); + __pyx_t_5 = __pyx_v_format; + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!((int)__pyx_t_3)) { + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__DEPTH_10BIT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = ((int)__pyx_t_7); + } else { + __pyx_t_8 = ((int)__pyx_t_3); + } + if (!__pyx_t_8) { + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__DEPTH_MM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = ((int)__pyx_t_3); + } else { + __pyx_t_7 = __pyx_t_8; + } + if (!__pyx_t_7) { + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__DEPTH_REGISTERED); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = ((int)__pyx_t_8); + } else { + __pyx_t_3 = __pyx_t_7; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = (__pyx_t_3 != 0); + if (__pyx_t_7) { - /* "freenect.pyx":480 + /* "freenect.pyx":487 * return - * if format == DEPTH_11BIT: + * if format in [DEPTH_11BIT, DEPTH_10BIT, DEPTH_MM, DEPTH_REGISTERED]: * dims[0], dims[1] = 480, 640 # <<<<<<<<<<<<<< * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp * else: */ - __pyx_t_6 = 480; - __pyx_t_7 = 640; - (__pyx_v_dims[0]) = __pyx_t_6; - (__pyx_v_dims[1]) = __pyx_t_7; + __pyx_t_9 = 480; + __pyx_t_10 = 640; + (__pyx_v_dims[0]) = __pyx_t_9; + (__pyx_v_dims[1]) = __pyx_t_10; - /* "freenect.pyx":481 - * if format == DEPTH_11BIT: + /* "freenect.pyx":488 + * if format in [DEPTH_11BIT, DEPTH_10BIT, DEPTH_MM, DEPTH_REGISTERED]: * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp # <<<<<<<<<<<<<< * else: * raise TypeError('Conversion not implemented for type [%d]' % (format)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT16, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT16, __pyx_v_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_3 = 0; + __pyx_t_5 = 0; __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_8); - __pyx_t_8 = 0; + __pyx_r = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; goto __pyx_L0; - goto __pyx_L10; + goto __pyx_L7; } /*else*/ { - /* "freenect.pyx":483 + /* "freenect.pyx":490 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT16, data), timestamp * else: * raise TypeError('Conversion not implemented for type [%d]' % (format)) # <<<<<<<<<<<<<< * * */ - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L10:; + __pyx_L7:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("freenect.sync_get_depth"); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("freenect.sync_get_depth", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4647,7 +5885,74 @@ static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObj return __pyx_r; } -/* "freenect.pyx":486 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_55sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8freenect_54sync_get_video[] = "Get the next available rgb frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: VIDEO_RGB)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(480, 640, 3) dtype:np.uint8\n timestamp: int representing the time\n "; +static PyMethodDef __pyx_mdef_8freenect_55sync_get_video = {__Pyx_NAMESTR("sync_get_video"), (PyCFunction)__pyx_pw_8freenect_55sync_get_video, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_54sync_get_video)}; +static PyObject *__pyx_pw_8freenect_55sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_format = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sync_get_video (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__format,0}; + PyObject* values[2] = {0,0}; + values[0] = ((PyObject *)__pyx_int_0); + values[1] = __pyx_k_11; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sync_get_video") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_index = values[0]; + __pyx_v_format = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sync_get_video", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("freenect.sync_get_video", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8freenect_54sync_get_video(__pyx_self, __pyx_v_index, __pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":493 * * * def sync_get_video(index=0, format=VIDEO_RGB): # <<<<<<<<<<<<<< @@ -4655,12 +5960,7 @@ static PyObject *__pyx_pf_8freenect_26sync_get_depth(PyObject *__pyx_self, PyObj * */ -static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8freenect_27sync_get_video[] = "Get the next available rgb frame from the kinect, as a numpy array.\n\n Args:\n index: Kinect device index (default: 0)\n format: Depth format (default: VIDEO_RGB)\n\n Returns:\n (depth, timestamp) or None on error\n depth: A numpy array, shape:(480, 640, 3) dtype:np.uint8\n timestamp: int representing the time\n "; -static PyMethodDef __pyx_mdef_8freenect_27sync_get_video = {__Pyx_NAMESTR("sync_get_video"), (PyCFunction)__pyx_pf_8freenect_27sync_get_video, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8freenect_27sync_get_video)}; -static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_index = 0; - PyObject *__pyx_v_format = 0; +static PyObject *__pyx_pf_8freenect_54sync_get_video(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_index, PyObject *__pyx_v_format) { void *__pyx_v_data; uint32_t __pyx_v_timestamp; npy_intp __pyx_v_dims[3]; @@ -4668,86 +5968,42 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj int __pyx_v__index; freenect_video_format __pyx_v__format; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; freenect_video_format __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + PyObject *__pyx_t_5 = NULL; npy_intp __pyx_t_6; npy_intp __pyx_t_7; npy_intp __pyx_t_8; PyObject *__pyx_t_9 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__format,0}; - __Pyx_RefNannySetupContext("sync_get_video"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - values[0] = ((PyObject *)__pyx_int_0); - values[1] = __pyx_k_11; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sync_get_video") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_index = values[0]; - __pyx_v_format = values[1]; - } else { - __pyx_v_index = ((PyObject *)__pyx_int_0); - __pyx_v_format = __pyx_k_11; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_format = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sync_get_video", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("freenect.sync_get_video"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sync_get_video", 0); - /* "freenect.pyx":502 + /* "freenect.pyx":509 * cdef npc.npy_intp dims[3] * cdef int out * cdef int _index = index # <<<<<<<<<<<<<< * cdef freenect_video_format _format = format * with nogil: */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v__index = __pyx_t_1; - /* "freenect.pyx":503 + /* "freenect.pyx":510 * cdef int out * cdef int _index = index * cdef freenect_video_format _format = format # <<<<<<<<<<<<<< * with nogil: * out = freenect_sync_get_video(&data, ×tamp, _index, _format) */ - __pyx_t_2 = ((freenect_video_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((freenect_video_format)PyInt_AsLong(__pyx_v_format)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v__format = __pyx_t_2; - /* "freenect.pyx":504 + /* "freenect.pyx":511 * cdef int _index = index * cdef freenect_video_format _format = format * with nogil: # <<<<<<<<<<<<<< @@ -4755,58 +6011,61 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj * if out: */ { - #ifdef WITH_THREAD - PyThreadState *_save; - #endif - Py_UNBLOCK_THREADS - /*try:*/ { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { - /* "freenect.pyx":505 + /* "freenect.pyx":512 * cdef freenect_video_format _format = format * with nogil: * out = freenect_sync_get_video(&data, ×tamp, _index, _format) # <<<<<<<<<<<<<< * if out: * error_open_device() */ - __pyx_v_out = freenect_sync_get_video((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_v__index, __pyx_v__format); - } + __pyx_v_out = freenect_sync_get_video((&__pyx_v_data), (&__pyx_v_timestamp), __pyx_v__index, __pyx_v__format); + } - /* "freenect.pyx":504 + /* "freenect.pyx":511 * cdef int _index = index * cdef freenect_video_format _format = format * with nogil: # <<<<<<<<<<<<<< * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: */ - /*finally:*/ { - Py_BLOCK_THREADS - } + /*finally:*/ { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + } } - /* "freenect.pyx":506 + /* "freenect.pyx":513 * with nogil: * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: # <<<<<<<<<<<<<< * error_open_device() * return */ - if (__pyx_v_out) { + __pyx_t_3 = (__pyx_v_out != 0); + if (__pyx_t_3) { - /* "freenect.pyx":507 + /* "freenect.pyx":514 * out = freenect_sync_get_video(&data, ×tamp, _index, _format) * if out: * error_open_device() # <<<<<<<<<<<<<< * return * if format == VIDEO_RGB: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__error_open_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__error_open_device); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "freenect.pyx":508 + /* "freenect.pyx":515 * if out: * error_open_device() * return # <<<<<<<<<<<<<< @@ -4816,27 +6075,26 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "freenect.pyx":509 + /* "freenect.pyx":516 * error_open_device() * return * if format == VIDEO_RGB: # <<<<<<<<<<<<<< * dims[0], dims[1], dims[2] = 480, 640, 3 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_format, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { + if (__pyx_t_3) { - /* "freenect.pyx":510 + /* "freenect.pyx":517 * return * if format == VIDEO_RGB: * dims[0], dims[1], dims[2] = 480, 640, 3 # <<<<<<<<<<<<<< @@ -4850,7 +6108,7 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj (__pyx_v_dims[1]) = __pyx_t_7; (__pyx_v_dims[2]) = __pyx_t_8; - /* "freenect.pyx":511 + /* "freenect.pyx":518 * if format == VIDEO_RGB: * dims[0], dims[1], dims[2] = 480, 640, 3 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp # <<<<<<<<<<<<<< @@ -4858,41 +6116,40 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj * dims[0], dims[1] = 480, 640 */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyArray_SimpleNewFromData(3, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyArray_SimpleNewFromData(3, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); __pyx_t_4 = 0; + __pyx_t_5 = 0; __pyx_r = ((PyObject *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; - goto __pyx_L10; + goto __pyx_L7; } - /* "freenect.pyx":512 + /* "freenect.pyx":519 * dims[0], dims[1], dims[2] = 480, 640, 3 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp * elif format == VIDEO_IR_8BIT: # <<<<<<<<<<<<<< * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT8, data), timestamp */ - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_IR_8BIT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__VIDEO_IR_8BIT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_format, __pyx_t_9, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_format, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { - /* "freenect.pyx":513 + /* "freenect.pyx":520 * return PyArray_SimpleNewFromData(3, dims, npc.NPY_UINT8, data), timestamp * elif format == VIDEO_IR_8BIT: * dims[0], dims[1] = 480, 640 # <<<<<<<<<<<<<< @@ -4904,7 +6161,7 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj (__pyx_v_dims[0]) = __pyx_t_8; (__pyx_v_dims[1]) = __pyx_t_7; - /* "freenect.pyx":514 + /* "freenect.pyx":521 * elif format == VIDEO_IR_8BIT: * dims[0], dims[1] = 480, 640 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT8, data), timestamp # <<<<<<<<<<<<<< @@ -4912,55 +6169,55 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj * raise TypeError('Conversion not implemented for type [%d]' % (format)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyArray_SimpleNewFromData(2, __pyx_v_dims, NPY_UINT8, __pyx_v_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_timestamp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_4 = 0; + __pyx_t_5 = 0; __pyx_t_9 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; goto __pyx_L0; - goto __pyx_L10; + goto __pyx_L7; } /*else*/ { - /* "freenect.pyx":516 + /* "freenect.pyx":523 * return PyArray_SimpleNewFromData(2, dims, npc.NPY_UINT8, data), timestamp * else: * raise TypeError('Conversion not implemented for type [%d]' % (format)) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L10:; + __pyx_L7:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("freenect.sync_get_video"); + __Pyx_AddTraceback("freenect.sync_get_video", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4968,7 +6225,20 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj return __pyx_r; } -/* "freenect.pyx":519 +/* Python wrapper */ +static PyObject *__pyx_pw_8freenect_57sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_8freenect_56sync_stop[] = "Terminate the synchronous runloop if running, else this is a NOP\n "; +static PyMethodDef __pyx_mdef_8freenect_57sync_stop = {__Pyx_NAMESTR("sync_stop"), (PyCFunction)__pyx_pw_8freenect_57sync_stop, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8freenect_56sync_stop)}; +static PyObject *__pyx_pw_8freenect_57sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sync_stop (wrapper)", 0); + __pyx_r = __pyx_pf_8freenect_56sync_stop(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "freenect.pyx":526 * * * def sync_stop(): # <<<<<<<<<<<<<< @@ -4976,15 +6246,12 @@ static PyObject *__pyx_pf_8freenect_27sync_get_video(PyObject *__pyx_self, PyObj * """ */ -static PyObject *__pyx_pf_8freenect_28sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8freenect_28sync_stop[] = "Terminate the synchronous runloop if running, else this is a NOP\n "; -static PyMethodDef __pyx_mdef_8freenect_28sync_stop = {__Pyx_NAMESTR("sync_stop"), (PyCFunction)__pyx_pf_8freenect_28sync_stop, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8freenect_28sync_stop)}; -static PyObject *__pyx_pf_8freenect_28sync_stop(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8freenect_56sync_stop(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("sync_stop"); - __pyx_self = __pyx_self; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sync_stop", 0); - /* "freenect.pyx":522 + /* "freenect.pyx":529 * """Terminate the synchronous runloop if running, else this is a NOP * """ * freenect_sync_stop() # <<<<<<<<<<<<<< @@ -4997,7 +6264,18 @@ static PyObject *__pyx_pf_8freenect_28sync_stop(PyObject *__pyx_self, CYTHON_UNU return __pyx_r; } -/* "numpy.pxd":188 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -5005,8 +6283,7 @@ static PyObject *__pyx_pf_8freenect_28sync_stop(PyObject *__pyx_self, CYTHON_UNU * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -5018,6 +6295,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; @@ -5027,13 +6305,32 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "numpy.pxd":194 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -5041,7 +6338,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":195 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -5050,26 +6347,26 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":197 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":199 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":200 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -5077,11 +6374,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":202 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -5090,135 +6387,136 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "numpy.pxd":204 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":206 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "numpy.pxd":208 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { - /* "numpy.pxd":209 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":210 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "numpy.pxd":212 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":213 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":214 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - if (__pyx_v_copy_shape) { + __pyx_t_2 = (__pyx_v_copy_shape != 0); + if (__pyx_t_2) { - /* "numpy.pxd":217 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":218 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":219 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] @@ -5228,49 +6526,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":220 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":221 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":223 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":224 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "numpy.pxd":225 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -5279,25 +6577,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":226 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":227 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "numpy.pxd":230 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -5306,17 +6604,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":235 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -5325,23 +6625,23 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":237 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); + __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "numpy.pxd":239 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -5353,69 +6653,70 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":242 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "numpy.pxd":244 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { - /* "numpy.pxd":245 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":246 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { - /* "numpy.pxd":247 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; @@ -5426,271 +6727,246 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":248 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + switch (__pyx_v_t) { - /* "numpy.pxd":249 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - __pyx_t_1 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_1) { + case NPY_BYTE: __pyx_v_f = __pyx_k__b; - goto __pyx_L14; - } + break; - /* "numpy.pxd":250 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_1) { + case NPY_UBYTE: __pyx_v_f = __pyx_k__B; - goto __pyx_L14; - } + break; - /* "numpy.pxd":251 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_t_1 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_1) { + case NPY_SHORT: __pyx_v_f = __pyx_k__h; - goto __pyx_L14; - } + break; - /* "numpy.pxd":252 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_t_1 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_1) { + case NPY_USHORT: __pyx_v_f = __pyx_k__H; - goto __pyx_L14; - } + break; - /* "numpy.pxd":253 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_t_1 = (__pyx_v_t == NPY_INT); - if (__pyx_t_1) { + case NPY_INT: __pyx_v_f = __pyx_k__i; - goto __pyx_L14; - } + break; - /* "numpy.pxd":254 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_t_1 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_1) { + case NPY_UINT: __pyx_v_f = __pyx_k__I; - goto __pyx_L14; - } + break; - /* "numpy.pxd":255 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_t_1 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_1) { + case NPY_LONG: __pyx_v_f = __pyx_k__l; - goto __pyx_L14; - } + break; - /* "numpy.pxd":256 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_t_1 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_1) { + case NPY_ULONG: __pyx_v_f = __pyx_k__L; - goto __pyx_L14; - } + break; - /* "numpy.pxd":257 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_1) { + case NPY_LONGLONG: __pyx_v_f = __pyx_k__q; - goto __pyx_L14; - } + break; - /* "numpy.pxd":258 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_1) { + case NPY_ULONGLONG: __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; - } + break; - /* "numpy.pxd":259 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_1) { + case NPY_FLOAT: __pyx_v_f = __pyx_k__f; - goto __pyx_L14; - } + break; - /* "numpy.pxd":260 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_1) { + case NPY_DOUBLE: __pyx_v_f = __pyx_k__d; - goto __pyx_L14; - } + break; - /* "numpy.pxd":261 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_1) { + case NPY_LONGDOUBLE: __pyx_v_f = __pyx_k__g; - goto __pyx_L14; - } + break; - /* "numpy.pxd":262 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_1) { + case NPY_CFLOAT: __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; - } + break; - /* "numpy.pxd":263 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_1) { + case NPY_CDOUBLE: __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; - } + break; - /* "numpy.pxd":264 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_1) { + case NPY_CLONGDOUBLE: __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; - } + break; - /* "numpy.pxd":265 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_1) { + case NPY_OBJECT: __pyx_v_f = __pyx_k__O; - goto __pyx_L14; - } - /*else*/ { + break; + default: - /* "numpy.pxd":267 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; } - __pyx_L14:; - /* "numpy.pxd":268 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -5699,7 +6975,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":269 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -5708,70 +6984,72 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":271 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":272 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":273 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":276 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":277 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } @@ -5781,30 +7059,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":279 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":280 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { - /* "numpy.pxd":281 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -5812,21 +7099,21 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":282 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":283 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -5834,14 +7121,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":756 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -5851,10 +7138,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":757 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -5862,7 +7153,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5872,7 +7163,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5880,7 +7171,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":759 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -5890,10 +7181,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":760 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -5901,7 +7196,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5911,7 +7206,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5919,7 +7214,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":762 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -5929,10 +7224,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":763 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -5940,7 +7239,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5950,7 +7249,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5958,7 +7257,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":765 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -5968,10 +7267,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":766 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -5979,7 +7282,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5989,7 +7292,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5997,7 +7300,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":768 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -6007,10 +7310,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":769 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -6018,7 +7325,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6028,7 +7335,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6036,7 +7343,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":771 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -6045,33 +7352,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "numpy.pxd":778 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -6080,7 +7387,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":779 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -6089,154 +7396,196 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":782 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":783 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":784 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "numpy.pxd":786 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":787 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":789 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_little_endian != 0); } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":790 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); + if (__pyx_t_7) { + __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":801 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -6244,16 +7593,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":802 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -6262,7 +7610,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":803 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -6271,430 +7619,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":804 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":806 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":808 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); + if (__pyx_t_7) { - /* "numpy.pxd":809 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":810 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); + if (__pyx_t_7) { - /* "numpy.pxd":811 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":814 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":815 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":816 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":817 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":818 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":819 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":820 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":821 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":822 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":832 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":833 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -6702,25 +8033,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":837 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":838 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -6733,23 +8064,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numpy.pxd":953 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -6759,10 +8090,12 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + int __pyx_t_2; + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":955 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -6770,9 +8103,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "numpy.pxd":956 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -6784,7 +8118,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":958 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -6793,7 +8127,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":959 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -6804,7 +8138,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":960 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -6813,7 +8147,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":961 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -6825,7 +8159,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":963 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -6835,20 +8169,21 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":964 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); + __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { - /* "numpy.pxd":965 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -6863,7 +8198,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":967 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -6882,9 +8217,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } -static PyObject *__pyx_tp_new_8freenect_CtxPtr(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; +static PyObject *__pyx_tp_new_8freenect_CtxPtr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; return o; } @@ -6896,110 +8232,88 @@ static PyMethodDef __pyx_methods_8freenect_CtxPtr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_CtxPtr = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 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*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ +static PyTypeObject __pyx_type_8freenect_CtxPtr = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("freenect.CtxPtr"), /*tp_name*/ + sizeof(struct __pyx_obj_8freenect_CtxPtr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8freenect_CtxPtr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ + 0, /*tp_compare*/ #else 0, /*reserved*/ #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 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*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ + __pyx_pw_8freenect_6CtxPtr_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8freenect_CtxPtr, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8freenect_CtxPtr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ #endif }; -static PySequenceMethods __pyx_tp_as_sequence_CtxPtr = { - 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 PyObject *__pyx_tp_new_8freenect_StatePtr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + return o; +} -static PyMappingMethods __pyx_tp_as_mapping_CtxPtr = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; +static void __pyx_tp_dealloc_8freenect_StatePtr(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} -static PyBufferProcs __pyx_tp_as_buffer_CtxPtr = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif +static PyMethodDef __pyx_methods_8freenect_StatePtr[] = { + {__Pyx_NAMESTR("_get_accelx"), (PyCFunction)__pyx_pw_8freenect_8StatePtr_3_get_accelx, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_accely"), (PyCFunction)__pyx_pw_8freenect_8StatePtr_5_get_accely, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_accelz"), (PyCFunction)__pyx_pw_8freenect_8StatePtr_7_get_accelz, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_tilt_angle"), (PyCFunction)__pyx_pw_8freenect_8StatePtr_9_get_tilt_angle, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_tilt_status"), (PyCFunction)__pyx_pw_8freenect_8StatePtr_11_get_tilt_status, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_8freenect_CtxPtr = { +static PyTypeObject __pyx_type_8freenect_StatePtr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("freenect.CtxPtr"), /*tp_name*/ - sizeof(struct __pyx_obj_8freenect_CtxPtr), /*tp_basicsize*/ + __Pyx_NAMESTR("freenect.StatePtr"), /*tp_name*/ + sizeof(struct __pyx_obj_8freenect_StatePtr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8freenect_CtxPtr, /*tp_dealloc*/ + __pyx_tp_dealloc_8freenect_StatePtr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -7008,17 +8322,17 @@ static PyTypeObject __pyx_type_8freenect_CtxPtr = { #else 0, /*reserved*/ #endif - __pyx_pf_8freenect_6CtxPtr___repr__, /*tp_repr*/ - &__pyx_tp_as_number_CtxPtr, /*tp_as_number*/ - &__pyx_tp_as_sequence_CtxPtr, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_CtxPtr, /*tp_as_mapping*/ + __pyx_pw_8freenect_8StatePtr_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_CtxPtr, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ @@ -7026,7 +8340,7 @@ static PyTypeObject __pyx_type_8freenect_CtxPtr = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8freenect_CtxPtr, /*tp_methods*/ + __pyx_methods_8freenect_StatePtr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -7036,7 +8350,7 @@ static PyTypeObject __pyx_type_8freenect_CtxPtr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8freenect_CtxPtr, /*tp_new*/ + __pyx_tp_new_8freenect_StatePtr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -7050,10 +8364,11 @@ static PyTypeObject __pyx_type_8freenect_CtxPtr = { #endif }; -static PyObject *__pyx_tp_new_8freenect_DevPtr(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_8freenect_DevPtr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_8freenect_DevPtr *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; p = ((struct __pyx_obj_8freenect_DevPtr *)o); p->ctx = ((struct __pyx_obj_8freenect_CtxPtr *)Py_None); Py_INCREF(Py_None); return o; @@ -7061,7 +8376,8 @@ static PyObject *__pyx_tp_new_8freenect_DevPtr(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc_8freenect_DevPtr(PyObject *o) { struct __pyx_obj_8freenect_DevPtr *p = (struct __pyx_obj_8freenect_DevPtr *)o; - Py_XDECREF(((PyObject *)p->ctx)); + PyObject_GC_UnTrack(o); + Py_CLEAR(p->ctx); (*Py_TYPE(o)->tp_free)(o); } @@ -7087,104 +8403,6 @@ static PyMethodDef __pyx_methods_8freenect_DevPtr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_DevPtr = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 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*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 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*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_DevPtr = { - 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_DevPtr = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_DevPtr = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - static PyTypeObject __pyx_type_8freenect_DevPtr = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("freenect.DevPtr"), /*tp_name*/ @@ -7199,17 +8417,17 @@ static PyTypeObject __pyx_type_8freenect_DevPtr = { #else 0, /*reserved*/ #endif - __pyx_pf_8freenect_6DevPtr___repr__, /*tp_repr*/ - &__pyx_tp_as_number_DevPtr, /*tp_as_number*/ - &__pyx_tp_as_sequence_DevPtr, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_DevPtr, /*tp_as_mapping*/ + __pyx_pw_8freenect_6DevPtr_1__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_DevPtr, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8freenect_DevPtr, /*tp_traverse*/ __pyx_tp_clear_8freenect_DevPtr, /*tp_clear*/ @@ -7241,188 +8459,19 @@ static PyTypeObject __pyx_type_8freenect_DevPtr = { #endif }; -static PyObject *__pyx_tp_new_8freenect_StatePtr(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - return o; -} - -static void __pyx_tp_dealloc_8freenect_StatePtr(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_8freenect_StatePtr[] = { - {__Pyx_NAMESTR("_get_accelx"), (PyCFunction)__pyx_pf_8freenect_8StatePtr_1_get_accelx, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_accely"), (PyCFunction)__pyx_pf_8freenect_8StatePtr_2_get_accely, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_accelz"), (PyCFunction)__pyx_pf_8freenect_8StatePtr_3_get_accelz, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_tilt_angle"), (PyCFunction)__pyx_pf_8freenect_8StatePtr_4_get_tilt_angle, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_tilt_status"), (PyCFunction)__pyx_pf_8freenect_8StatePtr_5_get_tilt_status, METH_NOARGS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_StatePtr = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 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*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 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*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_StatePtr = { - 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_StatePtr = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_StatePtr = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_8freenect_StatePtr = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("freenect.StatePtr"), /*tp_name*/ - sizeof(struct __pyx_obj_8freenect_StatePtr), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8freenect_StatePtr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - __pyx_pf_8freenect_8StatePtr___repr__, /*tp_repr*/ - &__pyx_tp_as_number_StatePtr, /*tp_as_number*/ - &__pyx_tp_as_sequence_StatePtr, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_StatePtr, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_StatePtr, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_8freenect_StatePtr, /*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*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_8freenect_StatePtr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pf_8freenect_18init, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("open_device"), (PyCFunction)__pyx_pf_8freenect_19open_device, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pw_8freenect_37init, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("open_device"), (PyCFunction)__pyx_pw_8freenect_39open_device, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else PyModuleDef_HEAD_INIT, + #endif __Pyx_NAMESTR("freenect"), 0, /* m_doc */ -1, /* m_size */ @@ -7446,13 +8495,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0}, {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, - {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0}, + {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0}, {&__pyx_n_s__DEPTH_10BIT, __pyx_k__DEPTH_10BIT, sizeof(__pyx_k__DEPTH_10BIT), 0, 0, 1, 1}, {&__pyx_n_s__DEPTH_10BIT_PACKED, __pyx_k__DEPTH_10BIT_PACKED, sizeof(__pyx_k__DEPTH_10BIT_PACKED), 0, 0, 1, 1}, {&__pyx_n_s__DEPTH_11BIT, __pyx_k__DEPTH_11BIT, sizeof(__pyx_k__DEPTH_11BIT), 0, 0, 1, 1}, {&__pyx_n_s__DEPTH_11BIT_PACKED, __pyx_k__DEPTH_11BIT_PACKED, sizeof(__pyx_k__DEPTH_11BIT_PACKED), 0, 0, 1, 1}, + {&__pyx_n_s__DEPTH_MM, __pyx_k__DEPTH_MM, sizeof(__pyx_k__DEPTH_MM), 0, 0, 1, 1}, + {&__pyx_n_s__DEPTH_REGISTERED, __pyx_k__DEPTH_REGISTERED, sizeof(__pyx_k__DEPTH_REGISTERED), 0, 0, 1, 1}, {&__pyx_n_s__DEVICE_AUDIO, __pyx_k__DEVICE_AUDIO, sizeof(__pyx_k__DEVICE_AUDIO), 0, 0, 1, 1}, {&__pyx_n_s__DEVICE_CAMERA, __pyx_k__DEVICE_CAMERA, sizeof(__pyx_k__DEVICE_CAMERA), 0, 0, 1, 1}, {&__pyx_n_s__DEVICE_MOTOR, __pyx_k__DEVICE_MOTOR, sizeof(__pyx_k__DEVICE_MOTOR), 0, 0, 1, 1}, @@ -7475,36 +8527,43 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__VIDEO_YUV_RAW, __pyx_k__VIDEO_YUV_RAW, sizeof(__pyx_k__VIDEO_YUV_RAW), 0, 0, 1, 1}, {&__pyx_n_s__VIDEO_YUV_RGB, __pyx_k__VIDEO_YUV_RGB, sizeof(__pyx_k__VIDEO_YUV_RGB), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1}, + {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1}, + {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___depth_cb, __pyx_k___depth_cb, sizeof(__pyx_k___depth_cb), 0, 0, 1, 1}, {&__pyx_n_s___depth_cb_np, __pyx_k___depth_cb_np, sizeof(__pyx_k___depth_cb_np), 0, 0, 1, 1}, + {&__pyx_n_s___format, __pyx_k___format, sizeof(__pyx_k___format), 0, 0, 1, 1}, {&__pyx_n_s___get_accelx, __pyx_k___get_accelx, sizeof(__pyx_k___get_accelx), 0, 0, 1, 1}, {&__pyx_n_s___get_accely, __pyx_k___get_accely, sizeof(__pyx_k___get_accely), 0, 0, 1, 1}, {&__pyx_n_s___get_accelz, __pyx_k___get_accelz, sizeof(__pyx_k___get_accelz), 0, 0, 1, 1}, {&__pyx_n_s___get_tilt_angle, __pyx_k___get_tilt_angle, sizeof(__pyx_k___get_tilt_angle), 0, 0, 1, 1}, {&__pyx_n_s___get_tilt_status, __pyx_k___get_tilt_status, sizeof(__pyx_k___get_tilt_status), 0, 0, 1, 1}, - {&__pyx_n_s___ptr, __pyx_k___ptr, sizeof(__pyx_k___ptr), 0, 0, 1, 1}, + {&__pyx_n_s___index, __pyx_k___index, sizeof(__pyx_k___index), 0, 0, 1, 1}, {&__pyx_n_s___video_cb, __pyx_k___video_cb, sizeof(__pyx_k___video_cb), 0, 0, 1, 1}, {&__pyx_n_s___video_cb_np, __pyx_k___video_cb_np, sizeof(__pyx_k___video_cb_np), 0, 0, 1, 1}, {&__pyx_n_s__accelerometer_x, __pyx_k__accelerometer_x, sizeof(__pyx_k__accelerometer_x), 0, 0, 1, 1}, {&__pyx_n_s__accelerometer_y, __pyx_k__accelerometer_y, sizeof(__pyx_k__accelerometer_y), 0, 0, 1, 1}, {&__pyx_n_s__accelerometer_z, __pyx_k__accelerometer_z, sizeof(__pyx_k__accelerometer_z), 0, 0, 1, 1}, {&__pyx_n_s__angle, __pyx_k__angle, sizeof(__pyx_k__angle), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, {&__pyx_n_s__base_runloop, __pyx_k__base_runloop, sizeof(__pyx_k__base_runloop), 0, 0, 1, 1}, {&__pyx_n_s__body, __pyx_k__body, sizeof(__pyx_k__body), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__cb, __pyx_k__cb, sizeof(__pyx_k__cb), 0, 0, 1, 1}, {&__pyx_n_s__close_device, __pyx_k__close_device, sizeof(__pyx_k__close_device), 0, 0, 1, 1}, {&__pyx_n_s__ctx, __pyx_k__ctx, sizeof(__pyx_k__ctx), 0, 0, 1, 1}, + {&__pyx_n_s__ctxp, __pyx_k__ctxp, sizeof(__pyx_k__ctxp), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__depth, __pyx_k__depth, sizeof(__pyx_k__depth), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, {&__pyx_n_s__dev, __pyx_k__dev, sizeof(__pyx_k__dev), 0, 0, 1, 1}, + {&__pyx_n_s__devp, __pyx_k__devp, sizeof(__pyx_k__devp), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, {&__pyx_n_s__error_open_device, __pyx_k__error_open_device, sizeof(__pyx_k__error_open_device), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__freenect, __pyx_k__freenect, sizeof(__pyx_k__freenect), 0, 0, 1, 1}, {&__pyx_n_s__fromstring, __pyx_k__fromstring, sizeof(__pyx_k__fromstring), 0, 0, 1, 1}, @@ -7513,19 +8572,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__get_tilt_degs, __pyx_k__get_tilt_degs, sizeof(__pyx_k__get_tilt_degs), 0, 0, 1, 1}, {&__pyx_n_s__get_tilt_state, __pyx_k__get_tilt_state, sizeof(__pyx_k__get_tilt_state), 0, 0, 1, 1}, {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__mdev, __pyx_k__mdev, sizeof(__pyx_k__mdev), 0, 0, 1, 1}, {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__num_devices, __pyx_k__num_devices, sizeof(__pyx_k__num_devices), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__option, __pyx_k__option, sizeof(__pyx_k__option), 0, 0, 1, 1}, + {&__pyx_n_s__out, __pyx_k__out, sizeof(__pyx_k__out), 0, 0, 1, 1}, + {&__pyx_n_s__print, __pyx_k__print, sizeof(__pyx_k__print), 0, 0, 1, 1}, {&__pyx_n_s__process_events, __pyx_k__process_events, sizeof(__pyx_k__process_events), 0, 0, 1, 1}, {&__pyx_n_s__property, __pyx_k__property, sizeof(__pyx_k__property), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, {&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1}, {&__pyx_n_s__resize, __pyx_k__resize, sizeof(__pyx_k__resize), 0, 0, 1, 1}, {&__pyx_n_s__runloop, __pyx_k__runloop, sizeof(__pyx_k__runloop), 0, 0, 1, 1}, @@ -7535,175 +8592,456 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__set_tilt_degs, __pyx_k__set_tilt_degs, sizeof(__pyx_k__set_tilt_degs), 0, 0, 1, 1}, {&__pyx_n_s__set_video_callback, __pyx_k__set_video_callback, sizeof(__pyx_k__set_video_callback), 0, 0, 1, 1}, {&__pyx_n_s__set_video_mode, __pyx_k__set_video_mode, sizeof(__pyx_k__set_video_mode), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__shutdown, __pyx_k__shutdown, sizeof(__pyx_k__shutdown), 0, 0, 1, 1}, {&__pyx_n_s__start_depth, __pyx_k__start_depth, sizeof(__pyx_k__start_depth), 0, 0, 1, 1}, {&__pyx_n_s__start_video, __pyx_k__start_video, sizeof(__pyx_k__start_video), 0, 0, 1, 1}, + {&__pyx_n_s__state, __pyx_k__state, sizeof(__pyx_k__state), 0, 0, 1, 1}, + {&__pyx_n_s__state_out, __pyx_k__state_out, sizeof(__pyx_k__state_out), 0, 0, 1, 1}, {&__pyx_n_s__stop_depth, __pyx_k__stop_depth, sizeof(__pyx_k__stop_depth), 0, 0, 1, 1}, {&__pyx_n_s__stop_video, __pyx_k__stop_video, sizeof(__pyx_k__stop_video), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, {&__pyx_n_s__sync_get_depth, __pyx_k__sync_get_depth, sizeof(__pyx_k__sync_get_depth), 0, 0, 1, 1}, {&__pyx_n_s__sync_get_video, __pyx_k__sync_get_video, sizeof(__pyx_k__sync_get_video), 0, 0, 1, 1}, {&__pyx_n_s__sync_stop, __pyx_k__sync_stop, sizeof(__pyx_k__sync_stop), 0, 0, 1, 1}, {&__pyx_n_s__tilt_angle, __pyx_k__tilt_angle, sizeof(__pyx_k__tilt_angle), 0, 0, 1, 1}, {&__pyx_n_s__tilt_status, __pyx_k__tilt_status, sizeof(__pyx_k__tilt_status), 0, 0, 1, 1}, {&__pyx_n_s__timestamp, __pyx_k__timestamp, sizeof(__pyx_k__timestamp), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, {&__pyx_n_s__uint16, __pyx_k__uint16, sizeof(__pyx_k__uint16), 0, 0, 1, 1}, {&__pyx_n_s__uint8, __pyx_k__uint8, sizeof(__pyx_k__uint8), 0, 0, 1, 1}, {&__pyx_n_s__update_tilt_state, __pyx_k__update_tilt_state, sizeof(__pyx_k__update_tilt_state), 0, 0, 1, 1}, {&__pyx_n_s__video, __pyx_k__video, sizeof(__pyx_k__video), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_property = __Pyx_GetName(__pyx_b, __pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "freenect.pyx":435 + /* "freenect.pyx":442 * """ * data = np.fromstring(string, dtype=np.uint16) * data.resize((480, 640)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_k_tuple_5 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); - __Pyx_INCREF(__pyx_int_480); - PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_int_480); - __Pyx_GIVEREF(__pyx_int_480); - __Pyx_INCREF(__pyx_int_640); - PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, __pyx_int_640); - __Pyx_GIVEREF(__pyx_int_640); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); - __Pyx_INCREF(((PyObject *)__pyx_k_tuple_5)); - PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_k_tuple_5)); + __pyx_k_tuple_5 = PyTuple_Pack(2, __pyx_int_480, __pyx_int_640); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_k_tuple_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "freenect.pyx":451 + /* "freenect.pyx":458 * """ * data = np.fromstring(string, dtype=np.uint8) * data.resize((480, 640, 3)) # <<<<<<<<<<<<<< * return dev, data, timestamp * */ - __pyx_k_tuple_7 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); - __Pyx_INCREF(__pyx_int_480); - PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, __pyx_int_480); - __Pyx_GIVEREF(__pyx_int_480); - __Pyx_INCREF(__pyx_int_640); - PyTuple_SET_ITEM(__pyx_k_tuple_7, 1, __pyx_int_640); - __Pyx_GIVEREF(__pyx_int_640); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_k_tuple_7, 2, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); - __Pyx_INCREF(((PyObject *)__pyx_k_tuple_7)); - PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_k_tuple_7)); + __pyx_k_tuple_7 = PyTuple_Pack(3, __pyx_int_480, __pyx_int_640, __pyx_int_3); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_k_tuple_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":206 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); - PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - /* "numpy.pxd":210 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); - PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); + __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); - /* "numpy.pxd":248 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); - PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - /* "numpy.pxd":787 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); - PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); + __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - /* "numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); - PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_16)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "numpy.pxd":811 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_22)); - PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_22)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22)); + __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_22)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + + /* "freenect.pyx":206 + * tilt_status = property(_get_tilt_status) + * + * def set_depth_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< + * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) + * + */ + __pyx_k_tuple_26 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__res), ((PyObject *)__pyx_n_s__mode)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__set_depth_mode, 206, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":209 + * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) + * + * def set_video_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< + * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) + * + */ + __pyx_k_tuple_29 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__res), ((PyObject *)__pyx_n_s__mode)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_29); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__set_video_mode, 209, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":212 + * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) + * + * def start_depth(DevPtr dev): # <<<<<<<<<<<<<< + * return freenect_start_depth(dev._ptr) + * + */ + __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__start_depth, 212, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":215 + * return freenect_start_depth(dev._ptr) + * + * def start_video(DevPtr dev): # <<<<<<<<<<<<<< + * return freenect_start_video(dev._ptr) + * + */ + __pyx_k_tuple_33 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_33); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + __pyx_k_codeobj_34 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__start_video, 215, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":218 + * return freenect_start_video(dev._ptr) + * + * def stop_depth(DevPtr dev): # <<<<<<<<<<<<<< + * return freenect_stop_depth(dev._ptr) + * + */ + __pyx_k_tuple_35 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_35); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__stop_depth, 218, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":221 + * return freenect_stop_depth(dev._ptr) + * + * def stop_video(DevPtr dev): # <<<<<<<<<<<<<< + * return freenect_stop_video(dev._ptr) + * + */ + __pyx_k_tuple_37 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_37); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__stop_video, 221, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":224 + * return freenect_stop_video(dev._ptr) + * + * def shutdown(CtxPtr ctx): # <<<<<<<<<<<<<< + * return freenect_shutdown(ctx._ptr) + * + */ + __pyx_k_tuple_39 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ctx)); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_39); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + __pyx_k_codeobj_40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__shutdown, 224, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":227 + * return freenect_shutdown(ctx._ptr) + * + * def process_events(CtxPtr ctx): # <<<<<<<<<<<<<< + * return freenect_process_events(ctx._ptr) + * + */ + __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ctx)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_k_codeobj_42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__process_events, 227, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":230 + * return freenect_process_events(ctx._ptr) + * + * def num_devices(CtxPtr ctx): # <<<<<<<<<<<<<< + * return freenect_num_devices(ctx._ptr) + * + */ + __pyx_k_tuple_43 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ctx)); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_43); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); + __pyx_k_codeobj_44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__num_devices, 230, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":233 + * return freenect_num_devices(ctx._ptr) + * + * def close_device(DevPtr dev): # <<<<<<<<<<<<<< + * return freenect_close_device(dev._ptr) + * + */ + __pyx_k_tuple_45 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_45); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); + __pyx_k_codeobj_46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__close_device, 233, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":236 + * return freenect_close_device(dev._ptr) + * + * def set_tilt_degs(DevPtr dev, float angle): # <<<<<<<<<<<<<< + * freenect_set_tilt_degs(dev._ptr, angle) + * + */ + __pyx_k_tuple_47 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__angle)); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_47); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); + __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__set_tilt_degs, 236, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":239 + * freenect_set_tilt_degs(dev._ptr, angle) + * + * def set_led(DevPtr dev, freenect_led_options option): # <<<<<<<<<<<<<< + * return freenect_set_led(dev._ptr, option) + * + */ + __pyx_k_tuple_49 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__option)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_49); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__set_led, 239, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":242 + * return freenect_set_led(dev._ptr, option) + * + * def update_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< + * return freenect_update_tilt_state(dev._ptr) + * + */ + __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_51); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); + __pyx_k_codeobj_52 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__update_tilt_state, 242, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":245 + * return freenect_update_tilt_state(dev._ptr) + * + * def get_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< + * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) + * cdef StatePtr state_out + */ + __pyx_k_tuple_53 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__state), ((PyObject *)__pyx_n_s__state_out)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_53); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); + __pyx_k_codeobj_54 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__get_tilt_state, 245, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":252 + * return state_out + * + * def get_mks_accel(StatePtr state): # <<<<<<<<<<<<<< + * cdef double x, y, z + * freenect_get_mks_accel(state._ptr, &x, &y, &z) + */ + __pyx_k_tuple_55 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__state), ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__y), ((PyObject *)__pyx_n_s__z)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_55); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); + __pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__get_mks_accel, 252, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":257 + * return x, y, z + * + * def get_accel(DevPtr dev): # <<<<<<<<<<<<<< + * """MKS Accelerometer helper + * + */ + __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dev)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_57); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); + __pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__get_accel, 257, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":270 + * + * + * def get_tilt_degs(StatePtr state): # <<<<<<<<<<<<<< + * return freenect_get_tilt_degs(state._ptr) + * + */ + __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__state)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_59); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); + __pyx_k_codeobj_60 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__get_tilt_degs, 270, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":274 + * + * + * def error_open_device(): # <<<<<<<<<<<<<< + * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") + * + */ + __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__error_open_device, 274, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":319 + * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) + * + * def set_depth_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _depth_cb + * if cb is not None: + */ + __pyx_k_tuple_62 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__cb)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_62); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); + __pyx_k_codeobj_63 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__set_depth_callback, 319, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":328 + * freenect_set_depth_callback(dev._ptr, NULL) + * + * def set_video_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< + * global _video_cb + * if cb is not None: + */ + __pyx_k_tuple_64 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__cb)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_64); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); + __pyx_k_codeobj_65 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__set_video_callback, 328, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":342 + * + * + * def runloop(depth=None, video=None, body=None, dev=None): # <<<<<<<<<<<<<< + * """Sets up the kinect and maintains a runloop + * + */ + __pyx_k_tuple_67 = PyTuple_Pack(8, ((PyObject *)__pyx_n_s__depth), ((PyObject *)__pyx_n_s__video), ((PyObject *)__pyx_n_s__body), ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__mdev), ((PyObject *)__pyx_n_s__ctx), ((PyObject *)__pyx_n_s__devp), ((PyObject *)__pyx_n_s__ctxp)); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_67); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); + __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__runloop, 342, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":406 + * freenect_shutdown(ctxp) + * + * def base_runloop(CtxPtr ctx, body=None): # <<<<<<<<<<<<<< + * """Starts a runloop + * + */ + __pyx_k_tuple_69 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__ctx), ((PyObject *)__pyx_n_s__body), ((PyObject *)__pyx_n_s__ctxp)); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_69); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); + __pyx_k_codeobj_70 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__base_runloop, 406, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":430 + * pass + * + * def _depth_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< + * """Converts the raw depth data into a numpy array for your function + * + */ + __pyx_k_tuple_71 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__string), ((PyObject *)__pyx_n_s__timestamp), ((PyObject *)__pyx_n_s__data)); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_71); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71)); + __pyx_k_codeobj_72 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s___depth_cb_np, 430, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":446 + * + * + * def _video_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< + * """Converts the raw depth data into a numpy array for your function + * + */ + __pyx_k_tuple_73 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__dev), ((PyObject *)__pyx_n_s__string), ((PyObject *)__pyx_n_s__timestamp), ((PyObject *)__pyx_n_s__data)); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_73); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73)); + __pyx_k_codeobj_74 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s___video_cb_np, 446, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":463 + * import_array() + * + * def sync_get_depth(index=0, format=DEPTH_11BIT): # <<<<<<<<<<<<<< + * """Get the next available depth frame from the kinect, as a numpy array. + * + */ + __pyx_k_tuple_75 = PyTuple_Pack(8, ((PyObject *)__pyx_n_s__index), ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__timestamp), ((PyObject *)__pyx_n_s__dims), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s___index), ((PyObject *)__pyx_n_s___format)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_75); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); + __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__sync_get_depth, 463, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":493 + * + * + * def sync_get_video(index=0, format=VIDEO_RGB): # <<<<<<<<<<<<<< + * """Get the next available rgb frame from the kinect, as a numpy array. + * + */ + __pyx_k_tuple_77 = PyTuple_Pack(8, ((PyObject *)__pyx_n_s__index), ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__timestamp), ((PyObject *)__pyx_n_s__dims), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s___index), ((PyObject *)__pyx_n_s___format)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_77); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); + __pyx_k_codeobj_78 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__sync_get_video, 493, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "freenect.pyx":526 + * + * + * def sync_stop(): # <<<<<<<<<<<<<< + * """Terminate the synchronous runloop if running, else this is a NOP + * """ + */ + __pyx_k_codeobj_79 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__sync_stop, 526, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7734,8 +9072,11 @@ PyMODINIT_FUNC PyInit_freenect(void) PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -7743,12 +9084,19 @@ PyMODINIT_FUNC PyInit_freenect(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_freenect(void)", __LINE__, __FILE__); #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_freenect(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -7759,19 +9107,31 @@ PyMODINIT_FUNC PyInit_freenect(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("freenect"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("freenect"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "freenect")) { + if (unlikely(PyDict_SetItemString(modules, "freenect", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif if (__pyx_module_is_main_freenect) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } @@ -7780,23 +9140,32 @@ PyMODINIT_FUNC PyInit_freenect(void) /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "CtxPtr", (PyObject *)&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "CtxPtr", (PyObject *)&__pyx_type_8freenect_CtxPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8freenect_CtxPtr = &__pyx_type_8freenect_CtxPtr; - if (PyType_Ready(&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "DevPtr", (PyObject *)&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8freenect_DevPtr = &__pyx_type_8freenect_DevPtr; - if (PyType_Ready(&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "StatePtr", (PyObject *)&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "StatePtr", (PyObject *)&__pyx_type_8freenect_StatePtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8freenect_StatePtr = &__pyx_type_8freenect_StatePtr; + if (PyType_Ready(&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "DevPtr", (PyObject *)&__pyx_type_8freenect_DevPtr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8freenect_DevPtr = &__pyx_type_8freenect_DevPtr; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -7807,609 +9176,633 @@ PyMODINIT_FUNC PyInit_freenect(void) * cimport numpy as npc * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":140 + /* "freenect.pyx":142 * * * VIDEO_RGB = FREENECT_VIDEO_RGB # <<<<<<<<<<<<<< * VIDEO_BAYER = FREENECT_VIDEO_BAYER * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__VIDEO_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":141 + /* "freenect.pyx":143 * * VIDEO_RGB = FREENECT_VIDEO_RGB * VIDEO_BAYER = FREENECT_VIDEO_BAYER # <<<<<<<<<<<<<< * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_BAYER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_BAYER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_BAYER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__VIDEO_BAYER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":142 + /* "freenect.pyx":144 * VIDEO_RGB = FREENECT_VIDEO_RGB * VIDEO_BAYER = FREENECT_VIDEO_BAYER * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT # <<<<<<<<<<<<<< * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_8BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_8BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_IR_8BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__VIDEO_IR_8BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":143 + /* "freenect.pyx":145 * VIDEO_BAYER = FREENECT_VIDEO_BAYER * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT # <<<<<<<<<<<<<< * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_IR_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__VIDEO_IR_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":144 + /* "freenect.pyx":146 * VIDEO_IR_8BIT = FREENECT_VIDEO_IR_8BIT * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED # <<<<<<<<<<<<<< * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_IR_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_24, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":145 + /* "freenect.pyx":147 * VIDEO_IR_10BIT = FREENECT_VIDEO_IR_10BIT * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB # <<<<<<<<<<<<<< * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW * DEPTH_11BIT = FREENECT_DEPTH_11BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RGB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_YUV_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__VIDEO_YUV_RGB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":146 + /* "freenect.pyx":148 * VIDEO_IR_10BIT_PACKED = FREENECT_VIDEO_IR_10BIT_PACKED * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW # <<<<<<<<<<<<<< * DEPTH_11BIT = FREENECT_DEPTH_11BIT * DEPTH_10BIT = FREENECT_DEPTH_10BIT */ - __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_VIDEO_YUV_RAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VIDEO_YUV_RAW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__VIDEO_YUV_RAW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":147 + /* "freenect.pyx":149 * VIDEO_YUV_RGB = FREENECT_VIDEO_YUV_RGB * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW * DEPTH_11BIT = FREENECT_DEPTH_11BIT # <<<<<<<<<<<<<< * DEPTH_10BIT = FREENECT_DEPTH_10BIT * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_11BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEPTH_11BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":148 + /* "freenect.pyx":150 * VIDEO_YUV_RAW = FREENECT_VIDEO_YUV_RAW * DEPTH_11BIT = FREENECT_DEPTH_11BIT * DEPTH_10BIT = FREENECT_DEPTH_10BIT # <<<<<<<<<<<<<< * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEPTH_10BIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":149 + /* "freenect.pyx":151 * DEPTH_11BIT = FREENECT_DEPTH_11BIT * DEPTH_10BIT = FREENECT_DEPTH_10BIT * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED # <<<<<<<<<<<<<< * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED - * LED_OFF = FREENECT_LED_OFF + * DEPTH_REGISTERED = FREENECT_DEPTH_REGISTERED */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_11BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_11BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEPTH_11BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":150 + /* "freenect.pyx":152 * DEPTH_10BIT = FREENECT_DEPTH_10BIT * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED # <<<<<<<<<<<<<< - * LED_OFF = FREENECT_LED_OFF - * LED_GREEN = FREENECT_LED_GREEN + * DEPTH_REGISTERED = FREENECT_DEPTH_REGISTERED + * DEPTH_MM = FREENECT_DEPTH_MM */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_10BIT_PACKED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEPTH_10BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEPTH_10BIT_PACKED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":151 + /* "freenect.pyx":153 * DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED + * DEPTH_REGISTERED = FREENECT_DEPTH_REGISTERED # <<<<<<<<<<<<<< + * DEPTH_MM = FREENECT_DEPTH_MM + * LED_OFF = FREENECT_LED_OFF + */ + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_REGISTERED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEPTH_REGISTERED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "freenect.pyx":154 + * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED + * DEPTH_REGISTERED = FREENECT_DEPTH_REGISTERED + * DEPTH_MM = FREENECT_DEPTH_MM # <<<<<<<<<<<<<< + * LED_OFF = FREENECT_LED_OFF + * LED_GREEN = FREENECT_LED_GREEN + */ + __pyx_t_1 = PyInt_FromLong(FREENECT_DEPTH_MM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEPTH_MM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "freenect.pyx":155 + * DEPTH_REGISTERED = FREENECT_DEPTH_REGISTERED + * DEPTH_MM = FREENECT_DEPTH_MM * LED_OFF = FREENECT_LED_OFF # <<<<<<<<<<<<<< * LED_GREEN = FREENECT_LED_GREEN * LED_RED = FREENECT_LED_RED */ - __pyx_t_1 = PyInt_FromLong(LED_OFF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_OFF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_OFF, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LED_OFF, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":152 - * DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED + /* "freenect.pyx":156 + * DEPTH_MM = FREENECT_DEPTH_MM * LED_OFF = FREENECT_LED_OFF * LED_GREEN = FREENECT_LED_GREEN # <<<<<<<<<<<<<< * LED_RED = FREENECT_LED_RED * LED_YELLOW = FREENECT_LED_YELLOW */ - __pyx_t_1 = PyInt_FromLong(LED_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LED_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":153 + /* "freenect.pyx":157 * LED_OFF = FREENECT_LED_OFF * LED_GREEN = FREENECT_LED_GREEN * LED_RED = FREENECT_LED_RED # <<<<<<<<<<<<<< * LED_YELLOW = FREENECT_LED_YELLOW * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN */ - __pyx_t_1 = PyInt_FromLong(LED_RED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_RED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_RED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LED_RED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":154 + /* "freenect.pyx":158 * LED_GREEN = FREENECT_LED_GREEN * LED_RED = FREENECT_LED_RED * LED_YELLOW = FREENECT_LED_YELLOW # <<<<<<<<<<<<<< * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW */ - __pyx_t_1 = PyInt_FromLong(LED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_YELLOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LED_YELLOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":155 + /* "freenect.pyx":159 * LED_RED = FREENECT_LED_RED * LED_YELLOW = FREENECT_LED_YELLOW * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN # <<<<<<<<<<<<<< * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW */ - __pyx_t_1 = PyInt_FromLong(LED_BLINK_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_BLINK_GREEN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LED_BLINK_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__LED_BLINK_GREEN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":156 + /* "freenect.pyx":160 * LED_YELLOW = FREENECT_LED_YELLOW * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW # <<<<<<<<<<<<<< * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM */ - __pyx_t_1 = PyInt_FromLong(LED_BLINK_RED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(LED_BLINK_RED_YELLOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_25, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_25, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":157 + /* "freenect.pyx":161 * LED_BLINK_GREEN = FREENECT_LED_BLINK_GREEN * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW # <<<<<<<<<<<<<< * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH */ - __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_LOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_LOW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_LOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__RESOLUTION_LOW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":158 + /* "freenect.pyx":162 * LED_BLINK_RED_YELLOW = FREENECT_LED_BLINK_RED_YELLOW * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM # <<<<<<<<<<<<<< * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR */ - __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_MEDIUM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_MEDIUM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_MEDIUM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__RESOLUTION_MEDIUM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":159 + /* "freenect.pyx":163 * RESOLUTION_LOW = FREENECT_RESOLUTION_LOW * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH # <<<<<<<<<<<<<< * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA */ - __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_HIGH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_RESOLUTION_HIGH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RESOLUTION_HIGH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__RESOLUTION_HIGH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":160 + /* "freenect.pyx":164 * RESOLUTION_MEDIUM = FREENECT_RESOLUTION_MEDIUM * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR # <<<<<<<<<<<<<< * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA * DEVICE_AUDIO = FREENECT_DEVICE_AUDIO */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_MOTOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_MOTOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_MOTOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEVICE_MOTOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":161 + /* "freenect.pyx":165 * RESOLUTION_HIGH = FREENECT_RESOLUTION_HIGH * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA # <<<<<<<<<<<<<< * DEVICE_AUDIO = FREENECT_DEVICE_AUDIO * */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_CAMERA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_CAMERA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_CAMERA, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEVICE_CAMERA, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":162 + /* "freenect.pyx":166 * DEVICE_MOTOR = FREENECT_DEVICE_MOTOR * DEVICE_CAMERA = FREENECT_DEVICE_CAMERA * DEVICE_AUDIO = FREENECT_DEVICE_AUDIO # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_AUDIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(FREENECT_DEVICE_AUDIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEVICE_AUDIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__DEVICE_AUDIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":196 + /* "freenect.pyx":200 * return int(self._ptr.tilt_status) * * accelerometer_x = property(_get_accelx) # <<<<<<<<<<<<<< * accelerometer_y = property(_get_accely) * accelerometer_z = property(_get_accelz) */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_x, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_x, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":197 + /* "freenect.pyx":201 * * accelerometer_x = property(_get_accelx) * accelerometer_y = property(_get_accely) # <<<<<<<<<<<<<< * accelerometer_z = property(_get_accelz) * tilt_angle = property(_get_tilt_angle) */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accely); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accely); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_y, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_y, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":198 + /* "freenect.pyx":202 * accelerometer_x = property(_get_accelx) * accelerometer_y = property(_get_accely) * accelerometer_z = property(_get_accelz) # <<<<<<<<<<<<<< * tilt_angle = property(_get_tilt_angle) * tilt_status = property(_get_tilt_status) */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_accelz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_z, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__accelerometer_z, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":199 + /* "freenect.pyx":203 * accelerometer_y = property(_get_accely) * accelerometer_z = property(_get_accelz) * tilt_angle = property(_get_tilt_angle) # <<<<<<<<<<<<<< * tilt_status = property(_get_tilt_status) * */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_angle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_angle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_angle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":200 + /* "freenect.pyx":204 * accelerometer_z = property(_get_accelz) * tilt_angle = property(_get_tilt_angle) * tilt_status = property(_get_tilt_status) # <<<<<<<<<<<<<< * * def set_depth_mode(DevPtr dev, int res, int mode): */ - __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8freenect_StatePtr, __pyx_n_s___get_tilt_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_status, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8freenect_StatePtr->tp_dict, __pyx_n_s__tilt_status, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_8freenect_StatePtr); - /* "freenect.pyx":202 + /* "freenect.pyx":206 * tilt_status = property(_get_tilt_status) * * def set_depth_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_set_depth_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_1set_depth_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_depth_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_depth_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":205 + /* "freenect.pyx":209 * return freenect_set_depth_mode(dev._ptr, freenect_find_depth_mode(res, mode)) * * def set_video_mode(DevPtr dev, int res, int mode): # <<<<<<<<<<<<<< * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_1set_video_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_3set_video_mode, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_video_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_video_mode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":208 + /* "freenect.pyx":212 * return freenect_set_video_mode(dev._ptr, freenect_find_video_mode(res, mode)) * * def start_depth(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_start_depth(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_2start_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_5start_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__start_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__start_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":211 + /* "freenect.pyx":215 * return freenect_start_depth(dev._ptr) * * def start_video(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_start_video(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_3start_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_7start_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__start_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__start_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":214 + /* "freenect.pyx":218 * return freenect_start_video(dev._ptr) * * def stop_depth(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_stop_depth(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_4stop_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_9stop_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stop_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__stop_depth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":217 + /* "freenect.pyx":221 * return freenect_stop_depth(dev._ptr) * * def stop_video(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_stop_video(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_5stop_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_11stop_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stop_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__stop_video, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":220 + /* "freenect.pyx":224 * return freenect_stop_video(dev._ptr) * * def shutdown(CtxPtr ctx): # <<<<<<<<<<<<<< * return freenect_shutdown(ctx._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_6shutdown, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_13shutdown, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":223 + /* "freenect.pyx":227 * return freenect_shutdown(ctx._ptr) * * def process_events(CtxPtr ctx): # <<<<<<<<<<<<<< * return freenect_process_events(ctx._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_7process_events, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_15process_events, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__process_events, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__process_events, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":226 + /* "freenect.pyx":230 * return freenect_process_events(ctx._ptr) * * def num_devices(CtxPtr ctx): # <<<<<<<<<<<<<< * return freenect_num_devices(ctx._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_8num_devices, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_17num_devices, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__num_devices, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__num_devices, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":229 + /* "freenect.pyx":233 * return freenect_num_devices(ctx._ptr) * * def close_device(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_close_device(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_9close_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_19close_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__close_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__close_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":232 + /* "freenect.pyx":236 * return freenect_close_device(dev._ptr) * * def set_tilt_degs(DevPtr dev, float angle): # <<<<<<<<<<<<<< * freenect_set_tilt_degs(dev._ptr, angle) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_10set_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_21set_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":235 + /* "freenect.pyx":239 * freenect_set_tilt_degs(dev._ptr, angle) * * def set_led(DevPtr dev, freenect_led_options option): # <<<<<<<<<<<<<< * return freenect_set_led(dev._ptr, option) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_11set_led, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_23set_led, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_led, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_led, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":238 + /* "freenect.pyx":242 * return freenect_set_led(dev._ptr, option) * * def update_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< * return freenect_update_tilt_state(dev._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_12update_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_25update_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__update_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__update_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":241 + /* "freenect.pyx":245 * return freenect_update_tilt_state(dev._ptr) * * def get_tilt_state(DevPtr dev): # <<<<<<<<<<<<<< * cdef freenect_raw_tilt_state* state = freenect_get_tilt_state(dev._ptr) * cdef StatePtr state_out */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_13get_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_27get_tilt_state, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_tilt_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":248 + /* "freenect.pyx":252 * return state_out * * def get_mks_accel(StatePtr state): # <<<<<<<<<<<<<< * cdef double x, y, z * freenect_get_mks_accel(state._ptr, &x, &y, &z) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_14get_mks_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_29get_mks_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_mks_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_mks_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":253 + /* "freenect.pyx":257 * return x, y, z * * def get_accel(DevPtr dev): # <<<<<<<<<<<<<< * """MKS Accelerometer helper * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_15get_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_31get_accel, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_accel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":266 + /* "freenect.pyx":270 * * * def get_tilt_degs(StatePtr state): # <<<<<<<<<<<<<< * return freenect_get_tilt_degs(state._ptr) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_16get_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_33get_tilt_degs, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__get_tilt_degs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":270 + /* "freenect.pyx":274 * * * def error_open_device(): # <<<<<<<<<<<<<< * print("Error: Can't open device. 1.) is it plugged in? 2.) Read the README") * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_17error_open_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8freenect_35error_open_device, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__error_open_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__error_open_device, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "freenect.pyx":297 + /* "freenect.pyx":301 * return dev_out * * _depth_cb, _video_cb = None, None # <<<<<<<<<<<<<< @@ -8420,106 +9813,106 @@ PyMODINIT_FUNC PyInit_freenect(void) __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = Py_None; __Pyx_INCREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___depth_cb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___video_cb, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":315 + /* "freenect.pyx":319 * _video_cb(*_video_cb_np(dev_out, (data)[:nbytes], timestamp)) * * def set_depth_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< * global _depth_cb * if cb is not None: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_20set_depth_callback, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_41set_depth_callback, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_depth_callback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_depth_callback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":324 + /* "freenect.pyx":328 * freenect_set_depth_callback(dev._ptr, NULL) * * def set_video_callback(DevPtr dev, cb): # <<<<<<<<<<<<<< * global _video_cb * if cb is not None: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_21set_video_callback, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_43set_video_callback, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_video_callback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_video_callback, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":334 + /* "freenect.pyx":338 * * * class Kill(Exception): # <<<<<<<<<<<<<< * """This kills the runloop, raise from the body only""" * */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); - if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_26)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__Kill, __pyx_n_s__freenect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_66)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__Kill, __pyx_n_s__Kill, __pyx_n_s__freenect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Kill, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__Kill, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "freenect.pyx":338 + /* "freenect.pyx":342 * * * def runloop(depth=None, video=None, body=None, dev=None): # <<<<<<<<<<<<<< * """Sets up the kinect and maintains a runloop * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_22runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_45runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":399 + /* "freenect.pyx":406 * freenect_shutdown(ctxp) * * def base_runloop(CtxPtr ctx, body=None): # <<<<<<<<<<<<<< * """Starts a runloop * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_23base_runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_47base_runloop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__base_runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__base_runloop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":423 + /* "freenect.pyx":430 * pass * * def _depth_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< * """Converts the raw depth data into a numpy array for your function * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_24_depth_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_49_depth_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___depth_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___depth_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":439 + /* "freenect.pyx":446 * * * def _video_cb_np(dev, string, timestamp): # <<<<<<<<<<<<<< * """Converts the raw depth data into a numpy array for your function * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_25_video_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_51_video_cb_np, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___video_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s___video_cb_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":454 + /* "freenect.pyx":461 * return dev, data, timestamp * * import_array() # <<<<<<<<<<<<<< @@ -8528,50 +9921,50 @@ PyMODINIT_FUNC PyInit_freenect(void) */ import_array(); - /* "freenect.pyx":456 + /* "freenect.pyx":463 * import_array() * * def sync_get_depth(index=0, format=DEPTH_11BIT): # <<<<<<<<<<<<<< * """Get the next available depth frame from the kinect, as a numpy array. * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__DEPTH_11BIT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_9 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_26sync_get_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_53sync_get_depth, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_get_depth, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__sync_get_depth, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":486 + /* "freenect.pyx":493 * * * def sync_get_video(index=0, format=VIDEO_RGB): # <<<<<<<<<<<<<< * """Get the next available rgb frame from the kinect, as a numpy array. * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__VIDEO_RGB); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_11 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_27sync_get_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_55sync_get_video, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_get_video, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__sync_get_video, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "freenect.pyx":519 + /* "freenect.pyx":526 * * * def sync_stop(): # <<<<<<<<<<<<<< * """Terminate the synchronous runloop if running, else this is a NOP * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_28sync_stop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8freenect_57sync_stop, NULL, __pyx_n_s__freenect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sync_stop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__sync_stop, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "freenect.pyx":1 @@ -8581,10 +9974,10 @@ PyMODINIT_FUNC PyInit_freenect(void) */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "numpy.pxd":963 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -8597,7 +9990,7 @@ PyMODINIT_FUNC PyInit_freenect(void) __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - __Pyx_AddTraceback("init freenect"); + __Pyx_AddTraceback("init freenect", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init freenect"); @@ -8612,12 +10005,32 @@ PyMODINIT_FUNC PyInit_freenect(void) } /* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } return result; } @@ -8629,8 +10042,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -8641,14 +10053,10 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", - #endif - func_name, more_or_less, num_expected, number, num_found); + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( @@ -8660,7 +10068,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -8676,55 +10084,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; } + name++; } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -8763,22 +10193,27 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed return 0; } -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + return result; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -8788,77 +10223,112 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } } +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { 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; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; - } - #else - type = (PyObject*) Py_TYPE(type); + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -8867,10 +10337,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XDECREF(tb); return; } - #else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -8880,7 +10349,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -8889,14 +10357,58 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -8906,46 +10418,82 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; +} + +static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + result = __Pyx_PyObject_GetAttrStr(nmspace, name); + if (!result) + result = __Pyx_GetModuleGlobalName(name); + return result; } static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; @@ -8953,9 +10501,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif } - static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; @@ -8967,18 +10518,23 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); if (!py_import) goto bad; + #endif if (from_list) list = from_list; else { @@ -8993,22 +10549,68 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: - Py_XDECREF(empty_list); + #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { PyObject *metaclass; - /* Default metaclass */ #if PY_MAJOR_VERSION < 3 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); - metaclass = PyObject_GetAttrString(base, "__class__"); + metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__); if (!metaclass) { PyErr_Clear(); metaclass = (PyObject*) Py_TYPE(base); @@ -9029,15 +10631,14 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { } static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, - PyObject *modname) { + PyObject *qualname, PyObject *modname) { PyObject *result; PyObject *metaclass; - - if (PyDict_SetItemString(dict, "__module__", modname) < 0) + if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0) return NULL; - - /* Python2 __metaclass__ */ - metaclass = PyDict_GetItemString(dict, "__metaclass__"); + if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0) + return NULL; + metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__); if (metaclass) { Py_INCREF(metaclass); } else { @@ -9068,7 +10669,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int16_t(int16_t val) { } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(int16_t), + return _PyLong_FromByteArray(bytes, sizeof(int16_t), little, !is_unsigned); } } @@ -9093,12 +10694,12 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int8_t(int8_t val) { } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(int8_t), + return _PyLong_FromByteArray(bytes, sizeof(int8_t), little, !is_unsigned); } } -#if PY_MAJOR_VERSION < 3 +#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static PyObject *__Pyx_GetStdout(void) { PyObject *f = PySys_GetObject((char *)"stdout"); if (!f) { @@ -9106,23 +10707,22 @@ static PyObject *__Pyx_GetStdout(void) { } return f; } - static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - PyObject* v; int i; - if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } + Py_INCREF(f); for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + PyObject* v; if (PyFile_SoftSpace(f, 1)) { if (PyFile_WriteString(" ", f) < 0) - return -1; + goto error; } v = PyTuple_GET_ITEM(arg_tuple, i); if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - return -1; + goto error; if (PyString_Check(v)) { char *s = PyString_AsString(v); Py_ssize_t len = PyString_Size(v); @@ -9134,20 +10734,22 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { } if (newline) { if (PyFile_WriteString("\n", f) < 0) - return -1; + goto error; PyFile_SoftSpace(f, 0); } + Py_DECREF(f); return 0; +error: + Py_DECREF(f); + return -1; } - #else /* Python 3 has a print function */ - static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; PyObject* end_string; if (unlikely(!__pyx_print)) { - __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s__print); if (!__pyx_print) return -1; } @@ -9155,13 +10757,13 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { kwargs = PyDict_New(); if (unlikely(!kwargs)) return -1; - if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) + if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s__file, stream) < 0)) goto bad; if (!newline) { end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) goto bad; - if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { + if (PyDict_SetItem(kwargs, __pyx_n_s__end, end_string) < 0) { Py_DECREF(end_string); goto bad; } @@ -9175,7 +10777,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) return -1; - if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { + if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s__end, end_string) < 0) { Py_DECREF(end_string); return -1; } @@ -9195,44 +10797,42 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { Py_XDECREF(kwargs); return -1; } - #endif -#if PY_MAJOR_VERSION < 3 - +#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static int __Pyx_PrintOne(PyObject* f, PyObject *o) { if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } + Py_INCREF(f); if (PyFile_SoftSpace(f, 0)) { if (PyFile_WriteString(" ", f) < 0) - return -1; + goto error; } if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - return -1; + goto error; if (PyFile_WriteString("\n", f) < 0) - return -1; + goto error; + Py_DECREF(f); return 0; - /* the line below is just to avoid compiler - * compiler warnings about unused functions */ +error: + Py_DECREF(f); + return -1; + /* the line below is just to avoid C compiler + * warnings about unused functions */ return __Pyx_Print(f, NULL, 0); } - #else /* Python 3 has a print function */ - static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { int res; - PyObject* arg_tuple = PyTuple_New(1); + PyObject* arg_tuple = PyTuple_Pack(1, o); if (unlikely(!arg_tuple)) return -1; - Py_INCREF(o); - PyTuple_SET_ITEM(arg_tuple, 0, o); res = __Pyx_Print(stream, arg_tuple, 1); Py_DECREF(arg_tuple); return res; } - #endif static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { @@ -9255,7 +10855,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), little, !is_unsigned); } } @@ -9690,10 +11290,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { return (int)__Pyx_PyInt_AsLong(x); } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { @@ -9706,14 +11311,35 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -9725,10 +11351,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { } } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { @@ -9741,14 +11372,35 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -9760,10 +11412,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje } } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { @@ -9776,14 +11433,35 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); } } else { long val; @@ -9795,10 +11473,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { } } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { @@ -9811,14 +11494,35 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -9830,10 +11534,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { } } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { @@ -9846,14 +11555,35 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -9865,10 +11595,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { } } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { @@ -9881,14 +11616,35 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -9900,42 +11656,59 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; } +#endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -9951,17 +11724,29 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); + if (PyErr_Warn(NULL, warning) < 0) goto bad; #else - PyErr_WarnEx(NULL, warning, 0); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { + else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -9971,54 +11756,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -10029,28 +11869,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -10058,11 +11915,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -10097,26 +11952,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } -/* Type Conversion Functions */ - +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } - static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); @@ -10132,7 +12043,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } #endif if (res) { -#if PY_VERSION_HEX < 0x03000000 +#if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { @@ -10150,7 +12061,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } return res; } - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); @@ -10159,7 +12069,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } - static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) @@ -10173,14 +12082,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); #endif } - static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { - return (size_t)-1; - } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val;