/* Generated by Cython 0.15 on Mon Aug  8 15:45:10 2011 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #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)
#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 PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#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_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#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
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#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_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#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)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#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)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (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))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #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))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#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 <math.h>
#define __PYX_HAVE__pysdif___pysdif
#define __PYX_HAVE_API__pysdif___pysdif
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "sdif.h"
#ifdef _OPENMP
#include <omp.h>
#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))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   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))

#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*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#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 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
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
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #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[] = {
  "_pysdif.pyx",
  "numpy.pxd",
};

/* "numpy.pxd":719
 * # 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":720
 * 
 * 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":721
 * 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":722
 * 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":726
 * #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":727
 * 
 * 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":728
 * 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":729
 * 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":733
 * #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":734
 * 
 * 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":743
 * # 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":744
 * # 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;

/* "numpy.pxd":745
 * 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":747
 * 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":748
 * 
 * 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":749
 * 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":751
 * 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":752
 * 
 * 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":754
 * 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":755
 * 
 * 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":756
 * 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;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif

/*--- Type declarations ---*/
struct __pyx_obj_6pysdif_7_pysdif_StreamID;
struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition;
struct __pyx_obj_6pysdif_7_pysdif_Matrix;
struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition;
struct __pyx_obj_6pysdif_7_pysdif_Component;
struct __pyx_obj_6pysdif_7_pysdif_FrameR;
struct __pyx_obj_6pysdif_7_pysdif_SdifFile;
struct __pyx_obj_6pysdif_7_pysdif_FrameW;

/* "numpy.pxd":758
 * 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":759
 * 
 * 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":760
 * 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":762
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_6pysdif_7_pysdif_FrameW_new;

/* "pysdif/_pysdif.pyx":362
 * 
 * # enums to keep state of reading
 * cdef enum MatrixStatusE:             # <<<<<<<<<<<<<<
 *     eMatrixInvalid,
 *     eMatrixNothingRead,
 */
enum __pyx_t_6pysdif_7_pysdif_MatrixStatusE {
  __pyx_e_6pysdif_7_pysdif_eMatrixInvalid,
  __pyx_e_6pysdif_7_pysdif_eMatrixNothingRead,
  __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead,
  __pyx_e_6pysdif_7_pysdif_eMatrixDataRead,
  __pyx_e_6pysdif_7_pysdif_eMatrixDataSkipped,
  __pyx_e_6pysdif_7_pysdif_eMatrixOffline
};

/* "pysdif/_pysdif.pyx":370
 *     eMatrixOffline
 * 
 * cdef enum FrameStatusE:             # <<<<<<<<<<<<<<
 *     eFrameInvalid,
 *     eFrameNothingRead,
 */
enum __pyx_t_6pysdif_7_pysdif_FrameStatusE {
  __pyx_e_6pysdif_7_pysdif_eFrameInvalid,
  __pyx_e_6pysdif_7_pysdif_eFrameNothingRead,
  __pyx_e_6pysdif_7_pysdif_eFrameHeaderRead,
  __pyx_e_6pysdif_7_pysdif_eFrameSomeDataRead,
  __pyx_e_6pysdif_7_pysdif_eFrameAllDataRead,
  __pyx_e_6pysdif_7_pysdif_eFrameSignatureRead
};

/* "pysdif/_pysdif.pyx":378
 *     eFrameSignatureRead
 * 
 * cdef enum SdifStatusE:             # <<<<<<<<<<<<<<
 *     eSdifNothing,
 *     eSdifGeneralHeader,
 */
enum __pyx_t_6pysdif_7_pysdif_SdifStatusE {
  __pyx_e_6pysdif_7_pysdif_eSdifNothing,
  __pyx_e_6pysdif_7_pysdif_eSdifGeneralHeader,
  __pyx_e_6pysdif_7_pysdif_eSdifAllASCIIChunks,
  __pyx_e_6pysdif_7_pysdif_eSdifSignature,
  __pyx_e_6pysdif_7_pysdif_eSdifFrameHeader,
  __pyx_e_6pysdif_7_pysdif_eSdifMatrixHeader,
  __pyx_e_6pysdif_7_pysdif_eSdifMatrixData
};

/* "pysdif/_pysdif.pyx":647
 *         self.sdiffile.write_status = eSdifMatrixData
 * 
 * cdef FrameW FrameW_new(SdifFile sdiffile, SdifSignature sig, SdifFloat8 time, SdifUInt4 streamID=0):             # <<<<<<<<<<<<<<
 *     cdef FrameW f = FrameW()
 *     f.sdiffile = sdiffile
 */
struct __pyx_opt_args_6pysdif_7_pysdif_FrameW_new {
  int __pyx_n;
  SdifUInt4 streamID;
};

/* "pysdif/_pysdif.pyx":184
 *     return streams
 * 
 * cdef class StreamID:             # <<<<<<<<<<<<<<
 *     cdef SdifStreamIDT *this
 *     cdef int own_this
 */
struct __pyx_obj_6pysdif_7_pysdif_StreamID {
  PyObject_HEAD
  SdifStreamIDT *this;
  int own_this;
};


/* "pysdif/_pysdif.pyx":233
 *     return ft
 * 
 * cdef class MatrixTypeDefinition:             # <<<<<<<<<<<<<<
 *     cdef public object signature
 *     cdef public list column_names
 */
struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pysdif_7_pysdif_MatrixTypeDefinition *__pyx_vtab;
  PyObject *signature;
  PyObject *column_names;
};


/* "pysdif/_pysdif.pyx":389
 * # -----------------------------------------------------------------------------------------------
 * 
 * cdef class Matrix:             # <<<<<<<<<<<<<<
 *     """
 *     Matrix is only a placeholder class to
 */
struct __pyx_obj_6pysdif_7_pysdif_Matrix {
  PyObject_HEAD
  SdifFileT *source_this;
  SdifSignature _signature;
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *source;
  enum __pyx_t_6pysdif_7_pysdif_MatrixStatusE status;
  PyArrayObject *data;
};


/* "pysdif/_pysdif.pyx":308
 *     return out
 * 
 * cdef class FrameTypeDefinition:             # <<<<<<<<<<<<<<
 *     cdef public str signature
 *     cdef public list components
 */
struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition {
  PyObject_HEAD
  PyObject *signature;
  PyObject *components;
};


/* "pysdif/_pysdif.pyx":272
 *     return out
 * 
 * cdef class Component:             # <<<<<<<<<<<<<<
 *     cdef readonly str signature
 *     cdef readonly str name
 */
struct __pyx_obj_6pysdif_7_pysdif_Component {
  PyObject_HEAD
  PyObject *signature;
  PyObject *name;
  unsigned int num;
};


/* "pysdif/_pysdif.pyx":358
 * 
 * # Forward declarations
 * cdef class FrameR             # <<<<<<<<<<<<<<
 * cdef class SdifFile
 * 
 */
struct __pyx_obj_6pysdif_7_pysdif_FrameR {
  PyObject_HEAD
  SdifFrameHeaderT *header;
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *source;
  SdifFileT *source_this;
};


/* "pysdif/_pysdif.pyx":359
 * # Forward declarations
 * cdef class FrameR
 * cdef class SdifFile             # <<<<<<<<<<<<<<
 * 
 * # enums to keep state of reading
 */
struct __pyx_obj_6pysdif_7_pysdif_SdifFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *__pyx_vtab;
  SdifFileT *this;
  int eof;
  struct __pyx_obj_6pysdif_7_pysdif_FrameR *frame;
  struct __pyx_obj_6pysdif_7_pysdif_Matrix *matrix;
  enum __pyx_t_6pysdif_7_pysdif_FrameStatusE frame_status;
  size_t matrix_idx;
  enum __pyx_t_6pysdif_7_pysdif_MatrixStatusE matrix_status;
  enum __pyx_t_6pysdif_7_pysdif_SdifStatusE write_status;
};


/* "pysdif/_pysdif.pyx":583
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)
 * 
 * cdef class FrameW:             # <<<<<<<<<<<<<<
 *     """
 *     FrameW : class to write frames to a SdifFile
 */
struct __pyx_obj_6pysdif_7_pysdif_FrameW {
  PyObject_HEAD
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *sdiffile;
  SdifSignature signature;
  SdifFloat8 time;
  SdifUInt4 streamID;
  PyObject *matrices;
  PyObject *signatures;
  SdifUInt4 frame_size;
  SdifUInt4 num_matrices;
};



/* "pysdif/_pysdif.pyx":233
 *     return ft
 * 
 * cdef class MatrixTypeDefinition:             # <<<<<<<<<<<<<<
 *     cdef public object signature
 *     cdef public list column_names
 */

struct __pyx_vtabstruct_6pysdif_7_pysdif_MatrixTypeDefinition {
  SdifMatrixTypeT *(*toSdifMatrixType)(struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *);
};
static struct __pyx_vtabstruct_6pysdif_7_pysdif_MatrixTypeDefinition *__pyx_vtabptr_6pysdif_7_pysdif_MatrixTypeDefinition;


/* "pysdif/_pysdif.pyx":662
 * # -----------------------------------------------------------------------------------------------
 * 
 * cdef class SdifFile:             # <<<<<<<<<<<<<<
 *     """
 *     SdifFile(filename, mode="r")
 */

struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile {
  void (*init_read)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
  void (*init_containers)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
  void (*init_write)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
  void (*finalize_frame)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
  void (*read_signature)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
  void (*read_matrix_data)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
  void (*reinit)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *);
};
static struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *__pyx_vtabptr_6pysdif_7_pysdif_SdifFile;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __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__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #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_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name)
  #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 */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*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 int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(d == Py_None)) {
        __Pyx_RaiseNoneIndexingError();
        return NULL;
    }
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#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, PyObject *cause); /*proto*/

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
    return unlikely(b < 0) ? b : !b; 
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static CYTHON_INLINE SdifUInt4 __Pyx_PyInt_from_py_SdifUInt4(PyObject *);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_SdifUInt4(SdifUInt4);

static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
#if PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t);

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_SdiffPosT(SdiffPosT);

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #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))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_absf(z)     (::std::abs(z))
        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    #if 1
        #define __Pyx_c_absf(z)     (cabsf(z))
        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (::std::abs(z))
        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (cabs(z))
        #define __Pyx_c_pow(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

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, int clineno,
                                  int lineno, const char *filename); /*proto*/

static int __Pyx_check_binary_version(void);

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'stdio' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'stdlib' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.object' */

/* 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 'cpython.string' */

/* Module declarations from 'python_string' */

/* Module declarations from 'pysdif.pysdif' */

/* Module declarations from 'pysdif._pysdif' */
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_StreamID = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_MatrixTypeDefinition = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_Component = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_FrameTypeDefinition = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_FrameR = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_SdifFile = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_Matrix = 0;
static PyTypeObject *__pyx_ptype_6pysdif_7_pysdif_FrameW = 0;
static int __pyx_v_6pysdif_7_pysdif_SDIF_CLOSED;
static int __pyx_v_6pysdif_7_pysdif__g_sdif_initiated;
static PyObject *__pyx_v_6pysdif_7_pysdif__SDIF_FILEMODE = 0;
static PyObject *__pyx_v_6pysdif_7_pysdif__SDIF_DATATYPES = 0;
static PyObject *__pyx_v_6pysdif_7_pysdif__SDIF_TO_NUMPY_TYPENUM = 0;
static CYTHON_INLINE int __pyx_f_6pysdif_7_pysdif_dtype_sdif2numpy(int); /*proto*/
static CYTHON_INLINE int __pyx_f_6pysdif_7_pysdif_dtype_numpy2sdif(int); /*proto*/
static CYTHON_INLINE unsigned int __pyx_f_6pysdif_7_pysdif__str2sig(char *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pysdif_7_pysdif_sig2str(SdifSignature); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_no_copy(SdifMatrixDataT *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_copy(SdifMatrixDataT *); /*proto*/
static CYTHON_INLINE SdifSignature __pyx_f_6pysdif_7_pysdif_as_signature(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pysdif_7_pysdif_PyString_from_SdifString(SdifStringT *); /*proto*/
static CYTHON_INLINE SdifStringT *__pyx_f_6pysdif_7_pysdif_SdifString_from_PyString(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pysdif_7_pysdif_nvt_to_dict(SdifNameValueTableT *); /*proto*/
static PyObject *__pyx_f_6pysdif_7_pysdif_valuetables_to_dicts(SdifNameValuesLT *); /*proto*/
static PyObject *__pyx_f_6pysdif_7_pysdif_streamidtable_to_list(SdifStreamIDTableT *); /*proto*/
static PyObject *__pyx_f_6pysdif_7_pysdif_StreamID_fromSdifStreadIDT(SdifStreamIDT *); /*proto*/
static SdifMatrixTypeT *__pyx_f_6pysdif_7_pysdif_MatrixType_create(PyObject *, PyObject *); /*proto*/
static SdifFrameTypeT *__pyx_f_6pysdif_7_pysdif_FrameType_create(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pysdif_7_pysdif_MatrixTypesTable_to_list(SdifHashTableT *); /*proto*/
static struct __pyx_obj_6pysdif_7_pysdif_Component *__pyx_f_6pysdif_7_pysdif_Component_from_SdifComponent(SdifComponentT *); /*proto*/
static PyObject *__pyx_f_6pysdif_7_pysdif_FrameTypesTable_to_list(SdifHashTableT *); /*proto*/
static struct __pyx_obj_6pysdif_7_pysdif_FrameW *__pyx_f_6pysdif_7_pysdif_FrameW_new(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *, SdifSignature, SdifFloat8, struct __pyx_opt_args_6pysdif_7_pysdif_FrameW_new *__pyx_optional_args); /*proto*/
#define __Pyx_MODULE_NAME "pysdif._pysdif"
int __pyx_module_is_main_pysdif___pysdif = 0;

/* Implementation of 'pysdif._pysdif' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_basestring;
static PyObject *__pyx_builtin_ValueError;
static char __pyx_k_1[] = "StreamID(numid=%d, source='%s', treeway='%s')";
static char __pyx_k_3[] = "1MTD(signature=%s, column_names=%s)";
static char __pyx_k_4[] = ", ";
static char __pyx_k_5[] = "Component(sig=%s, name=%s)";
static char __pyx_k_6[] = "1FTD (signature='%s', components=[%s])";
static char __pyx_k_7[] = "SdifTypes.STYP";
static char __pyx_k_8[] = "";
static char __pyx_k_9[] = "Sdif initialized";
static char __pyx_k_12[] = "Matrix(sig=%s, rows=%d, cols=%d, dtype=%s)";
static char __pyx_k_14[] = "FrameW(signature=%s, time=%f, streamID=%d)";
static char __pyx_k_15[] = "path not found, cannot open sdif file for reading";
static char __pyx_k_17[] = "write_all_ascii_chunks";
static char __pyx_k_18[] = ",";
static char __pyx_k_21[] = ";";
static char __pyx_k_23[] = "clone_type_definitions";
static char __pyx_k_24[] = "get_predefined_frames_and_matrices";
static char __pyx_k_25[] = "Definition of sdif type not found";
static char __pyx_k_28[] = "1MTX pupu";
static char __pyx_k_32[] = "ndarray is not C contiguous";
static char __pyx_k_34[] = "ndarray is not Fortran contiguous";
static char __pyx_k_36[] = "Non-native byte order not supported";
static char __pyx_k_38[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_39[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_42[] = "Format string allocated too short.";
static char __pyx_k_44[] = "signature: object";
static char __pyx_k_45[] = "column_names: list";
static char __pyx_k_46[] = "signature: str";
static char __pyx_k_47[] = "name: str";
static char __pyx_k_48[] = "num: 'unsigned int'";
static char __pyx_k_49[] = "components: list";
static char __pyx_k_50[] = "eof: 'int'";
static char __pyx_k_51[] = "os.path";
static char __pyx_k_52[] = "pysdif._pysdif";
static char __pyx_k_53[] = "RBEP ReassignedBandEnhancedPartials";
static char __pyx_k_55[] = "Index, Frequency, Amplitude, Phase, Bandwidth, Offset";
static char __pyx_k_57[] = "test_bench_read_sdif1";
static char __pyx_k_58[] = "test_bench_read_sdif2";
static char __pyx_k_59[] = "test_bench_read_sdif6";
static char __pyx_k_60[] = "test_bench_read_sdif3";
static char __pyx_k_61[] = "test_bench_read_sdif4";
static char __pyx_k_62[] = "test_bench_read_sdif5";
static char __pyx_k__B[] = "B";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
static char __pyx_k__L[] = "L";
static char __pyx_k__O[] = "O";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__b[] = "b";
static char __pyx_k__d[] = "d";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
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__r[] = "r";
static char __pyx_k__w[] = "w";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__os[] = "os";
static char __pyx_k__rw[] = "rw";
static char __pyx_k__wr[] = "wr";
static char __pyx_k__get[] = "get";
static char __pyx_k__sep[] = "sep";
static char __pyx_k__1ABC[] = "1ABC";
static char __pyx_k__1MTX[] = "1MTX";
static char __pyx_k__RBEP[] = "RBEP";
static char __pyx_k__char[] = "char";
static char __pyx_k__cols[] = "cols";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__data[] = "data";
static char __pyx_k__int8[] = "int8";
static char __pyx_k__join[] = "join";
static char __pyx_k__meta[] = "meta";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__name[] = "name";
static char __pyx_k__next[] = "next";
static char __pyx_k__path[] = "path";
static char __pyx_k__rows[] = "rows";
static char __pyx_k__time[] = "time";
static char __pyx_k___init[] = "_init";
static char __pyx_k__array[] = "array";
static char __pyx_k__close[] = "close";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__int16[] = "int16";
static char __pyx_k__int32[] = "int32";
static char __pyx_k__int64[] = "int64";
static char __pyx_k__numid[] = "numid";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__range[] = "range";
static char __pyx_k__split[] = "split";
static char __pyx_k__uint8[] = "uint8";
static char __pyx_k__write[] = "write";
static char __pyx_k__exists[] = "exists";
static char __pyx_k__resize[] = "resize";
static char __pyx_k__source[] = "source";
static char __pyx_k__uint16[] = "uint16";
static char __pyx_k__uint32[] = "uint32";
static char __pyx_k__uint64[] = "uint64";
static char __pyx_k__add_NVT[] = "add_NVT";
static char __pyx_k__c_numpy[] = "c_numpy";
static char __pyx_k__float32[] = "float32";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__treeway[] = "treeway";
static char __pyx_k__ColumnaA[] = "ColumnaA";
static char __pyx_k____file__[] = "__file__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k___cleanup[] = "_cleanup";
static char __pyx_k__filename[] = "filename";
static char __pyx_k__get_NVTs[] = "get_NVTs";
static char __pyx_k__get_data[] = "get_data";
static char __pyx_k__streamID[] = "streamID";
static char __pyx_k__NPY_ULONg[] = "NPY_ULONg";
static char __pyx_k__frame_sig[] = "frame_sig";
static char __pyx_k__new_frame[] = "new_frame";
static char __pyx_k__signature[] = "signature";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__add_matrix[] = "add_matrix";
static char __pyx_k__basestring[] = "basestring";
static char __pyx_k__clone_NVTs[] = "clone_NVTs";
static char __pyx_k__components[] = "components";
static char __pyx_k__data_array[] = "data_array";
static char __pyx_k__matrix_sig[] = "matrix_sig";
static char __pyx_k__test_write[] = "test_write";
static char __pyx_k__frame_types[] = "frame_types";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__column_names[] = "column_names";
static char __pyx_k__matrix_types[] = "matrix_types";
static char __pyx_k__SDIF_NEWTYPES[] = "SDIF_NEWTYPES";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k__signature2str[] = "signature2str";
static char __pyx_k__str2signature[] = "str2signature";
static char __pyx_k__add_frame_type[] = "add_frame_type";
static char __pyx_k__add_matrix_type[] = "add_matrix_type";
static char __pyx_k__get_frame_types[] = "get_frame_types";
static char __pyx_k__get_matrix_data[] = "get_matrix_data";
static char __pyx_k__get_next_matrix[] = "get_next_matrix";
static char __pyx_k__predefined_type[] = "predefined_type";
static char __pyx_k__get_matrix_types[] = "get_matrix_types";
static char __pyx_k__skip_matrix_data[] = "skip_matrix_data";
static char __pyx_k__matrices_in_frame[] = "matrices_in_frame";
static char __pyx_k__read_frame_header[] = "read_frame_header";
static char __pyx_k__read_matrix_header[] = "read_matrix_header";
static char __pyx_k__add_predefined_type[] = "add_predefined_type";
static char __pyx_k__signatures_to_clone[] = "signatures_to_clone";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_n_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_n_s_23;
static PyObject *__pyx_n_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_u_32;
static PyObject *__pyx_kp_u_34;
static PyObject *__pyx_kp_u_36;
static PyObject *__pyx_kp_u_38;
static PyObject *__pyx_kp_u_39;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_u_42;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_n_s_51;
static PyObject *__pyx_n_s_52;
static PyObject *__pyx_kp_s_53;
static PyObject *__pyx_kp_s_55;
static PyObject *__pyx_n_s_57;
static PyObject *__pyx_n_s_58;
static PyObject *__pyx_n_s_59;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_n_s_60;
static PyObject *__pyx_n_s_61;
static PyObject *__pyx_n_s_62;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_kp_s__1ABC;
static PyObject *__pyx_kp_s__1MTX;
static PyObject *__pyx_n_s__ColumnaA;
static PyObject *__pyx_n_s__NPY_ULONg;
static PyObject *__pyx_n_s__RBEP;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__SDIF_NEWTYPES;
static PyObject *__pyx_n_s__StopIteration;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____file__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___cleanup;
static PyObject *__pyx_n_s___init;
static PyObject *__pyx_n_s__add_NVT;
static PyObject *__pyx_n_s__add_frame_type;
static PyObject *__pyx_n_s__add_matrix;
static PyObject *__pyx_n_s__add_matrix_type;
static PyObject *__pyx_n_s__add_predefined_type;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__basestring;
static PyObject *__pyx_n_s__c_numpy;
static PyObject *__pyx_n_s__char;
static PyObject *__pyx_n_s__clone_NVTs;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__cols;
static PyObject *__pyx_n_s__column_names;
static PyObject *__pyx_n_s__components;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__data_array;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__exists;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__float32;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__frame_sig;
static PyObject *__pyx_n_s__frame_types;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__get_NVTs;
static PyObject *__pyx_n_s__get_data;
static PyObject *__pyx_n_s__get_frame_types;
static PyObject *__pyx_n_s__get_matrix_data;
static PyObject *__pyx_n_s__get_matrix_types;
static PyObject *__pyx_n_s__get_next_matrix;
static PyObject *__pyx_n_s__int16;
static PyObject *__pyx_n_s__int32;
static PyObject *__pyx_n_s__int64;
static PyObject *__pyx_n_s__int8;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__matrices_in_frame;
static PyObject *__pyx_n_s__matrix_sig;
static PyObject *__pyx_n_s__matrix_types;
static PyObject *__pyx_n_s__meta;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__new_frame;
static PyObject *__pyx_n_s__next;
static PyObject *__pyx_n_s__numid;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__os;
static PyObject *__pyx_n_s__path;
static PyObject *__pyx_n_s__predefined_type;
static PyObject *__pyx_n_s__r;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__read_frame_header;
static PyObject *__pyx_n_s__read_matrix_header;
static PyObject *__pyx_n_s__resize;
static PyObject *__pyx_n_s__rows;
static PyObject *__pyx_n_s__rw;
static PyObject *__pyx_n_s__sep;
static PyObject *__pyx_n_s__signature;
static PyObject *__pyx_n_s__signature2str;
static PyObject *__pyx_n_s__signatures_to_clone;
static PyObject *__pyx_n_s__skip_matrix_data;
static PyObject *__pyx_n_s__source;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__str2signature;
static PyObject *__pyx_n_s__streamID;
static PyObject *__pyx_n_s__test_write;
static PyObject *__pyx_n_s__time;
static PyObject *__pyx_n_s__treeway;
static PyObject *__pyx_n_s__uint16;
static PyObject *__pyx_n_s__uint32;
static PyObject *__pyx_n_s__uint64;
static PyObject *__pyx_n_s__uint8;
static PyObject *__pyx_n_s__w;
static PyObject *__pyx_n_s__wr;
static PyObject *__pyx_n_s__write;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_257;
static PyObject *__pyx_int_258;
static PyObject *__pyx_int_260;
static PyObject *__pyx_int_264;
static PyObject *__pyx_int_513;
static PyObject *__pyx_int_514;
static PyObject *__pyx_int_516;
static PyObject *__pyx_int_520;
static PyObject *__pyx_int_769;
static PyObject *__pyx_k_10;
static PyObject *__pyx_k_13;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_11;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_27;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_30;
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_40;
static PyObject *__pyx_k_tuple_41;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_54;
static PyObject *__pyx_k_tuple_56;

/* "pysdif/_pysdif.pyx":65
 *     }
 * 
 * cdef inline int dtype_sdif2numpy(int typenum):             # <<<<<<<<<<<<<<
 *     if   typenum == 0x0004: typenum = c_numpy.NPY_FLOAT
 *     elif typenum == 0x0301: typenum = c_numpy.NPY_BYTE
 */

static CYTHON_INLINE int __pyx_f_6pysdif_7_pysdif_dtype_sdif2numpy(int __pyx_v_typenum) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dtype_sdif2numpy");

  /* "pysdif/_pysdif.pyx":76
 *     elif typenum == 0x0202: typenum = c_numpy.NPY_USHORT
 *     elif typenum == 0x0204: typenum = c_numpy.NPY_UINT
 *     elif typenum == 0x0208: typenum = c_numpy.NPY_ULONG             # <<<<<<<<<<<<<<
 *     return typenum
 * 
 */
  switch (__pyx_v_typenum) {

    /* "pysdif/_pysdif.pyx":66
 * 
 * cdef inline int dtype_sdif2numpy(int typenum):
 *     if   typenum == 0x0004: typenum = c_numpy.NPY_FLOAT             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0301: typenum = c_numpy.NPY_BYTE
 *     elif typenum == 0x0008: typenum = c_numpy.NPY_DOUBLE
 */
    case 0x0004:
    __pyx_v_typenum = NPY_FLOAT;
    break;

    /* "pysdif/_pysdif.pyx":67
 * cdef inline int dtype_sdif2numpy(int typenum):
 *     if   typenum == 0x0004: typenum = c_numpy.NPY_FLOAT
 *     elif typenum == 0x0301: typenum = c_numpy.NPY_BYTE             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0008: typenum = c_numpy.NPY_DOUBLE
 *     elif typenum == 0x0104: typenum = c_numpy.NPY_INT
 */
    case 0x0301:
    __pyx_v_typenum = NPY_BYTE;
    break;

    /* "pysdif/_pysdif.pyx":68
 *     if   typenum == 0x0004: typenum = c_numpy.NPY_FLOAT
 *     elif typenum == 0x0301: typenum = c_numpy.NPY_BYTE
 *     elif typenum == 0x0008: typenum = c_numpy.NPY_DOUBLE             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0104: typenum = c_numpy.NPY_INT
 *     elif typenum == 0x0101: typenum = c_numpy.NPY_BYTE
 */
    case 0x0008:
    __pyx_v_typenum = NPY_DOUBLE;
    break;

    /* "pysdif/_pysdif.pyx":69
 *     elif typenum == 0x0301: typenum = c_numpy.NPY_BYTE
 *     elif typenum == 0x0008: typenum = c_numpy.NPY_DOUBLE
 *     elif typenum == 0x0104: typenum = c_numpy.NPY_INT             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0101: typenum = c_numpy.NPY_BYTE
 *     elif typenum == 0x0102: typenum = c_numpy.NPY_SHORT
 */
    case 0x0104:
    __pyx_v_typenum = NPY_INT;
    break;

    /* "pysdif/_pysdif.pyx":70
 *     elif typenum == 0x0008: typenum = c_numpy.NPY_DOUBLE
 *     elif typenum == 0x0104: typenum = c_numpy.NPY_INT
 *     elif typenum == 0x0101: typenum = c_numpy.NPY_BYTE             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0102: typenum = c_numpy.NPY_SHORT
 *     elif typenum == 0x0108: typenum = c_numpy.NPY_LONG
 */
    case 0x0101:
    __pyx_v_typenum = NPY_BYTE;
    break;

    /* "pysdif/_pysdif.pyx":71
 *     elif typenum == 0x0104: typenum = c_numpy.NPY_INT
 *     elif typenum == 0x0101: typenum = c_numpy.NPY_BYTE
 *     elif typenum == 0x0102: typenum = c_numpy.NPY_SHORT             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0108: typenum = c_numpy.NPY_LONG
 *     elif typenum == 0x0201: typenum = c_numpy.NPY_UBYTE
 */
    case 0x0102:
    __pyx_v_typenum = NPY_SHORT;
    break;

    /* "pysdif/_pysdif.pyx":72
 *     elif typenum == 0x0101: typenum = c_numpy.NPY_BYTE
 *     elif typenum == 0x0102: typenum = c_numpy.NPY_SHORT
 *     elif typenum == 0x0108: typenum = c_numpy.NPY_LONG             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0201: typenum = c_numpy.NPY_UBYTE
 *     elif typenum == 0x0202: typenum = c_numpy.NPY_USHORT
 */
    case 0x0108:
    __pyx_v_typenum = NPY_LONG;
    break;

    /* "pysdif/_pysdif.pyx":73
 *     elif typenum == 0x0102: typenum = c_numpy.NPY_SHORT
 *     elif typenum == 0x0108: typenum = c_numpy.NPY_LONG
 *     elif typenum == 0x0201: typenum = c_numpy.NPY_UBYTE             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0202: typenum = c_numpy.NPY_USHORT
 *     elif typenum == 0x0204: typenum = c_numpy.NPY_UINT
 */
    case 0x0201:
    __pyx_v_typenum = NPY_UBYTE;
    break;

    /* "pysdif/_pysdif.pyx":74
 *     elif typenum == 0x0108: typenum = c_numpy.NPY_LONG
 *     elif typenum == 0x0201: typenum = c_numpy.NPY_UBYTE
 *     elif typenum == 0x0202: typenum = c_numpy.NPY_USHORT             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0204: typenum = c_numpy.NPY_UINT
 *     elif typenum == 0x0208: typenum = c_numpy.NPY_ULONG
 */
    case 0x0202:
    __pyx_v_typenum = NPY_USHORT;
    break;

    /* "pysdif/_pysdif.pyx":75
 *     elif typenum == 0x0201: typenum = c_numpy.NPY_UBYTE
 *     elif typenum == 0x0202: typenum = c_numpy.NPY_USHORT
 *     elif typenum == 0x0204: typenum = c_numpy.NPY_UINT             # <<<<<<<<<<<<<<
 *     elif typenum == 0x0208: typenum = c_numpy.NPY_ULONG
 *     return typenum
 */
    case 0x0204:
    __pyx_v_typenum = NPY_UINT;
    break;

    /* "pysdif/_pysdif.pyx":76
 *     elif typenum == 0x0202: typenum = c_numpy.NPY_USHORT
 *     elif typenum == 0x0204: typenum = c_numpy.NPY_UINT
 *     elif typenum == 0x0208: typenum = c_numpy.NPY_ULONG             # <<<<<<<<<<<<<<
 *     return typenum
 * 
 */
    case 0x0208:
    __pyx_v_typenum = NPY_ULONG;
    break;
  }

  /* "pysdif/_pysdif.pyx":77
 *     elif typenum == 0x0204: typenum = c_numpy.NPY_UINT
 *     elif typenum == 0x0208: typenum = c_numpy.NPY_ULONG
 *     return typenum             # <<<<<<<<<<<<<<
 * 
 * cdef inline int dtype_numpy2sdif(int dtype):
 */
  __pyx_r = __pyx_v_typenum;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":79
 *     return typenum
 * 
 * cdef inline int dtype_numpy2sdif(int dtype):             # <<<<<<<<<<<<<<
 *     if   dtype == c_numpy.NPY_FLOAT : dtype = 0x0004
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0301
 */

static CYTHON_INLINE int __pyx_f_6pysdif_7_pysdif_dtype_numpy2sdif(int __pyx_v_dtype) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dtype_numpy2sdif");

  /* "pysdif/_pysdif.pyx":80
 * 
 * cdef inline int dtype_numpy2sdif(int dtype):
 *     if   dtype == c_numpy.NPY_FLOAT : dtype = 0x0004             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0301
 *     elif dtype == c_numpy.NPY_DOUBLE: dtype = 0x0008
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_FLOAT);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0004;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":81
 * cdef inline int dtype_numpy2sdif(int dtype):
 *     if   dtype == c_numpy.NPY_FLOAT : dtype = 0x0004
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0301             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_DOUBLE: dtype = 0x0008
 *     elif dtype == c_numpy.NPY_INT   : dtype = 0x0104
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_BYTE);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0301;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":82
 *     if   dtype == c_numpy.NPY_FLOAT : dtype = 0x0004
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0301
 *     elif dtype == c_numpy.NPY_DOUBLE: dtype = 0x0008             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_INT   : dtype = 0x0104
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0101
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_DOUBLE);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0008;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":83
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0301
 *     elif dtype == c_numpy.NPY_DOUBLE: dtype = 0x0008
 *     elif dtype == c_numpy.NPY_INT   : dtype = 0x0104             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0101
 *     elif dtype == c_numpy.NPY_SHORT : dtype = 0x0102
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_INT);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0104;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":84
 *     elif dtype == c_numpy.NPY_DOUBLE: dtype = 0x0008
 *     elif dtype == c_numpy.NPY_INT   : dtype = 0x0104
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0101             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_SHORT : dtype = 0x0102
 *     elif dtype == c_numpy.NPY_LONG  : dtype = 0x0108
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_BYTE);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0101;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":85
 *     elif dtype == c_numpy.NPY_INT   : dtype = 0x0104
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0101
 *     elif dtype == c_numpy.NPY_SHORT : dtype = 0x0102             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_LONG  : dtype = 0x0108
 *     elif dtype == c_numpy.NPY_UBYTE : dtype = 0x0201
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_SHORT);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0102;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":86
 *     elif dtype == c_numpy.NPY_BYTE  : dtype = 0x0101
 *     elif dtype == c_numpy.NPY_SHORT : dtype = 0x0102
 *     elif dtype == c_numpy.NPY_LONG  : dtype = 0x0108             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_UBYTE : dtype = 0x0201
 *     elif dtype == c_numpy.NPY_USHORT: dtype = 0x0202
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_LONG);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0108;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":87
 *     elif dtype == c_numpy.NPY_SHORT : dtype = 0x0102
 *     elif dtype == c_numpy.NPY_LONG  : dtype = 0x0108
 *     elif dtype == c_numpy.NPY_UBYTE : dtype = 0x0201             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_USHORT: dtype = 0x0202
 *     elif dtype == c_numpy.NPY_UINT  : dtype = 0x0204
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_UBYTE);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0201;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":88
 *     elif dtype == c_numpy.NPY_LONG  : dtype = 0x0108
 *     elif dtype == c_numpy.NPY_UBYTE : dtype = 0x0201
 *     elif dtype == c_numpy.NPY_USHORT: dtype = 0x0202             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_UINT  : dtype = 0x0204
 *     elif dtype == c_numpy.NPY_ULONg : dtype = 0x0208
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_USHORT);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0202;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":89
 *     elif dtype == c_numpy.NPY_UBYTE : dtype = 0x0201
 *     elif dtype == c_numpy.NPY_USHORT: dtype = 0x0202
 *     elif dtype == c_numpy.NPY_UINT  : dtype = 0x0204             # <<<<<<<<<<<<<<
 *     elif dtype == c_numpy.NPY_ULONg : dtype = 0x0208
 *     return dtype
 */
  __pyx_t_1 = (__pyx_v_dtype == NPY_UINT);
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0204;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":90
 *     elif dtype == c_numpy.NPY_USHORT: dtype = 0x0202
 *     elif dtype == c_numpy.NPY_UINT  : dtype = 0x0204
 *     elif dtype == c_numpy.NPY_ULONg : dtype = 0x0208             # <<<<<<<<<<<<<<
 *     return dtype
 * 
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__c_numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__NPY_ULONg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {
    __pyx_v_dtype = 0x0208;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysdif/_pysdif.pyx":91
 *     elif dtype == c_numpy.NPY_UINT  : dtype = 0x0204
 *     elif dtype == c_numpy.NPY_ULONg : dtype = 0x0208
 *     return dtype             # <<<<<<<<<<<<<<
 * 
 * cdef inline unsigned int _str2sig (char *sig):
 */
  __pyx_r = __pyx_v_dtype;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pysdif._pysdif.dtype_numpy2sdif", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":93
 *     return dtype
 * 
 * cdef inline unsigned int _str2sig (char *sig):             # <<<<<<<<<<<<<<
 *    return ((((<unsigned int>(sig[0])) & 0xff) << 24) |
 *        (((<unsigned int>(sig[1])) & 0xff) << 16) |
 */

static CYTHON_INLINE unsigned int __pyx_f_6pysdif_7_pysdif__str2sig(char *__pyx_v_sig) {
  unsigned int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_str2sig");

  /* "pysdif/_pysdif.pyx":97
 *        (((<unsigned int>(sig[1])) & 0xff) << 16) |
 *        (((<unsigned int>(sig[2])) & 0xff) << 8) |
 *        ((<unsigned int>(sig[3])) & 0xff))             # <<<<<<<<<<<<<<
 * 
 * def signature2str(SdifSignature signature):
 */
  __pyx_r = (((((((unsigned int)(__pyx_v_sig[0])) & 0xff) << 24) | ((((unsigned int)(__pyx_v_sig[1])) & 0xff) << 16)) | ((((unsigned int)(__pyx_v_sig[2])) & 0xff) << 8)) | (((unsigned int)(__pyx_v_sig[3])) & 0xff));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":99
 *        ((<unsigned int>(sig[3])) & 0xff))
 * 
 * def signature2str(SdifSignature signature):             # <<<<<<<<<<<<<<
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_signature2str(PyObject *__pyx_self, PyObject *__pyx_arg_signature); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_signature2str[] = "signature2str(SdifSignature signature)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_signature2str = {__Pyx_NAMESTR("signature2str"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_signature2str, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_signature2str)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_signature2str(PyObject *__pyx_self, PyObject *__pyx_arg_signature) {
  SdifSignature __pyx_v_signature;
  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("signature2str");
  __pyx_self = __pyx_self;
  assert(__pyx_arg_signature); {
    __pyx_v_signature = __Pyx_PyInt_from_py_SdifUInt4(__pyx_arg_signature); if (unlikely((__pyx_v_signature == (SdifSignature)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.signature2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":100
 * 
 * def signature2str(SdifSignature signature):
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)             # <<<<<<<<<<<<<<
 * 
 * cdef inline sig2str(SdifSignature signature):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyString_FromStringAndSize(SdifSignatureToString(__pyx_v_signature), 4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.signature2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":102
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)
 * 
 * cdef inline sig2str(SdifSignature signature):             # <<<<<<<<<<<<<<
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_6pysdif_7_pysdif_sig2str(SdifSignature __pyx_v_signature) {
  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("sig2str");

  /* "pysdif/_pysdif.pyx":103
 * 
 * cdef inline sig2str(SdifSignature signature):
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)             # <<<<<<<<<<<<<<
 * 
 * def str2signature(s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyString_FromStringAndSize(SdifSignatureToString(__pyx_v_signature), 4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.sig2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":105
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)
 * 
 * def str2signature(s):             # <<<<<<<<<<<<<<
 *     return _str2sig(s)
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_1str2signature(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_1str2signature[] = "str2signature(s)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_1str2signature = {__Pyx_NAMESTR("str2signature"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_1str2signature, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_1str2signature)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_1str2signature(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("str2signature");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":106
 * 
 * def str2signature(s):
 *     return _str2sig(s)             # <<<<<<<<<<<<<<
 * 
 * cdef inline ndarray _array_from_matrix_data_no_copy(SdifMatrixDataT *matrix): # , int copy=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBytes_AsString(__pyx_v_s); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_f_6pysdif_7_pysdif__str2sig(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.str2signature", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":108
 *     return _str2sig(s)
 * 
 * cdef inline ndarray _array_from_matrix_data_no_copy(SdifMatrixDataT *matrix): # , int copy=0):             # <<<<<<<<<<<<<<
 *     cdef SdifMatrixHeaderT *header = matrix.Header
 *     cdef npy_intp dims[2]
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_no_copy(SdifMatrixDataT *__pyx_v_matrix) {
  SdifMatrixHeaderT *__pyx_v_header;
  npy_intp __pyx_v_dims[2];
  PyArrayObject *__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("_array_from_matrix_data_no_copy");

  /* "pysdif/_pysdif.pyx":109
 * 
 * cdef inline ndarray _array_from_matrix_data_no_copy(SdifMatrixDataT *matrix): # , int copy=0):
 *     cdef SdifMatrixHeaderT *header = matrix.Header             # <<<<<<<<<<<<<<
 *     cdef npy_intp dims[2]
 *     dims[0] = <npy_intp>header.NbRow
 */
  __pyx_v_header = __pyx_v_matrix->Header;

  /* "pysdif/_pysdif.pyx":111
 *     cdef SdifMatrixHeaderT *header = matrix.Header
 *     cdef npy_intp dims[2]
 *     dims[0] = <npy_intp>header.NbRow             # <<<<<<<<<<<<<<
 *     dims[1] = <npy_intp>header.NbCol
 *     return PyArray_SimpleNewFromData(2, dims, dtype_sdif2numpy(header.DataType), matrix.Data.Void)
 */
  (__pyx_v_dims[0]) = ((npy_intp)__pyx_v_header->NbRow);

  /* "pysdif/_pysdif.pyx":112
 *     cdef npy_intp dims[2]
 *     dims[0] = <npy_intp>header.NbRow
 *     dims[1] = <npy_intp>header.NbCol             # <<<<<<<<<<<<<<
 *     return PyArray_SimpleNewFromData(2, dims, dtype_sdif2numpy(header.DataType), matrix.Data.Void)
 * 
 */
  (__pyx_v_dims[1]) = ((npy_intp)__pyx_v_header->NbCol);

  /* "pysdif/_pysdif.pyx":113
 *     dims[0] = <npy_intp>header.NbRow
 *     dims[1] = <npy_intp>header.NbCol
 *     return PyArray_SimpleNewFromData(2, dims, dtype_sdif2numpy(header.DataType), matrix.Data.Void)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyArray_SimpleNewFromData(2, __pyx_v_dims, __pyx_f_6pysdif_7_pysdif_dtype_sdif2numpy(__pyx_v_header->DataType), __pyx_v_matrix->Data.Void); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif._array_from_matrix_data_no_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":116
 * 
 * 
 * cdef inline ndarray _array_from_matrix_data_copy(SdifMatrixDataT *matrix):             # <<<<<<<<<<<<<<
 *     cdef ndarray out
 *     cdef SdifMatrixHeaderT *header = matrix.Header
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_copy(SdifMatrixDataT *__pyx_v_matrix) {
  PyArrayObject *__pyx_v_out = 0;
  SdifMatrixHeaderT *__pyx_v_header;
  npy_intp __pyx_v_dims[2];
  PyArrayObject *__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("_array_from_matrix_data_copy");

  /* "pysdif/_pysdif.pyx":118
 * cdef inline ndarray _array_from_matrix_data_copy(SdifMatrixDataT *matrix):
 *     cdef ndarray out
 *     cdef SdifMatrixHeaderT *header = matrix.Header             # <<<<<<<<<<<<<<
 *     cdef npy_intp dims[2]
 *     dims[0] = <npy_intp>header.NbRow
 */
  __pyx_v_header = __pyx_v_matrix->Header;

  /* "pysdif/_pysdif.pyx":120
 *     cdef SdifMatrixHeaderT *header = matrix.Header
 *     cdef npy_intp dims[2]
 *     dims[0] = <npy_intp>header.NbRow             # <<<<<<<<<<<<<<
 *     dims[1] = <npy_intp>header.NbCol
 *     out = PyArray_SimpleNew(2, dims, dtype_sdif2numpy(header.DataType))
 */
  (__pyx_v_dims[0]) = ((npy_intp)__pyx_v_header->NbRow);

  /* "pysdif/_pysdif.pyx":121
 *     cdef npy_intp dims[2]
 *     dims[0] = <npy_intp>header.NbRow
 *     dims[1] = <npy_intp>header.NbCol             # <<<<<<<<<<<<<<
 *     out = PyArray_SimpleNew(2, dims, dtype_sdif2numpy(header.DataType))
 *     memcpy(<void *>out.data, matrix.Data.Void, c_numpy.PyArray_ITEMSIZE(out) * dims[0] * dims[1])
 */
  (__pyx_v_dims[1]) = ((npy_intp)__pyx_v_header->NbCol);

  /* "pysdif/_pysdif.pyx":122
 *     dims[0] = <npy_intp>header.NbRow
 *     dims[1] = <npy_intp>header.NbCol
 *     out = PyArray_SimpleNew(2, dims, dtype_sdif2numpy(header.DataType))             # <<<<<<<<<<<<<<
 *     memcpy(<void *>out.data, matrix.Data.Void, c_numpy.PyArray_ITEMSIZE(out) * dims[0] * dims[1])
 *     return out
 */
  __pyx_t_1 = PyArray_SimpleNew(2, __pyx_v_dims, __pyx_f_6pysdif_7_pysdif_dtype_sdif2numpy(__pyx_v_header->DataType)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_out = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":123
 *     dims[1] = <npy_intp>header.NbCol
 *     out = PyArray_SimpleNew(2, dims, dtype_sdif2numpy(header.DataType))
 *     memcpy(<void *>out.data, matrix.Data.Void, c_numpy.PyArray_ITEMSIZE(out) * dims[0] * dims[1])             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
  memcpy(((void *)__pyx_v_out->data), __pyx_v_matrix->Data.Void, ((PyArray_ITEMSIZE(__pyx_v_out) * (__pyx_v_dims[0])) * (__pyx_v_dims[1])));

  /* "pysdif/_pysdif.pyx":124
 *     out = PyArray_SimpleNew(2, dims, dtype_sdif2numpy(header.DataType))
 *     memcpy(<void *>out.data, matrix.Data.Void, c_numpy.PyArray_ITEMSIZE(out) * dims[0] * dims[1])
 *     return out             # <<<<<<<<<<<<<<
 * 
 * cdef inline SdifSignature as_signature(sig):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif._array_from_matrix_data_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":126
 *     return out
 * 
 * cdef inline SdifSignature as_signature(sig):             # <<<<<<<<<<<<<<
 *     if isinstance(sig, str):
 *         return _str2sig(sig)
 */

static CYTHON_INLINE SdifSignature __pyx_f_6pysdif_7_pysdif_as_signature(PyObject *__pyx_v_sig) {
  SdifSignature __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  char *__pyx_t_3;
  SdifSignature __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("as_signature");

  /* "pysdif/_pysdif.pyx":127
 * 
 * cdef inline SdifSignature as_signature(sig):
 *     if isinstance(sig, str):             # <<<<<<<<<<<<<<
 *         return _str2sig(sig)
 *     else:
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyString_Type)));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sig, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysdif/_pysdif.pyx":128
 * cdef inline SdifSignature as_signature(sig):
 *     if isinstance(sig, str):
 *         return _str2sig(sig)             # <<<<<<<<<<<<<<
 *     else:
 *         return sig
 */
    __pyx_t_3 = PyBytes_AsString(__pyx_v_sig); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_f_6pysdif_7_pysdif__str2sig(__pyx_t_3);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":130
 *         return _str2sig(sig)
 *     else:
 *         return sig             # <<<<<<<<<<<<<<
 * 
 * cdef inline PyString_from_SdifString(SdifStringT *s):
 */
    __pyx_t_4 = __Pyx_PyInt_from_py_SdifUInt4(__pyx_v_sig); if (unlikely((__pyx_t_4 == (SdifSignature)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_t_4;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("pysdif._pysdif.as_signature", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":132
 *         return sig
 * 
 * cdef inline PyString_from_SdifString(SdifStringT *s):             # <<<<<<<<<<<<<<
 *     """ convert a SdifStringT to a python string """
 *     return PyString_FromStringAndSize(s.str, s.SizeW)
 */

static CYTHON_INLINE PyObject *__pyx_f_6pysdif_7_pysdif_PyString_from_SdifString(SdifStringT *__pyx_v_s) {
  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("PyString_from_SdifString");

  /* "pysdif/_pysdif.pyx":134
 * cdef inline PyString_from_SdifString(SdifStringT *s):
 *     """ convert a SdifStringT to a python string """
 *     return PyString_FromStringAndSize(s.str, s.SizeW)             # <<<<<<<<<<<<<<
 * 
 * cdef inline SdifStringT *SdifString_from_PyString(bytes s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyString_FromStringAndSize(__pyx_v_s->str, __pyx_v_s->SizeW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.PyString_from_SdifString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":136
 *     return PyString_FromStringAndSize(s.str, s.SizeW)
 * 
 * cdef inline SdifStringT *SdifString_from_PyString(bytes s):             # <<<<<<<<<<<<<<
 *     cdef char *bytes = s
 *     cdef SdifStringT *sdifstr = SdifStringNew()
 */

static CYTHON_INLINE SdifStringT *__pyx_f_6pysdif_7_pysdif_SdifString_from_PyString(PyObject *__pyx_v_s) {
  char *__pyx_v_bytes;
  SdifStringT *__pyx_v_sdifstr;
  SdifStringT *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SdifString_from_PyString");

  /* "pysdif/_pysdif.pyx":137
 * 
 * cdef inline SdifStringT *SdifString_from_PyString(bytes s):
 *     cdef char *bytes = s             # <<<<<<<<<<<<<<
 *     cdef SdifStringT *sdifstr = SdifStringNew()
 *     SdifStringAppend(sdifstr, bytes)
 */
  __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_s)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_bytes = __pyx_t_1;

  /* "pysdif/_pysdif.pyx":138
 * cdef inline SdifStringT *SdifString_from_PyString(bytes s):
 *     cdef char *bytes = s
 *     cdef SdifStringT *sdifstr = SdifStringNew()             # <<<<<<<<<<<<<<
 *     SdifStringAppend(sdifstr, bytes)
 *     return sdifstr
 */
  __pyx_v_sdifstr = SdifStringNew();

  /* "pysdif/_pysdif.pyx":139
 *     cdef char *bytes = s
 *     cdef SdifStringT *sdifstr = SdifStringNew()
 *     SdifStringAppend(sdifstr, bytes)             # <<<<<<<<<<<<<<
 *     return sdifstr
 * 
 */
  SdifStringAppend(__pyx_v_sdifstr, __pyx_v_bytes);

  /* "pysdif/_pysdif.pyx":140
 *     cdef SdifStringT *sdifstr = SdifStringNew()
 *     SdifStringAppend(sdifstr, bytes)
 *     return sdifstr             # <<<<<<<<<<<<<<
 * 
 * cdef inline nvt_to_dict( SdifNameValueTableT *nvt ):
 */
  __pyx_r = __pyx_v_sdifstr;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pysdif._pysdif.SdifString_from_PyString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":142
 *     return sdifstr
 * 
 * cdef inline nvt_to_dict( SdifNameValueTableT *nvt ):             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef SdifUInt4      iNV
 */

static CYTHON_INLINE PyObject *__pyx_f_6pysdif_7_pysdif_nvt_to_dict(SdifNameValueTableT *__pyx_v_nvt) {
  int __pyx_v_i;
  SdifHashNT *__pyx_v_pNV;
  SdifHashTableT *__pyx_v_HTable;
  SdifNameValueT *__pyx_v_namevalue;
  PyObject *__pyx_v_table = NULL;
  char *__pyx_v_name;
  char *__pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("nvt_to_dict");

  /* "pysdif/_pysdif.pyx":149
 *     cdef SdifNameValueT *namevalue
 * 
 *     HTable = nvt.NVHT             # <<<<<<<<<<<<<<
 *     table = {}
 *     for i in range(HTable.HashSize):
 */
  __pyx_v_HTable = __pyx_v_nvt->NVHT;

  /* "pysdif/_pysdif.pyx":150
 * 
 *     HTable = nvt.NVHT
 *     table = {}             # <<<<<<<<<<<<<<
 *     for i in range(HTable.HashSize):
 *         pNV = HTable.Table[i]
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_table = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":151
 *     HTable = nvt.NVHT
 *     table = {}
 *     for i in range(HTable.HashSize):             # <<<<<<<<<<<<<<
 *         pNV = HTable.Table[i]
 *         while pNV:
 */
  __pyx_t_2 = __pyx_v_HTable->HashSize;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysdif/_pysdif.pyx":152
 *     table = {}
 *     for i in range(HTable.HashSize):
 *         pNV = HTable.Table[i]             # <<<<<<<<<<<<<<
 *         while pNV:
 *             namevalue = <SdifNameValueT *>(pNV.Data)
 */
    __pyx_v_pNV = (__pyx_v_HTable->Table[__pyx_v_i]);

    /* "pysdif/_pysdif.pyx":153
 *     for i in range(HTable.HashSize):
 *         pNV = HTable.Table[i]
 *         while pNV:             # <<<<<<<<<<<<<<
 *             namevalue = <SdifNameValueT *>(pNV.Data)
 *             name = namevalue.Name
 */
    while (1) {
      __pyx_t_4 = (__pyx_v_pNV != 0);
      if (!__pyx_t_4) break;

      /* "pysdif/_pysdif.pyx":154
 *         pNV = HTable.Table[i]
 *         while pNV:
 *             namevalue = <SdifNameValueT *>(pNV.Data)             # <<<<<<<<<<<<<<
 *             name = namevalue.Name
 *             value = namevalue.Value
 */
      __pyx_v_namevalue = ((SdifNameValueT *)__pyx_v_pNV->Data);

      /* "pysdif/_pysdif.pyx":155
 *         while pNV:
 *             namevalue = <SdifNameValueT *>(pNV.Data)
 *             name = namevalue.Name             # <<<<<<<<<<<<<<
 *             value = namevalue.Value
 *             table[name] = value
 */
      __pyx_v_name = __pyx_v_namevalue->Name;

      /* "pysdif/_pysdif.pyx":156
 *             namevalue = <SdifNameValueT *>(pNV.Data)
 *             name = namevalue.Name
 *             value = namevalue.Value             # <<<<<<<<<<<<<<
 *             table[name] = value
 *             pNV = pNV.Next
 */
      __pyx_v_value = __pyx_v_namevalue->Value;

      /* "pysdif/_pysdif.pyx":157
 *             name = namevalue.Name
 *             value = namevalue.Value
 *             table[name] = value             # <<<<<<<<<<<<<<
 *             pNV = pNV.Next
 *     return table
 */
      __pyx_t_1 = PyBytes_FromString(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_5 = PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      if (PyDict_SetItem(((PyObject *)__pyx_v_table), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

      /* "pysdif/_pysdif.pyx":158
 *             value = namevalue.Value
 *             table[name] = value
 *             pNV = pNV.Next             # <<<<<<<<<<<<<<
 *     return table
 * 
 */
      __pyx_v_pNV = __pyx_v_pNV->Next;
    }
  }

  /* "pysdif/_pysdif.pyx":159
 *             table[name] = value
 *             pNV = pNV.Next
 *     return table             # <<<<<<<<<<<<<<
 * 
 * cdef valuetables_to_dicts (SdifNameValuesLT *namevalues):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_table));
  __pyx_r = ((PyObject *)__pyx_v_table);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysdif._pysdif.nvt_to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_table);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":161
 *     return table
 * 
 * cdef valuetables_to_dicts (SdifNameValuesLT *namevalues):             # <<<<<<<<<<<<<<
 *     """ create a list of dicts where each dict represents a value table """
 *     SdifListInitLoop(namevalues.NVTList)
 */

static PyObject *__pyx_f_6pysdif_7_pysdif_valuetables_to_dicts(SdifNameValuesLT *__pyx_v_namevalues) {
  PyObject *__pyx_v_tables = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("valuetables_to_dicts");

  /* "pysdif/_pysdif.pyx":163
 * cdef valuetables_to_dicts (SdifNameValuesLT *namevalues):
 *     """ create a list of dicts where each dict represents a value table """
 *     SdifListInitLoop(namevalues.NVTList)             # <<<<<<<<<<<<<<
 *     tables = []
 *     while SdifListIsNext(namevalues.NVTList):
 */
  SdifListInitLoop(__pyx_v_namevalues->NVTList);

  /* "pysdif/_pysdif.pyx":164
 *     """ create a list of dicts where each dict represents a value table """
 *     SdifListInitLoop(namevalues.NVTList)
 *     tables = []             # <<<<<<<<<<<<<<
 *     while SdifListIsNext(namevalues.NVTList):
 *         namevalues.CurrNVT = <SdifNameValueTableT *>(SdifListGetNext(namevalues.NVTList))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_tables = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":165
 *     SdifListInitLoop(namevalues.NVTList)
 *     tables = []
 *     while SdifListIsNext(namevalues.NVTList):             # <<<<<<<<<<<<<<
 *         namevalues.CurrNVT = <SdifNameValueTableT *>(SdifListGetNext(namevalues.NVTList))
 *         tables.append(nvt_to_dict(namevalues.CurrNVT))
 */
  while (1) {
    __pyx_t_2 = SdifListIsNext(__pyx_v_namevalues->NVTList);
    if (!__pyx_t_2) break;

    /* "pysdif/_pysdif.pyx":166
 *     tables = []
 *     while SdifListIsNext(namevalues.NVTList):
 *         namevalues.CurrNVT = <SdifNameValueTableT *>(SdifListGetNext(namevalues.NVTList))             # <<<<<<<<<<<<<<
 *         tables.append(nvt_to_dict(namevalues.CurrNVT))
 *     return tables
 */
    __pyx_v_namevalues->CurrNVT = ((SdifNameValueTableT *)SdifListGetNext(__pyx_v_namevalues->NVTList));

    /* "pysdif/_pysdif.pyx":167
 *     while SdifListIsNext(namevalues.NVTList):
 *         namevalues.CurrNVT = <SdifNameValueTableT *>(SdifListGetNext(namevalues.NVTList))
 *         tables.append(nvt_to_dict(namevalues.CurrNVT))             # <<<<<<<<<<<<<<
 *     return tables
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_tables) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_nvt_to_dict(__pyx_v_namevalues->CurrNVT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyList_Append(__pyx_v_tables, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pysdif/_pysdif.pyx":168
 *         namevalues.CurrNVT = <SdifNameValueTableT *>(SdifListGetNext(namevalues.NVTList))
 *         tables.append(nvt_to_dict(namevalues.CurrNVT))
 *     return tables             # <<<<<<<<<<<<<<
 * 
 * cdef streamidtable_to_list(SdifStreamIDTableT *table):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tables));
  __pyx_r = ((PyObject *)__pyx_v_tables);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.valuetables_to_dicts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tables);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":170
 *     return tables
 * 
 * cdef streamidtable_to_list(SdifStreamIDTableT *table):             # <<<<<<<<<<<<<<
 *     cdef unsigned int i
 *     cdef SdifHashNT *pID
 */

static PyObject *__pyx_f_6pysdif_7_pysdif_streamidtable_to_list(SdifStreamIDTableT *__pyx_v_table) {
  unsigned int __pyx_v_i;
  SdifHashNT *__pyx_v_pID;
  SdifStreamIDT *__pyx_v_streamid;
  PyObject *__pyx_v_streams = NULL;
  PyObject *__pyx_v_streamid_w = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("streamidtable_to_list");

  /* "pysdif/_pysdif.pyx":174
 *     cdef SdifHashNT *pID
 *     cdef SdifStreamIDT *streamid
 *     streams = []             # <<<<<<<<<<<<<<
 *     for i in range(table.SIDHT.HashSize):
 *         pID = table.SIDHT.Table[i]
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_streams = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":175
 *     cdef SdifStreamIDT *streamid
 *     streams = []
 *     for i in range(table.SIDHT.HashSize):             # <<<<<<<<<<<<<<
 *         pID = table.SIDHT.Table[i]
 *         while pID:
 */
  __pyx_t_2 = __pyx_v_table->SIDHT->HashSize;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysdif/_pysdif.pyx":176
 *     streams = []
 *     for i in range(table.SIDHT.HashSize):
 *         pID = table.SIDHT.Table[i]             # <<<<<<<<<<<<<<
 *         while pID:
 *             streamid = <SdifStreamIDT *>(pID.Data)
 */
    __pyx_v_pID = (__pyx_v_table->SIDHT->Table[__pyx_v_i]);

    /* "pysdif/_pysdif.pyx":177
 *     for i in range(table.SIDHT.HashSize):
 *         pID = table.SIDHT.Table[i]
 *         while pID:             # <<<<<<<<<<<<<<
 *             streamid = <SdifStreamIDT *>(pID.Data)
 *             streamid_w = StreamID_fromSdifStreadIDT(streamid)
 */
    while (1) {
      __pyx_t_4 = (__pyx_v_pID != 0);
      if (!__pyx_t_4) break;

      /* "pysdif/_pysdif.pyx":178
 *         pID = table.SIDHT.Table[i]
 *         while pID:
 *             streamid = <SdifStreamIDT *>(pID.Data)             # <<<<<<<<<<<<<<
 *             streamid_w = StreamID_fromSdifStreadIDT(streamid)
 *             streams.append(streamid_w)
 */
      __pyx_v_streamid = ((SdifStreamIDT *)__pyx_v_pID->Data);

      /* "pysdif/_pysdif.pyx":179
 *         while pID:
 *             streamid = <SdifStreamIDT *>(pID.Data)
 *             streamid_w = StreamID_fromSdifStreadIDT(streamid)             # <<<<<<<<<<<<<<
 *             streams.append(streamid_w)
 *             pID = pID.Next
 */
      __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_StreamID_fromSdifStreadIDT(__pyx_v_streamid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_v_streamid_w);
      __pyx_v_streamid_w = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pysdif/_pysdif.pyx":180
 *             streamid = <SdifStreamIDT *>(pID.Data)
 *             streamid_w = StreamID_fromSdifStreadIDT(streamid)
 *             streams.append(streamid_w)             # <<<<<<<<<<<<<<
 *             pID = pID.Next
 *     return streams
 */
      if (unlikely(((PyObject *)__pyx_v_streams) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = PyList_Append(__pyx_v_streams, __pyx_v_streamid_w); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pysdif/_pysdif.pyx":181
 *             streamid_w = StreamID_fromSdifStreadIDT(streamid)
 *             streams.append(streamid_w)
 *             pID = pID.Next             # <<<<<<<<<<<<<<
 *     return streams
 * 
 */
      __pyx_v_pID = __pyx_v_pID->Next;
    }
  }

  /* "pysdif/_pysdif.pyx":182
 *             streams.append(streamid_w)
 *             pID = pID.Next
 *     return streams             # <<<<<<<<<<<<<<
 * 
 * cdef class StreamID:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_streams));
  __pyx_r = ((PyObject *)__pyx_v_streams);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.streamidtable_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_streams);
  __Pyx_XDECREF(__pyx_v_streamid_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":188
 *     cdef int own_this
 *     property numid:
 *         def __get__(self): return self.this.NumID             # <<<<<<<<<<<<<<
 *     property source:
 *         def __get__(self): return self.this.Source
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_5numid___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_5numid___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->this->NumID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.StreamID.numid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":190
 *         def __get__(self): return self.this.NumID
 *     property source:
 *         def __get__(self): return self.this.Source             # <<<<<<<<<<<<<<
 *     property treeway:
 *         def __get__(self): return self.this.TreeWay
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_6source___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_6source___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->this->Source); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.StreamID.source.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":192
 *         def __get__(self): return self.this.Source
 *     property treeway:
 *         def __get__(self): return self.this.TreeWay             # <<<<<<<<<<<<<<
 *     def __cinit__(self, int numid, source, treeway):
 *         if numid == -1:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_7treeway___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_7treeway___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->this->TreeWay); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.StreamID.treeway.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":193
 *     property treeway:
 *         def __get__(self): return self.this.TreeWay
 *     def __cinit__(self, int numid, source, treeway):             # <<<<<<<<<<<<<<
 *         if numid == -1:
 *             # we are a wrapper of an existing SdifStreamID
 */

static int __pyx_pf_6pysdif_7_pysdif_8StreamID___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_8StreamID___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_numid;
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_treeway = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  char *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__numid,&__pyx_n_s__source,&__pyx_n_s__treeway,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__numid);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__treeway);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __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), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_numid = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_numid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_source = values[1];
    __pyx_v_treeway = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_numid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_numid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_source = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_treeway = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.StreamID.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":194
 *         def __get__(self): return self.this.TreeWay
 *     def __cinit__(self, int numid, source, treeway):
 *         if numid == -1:             # <<<<<<<<<<<<<<
 *             # we are a wrapper of an existing SdifStreamID
 *             self.own_this = 0
 */
  __pyx_t_1 = (__pyx_v_numid == -1);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":196
 *         if numid == -1:
 *             # we are a wrapper of an existing SdifStreamID
 *             self.own_this = 0             # <<<<<<<<<<<<<<
 *         else:
 *             self.this = SdifCreateStreamID(<SdifUInt4>numid, source, treeway)
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->own_this = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":198
 *             self.own_this = 0
 *         else:
 *             self.this = SdifCreateStreamID(<SdifUInt4>numid, source, treeway)             # <<<<<<<<<<<<<<
 *             self.own_this = 1
 *     def __dealloc__(self):
 */
    __pyx_t_2 = PyBytes_AsString(__pyx_v_source); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyBytes_AsString(__pyx_v_treeway); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    ((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->this = SdifCreateStreamID(((SdifUInt4)__pyx_v_numid), __pyx_t_2, __pyx_t_3);

    /* "pysdif/_pysdif.pyx":199
 *         else:
 *             self.this = SdifCreateStreamID(<SdifUInt4>numid, source, treeway)
 *             self.own_this = 1             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         if self.own_this:
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->own_this = 1;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.StreamID.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":200
 *             self.this = SdifCreateStreamID(<SdifUInt4>numid, source, treeway)
 *             self.own_this = 1
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.own_this:
 *             SdifKillStreamID(self.this)
 */

static void __pyx_pf_6pysdif_7_pysdif_8StreamID_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_6pysdif_7_pysdif_8StreamID_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "pysdif/_pysdif.pyx":201
 *             self.own_this = 1
 *     def __dealloc__(self):
 *         if self.own_this:             # <<<<<<<<<<<<<<
 *             SdifKillStreamID(self.this)
 *     def __repr__(self):
 */
  if (((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->own_this) {

    /* "pysdif/_pysdif.pyx":202
 *     def __dealloc__(self):
 *         if self.own_this:
 *             SdifKillStreamID(self.this)             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return "StreamID(numid=%d, source='%s', treeway='%s')" % (
 */
    SdifKillStreamID(((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_v_self)->this);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":203
 *         if self.own_this:
 *             SdifKillStreamID(self.this)
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "StreamID(numid=%d, source='%s', treeway='%s')" % (
 *             self.numid,
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8StreamID_2__repr__(PyObject *__pyx_v_self) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "pysdif/_pysdif.pyx":204
 *             SdifKillStreamID(self.this)
 *     def __repr__(self):
 *         return "StreamID(numid=%d, source='%s', treeway='%s')" % (             # <<<<<<<<<<<<<<
 *             self.numid,
 *             self.source,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pysdif/_pysdif.pyx":205
 *     def __repr__(self):
 *         return "StreamID(numid=%d, source='%s', treeway='%s')" % (
 *             self.numid,             # <<<<<<<<<<<<<<
 *             self.source,
 *             self.treeway)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__numid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "pysdif/_pysdif.pyx":206
 *         return "StreamID(numid=%d, source='%s', treeway='%s')" % (
 *             self.numid,
 *             self.source,             # <<<<<<<<<<<<<<
 *             self.treeway)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__source); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "pysdif/_pysdif.pyx":207
 *             self.numid,
 *             self.source,
 *             self.treeway)             # <<<<<<<<<<<<<<
 * 
 * cdef StreamID_fromSdifStreadIDT(SdifStreamIDT *this):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__treeway); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __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 = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysdif._pysdif.StreamID.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":209
 *             self.treeway)
 * 
 * cdef StreamID_fromSdifStreadIDT(SdifStreamIDT *this):             # <<<<<<<<<<<<<<
 *     cdef StreamID out = StreamID(-1, None, None)  # create a wrapper
 *     out.this = this
 */

static PyObject *__pyx_f_6pysdif_7_pysdif_StreamID_fromSdifStreadIDT(SdifStreamIDT *__pyx_v_this) {
  struct __pyx_obj_6pysdif_7_pysdif_StreamID *__pyx_v_out = 0;
  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("StreamID_fromSdifStreadIDT");

  /* "pysdif/_pysdif.pyx":210
 * 
 * cdef StreamID_fromSdifStreadIDT(SdifStreamIDT *this):
 *     cdef StreamID out = StreamID(-1, None, None)  # create a wrapper             # <<<<<<<<<<<<<<
 *     out.this = this
 *     out.own_this = 0
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_StreamID)), ((PyObject *)__pyx_k_tuple_2), NULL); 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_v_out = ((struct __pyx_obj_6pysdif_7_pysdif_StreamID *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":211
 * cdef StreamID_fromSdifStreadIDT(SdifStreamIDT *this):
 *     cdef StreamID out = StreamID(-1, None, None)  # create a wrapper
 *     out.this = this             # <<<<<<<<<<<<<<
 *     out.own_this = 0
 *     return out
 */
  __pyx_v_out->this = __pyx_v_this;

  /* "pysdif/_pysdif.pyx":212
 *     cdef StreamID out = StreamID(-1, None, None)  # create a wrapper
 *     out.this = this
 *     out.own_this = 0             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
  __pyx_v_out->own_this = 0;

  /* "pysdif/_pysdif.pyx":213
 *     out.this = this
 *     out.own_this = 0
 *     return out             # <<<<<<<<<<<<<<
 * 
 * cdef SdifMatrixTypeT *MatrixType_create(signature, column_names):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.StreamID_fromSdifStreadIDT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":215
 *     return out
 * 
 * cdef SdifMatrixTypeT *MatrixType_create(signature, column_names):             # <<<<<<<<<<<<<<
 *     cdef SdifSignature sig = _str2sig(signature)
 *     cdef SdifMatrixTypeT *mt = SdifCreateMatrixType(sig, NULL)
 */

static SdifMatrixTypeT *__pyx_f_6pysdif_7_pysdif_MatrixType_create(PyObject *__pyx_v_signature, PyObject *__pyx_v_column_names) {
  SdifSignature __pyx_v_sig;
  SdifMatrixTypeT *__pyx_v_mt;
  PyObject *__pyx_v_column_name = NULL;
  SdifMatrixTypeT *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  const char* __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("MatrixType_create");

  /* "pysdif/_pysdif.pyx":216
 * 
 * cdef SdifMatrixTypeT *MatrixType_create(signature, column_names):
 *     cdef SdifSignature sig = _str2sig(signature)             # <<<<<<<<<<<<<<
 *     cdef SdifMatrixTypeT *mt = SdifCreateMatrixType(sig, NULL)
 *     for column_name in column_names:
 */
  __pyx_t_1 = PyBytes_AsString(__pyx_v_signature); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_sig = __pyx_f_6pysdif_7_pysdif__str2sig(__pyx_t_1);

  /* "pysdif/_pysdif.pyx":217
 * cdef SdifMatrixTypeT *MatrixType_create(signature, column_names):
 *     cdef SdifSignature sig = _str2sig(signature)
 *     cdef SdifMatrixTypeT *mt = SdifCreateMatrixType(sig, NULL)             # <<<<<<<<<<<<<<
 *     for column_name in column_names:
 *         SdifMatrixTypeInsertTailColumnDef(mt, column_name)
 */
  __pyx_v_mt = SdifCreateMatrixType(__pyx_v_sig, NULL);

  /* "pysdif/_pysdif.pyx":218
 *     cdef SdifSignature sig = _str2sig(signature)
 *     cdef SdifMatrixTypeT *mt = SdifCreateMatrixType(sig, NULL)
 *     for column_name in column_names:             # <<<<<<<<<<<<<<
 *         SdifMatrixTypeInsertTailColumnDef(mt, column_name)
 *     return mt
 */
  if (PyList_CheckExact(__pyx_v_column_names) || PyTuple_CheckExact(__pyx_v_column_names)) {
    __pyx_t_2 = __pyx_v_column_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_column_names); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF(__pyx_v_column_name);
    __pyx_v_column_name = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pysdif/_pysdif.pyx":219
 *     cdef SdifMatrixTypeT *mt = SdifCreateMatrixType(sig, NULL)
 *     for column_name in column_names:
 *         SdifMatrixTypeInsertTailColumnDef(mt, column_name)             # <<<<<<<<<<<<<<
 *     return mt
 * 
 */
    __pyx_t_6 = PyBytes_AsString(__pyx_v_column_name); if (unlikely((__pyx_t_6 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    SdifMatrixTypeInsertTailColumnDef(__pyx_v_mt, __pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":220
 *     for column_name in column_names:
 *         SdifMatrixTypeInsertTailColumnDef(mt, column_name)
 *     return mt             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_mt;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("pysdif._pysdif.MatrixType_create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_column_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":223
 * 
 * 
 * cdef SdifFrameTypeT *FrameType_create(signature, components):             # <<<<<<<<<<<<<<
 *     cdef SdifSignature sig = str2signature(signature)
 *     cdef SdifFrameTypeT *ft = SdifCreateFrameType(sig, NULL)
 */

static SdifFrameTypeT *__pyx_f_6pysdif_7_pysdif_FrameType_create(PyObject *__pyx_v_signature, PyObject *__pyx_v_components) {
  SdifSignature __pyx_v_sig;
  SdifFrameTypeT *__pyx_v_ft;
  PyObject *__pyx_v_component = NULL;
  SdifFrameTypeT *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  SdifSignature __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("FrameType_create");

  /* "pysdif/_pysdif.pyx":224
 * 
 * cdef SdifFrameTypeT *FrameType_create(signature, components):
 *     cdef SdifSignature sig = str2signature(signature)             # <<<<<<<<<<<<<<
 *     cdef SdifFrameTypeT *ft = SdifCreateFrameType(sig, NULL)
 *     for component in components:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__str2signature); 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);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_signature);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_signature);
  __Pyx_GIVEREF(__pyx_v_signature);
  __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 = 224; __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_t_4 = __Pyx_PyInt_from_py_SdifUInt4(__pyx_t_3); if (unlikely((__pyx_t_4 == (SdifSignature)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sig = __pyx_t_4;

  /* "pysdif/_pysdif.pyx":225
 * cdef SdifFrameTypeT *FrameType_create(signature, components):
 *     cdef SdifSignature sig = str2signature(signature)
 *     cdef SdifFrameTypeT *ft = SdifCreateFrameType(sig, NULL)             # <<<<<<<<<<<<<<
 *     for component in components:
 *         if isinstance(component, Component):
 */
  __pyx_v_ft = SdifCreateFrameType(__pyx_v_sig, NULL);

  /* "pysdif/_pysdif.pyx":226
 *     cdef SdifSignature sig = str2signature(signature)
 *     cdef SdifFrameTypeT *ft = SdifCreateFrameType(sig, NULL)
 *     for component in components:             # <<<<<<<<<<<<<<
 *         if isinstance(component, Component):
 *             SdifFrameTypePutComponent(ft, str2signature(component.signature), component.name)
 */
  if (PyList_CheckExact(__pyx_v_components) || PyTuple_CheckExact(__pyx_v_components)) {
    __pyx_t_3 = __pyx_v_components; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_components); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_3)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
    } else if (PyTuple_CheckExact(__pyx_t_3)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF(__pyx_v_component);
    __pyx_v_component = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pysdif/_pysdif.pyx":227
 *     cdef SdifFrameTypeT *ft = SdifCreateFrameType(sig, NULL)
 *     for component in components:
 *         if isinstance(component, Component):             # <<<<<<<<<<<<<<
 *             SdifFrameTypePutComponent(ft, str2signature(component.signature), component.name)
 *         else:
 */
    __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_Component));
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_component, __pyx_t_2); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "pysdif/_pysdif.pyx":228
 *     for component in components:
 *         if isinstance(component, Component):
 *             SdifFrameTypePutComponent(ft, str2signature(component.signature), component.name)             # <<<<<<<<<<<<<<
 *         else:
 *             SdifFrameTypePutComponent(ft, str2signature(component[0]), component[1])
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__str2signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_component, __pyx_n_s__signature); 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_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyInt_from_py_SdifUInt4(__pyx_t_1); if (unlikely((__pyx_t_4 == (SdifSignature)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_component, __pyx_n_s__name); 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_t_9 = PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      SdifFrameTypePutComponent(__pyx_v_ft, __pyx_t_4, __pyx_t_9);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "pysdif/_pysdif.pyx":230
 *             SdifFrameTypePutComponent(ft, str2signature(component.signature), component.name)
 *         else:
 *             SdifFrameTypePutComponent(ft, str2signature(component[0]), component[1])             # <<<<<<<<<<<<<<
 *     return ft
 * 
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__str2signature); 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);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_component, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyInt_from_py_SdifUInt4(__pyx_t_8); if (unlikely((__pyx_t_4 == (SdifSignature)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_component, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyBytes_AsString(__pyx_t_8); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      SdifFrameTypePutComponent(__pyx_v_ft, __pyx_t_4, __pyx_t_9);
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysdif/_pysdif.pyx":231
 *         else:
 *             SdifFrameTypePutComponent(ft, str2signature(component[0]), component[1])
 *     return ft             # <<<<<<<<<<<<<<
 * 
 * cdef class MatrixTypeDefinition:
 */
  __pyx_r = __pyx_v_ft;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("pysdif._pysdif.FrameType_create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_component);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":236
 *     cdef public object signature
 *     cdef public list column_names
 *     def __init__(self, signature, column_names):             # <<<<<<<<<<<<<<
 *         self.signature = signature
 *         self.column_names = column_names
 */

static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_column_names = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__column_names,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__column_names);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 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, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = values[0];
    __pyx_v_column_names = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_signature = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_column_names = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 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("pysdif._pysdif.MatrixTypeDefinition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":237
 *     cdef public list column_names
 *     def __init__(self, signature, column_names):
 *         self.signature = signature             # <<<<<<<<<<<<<<
 *         self.column_names = column_names
 *     def __repr__(self):
 */
  __Pyx_INCREF(__pyx_v_signature);
  __Pyx_GIVEREF(__pyx_v_signature);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_DECREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature = __pyx_v_signature;

  /* "pysdif/_pysdif.pyx":238
 *     def __init__(self, signature, column_names):
 *         self.signature = signature
 *         self.column_names = column_names             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return "1MTD(signature=%s, column_names=%s)" % (self.signature, ', '.join(self.column_names))
 */
  if (!(likely(PyList_CheckExact(__pyx_v_column_names))||((__pyx_v_column_names) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_column_names)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_column_names);
  __Pyx_GIVEREF(__pyx_v_column_names);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names = ((PyObject*)__pyx_v_column_names);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.MatrixTypeDefinition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":239
 *         self.signature = signature
 *         self.column_names = column_names
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "1MTD(signature=%s, column_names=%s)" % (self.signature, ', '.join(self.column_names))
 *     def __iter__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("__repr__");

  /* "pysdif/_pysdif.pyx":240
 *         self.column_names = column_names
 *     def __repr__(self):
 *         return "1MTD(signature=%s, column_names=%s)" % (self.signature, ', '.join(self.column_names))             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         return iter(self.column_names)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_4), __pyx_n_s__join); 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_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  __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 = 240; __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_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_GIVEREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.MatrixTypeDefinition.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":241
 *     def __repr__(self):
 *         return "1MTD(signature=%s, column_names=%s)" % (self.signature, ', '.join(self.column_names))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.column_names)
 *     def __len__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_2__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_2__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__");

  /* "pysdif/_pysdif.pyx":242
 *         return "1MTD(signature=%s, column_names=%s)" % (self.signature, ', '.join(self.column_names))
 *     def __iter__(self):
 *         return iter(self.column_names)             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return len(self.column_names)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.MatrixTypeDefinition.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":243
 *     def __iter__(self):
 *         return iter(self.column_names)
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.column_names)
 *     cdef SdifMatrixTypeT *toSdifMatrixType(self):
 */

static Py_ssize_t __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__");

  /* "pysdif/_pysdif.pyx":244
 *         return iter(self.column_names)
 *     def __len__(self):
 *         return len(self.column_names)             # <<<<<<<<<<<<<<
 *     cdef SdifMatrixTypeT *toSdifMatrixType(self):
 *         return MatrixType_create(self.signature, self.column_names)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.MatrixTypeDefinition.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":245
 *     def __len__(self):
 *         return len(self.column_names)
 *     cdef SdifMatrixTypeT *toSdifMatrixType(self):             # <<<<<<<<<<<<<<
 *         return MatrixType_create(self.signature, self.column_names)
 * 
 */

static SdifMatrixTypeT *__pyx_f_6pysdif_7_pysdif_20MatrixTypeDefinition_toSdifMatrixType(struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *__pyx_v_self) {
  SdifMatrixTypeT *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("toSdifMatrixType");

  /* "pysdif/_pysdif.pyx":246
 *         return len(self.column_names)
 *     cdef SdifMatrixTypeT *toSdifMatrixType(self):
 *         return MatrixType_create(self.signature, self.column_names)             # <<<<<<<<<<<<<<
 * 
 * cdef MatrixTypesTable_to_list(SdifHashTableT *t):
 */
  __pyx_t_1 = __pyx_v_self->signature;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->column_names);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_r = __pyx_f_6pysdif_7_pysdif_MatrixType_create(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":234
 * 
 * cdef class MatrixTypeDefinition:
 *     cdef public object signature             # <<<<<<<<<<<<<<
 *     cdef public list column_names
 *     def __init__(self, signature, column_names):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  __pyx_r = ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_DECREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_DECREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature);
  ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->signature = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":235
 * cdef class MatrixTypeDefinition:
 *     cdef public object signature
 *     cdef public list column_names             # <<<<<<<<<<<<<<
 *     def __init__(self, signature, column_names):
 *         self.signature = signature
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.MatrixTypeDefinition.column_names.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names));
  ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)__pyx_v_self)->column_names = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":248
 *         return MatrixType_create(self.signature, self.column_names)
 * 
 * cdef MatrixTypesTable_to_list(SdifHashTableT *t):             # <<<<<<<<<<<<<<
 *     cdef unsigned int i
 *     cdef SdifHashNT *pName
 */

static PyObject *__pyx_f_6pysdif_7_pysdif_MatrixTypesTable_to_list(SdifHashTableT *__pyx_v_t) {
  unsigned int __pyx_v_i;
  SdifHashNT *__pyx_v_pName;
  SdifMatrixTypeT *__pyx_v_matrix;
  SdifColumnDefT *__pyx_v_column_def;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_column_names = 0;
  PyObject *__pyx_v_signature = NULL;
  PyObject *__pyx_v_row = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("MatrixTypesTable_to_list");

  /* "pysdif/_pysdif.pyx":253
 *     cdef SdifMatrixTypeT *matrix
 *     cdef SdifColumnDefT *column_def
 *     cdef list out = []             # <<<<<<<<<<<<<<
 *     cdef list column_names
 *     for i in range(t.HashSize):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":255
 *     cdef list out = []
 *     cdef list column_names
 *     for i in range(t.HashSize):             # <<<<<<<<<<<<<<
 *         pName = t.Table[i]
 *         while pName:
 */
  __pyx_t_2 = __pyx_v_t->HashSize;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysdif/_pysdif.pyx":256
 *     cdef list column_names
 *     for i in range(t.HashSize):
 *         pName = t.Table[i]             # <<<<<<<<<<<<<<
 *         while pName:
 *             matrix = <SdifMatrixTypeT *>(pName.Data)
 */
    __pyx_v_pName = (__pyx_v_t->Table[__pyx_v_i]);

    /* "pysdif/_pysdif.pyx":257
 *     for i in range(t.HashSize):
 *         pName = t.Table[i]
 *         while pName:             # <<<<<<<<<<<<<<
 *             matrix = <SdifMatrixTypeT *>(pName.Data)
 *             if not SdifListIsEmpty(matrix.ColumnUserList):
 */
    while (1) {
      __pyx_t_4 = (__pyx_v_pName != 0);
      if (!__pyx_t_4) break;

      /* "pysdif/_pysdif.pyx":258
 *         pName = t.Table[i]
 *         while pName:
 *             matrix = <SdifMatrixTypeT *>(pName.Data)             # <<<<<<<<<<<<<<
 *             if not SdifListIsEmpty(matrix.ColumnUserList):
 *                 signature = sig2str(matrix.Signature)
 */
      __pyx_v_matrix = ((SdifMatrixTypeT *)__pyx_v_pName->Data);

      /* "pysdif/_pysdif.pyx":259
 *         while pName:
 *             matrix = <SdifMatrixTypeT *>(pName.Data)
 *             if not SdifListIsEmpty(matrix.ColumnUserList):             # <<<<<<<<<<<<<<
 *                 signature = sig2str(matrix.Signature)
 *                 column_def = <SdifColumnDefT *>SdifListGetHead(matrix.ColumnUserList)
 */
      __pyx_t_4 = (!SdifListIsEmpty(__pyx_v_matrix->ColumnUserList));
      if (__pyx_t_4) {

        /* "pysdif/_pysdif.pyx":260
 *             matrix = <SdifMatrixTypeT *>(pName.Data)
 *             if not SdifListIsEmpty(matrix.ColumnUserList):
 *                 signature = sig2str(matrix.Signature)             # <<<<<<<<<<<<<<
 *                 column_def = <SdifColumnDefT *>SdifListGetHead(matrix.ColumnUserList)
 *                 column_names = []
 */
        __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(__pyx_v_matrix->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF(__pyx_v_signature);
        __pyx_v_signature = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pysdif/_pysdif.pyx":261
 *             if not SdifListIsEmpty(matrix.ColumnUserList):
 *                 signature = sig2str(matrix.Signature)
 *                 column_def = <SdifColumnDefT *>SdifListGetHead(matrix.ColumnUserList)             # <<<<<<<<<<<<<<
 *                 column_names = []
 *                 column_names.append(column_def.Name)
 */
        __pyx_v_column_def = ((SdifColumnDefT *)SdifListGetHead(__pyx_v_matrix->ColumnUserList));

        /* "pysdif/_pysdif.pyx":262
 *                 signature = sig2str(matrix.Signature)
 *                 column_def = <SdifColumnDefT *>SdifListGetHead(matrix.ColumnUserList)
 *                 column_names = []             # <<<<<<<<<<<<<<
 *                 column_names.append(column_def.Name)
 *                 while SdifListIsNext(matrix.ColumnUserList):
 */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_XDECREF(((PyObject *)__pyx_v_column_names));
        __pyx_v_column_names = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pysdif/_pysdif.pyx":263
 *                 column_def = <SdifColumnDefT *>SdifListGetHead(matrix.ColumnUserList)
 *                 column_names = []
 *                 column_names.append(column_def.Name)             # <<<<<<<<<<<<<<
 *                 while SdifListIsNext(matrix.ColumnUserList):
 *                     column_def = <SdifColumnDefT *>(SdifListGetNext(matrix.ColumnUserList))
 */
        if (unlikely(((PyObject *)__pyx_v_column_names) == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_1 = PyBytes_FromString(__pyx_v_column_def->Name); 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_5 = PyList_Append(__pyx_v_column_names, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

        /* "pysdif/_pysdif.pyx":264
 *                 column_names = []
 *                 column_names.append(column_def.Name)
 *                 while SdifListIsNext(matrix.ColumnUserList):             # <<<<<<<<<<<<<<
 *                     column_def = <SdifColumnDefT *>(SdifListGetNext(matrix.ColumnUserList))
 *                     column_names.append(column_def.Name)
 */
        while (1) {
          __pyx_t_6 = SdifListIsNext(__pyx_v_matrix->ColumnUserList);
          if (!__pyx_t_6) break;

          /* "pysdif/_pysdif.pyx":265
 *                 column_names.append(column_def.Name)
 *                 while SdifListIsNext(matrix.ColumnUserList):
 *                     column_def = <SdifColumnDefT *>(SdifListGetNext(matrix.ColumnUserList))             # <<<<<<<<<<<<<<
 *                     column_names.append(column_def.Name)
 *                 row = MatrixTypeDefinition(signature=signature, column_names=column_names)
 */
          __pyx_v_column_def = ((SdifColumnDefT *)SdifListGetNext(__pyx_v_matrix->ColumnUserList));

          /* "pysdif/_pysdif.pyx":266
 *                 while SdifListIsNext(matrix.ColumnUserList):
 *                     column_def = <SdifColumnDefT *>(SdifListGetNext(matrix.ColumnUserList))
 *                     column_names.append(column_def.Name)             # <<<<<<<<<<<<<<
 *                 row = MatrixTypeDefinition(signature=signature, column_names=column_names)
 *                 out.append(row)
 */
          if (unlikely(((PyObject *)__pyx_v_column_names) == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
          }
          __pyx_t_1 = PyBytes_FromString(__pyx_v_column_def->Name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
          __pyx_t_5 = PyList_Append(__pyx_v_column_names, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        }

        /* "pysdif/_pysdif.pyx":267
 *                     column_def = <SdifColumnDefT *>(SdifListGetNext(matrix.ColumnUserList))
 *                     column_names.append(column_def.Name)
 *                 row = MatrixTypeDefinition(signature=signature, column_names=column_names)             # <<<<<<<<<<<<<<
 *                 out.append(row)
 *             pName = pName.Next
 */
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__signature), __pyx_v_signature) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__column_names), ((PyObject *)__pyx_v_column_names)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_MatrixTypeDefinition)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_v_row);
        __pyx_v_row = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pysdif/_pysdif.pyx":268
 *                     column_names.append(column_def.Name)
 *                 row = MatrixTypeDefinition(signature=signature, column_names=column_names)
 *                 out.append(row)             # <<<<<<<<<<<<<<
 *             pName = pName.Next
 *     return out
 */
        if (unlikely(((PyObject *)__pyx_v_out) == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_5 = PyList_Append(__pyx_v_out, __pyx_v_row); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pysdif/_pysdif.pyx":269
 *                 row = MatrixTypeDefinition(signature=signature, column_names=column_names)
 *                 out.append(row)
 *             pName = pName.Next             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
      __pyx_v_pName = __pyx_v_pName->Next;
    }
  }

  /* "pysdif/_pysdif.pyx":270
 *                 out.append(row)
 *             pName = pName.Next
 *     return out             # <<<<<<<<<<<<<<
 * 
 * cdef class Component:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.MatrixTypesTable_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_column_names);
  __Pyx_XDECREF(__pyx_v_signature);
  __Pyx_XDECREF(__pyx_v_row);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":276
 *     cdef readonly str name
 *     cdef readonly unsigned int num
 *     def __init__(self, str signature, str name):             # <<<<<<<<<<<<<<
 *         self.signature = signature
 *         self.name = name
 */

static int __pyx_pf_6pysdif_7_pysdif_9Component___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_9Component___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__name,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = ((PyObject*)values[0]);
    __pyx_v_name = ((PyObject*)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_signature = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_name = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.Component.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signature), (&PyString_Type), 1, "signature", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyString_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":277
 *     cdef readonly unsigned int num
 *     def __init__(self, str signature, str name):
 *         self.signature = signature             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.num = 0
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_signature));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_signature));
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature));
  ((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature = __pyx_v_signature;

  /* "pysdif/_pysdif.pyx":278
 *     def __init__(self, str signature, str name):
 *         self.signature = signature
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.num = 0
 *     def __repr__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name));
  ((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name = __pyx_v_name;

  /* "pysdif/_pysdif.pyx":279
 *         self.signature = signature
 *         self.name = name
 *         self.num = 0             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return "Component(sig=%s, name=%s)" % (self.signature, self.name)
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->num = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.Component.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":280
 *         self.name = name
 *         self.num = 0
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Component(sig=%s, name=%s)" % (self.signature, self.name)
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "pysdif/_pysdif.pyx":281
 *         self.num = 0
 *     def __repr__(self):
 *         return "Component(sig=%s, name=%s)" % (self.signature, self.name)             # <<<<<<<<<<<<<<
 * 
 * cdef Component Component_from_SdifComponent(SdifComponentT *c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name));
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Component.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":273
 * 
 * cdef class Component:
 *     cdef readonly str signature             # <<<<<<<<<<<<<<
 *     cdef readonly str name
 *     cdef readonly unsigned int num
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_9signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_9signature___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->signature);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":274
 * cdef class Component:
 *     cdef readonly str signature
 *     cdef readonly str name             # <<<<<<<<<<<<<<
 *     cdef readonly unsigned int num
 *     def __init__(self, str signature, str name):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->name);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":275
 *     cdef readonly str signature
 *     cdef readonly str name
 *     cdef readonly unsigned int num             # <<<<<<<<<<<<<<
 *     def __init__(self, str signature, str name):
 *         self.signature = signature
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_3num___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_9Component_3num___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_v_self)->num); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.Component.num.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":283
 *         return "Component(sig=%s, name=%s)" % (self.signature, self.name)
 * 
 * cdef Component Component_from_SdifComponent(SdifComponentT *c):             # <<<<<<<<<<<<<<
 *     cdef Component out = Component(sig2str(c.MtrxS), c.Name)
 *     out.num = c.Num
 */

static struct __pyx_obj_6pysdif_7_pysdif_Component *__pyx_f_6pysdif_7_pysdif_Component_from_SdifComponent(SdifComponentT *__pyx_v_c) {
  struct __pyx_obj_6pysdif_7_pysdif_Component *__pyx_v_out = 0;
  struct __pyx_obj_6pysdif_7_pysdif_Component *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("Component_from_SdifComponent");

  /* "pysdif/_pysdif.pyx":284
 * 
 * cdef Component Component_from_SdifComponent(SdifComponentT *c):
 *     cdef Component out = Component(sig2str(c.MtrxS), c.Name)             # <<<<<<<<<<<<<<
 *     out.num = c.Num
 *     return out
 */
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(__pyx_v_c->MtrxS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyBytes_FromString(__pyx_v_c->Name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_Component)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_v_out = ((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":285
 * cdef Component Component_from_SdifComponent(SdifComponentT *c):
 *     cdef Component out = Component(sig2str(c.MtrxS), c.Name)
 *     out.num = c.Num             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
  __pyx_v_out->num = __pyx_v_c->Num;

  /* "pysdif/_pysdif.pyx":286
 *     cdef Component out = Component(sig2str(c.MtrxS), c.Name)
 *     out.num = c.Num
 *     return out             # <<<<<<<<<<<<<<
 * 
 * cdef FrameTypesTable_to_list(SdifHashTableT *t):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_6pysdif_7_pysdif_Component *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.Component_from_SdifComponent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":288
 *     return out
 * 
 * cdef FrameTypesTable_to_list(SdifHashTableT *t):             # <<<<<<<<<<<<<<
 *     cdef unsigned int i
 *     cdef SdifHashNT *pName
 */

static PyObject *__pyx_f_6pysdif_7_pysdif_FrameTypesTable_to_list(SdifHashTableT *__pyx_v_t) {
  unsigned int __pyx_v_i;
  SdifHashNT *__pyx_v_pName;
  SdifFrameTypeT *__pyx_v_frame;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_components = NULL;
  PyObject *__pyx_v_signature = NULL;
  long __pyx_v_j;
  struct __pyx_obj_6pysdif_7_pysdif_Component *__pyx_v_component = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  unsigned int __pyx_t_2;
  unsigned int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  long __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("FrameTypesTable_to_list");

  /* "pysdif/_pysdif.pyx":292
 *     cdef SdifHashNT *pName
 *     cdef SdifFrameTypeT *frame
 *     cdef list out = []             # <<<<<<<<<<<<<<
 * 
 *     for i in range(t.HashSize):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":294
 *     cdef list out = []
 * 
 *     for i in range(t.HashSize):             # <<<<<<<<<<<<<<
 *         pName = t.Table[i]
 *         while pName:
 */
  __pyx_t_2 = __pyx_v_t->HashSize;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysdif/_pysdif.pyx":295
 * 
 *     for i in range(t.HashSize):
 *         pName = t.Table[i]             # <<<<<<<<<<<<<<
 *         while pName:
 *             frame = <SdifFrameTypeT *>(pName.Data)
 */
    __pyx_v_pName = (__pyx_v_t->Table[__pyx_v_i]);

    /* "pysdif/_pysdif.pyx":296
 *     for i in range(t.HashSize):
 *         pName = t.Table[i]
 *         while pName:             # <<<<<<<<<<<<<<
 *             frame = <SdifFrameTypeT *>(pName.Data)
 *             if frame.NbComponentUse > 0:
 */
    while (1) {
      __pyx_t_4 = (__pyx_v_pName != 0);
      if (!__pyx_t_4) break;

      /* "pysdif/_pysdif.pyx":297
 *         pName = t.Table[i]
 *         while pName:
 *             frame = <SdifFrameTypeT *>(pName.Data)             # <<<<<<<<<<<<<<
 *             if frame.NbComponentUse > 0:
 *                 components = []
 */
      __pyx_v_frame = ((SdifFrameTypeT *)__pyx_v_pName->Data);

      /* "pysdif/_pysdif.pyx":298
 *         while pName:
 *             frame = <SdifFrameTypeT *>(pName.Data)
 *             if frame.NbComponentUse > 0:             # <<<<<<<<<<<<<<
 *                 components = []
 *                 signature = sig2str(frame.Signature)
 */
      __pyx_t_4 = (__pyx_v_frame->NbComponentUse > 0);
      if (__pyx_t_4) {

        /* "pysdif/_pysdif.pyx":299
 *             frame = <SdifFrameTypeT *>(pName.Data)
 *             if frame.NbComponentUse > 0:
 *                 components = []             # <<<<<<<<<<<<<<
 *                 signature = sig2str(frame.Signature)
 *                 for j in range(frame.NbComponent - frame.NbComponentUse + 1, frame.NbComponent + 1):
 */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_XDECREF(((PyObject *)__pyx_v_components));
        __pyx_v_components = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pysdif/_pysdif.pyx":300
 *             if frame.NbComponentUse > 0:
 *                 components = []
 *                 signature = sig2str(frame.Signature)             # <<<<<<<<<<<<<<
 *                 for j in range(frame.NbComponent - frame.NbComponentUse + 1, frame.NbComponent + 1):
 *                     component = Component_from_SdifComponent(SdifFrameTypeGetNthComponent(frame, j))
 */
        __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(__pyx_v_frame->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF(__pyx_v_signature);
        __pyx_v_signature = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pysdif/_pysdif.pyx":301
 *                 components = []
 *                 signature = sig2str(frame.Signature)
 *                 for j in range(frame.NbComponent - frame.NbComponentUse + 1, frame.NbComponent + 1):             # <<<<<<<<<<<<<<
 *                     component = Component_from_SdifComponent(SdifFrameTypeGetNthComponent(frame, j))
 *                     components.append(component)
 */
        __pyx_t_5 = (__pyx_v_frame->NbComponent + 1);
        for (__pyx_t_6 = ((__pyx_v_frame->NbComponent - __pyx_v_frame->NbComponentUse) + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
          __pyx_v_j = __pyx_t_6;

          /* "pysdif/_pysdif.pyx":302
 *                 signature = sig2str(frame.Signature)
 *                 for j in range(frame.NbComponent - frame.NbComponentUse + 1, frame.NbComponent + 1):
 *                     component = Component_from_SdifComponent(SdifFrameTypeGetNthComponent(frame, j))             # <<<<<<<<<<<<<<
 *                     components.append(component)
 *                 out.append(FrameTypeDefinition(signature, components))
 */
          __pyx_t_1 = ((PyObject *)__pyx_f_6pysdif_7_pysdif_Component_from_SdifComponent(SdifFrameTypeGetNthComponent(__pyx_v_frame, __pyx_v_j))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_XDECREF(((PyObject *)__pyx_v_component));
          __pyx_v_component = ((struct __pyx_obj_6pysdif_7_pysdif_Component *)__pyx_t_1);
          __pyx_t_1 = 0;

          /* "pysdif/_pysdif.pyx":303
 *                 for j in range(frame.NbComponent - frame.NbComponentUse + 1, frame.NbComponent + 1):
 *                     component = Component_from_SdifComponent(SdifFrameTypeGetNthComponent(frame, j))
 *                     components.append(component)             # <<<<<<<<<<<<<<
 *                 out.append(FrameTypeDefinition(signature, components))
 *             pName = pName.Next
 */
          if (unlikely(((PyObject *)__pyx_v_components) == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
          }
          __pyx_t_7 = PyList_Append(__pyx_v_components, ((PyObject *)__pyx_v_component)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "pysdif/_pysdif.pyx":304
 *                     component = Component_from_SdifComponent(SdifFrameTypeGetNthComponent(frame, j))
 *                     components.append(component)
 *                 out.append(FrameTypeDefinition(signature, components))             # <<<<<<<<<<<<<<
 *             pName = pName.Next
 *     return out
 */
        if (unlikely(((PyObject *)__pyx_v_out) == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_signature);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_signature);
        __Pyx_GIVEREF(__pyx_v_signature);
        __Pyx_INCREF(((PyObject *)__pyx_v_components));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_components));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_components));
        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_FrameTypeDefinition)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_7 = PyList_Append(__pyx_v_out, __pyx_t_8); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pysdif/_pysdif.pyx":305
 *                     components.append(component)
 *                 out.append(FrameTypeDefinition(signature, components))
 *             pName = pName.Next             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
      __pyx_v_pName = __pyx_v_pName->Next;
    }
  }

  /* "pysdif/_pysdif.pyx":306
 *                 out.append(FrameTypeDefinition(signature, components))
 *             pName = pName.Next
 *     return out             # <<<<<<<<<<<<<<
 * 
 * cdef class FrameTypeDefinition:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypesTable_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_components);
  __Pyx_XDECREF(__pyx_v_signature);
  __Pyx_XDECREF((PyObject *)__pyx_v_component);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":311
 *     cdef public str signature
 *     cdef public list components
 *     def __init__(self, signature, components):             # <<<<<<<<<<<<<<
 *         self.signature = signature
 *         self.components = components
 */

static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_components = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__components,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__components);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = values[0];
    __pyx_v_components = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_signature = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_components = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":312
 *     cdef public list components
 *     def __init__(self, signature, components):
 *         self.signature = signature             # <<<<<<<<<<<<<<
 *         self.components = components
 *     def __repr__(self):
 */
  if (!(likely(PyString_CheckExact(__pyx_v_signature))||((__pyx_v_signature) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_signature)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_signature);
  __Pyx_GIVEREF(__pyx_v_signature);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature = ((PyObject*)__pyx_v_signature);

  /* "pysdif/_pysdif.pyx":313
 *     def __init__(self, signature, components):
 *         self.signature = signature
 *         self.components = components             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         s = [str(component) for component in self.components]
 */
  if (!(likely(PyList_CheckExact(__pyx_v_components))||((__pyx_v_components) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_components)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_components);
  __Pyx_GIVEREF(__pyx_v_components);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components = ((PyObject*)__pyx_v_components);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":314
 *         self.signature = signature
 *         self.components = components
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         s = [str(component) for component in self.components]
 *         return "1FTD (signature='%s', components=[%s])" % (self.signature, ', '.join(s))
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_v_component = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  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("__repr__");

  /* "pysdif/_pysdif.pyx":315
 *         self.components = components
 *     def __repr__(self):
 *         s = [str(component) for component in self.components]             # <<<<<<<<<<<<<<
 *         return "1FTD (signature='%s', components=[%s])" % (self.signature, ', '.join(s))
 *     def __iter__(self):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (unlikely(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    __Pyx_XDECREF(__pyx_v_component);
    __pyx_v_component = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_component);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_component);
    __Pyx_GIVEREF(__pyx_v_component);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_v_s = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":316
 *     def __repr__(self):
 *         s = [str(component) for component in self.components]
 *         return "1FTD (signature='%s', components=[%s])" % (self.signature, ', '.join(s))             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         return iter(self.components)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_4), __pyx_n_s__join); 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 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_s));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_s));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_s));
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __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_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_component);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":317
 *         s = [str(component) for component in self.components]
 *         return "1FTD (signature='%s', components=[%s])" % (self.signature, ', '.join(s))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.components)
 *     def __len__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_2__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_2__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__");

  /* "pysdif/_pysdif.pyx":318
 *         return "1FTD (signature='%s', components=[%s])" % (self.signature, ', '.join(s))
 *     def __iter__(self):
 *         return iter(self.components)             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return len(self.components)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":319
 *     def __iter__(self):
 *         return iter(self.components)
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.components)
 * 
 */

static Py_ssize_t __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__");

  /* "pysdif/_pysdif.pyx":320
 *         return iter(self.components)
 *     def __len__(self):
 *         return len(self.components)             # <<<<<<<<<<<<<<
 * 
 * # ----------------------------------------------------------------------
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":309
 * 
 * cdef class FrameTypeDefinition:
 *     cdef public str signature             # <<<<<<<<<<<<<<
 *     cdef public list components
 *     def __init__(self, signature, components):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.signature.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->signature = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":310
 * cdef class FrameTypeDefinition:
 *     cdef public str signature
 *     cdef public list components             # <<<<<<<<<<<<<<
 *     def __init__(self, signature, components):
 *         self.signature = signature
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameTypeDefinition.components.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)__pyx_v_self)->components = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":331
 * }
 * 
 * def get_predefined_frames_and_matrices(sdiftype):             # <<<<<<<<<<<<<<
 *     t = SDIF_NEWTYPES.get(sdiftype)
 *     if t:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_2get_predefined_frames_and_matrices(PyObject *__pyx_self, PyObject *__pyx_v_sdiftype); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_2get_predefined_frames_and_matrices[] = "get_predefined_frames_and_matrices(sdiftype)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_2get_predefined_frames_and_matrices = {__Pyx_NAMESTR("get_predefined_frames_and_matrices"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_2get_predefined_frames_and_matrices, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_2get_predefined_frames_and_matrices)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_2get_predefined_frames_and_matrices(PyObject *__pyx_self, PyObject *__pyx_v_sdiftype) {
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_predefined_frames_and_matrices");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":332
 * 
 * def get_predefined_frames_and_matrices(sdiftype):
 *     t = SDIF_NEWTYPES.get(sdiftype)             # <<<<<<<<<<<<<<
 *     if t:
 *         return t['frame_types'], t['matrix_types']
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__SDIF_NEWTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __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 = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_sdiftype);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sdiftype);
  __Pyx_GIVEREF(__pyx_v_sdiftype);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_t = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pysdif/_pysdif.pyx":333
 * def get_predefined_frames_and_matrices(sdiftype):
 *     t = SDIF_NEWTYPES.get(sdiftype)
 *     if t:             # <<<<<<<<<<<<<<
 *         return t['frame_types'], t['matrix_types']
 *     else:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_t); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "pysdif/_pysdif.pyx":334
 *     t = SDIF_NEWTYPES.get(sdiftype)
 *     if t:
 *         return t['frame_types'], t['matrix_types']             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyObject_GetItem(__pyx_v_t, ((PyObject *)__pyx_n_s__frame_types)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetItem(__pyx_v_t, ((PyObject *)__pyx_n_s__matrix_types)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":336
 *         return t['frame_types'], t['matrix_types']
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * # ----------------------------------------------------------------------
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.get_predefined_frames_and_matrices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":340
 * # ----------------------------------------------------------------------
 * 
 * def _init():             # <<<<<<<<<<<<<<
 *     """initialize the sdif library (SdifGenInit) and initialize the numpy API"""
 *     global _g_sdif_initiated
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_3_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_3_init[] = "_init()\ninitialize the sdif library (SdifGenInit) and initialize the numpy API";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_3_init = {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_3_init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_3_init)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_3_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_type_definitions_file = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  const char* __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":343
 *     """initialize the sdif library (SdifGenInit) and initialize the numpy API"""
 *     global _g_sdif_initiated
 *     import_array()             # <<<<<<<<<<<<<<
 *     if _g_sdif_initiated == 0:
 *         _g_sdif_initiated = 1
 */
  import_array();

  /* "pysdif/_pysdif.pyx":344
 *     global _g_sdif_initiated
 *     import_array()
 *     if _g_sdif_initiated == 0:             # <<<<<<<<<<<<<<
 *         _g_sdif_initiated = 1
 *         type_definitions_file = os.path.split(__file__)[0] + os.path.sep + "SdifTypes.STYP"
 */
  __pyx_t_1 = (__pyx_v_6pysdif_7_pysdif__g_sdif_initiated == 0);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":345
 *     import_array()
 *     if _g_sdif_initiated == 0:
 *         _g_sdif_initiated = 1             # <<<<<<<<<<<<<<
 *         type_definitions_file = os.path.split(__file__)[0] + os.path.sep + "SdifTypes.STYP"
 *         if os.path.exists(type_definitions_file):
 */
    __pyx_v_6pysdif_7_pysdif__g_sdif_initiated = 1;

    /* "pysdif/_pysdif.pyx":346
 *     if _g_sdif_initiated == 0:
 *         _g_sdif_initiated = 1
 *         type_definitions_file = os.path.split(__file__)[0] + os.path.sep + "SdifTypes.STYP"             # <<<<<<<<<<<<<<
 *         if os.path.exists(type_definitions_file):
 *             SdifGenInit(type_definitions_file)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s____file__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sep); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_type_definitions_file = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pysdif/_pysdif.pyx":347
 *         _g_sdif_initiated = 1
 *         type_definitions_file = os.path.split(__file__)[0] + os.path.sep + "SdifTypes.STYP"
 *         if os.path.exists(type_definitions_file):             # <<<<<<<<<<<<<<
 *             SdifGenInit(type_definitions_file)
 *         else:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_type_definitions_file);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_type_definitions_file);
    __Pyx_GIVEREF(__pyx_v_type_definitions_file);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __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_2)); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pysdif/_pysdif.pyx":348
 *         type_definitions_file = os.path.split(__file__)[0] + os.path.sep + "SdifTypes.STYP"
 *         if os.path.exists(type_definitions_file):
 *             SdifGenInit(type_definitions_file)             # <<<<<<<<<<<<<<
 *         else:
 *             SdifGenInit("")
 */
      __pyx_t_5 = PyBytes_AsString(__pyx_v_type_definitions_file); if (unlikely((__pyx_t_5 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      SdifGenInit(__pyx_t_5);
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pysdif/_pysdif.pyx":350
 *             SdifGenInit(type_definitions_file)
 *         else:
 *             SdifGenInit("")             # <<<<<<<<<<<<<<
 *         print "Sdif initialized"
 *     return _g_sdif_initiated
 */
      SdifGenInit(__pyx_k_8);
    }
    __pyx_L6:;

    /* "pysdif/_pysdif.pyx":351
 *         else:
 *             SdifGenInit("")
 *         print "Sdif initialized"             # <<<<<<<<<<<<<<
 *     return _g_sdif_initiated
 * 
 */
    if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_9)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":352
 *             SdifGenInit("")
 *         print "Sdif initialized"
 *     return _g_sdif_initiated             # <<<<<<<<<<<<<<
 * 
 * def _cleanup():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_6pysdif_7_pysdif__g_sdif_initiated); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __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("pysdif._pysdif._init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_type_definitions_file);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":354
 *     return _g_sdif_initiated
 * 
 * def _cleanup():             # <<<<<<<<<<<<<<
 *     SdifGenKill()
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_4_cleanup(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_4_cleanup[] = "_cleanup()";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_4_cleanup = {__Pyx_NAMESTR("_cleanup"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_4_cleanup, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_4_cleanup)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_4_cleanup(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cleanup");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":355
 * 
 * def _cleanup():
 *     SdifGenKill()             # <<<<<<<<<<<<<<
 * 
 * # Forward declarations
 */
  SdifGenKill();

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":409
 *     cdef ndarray data
 * 
 *     def __cinit__(self, SdifFile source):             # <<<<<<<<<<<<<<
 *         if source is not None:
 *             self.source = source
 */

static int __pyx_pf_6pysdif_7_pysdif_6Matrix___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_6Matrix___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_source = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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__source);
      if (likely(values[0])) kw_args--;
      else 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), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)values[0]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)PyTuple_GET_ITEM(__pyx_args, 0));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_6pysdif_7_pysdif_SdifFile, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":410
 * 
 *     def __cinit__(self, SdifFile source):
 *         if source is not None:             # <<<<<<<<<<<<<<
 *             self.source = source
 *             #self.header = source.this.CurrMtrxH
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_source) != Py_None);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":411
 *     def __cinit__(self, SdifFile source):
 *         if source is not None:
 *             self.source = source             # <<<<<<<<<<<<<<
 *             #self.header = source.this.CurrMtrxH
 *             self.source_this = source.this
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_source));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
    __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source));
    ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source = __pyx_v_source;

    /* "pysdif/_pysdif.pyx":413
 *             self.source = source
 *             #self.header = source.this.CurrMtrxH
 *             self.source_this = source.this             # <<<<<<<<<<<<<<
 *             self.data = None
 *         else:
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this = __pyx_v_source->this;

    /* "pysdif/_pysdif.pyx":414
 *             #self.header = source.this.CurrMtrxH
 *             self.source_this = source.this
 *             self.data = None             # <<<<<<<<<<<<<<
 *         else:
 *             #self.header = NULL
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->data);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->data));
    ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->data = ((PyArrayObject *)Py_None);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":417
 *         else:
 *             #self.header = NULL
 *             self.source_this = NULL             # <<<<<<<<<<<<<<
 *             self.status = eMatrixOffline
 * 
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this = NULL;

    /* "pysdif/_pysdif.pyx":418
 *             #self.header = NULL
 *             self.source_this = NULL
 *             self.status = eMatrixOffline             # <<<<<<<<<<<<<<
 * 
 *     property rows:
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->status = __pyx_e_6pysdif_7_pysdif_eMatrixOffline;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":421
 * 
 *     property rows:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             #if self.header:
 *             if self.source_this:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_4rows___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_4rows___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":423
 *         def __get__(self):
 *             #if self.header:
 *             if self.source_this:             # <<<<<<<<<<<<<<
 *                 #return self.header.NbRow
 *                 return self.source_this.CurrMtrxH.NbRow
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this != 0);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":425
 *             if self.source_this:
 *                 #return self.header.NbRow
 *                 return self.source_this.CurrMtrxH.NbRow             # <<<<<<<<<<<<<<
 *             else:
 *                 assert self.status == eMatrixOffline
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxH->NbRow); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":427
 *                 return self.source_this.CurrMtrxH.NbRow
 *             else:
 *                 assert self.status == eMatrixOffline             # <<<<<<<<<<<<<<
 *                 return len(self.data)
 *     property cols:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->status == __pyx_e_6pysdif_7_pysdif_eMatrixOffline))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif

    /* "pysdif/_pysdif.pyx":428
 *             else:
 *                 assert self.status == eMatrixOffline
 *                 return len(self.data)             # <<<<<<<<<<<<<<
 *     property cols:
 *         def __get__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->data);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.rows.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":430
 *                 return len(self.data)
 *     property cols:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             #if self.header:
 *             if self.source_this:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_4cols___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_4cols___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":432
 *         def __get__(self):
 *             #if self.header:
 *             if self.source_this:             # <<<<<<<<<<<<<<
 *                 #return self.header.NbCol
 *                 return self.source_this.CurrMtrxH.NbCol
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this != 0);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":434
 *             if self.source_this:
 *                 #return self.header.NbCol
 *                 return self.source_this.CurrMtrxH.NbCol             # <<<<<<<<<<<<<<
 *             else:
 *                 assert self.status == eMatrixOffline
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxH->NbCol); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":436
 *                 return self.source_this.CurrMtrxH.NbCol
 *             else:
 *                 assert self.status == eMatrixOffline             # <<<<<<<<<<<<<<
 *                 return len(self.data[0])
 *     property dtype:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->status == __pyx_e_6pysdif_7_pysdif_eMatrixOffline))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #endif

    /* "pysdif/_pysdif.pyx":437
 *             else:
 *                 assert self.status == eMatrixOffline
 *                 return len(self.data[0])             # <<<<<<<<<<<<<<
 *     property dtype:
 *         def __get__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->data), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.cols.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":439
 *                 return len(self.data[0])
 *     property dtype:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             #if self.header:
 *             if self.source_this:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_5dtype___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_5dtype___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":441
 *         def __get__(self):
 *             #if self.header:
 *             if self.source_this:             # <<<<<<<<<<<<<<
 *                 return _SDIF_DATATYPES[self.source_this.CurrMtrxH.DataType]
 *             else:
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this != 0);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":442
 *             #if self.header:
 *             if self.source_this:
 *                 return _SDIF_DATATYPES[self.source_this.CurrMtrxH.DataType]             # <<<<<<<<<<<<<<
 *             else:
 *                 return self.data.dtype
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxH->DataType); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_DATATYPES), __pyx_t_2); if (!__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_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":444
 *                 return _SDIF_DATATYPES[self.source_this.CurrMtrxH.DataType]
 *             else:
 *                 return self.data.dtype             # <<<<<<<<<<<<<<
 *     property signature:
 *         def __get__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->data), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __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("pysdif._pysdif.Matrix.dtype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":446
 *                 return self.data.dtype
 *     property signature:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             #if self.header:
 *             if self.source_this:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_9signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_9signature___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":448
 *         def __get__(self):
 *             #if self.header:
 *             if self.source_this:             # <<<<<<<<<<<<<<
 *                 return sig2str(self.source_this.CurrMtrxH.Signature)
 *             else:
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this != 0);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":449
 *             #if self.header:
 *             if self.source_this:
 *                 return sig2str(self.source_this.CurrMtrxH.Signature)             # <<<<<<<<<<<<<<
 *             else:
 *                 return sig2str(self._signature)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxH->Signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":451
 *                 return sig2str(self.source_this.CurrMtrxH.Signature)
 *             else:
 *                 return sig2str(self._signature)             # <<<<<<<<<<<<<<
 *     property numerical_signature:
 *         def __get__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->_signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":453
 *                 return sig2str(self._signature)
 *     property numerical_signature:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             #if self.header:
 *             if self.source_this:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_19numerical_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_19numerical_signature___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":455
 *         def __get__(self):
 *             #if self.header:
 *             if self.source_this:             # <<<<<<<<<<<<<<
 *                 return self.source_this.CurrMtrxH.Signature
 *             else:
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this != 0);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":456
 *             #if self.header:
 *             if self.source_this:
 *                 return self.source_this.CurrMtrxH.Signature             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._signature
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxH->Signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":458
 *                 return self.source_this.CurrMtrxH.Signature
 *             else:
 *                 return self._signature             # <<<<<<<<<<<<<<
 * 
 *     def get_data(self, copy=True):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->_signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.numerical_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":460
 *                 return self._signature
 * 
 *     def get_data(self, copy=True):             # <<<<<<<<<<<<<<
 *         """
 *         read the data from the matrix as a numpy array
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_1get_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6Matrix_1get_data[] = "Matrix.get_data(self, copy=True)\n\n        read the data from the matrix as a numpy array\n        \n        NB: if copy is False, the data is not copied to the array, \n        the array is only a 'view' of this data and does not own it,\n        so it is only valid until you read a new matrix. \n        If you want to keep the data, do \n        data = matrix.get_data().copy()\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_1get_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__copy,0};
  __Pyx_RefNannySetupContext("get_data");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = __pyx_k_10;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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__copy);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_copy = values[0];
  } else {
    __pyx_v_copy = __pyx_k_10;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_copy = 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("get_data", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.get_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":470
 *         data = matrix.get_data().copy()
 *         """
 *         if self.source.matrix_status == eMatrixHeaderRead:             # <<<<<<<<<<<<<<
 *             self.source.read_matrix_data()
 *         if copy:
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source->matrix_status == __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":471
 *         """
 *         if self.source.matrix_status == eMatrixHeaderRead:
 *             self.source.read_matrix_data()             # <<<<<<<<<<<<<<
 *         if copy:
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 */
    ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source->__pyx_vtab)->read_matrix_data(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":472
 *         if self.source.matrix_status == eMatrixHeaderRead:
 *             self.source.read_matrix_data()
 *         if copy:             # <<<<<<<<<<<<<<
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":473
 *             self.source.read_matrix_data()
 *         if copy:
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)             # <<<<<<<<<<<<<<
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)
 *     def copy(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_copy(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxData)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "pysdif/_pysdif.pyx":474
 *         if copy:
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)             # <<<<<<<<<<<<<<
 *     def copy(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_no_copy(((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxData)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.get_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":475
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """
 *         create a copy of the current matrix with the data
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_2copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6Matrix_2copy[] = "Matrix.copy(self)\n\n        create a copy of the current matrix with the data\n        already read and owned (placed in new_matrix.data). \n        This copied matrix does not get invalidated when a \n        new matrix is read\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_2copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_6pysdif_7_pysdif_Matrix *__pyx_v_new = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy");

  /* "pysdif/_pysdif.pyx":482
 *         new matrix is read
 *         """
 *         cdef Matrix new = Matrix(None)             # <<<<<<<<<<<<<<
 *         new.data = self.get_data().copy()
 *         new._signature = self.source_this.CurrMtrxH.Signature
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_Matrix)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new = ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":483
 *         """
 *         cdef Matrix new = Matrix(None)
 *         new.data = self.get_data().copy()             # <<<<<<<<<<<<<<
 *         new._signature = self.source_this.CurrMtrxH.Signature
 *         return new
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_new->data);
  __Pyx_DECREF(((PyObject *)__pyx_v_new->data));
  __pyx_v_new->data = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":484
 *         cdef Matrix new = Matrix(None)
 *         new.data = self.get_data().copy()
 *         new._signature = self.source_this.CurrMtrxH.Signature             # <<<<<<<<<<<<<<
 *         return new
 *     def skip(self):
 */
  __pyx_v_new->_signature = ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source_this->CurrMtrxH->Signature;

  /* "pysdif/_pysdif.pyx":485
 *         new.data = self.get_data().copy()
 *         new._signature = self.source_this.CurrMtrxH.Signature
 *         return new             # <<<<<<<<<<<<<<
 *     def skip(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_new));
  __pyx_r = ((PyObject *)__pyx_v_new);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":486
 *         new._signature = self.source_this.CurrMtrxH.Signature
 *         return new
 *     def skip(self):             # <<<<<<<<<<<<<<
 *         """
 *         skip the matrix.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_3skip(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6Matrix_3skip[] = "Matrix.skip(self)\n\n        skip the matrix.\n        if only header was read, tell the Frame to skip the data\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_3skip(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("skip");

  /* "pysdif/_pysdif.pyx":491
 *         if only header was read, tell the Frame to skip the data
 *         """
 *         if self.status == eMatrixHeaderRead:             # <<<<<<<<<<<<<<
 *             # data has not been read yet
 *             self.source.skip_matrix_data()
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->status == __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":493
 *         if self.status == eMatrixHeaderRead:
 *             # data has not been read yet
 *             self.source.skip_matrix_data()             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return "Matrix(sig=%s, rows=%d, cols=%d, dtype=%s)" % (self.signature, self.rows, self.cols, str(self.dtype))
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_v_self)->source), __pyx_n_s__skip_matrix_data); 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_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  __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("pysdif._pysdif.Matrix.skip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":494
 *             # data has not been read yet
 *             self.source.skip_matrix_data()
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Matrix(sig=%s, rows=%d, cols=%d, dtype=%s)" % (self.signature, self.rows, self.cols, str(self.dtype))
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_4__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6Matrix_4__repr__(PyObject *__pyx_v_self) {
  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("__repr__");

  /* "pysdif/_pysdif.pyx":495
 *             self.source.skip_matrix_data()
 *     def __repr__(self):
 *         return "Matrix(sig=%s, rows=%d, cols=%d, dtype=%s)" % (self.signature, self.rows, self.cols, str(self.dtype))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rows); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cols); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysdif._pysdif.Matrix.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":519
 *     cdef SdifFileT *source_this
 * 
 *     def __cinit__(self, SdifFile source):             # <<<<<<<<<<<<<<
 *         self.source = source
 *         self.source_this = source.this
 */

static int __pyx_pf_6pysdif_7_pysdif_6FrameR___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_6FrameR___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_source = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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__source);
      if (likely(values[0])) kw_args--;
      else 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), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)values[0]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)PyTuple_GET_ITEM(__pyx_args, 0));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_6pysdif_7_pysdif_SdifFile, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":520
 * 
 *     def __cinit__(self, SdifFile source):
 *         self.source = source             # <<<<<<<<<<<<<<
 *         self.source_this = source.this
 *         self.header = source.this.CurrFramH
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source = __pyx_v_source;

  /* "pysdif/_pysdif.pyx":521
 *     def __cinit__(self, SdifFile source):
 *         self.source = source
 *         self.source_this = source.this             # <<<<<<<<<<<<<<
 *         self.header = source.this.CurrFramH
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this = __pyx_v_source->this;

  /* "pysdif/_pysdif.pyx":522
 *         self.source = source
 *         self.source_this = source.this
 *         self.header = source.this.CurrFramH             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         self.source = None
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->header = __pyx_v_source->this->CurrFramH;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":523
 *         self.source_this = source.this
 *         self.header = source.this.CurrFramH
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.source = None
 * 
 */

static void __pyx_pf_6pysdif_7_pysdif_6FrameR_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_6pysdif_7_pysdif_6FrameR_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "pysdif/_pysdif.pyx":524
 *         self.header = source.this.CurrFramH
 *     def __dealloc__(self):
 *         self.source = None             # <<<<<<<<<<<<<<
 * 
 *     property signature:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source));
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None);

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":527
 * 
 *     property signature:
 *         def __get__(self): #return sig2str(self.header.Signature)             # <<<<<<<<<<<<<<
 *             return sig2str(self.source_this.CurrFramH.Signature)
 *     property numerical_signature:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_9signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_9signature___get__(PyObject *__pyx_v_self) {
  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("__get__");

  /* "pysdif/_pysdif.pyx":528
 *     property signature:
 *         def __get__(self): #return sig2str(self.header.Signature)
 *             return sig2str(self.source_this.CurrFramH.Signature)             # <<<<<<<<<<<<<<
 *     property numerical_signature:
 *         def __get__(self): return self.source_this.CurrFramH.Signature
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":530
 *             return sig2str(self.source_this.CurrFramH.Signature)
 *     property numerical_signature:
 *         def __get__(self): return self.source_this.CurrFramH.Signature             # <<<<<<<<<<<<<<
 *     property size:
 *         def __get__(self): return self.source_this.CurrFramH.Size
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_19numerical_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_19numerical_signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.numerical_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":532
 *         def __get__(self): return self.source_this.CurrFramH.Signature
 *     property size:
 *         def __get__(self): return self.source_this.CurrFramH.Size             # <<<<<<<<<<<<<<
 *     property num_matrices:
 *         def __get__(self): return self.source_this.CurrFramH.NbMatrix
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_4size___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_4size___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->Size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":534
 *         def __get__(self): return self.source_this.CurrFramH.Size
 *     property num_matrices:
 *         def __get__(self): return self.source_this.CurrFramH.NbMatrix             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.header.NbMatrix
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_12num_matrices___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_12num_matrices___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->NbMatrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.num_matrices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":535
 *     property num_matrices:
 *         def __get__(self): return self.source_this.CurrFramH.NbMatrix
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.header.NbMatrix
 *     property id:
 */

static Py_ssize_t __pyx_pf_6pysdif_7_pysdif_6FrameR_2__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_6pysdif_7_pysdif_6FrameR_2__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__");

  /* "pysdif/_pysdif.pyx":536
 *         def __get__(self): return self.source_this.CurrFramH.NbMatrix
 *     def __len__(self):
 *         return self.header.NbMatrix             # <<<<<<<<<<<<<<
 *     property id:
 *         def __get__(self): return self.source_this.CurrFramH.NumID
 */
  __pyx_r = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->header->NbMatrix;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":538
 *         return self.header.NbMatrix
 *     property id:
 *         def __get__(self): return self.source_this.CurrFramH.NumID             # <<<<<<<<<<<<<<
 *     property time:
 *         def __get__(self): return self.source_this.CurrFramH.Time
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_2id___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_2id___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->NumID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":540
 *         def __get__(self): return self.source_this.CurrFramH.NumID
 *     property time:
 *         def __get__(self): return self.source_this.CurrFramH.Time             # <<<<<<<<<<<<<<
 *     property matrix_idx:
 *         def __get__(self): return self.source.matrix_idx
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_4time___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_4time___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->Time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":542
 *         def __get__(self): return self.source_this.CurrFramH.Time
 *     property matrix_idx:
 *         def __get__(self): return self.source.matrix_idx             # <<<<<<<<<<<<<<
 *     def matrix_exists(self, signature):
 *         cdef SdifSignature sig = as_signature(signature)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_10matrix_idx___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_10matrix_idx___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.matrix_idx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":543
 *     property matrix_idx:
 *         def __get__(self): return self.source.matrix_idx
 *     def matrix_exists(self, signature):             # <<<<<<<<<<<<<<
 *         cdef SdifSignature sig = as_signature(signature)
 *         # TODO
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_3matrix_exists(PyObject *__pyx_v_self, PyObject *__pyx_v_signature); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6FrameR_3matrix_exists[] = "FrameR.matrix_exists(self, signature)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_3matrix_exists(PyObject *__pyx_v_self, PyObject *__pyx_v_signature) {
  SdifSignature __pyx_v_sig;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matrix_exists");

  /* "pysdif/_pysdif.pyx":544
 *         def __get__(self): return self.source.matrix_idx
 *     def matrix_exists(self, signature):
 *         cdef SdifSignature sig = as_signature(signature)             # <<<<<<<<<<<<<<
 *         # TODO
 *     def __iter__(self):
 */
  __pyx_v_sig = __pyx_f_6pysdif_7_pysdif_as_signature(__pyx_v_signature);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":546
 *         cdef SdifSignature sig = as_signature(signature)
 *         # TODO
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         self.source.frame_status = eFrameSomeDataRead
 *         return self
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_4__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_4__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__");

  /* "pysdif/_pysdif.pyx":547
 *         # TODO
 *     def __iter__(self):
 *         self.source.frame_status = eFrameSomeDataRead             # <<<<<<<<<<<<<<
 *         return self
 *     def __next__(self):
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameSomeDataRead;

  /* "pysdif/_pysdif.pyx":548
 *     def __iter__(self):
 *         self.source.frame_status = eFrameSomeDataRead
 *         return self             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":549
 *         self.source.frame_status = eFrameSomeDataRead
 *         return self
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         """
 *         read next matrix and update the index
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_5__next__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6FrameR_5__next__[] = "\n        read next matrix and update the index\n        NB: only the header of the matrix will be read, to get the data\n        you must call the method matrix.get_data() on the resulting Matrix\n        ";
struct wrapperbase __pyx_wrapperbase_6pysdif_7_pysdif_6FrameR_5__next__;
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__");

  /* "pysdif/_pysdif.pyx":556
 *         """
 *         # cdef SdifFile source = self.source
 *         if self.source.matrix_idx == self.source_this.CurrFramH.NbMatrix:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         if self.source.matrix_status == eMatrixHeaderRead:
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix_idx == ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrFramH->NbMatrix);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":557
 *         # cdef SdifFile source = self.source
 *         if self.source.matrix_idx == self.source_this.CurrFramH.NbMatrix:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         if self.source.matrix_status == eMatrixHeaderRead:
 *             SdifFSkipMatrixData(self.source_this)
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":558
 *         if self.source.matrix_idx == self.source_this.CurrFramH.NbMatrix:
 *             raise StopIteration
 *         if self.source.matrix_status == eMatrixHeaderRead:             # <<<<<<<<<<<<<<
 *             SdifFSkipMatrixData(self.source_this)
 *         SdifFReadMatrixHeader(self.source_this)
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix_status == __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":559
 *             raise StopIteration
 *         if self.source.matrix_status == eMatrixHeaderRead:
 *             SdifFSkipMatrixData(self.source_this)             # <<<<<<<<<<<<<<
 *         SdifFReadMatrixHeader(self.source_this)
 *         self.source.matrix_idx += 1
 */
    SdifFSkipMatrixData(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":560
 *         if self.source.matrix_status == eMatrixHeaderRead:
 *             SdifFSkipMatrixData(self.source_this)
 *         SdifFReadMatrixHeader(self.source_this)             # <<<<<<<<<<<<<<
 *         self.source.matrix_idx += 1
 *         self.source.matrix_status = eMatrixHeaderRead
 */
  SdifFReadMatrixHeader(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this);

  /* "pysdif/_pysdif.pyx":561
 *             SdifFSkipMatrixData(self.source_this)
 *         SdifFReadMatrixHeader(self.source_this)
 *         self.source.matrix_idx += 1             # <<<<<<<<<<<<<<
 *         self.source.matrix_status = eMatrixHeaderRead
 *         return self.source.matrix
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source));
  __pyx_t_2 = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source;
  __pyx_t_2->matrix_idx = (__pyx_t_2->matrix_idx + 1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":562
 *         SdifFReadMatrixHeader(self.source_this)
 *         self.source.matrix_idx += 1
 *         self.source.matrix_status = eMatrixHeaderRead             # <<<<<<<<<<<<<<
 *         return self.source.matrix
 *     def get_matrix_data(self, copy=True):
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead;

  /* "pysdif/_pysdif.pyx":563
 *         self.source.matrix_idx += 1
 *         self.source.matrix_status = eMatrixHeaderRead
 *         return self.source.matrix             # <<<<<<<<<<<<<<
 *     def get_matrix_data(self, copy=True):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(((PyObject *)__pyx_t_2));
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":564
 *         self.source.matrix_status = eMatrixHeaderRead
 *         return self.source.matrix
 *     def get_matrix_data(self, copy=True):             # <<<<<<<<<<<<<<
 *         """
 *         optimized method for frames which only have one matrix.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_6get_matrix_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6FrameR_6get_matrix_data[] = "FrameR.get_matrix_data(self, copy=True)\n\n        optimized method for frames which only have one matrix.\n        \n        example:\n        \n        for frame in sdiffile:\n            if frame.signature == \"1TRC\":\n                data = frame.get_matrix_data()  # no need to iterate through matrices in 1TRC files\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameR_6get_matrix_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__copy,0};
  __Pyx_RefNannySetupContext("get_matrix_data");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = __pyx_k_13;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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__copy);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_matrix_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_copy = values[0];
  } else {
    __pyx_v_copy = __pyx_k_13;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_copy = 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("get_matrix_data", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.get_matrix_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":574
 *                 data = frame.get_matrix_data()  # no need to iterate through matrices in 1TRC files
 *         """
 *         SdifFReadMatrixHeader(self.source_this)             # <<<<<<<<<<<<<<
 *         SdifFReadMatrixData(self.source_this)
 *         self.source.matrix_idx = 1
 */
  SdifFReadMatrixHeader(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this);

  /* "pysdif/_pysdif.pyx":575
 *         """
 *         SdifFReadMatrixHeader(self.source_this)
 *         SdifFReadMatrixData(self.source_this)             # <<<<<<<<<<<<<<
 *         self.source.matrix_idx = 1
 *         self.source.matrix_status = eMatrixDataRead
 */
  SdifFReadMatrixData(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this);

  /* "pysdif/_pysdif.pyx":576
 *         SdifFReadMatrixHeader(self.source_this)
 *         SdifFReadMatrixData(self.source_this)
 *         self.source.matrix_idx = 1             # <<<<<<<<<<<<<<
 *         self.source.matrix_status = eMatrixDataRead
 *         self.source.frame_status = eFrameAllDataRead
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix_idx = 1;

  /* "pysdif/_pysdif.pyx":577
 *         SdifFReadMatrixData(self.source_this)
 *         self.source.matrix_idx = 1
 *         self.source.matrix_status = eMatrixDataRead             # <<<<<<<<<<<<<<
 *         self.source.frame_status = eFrameAllDataRead
 *         if copy:
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixDataRead;

  /* "pysdif/_pysdif.pyx":578
 *         self.source.matrix_idx = 1
 *         self.source.matrix_status = eMatrixDataRead
 *         self.source.frame_status = eFrameAllDataRead             # <<<<<<<<<<<<<<
 *         if copy:
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameAllDataRead;

  /* "pysdif/_pysdif.pyx":579
 *         self.source.matrix_status = eMatrixDataRead
 *         self.source.frame_status = eFrameAllDataRead
 *         if copy:             # <<<<<<<<<<<<<<
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":580
 *         self.source.frame_status = eFrameAllDataRead
 *         if copy:
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)             # <<<<<<<<<<<<<<
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_copy(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrMtrxData)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":581
 *         if copy:
 *             return _array_from_matrix_data_copy(self.source_this.CurrMtrxData)
 *         return _array_from_matrix_data_no_copy(self.source_this.CurrMtrxData)             # <<<<<<<<<<<<<<
 * 
 * cdef class FrameW:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_no_copy(((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_v_self)->source_this->CurrMtrxData)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.FrameR.get_matrix_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":605
 *     cdef SdifUInt4 frame_size
 *     cdef SdifUInt4 num_matrices
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "FrameW(signature=%s, time=%f, streamID=%d)" % (
 *             sig2str(self.signature),
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameW___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameW___repr__(PyObject *__pyx_v_self) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "pysdif/_pysdif.pyx":606
 *     cdef SdifUInt4 num_matrices
 *     def __repr__(self):
 *         return "FrameW(signature=%s, time=%f, streamID=%d)" % (             # <<<<<<<<<<<<<<
 *             sig2str(self.signature),
 *             self.time,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pysdif/_pysdif.pyx":607
 *     def __repr__(self):
 *         return "FrameW(signature=%s, time=%f, streamID=%d)" % (
 *             sig2str(self.signature),             # <<<<<<<<<<<<<<
 *             self.time,
 *             self.streamID)
 */
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "pysdif/_pysdif.pyx":608
 *         return "FrameW(signature=%s, time=%f, streamID=%d)" % (
 *             sig2str(self.signature),
 *             self.time,             # <<<<<<<<<<<<<<
 *             self.streamID)
 *     def add_matrix(self, signature, c_numpy.ndarray data_array):
 */
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "pysdif/_pysdif.pyx":609
 *             sig2str(self.signature),
 *             self.time,
 *             self.streamID)             # <<<<<<<<<<<<<<
 *     def add_matrix(self, signature, c_numpy.ndarray data_array):
 *         if data_array.ndim == 1:
 */
  __pyx_t_3 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->streamID); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __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 = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysdif._pysdif.FrameW.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":610
 *             self.time,
 *             self.streamID)
 *     def add_matrix(self, signature, c_numpy.ndarray data_array):             # <<<<<<<<<<<<<<
 *         if data_array.ndim == 1:
 *             data_array.resize((data_array.shape[0], 1))
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameW_1add_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6FrameW_1add_matrix[] = "FrameW.add_matrix(self, signature, ndarray data_array)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameW_1add_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  PyArrayObject *__pyx_v_data_array = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__data_array,0};
  __Pyx_RefNannySetupContext("add_matrix");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_array);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_matrix", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __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), "add_matrix") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = values[0];
    __pyx_v_data_array = ((PyArrayObject *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_signature = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_data_array = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_matrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.FrameW.add_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data_array), __pyx_ptype_5numpy_ndarray, 1, "data_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":611
 *             self.streamID)
 *     def add_matrix(self, signature, c_numpy.ndarray data_array):
 *         if data_array.ndim == 1:             # <<<<<<<<<<<<<<
 *             data_array.resize((data_array.shape[0], 1))
 *         self.signatures.append(signature)
 */
  __pyx_t_1 = (__pyx_v_data_array->nd == 1);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":612
 *     def add_matrix(self, signature, c_numpy.ndarray data_array):
 *         if data_array.ndim == 1:
 *             data_array.resize((data_array.shape[0], 1))             # <<<<<<<<<<<<<<
 *         self.signatures.append(signature)
 *         self.matrices.append(data_array)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_data_array), __pyx_n_s__resize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_data_array->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __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_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":613
 *         if data_array.ndim == 1:
 *             data_array.resize((data_array.shape[0], 1))
 *         self.signatures.append(signature)             # <<<<<<<<<<<<<<
 *         self.matrices.append(data_array)
 *         self.num_matrices += 1
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->signatures) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = PyList_Append(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->signatures, __pyx_v_signature); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":614
 *             data_array.resize((data_array.shape[0], 1))
 *         self.signatures.append(signature)
 *         self.matrices.append(data_array)             # <<<<<<<<<<<<<<
 *         self.num_matrices += 1
 *         self.frame_size += SdifSizeOfMatrix(
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->matrices) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = PyList_Append(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->matrices, ((PyObject *)__pyx_v_data_array)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":615
 *         self.signatures.append(signature)
 *         self.matrices.append(data_array)
 *         self.num_matrices += 1             # <<<<<<<<<<<<<<
 *         self.frame_size += SdifSizeOfMatrix(
 *             #<SdifDataTypeET>(dtype_numpy2sdif(data_array.dtype.type_num)),
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->num_matrices = (((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->num_matrices + 1);

  /* "pysdif/_pysdif.pyx":616
 *         self.matrices.append(data_array)
 *         self.num_matrices += 1
 *         self.frame_size += SdifSizeOfMatrix(             # <<<<<<<<<<<<<<
 *             #<SdifDataTypeET>(dtype_numpy2sdif(data_array.dtype.type_num)),
 *             #<SdifDataTypeET>(dtype_numpy2sdif(data_array.dtype.num)),
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->frame_size = (((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->frame_size + SdifSizeOfMatrix(((SdifDataTypeET)__pyx_f_6pysdif_7_pysdif_dtype_numpy2sdif(__pyx_v_data_array->descr->type_num)), (__pyx_v_data_array->dimensions[0]), (__pyx_v_data_array->dimensions[1])));

  __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("pysdif._pysdif.FrameW.add_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":621
 *             <SdifDataTypeET>(dtype_numpy2sdif(data_array.descr.type_num)),
 *             data_array.shape[0], data_array.shape[1]) # rows, cols
 *     def write(self):             # <<<<<<<<<<<<<<
 *         """
 *         write the current frame to disk. This function is called
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameW_2write(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6FrameW_2write[] = "FrameW.write(self)\n\n        write the current frame to disk. This function is called\n        after add_matrix has been called (if there are any matrices in\n        the current frame). The frame is written all at once. \n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_6FrameW_2write(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  SdifUInt4 __pyx_v_fsz;
  SdifSignature __pyx_v_matrix_sig;
  int __pyx_v_dtype;
  PyArrayObject *__pyx_v_matrix = 0;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  SdifUInt4 __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write");

  /* "pysdif/_pysdif.pyx":634
 *         cdef int i
 *         SdifFSetCurrFrameHeader(self.sdiffile.this, self.signature, self.frame_size,
 *             self.num_matrices, self.streamID, self.time)             # <<<<<<<<<<<<<<
 *         fsz = SdifFWriteFrameHeader(self.sdiffile.this)
 *         for i in range(self.num_matrices):
 */
  SdifFSetCurrFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->sdiffile->this, ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->signature, ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->frame_size, ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->num_matrices, ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->streamID, ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->time);

  /* "pysdif/_pysdif.pyx":635
 *         SdifFSetCurrFrameHeader(self.sdiffile.this, self.signature, self.frame_size,
 *             self.num_matrices, self.streamID, self.time)
 *         fsz = SdifFWriteFrameHeader(self.sdiffile.this)             # <<<<<<<<<<<<<<
 *         for i in range(self.num_matrices):
 *             matrix_sig = _str2sig(self.signatures[i])
 */
  __pyx_v_fsz = SdifFWriteFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->sdiffile->this);

  /* "pysdif/_pysdif.pyx":636
 *             self.num_matrices, self.streamID, self.time)
 *         fsz = SdifFWriteFrameHeader(self.sdiffile.this)
 *         for i in range(self.num_matrices):             # <<<<<<<<<<<<<<
 *             matrix_sig = _str2sig(self.signatures[i])
 *             matrix = self.matrices[i]
 */
  __pyx_t_1 = ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->num_matrices;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pysdif/_pysdif.pyx":637
 *         fsz = SdifFWriteFrameHeader(self.sdiffile.this)
 *         for i in range(self.num_matrices):
 *             matrix_sig = _str2sig(self.signatures[i])             # <<<<<<<<<<<<<<
 *             matrix = self.matrices[i]
 *             #dtype = dtype_numpy2sdif(matrix.dtype.num)
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->signatures), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_matrix_sig = __pyx_f_6pysdif_7_pysdif__str2sig(__pyx_t_4);

    /* "pysdif/_pysdif.pyx":638
 *         for i in range(self.num_matrices):
 *             matrix_sig = _str2sig(self.signatures[i])
 *             matrix = self.matrices[i]             # <<<<<<<<<<<<<<
 *             #dtype = dtype_numpy2sdif(matrix.dtype.num)
 *             dtype = dtype_numpy2sdif(matrix.descr.type_num)
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->matrices), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __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_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_matrix));
    __pyx_v_matrix = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysdif/_pysdif.pyx":640
 *             matrix = self.matrices[i]
 *             #dtype = dtype_numpy2sdif(matrix.dtype.num)
 *             dtype = dtype_numpy2sdif(matrix.descr.type_num)             # <<<<<<<<<<<<<<
 *             fsz += SdifFWriteMatrix(self.sdiffile.this, matrix_sig,
 *                 <SdifDataTypeET>dtype,
 */
    __pyx_v_dtype = __pyx_f_6pysdif_7_pysdif_dtype_numpy2sdif(__pyx_v_matrix->descr->type_num);

    /* "pysdif/_pysdif.pyx":644
 *                 <SdifDataTypeET>dtype,
 *                 matrix.shape[0], matrix.shape[1],   # rows, cols
 *                 matrix.data)             # <<<<<<<<<<<<<<
 *         self.sdiffile.write_status = eSdifMatrixData
 * 
 */
    __pyx_v_fsz = (__pyx_v_fsz + SdifFWriteMatrix(((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->sdiffile->this, __pyx_v_matrix_sig, ((SdifDataTypeET)__pyx_v_dtype), (__pyx_v_matrix->dimensions[0]), (__pyx_v_matrix->dimensions[1]), __pyx_v_matrix->data));
  }

  /* "pysdif/_pysdif.pyx":645
 *                 matrix.shape[0], matrix.shape[1],   # rows, cols
 *                 matrix.data)
 *         self.sdiffile.write_status = eSdifMatrixData             # <<<<<<<<<<<<<<
 * 
 * cdef FrameW FrameW_new(SdifFile sdiffile, SdifSignature sig, SdifFloat8 time, SdifUInt4 streamID=0):
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_v_self)->sdiffile->write_status = __pyx_e_6pysdif_7_pysdif_eSdifMatrixData;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.FrameW.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matrix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":647
 *         self.sdiffile.write_status = eSdifMatrixData
 * 
 * cdef FrameW FrameW_new(SdifFile sdiffile, SdifSignature sig, SdifFloat8 time, SdifUInt4 streamID=0):             # <<<<<<<<<<<<<<
 *     cdef FrameW f = FrameW()
 *     f.sdiffile = sdiffile
 */

static struct __pyx_obj_6pysdif_7_pysdif_FrameW *__pyx_f_6pysdif_7_pysdif_FrameW_new(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_sdiffile, SdifSignature __pyx_v_sig, SdifFloat8 __pyx_v_time, struct __pyx_opt_args_6pysdif_7_pysdif_FrameW_new *__pyx_optional_args) {
  SdifUInt4 __pyx_v_streamID = ((SdifUInt4)0);
  struct __pyx_obj_6pysdif_7_pysdif_FrameW *__pyx_v_f = 0;
  struct __pyx_obj_6pysdif_7_pysdif_FrameW *__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("FrameW_new");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_streamID = __pyx_optional_args->streamID;
    }
  }

  /* "pysdif/_pysdif.pyx":648
 * 
 * cdef FrameW FrameW_new(SdifFile sdiffile, SdifSignature sig, SdifFloat8 time, SdifUInt4 streamID=0):
 *     cdef FrameW f = FrameW()             # <<<<<<<<<<<<<<
 *     f.sdiffile = sdiffile
 *     f.signature = sig
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_FrameW)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_f = ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":649
 * cdef FrameW FrameW_new(SdifFile sdiffile, SdifSignature sig, SdifFloat8 time, SdifUInt4 streamID=0):
 *     cdef FrameW f = FrameW()
 *     f.sdiffile = sdiffile             # <<<<<<<<<<<<<<
 *     f.signature = sig
 *     f.time = time
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_sdiffile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_sdiffile));
  __Pyx_GOTREF(__pyx_v_f->sdiffile);
  __Pyx_DECREF(((PyObject *)__pyx_v_f->sdiffile));
  __pyx_v_f->sdiffile = __pyx_v_sdiffile;

  /* "pysdif/_pysdif.pyx":650
 *     cdef FrameW f = FrameW()
 *     f.sdiffile = sdiffile
 *     f.signature = sig             # <<<<<<<<<<<<<<
 *     f.time = time
 *     f.streamID = streamID
 */
  __pyx_v_f->signature = __pyx_v_sig;

  /* "pysdif/_pysdif.pyx":651
 *     f.sdiffile = sdiffile
 *     f.signature = sig
 *     f.time = time             # <<<<<<<<<<<<<<
 *     f.streamID = streamID
 *     f.matrices = []
 */
  __pyx_v_f->time = __pyx_v_time;

  /* "pysdif/_pysdif.pyx":652
 *     f.signature = sig
 *     f.time = time
 *     f.streamID = streamID             # <<<<<<<<<<<<<<
 *     f.matrices = []
 *     f.signatures = []
 */
  __pyx_v_f->streamID = __pyx_v_streamID;

  /* "pysdif/_pysdif.pyx":653
 *     f.time = time
 *     f.streamID = streamID
 *     f.matrices = []             # <<<<<<<<<<<<<<
 *     f.signatures = []
 *     f.frame_size = SdifSizeOfFrameHeader()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_f->matrices);
  __Pyx_DECREF(((PyObject *)__pyx_v_f->matrices));
  __pyx_v_f->matrices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":654
 *     f.streamID = streamID
 *     f.matrices = []
 *     f.signatures = []             # <<<<<<<<<<<<<<
 *     f.frame_size = SdifSizeOfFrameHeader()
 *     f.num_matrices = 0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_f->signatures);
  __Pyx_DECREF(((PyObject *)__pyx_v_f->signatures));
  __pyx_v_f->signatures = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":655
 *     f.matrices = []
 *     f.signatures = []
 *     f.frame_size = SdifSizeOfFrameHeader()             # <<<<<<<<<<<<<<
 *     f.num_matrices = 0
 *     return f
 */
  __pyx_v_f->frame_size = SdifSizeOfFrameHeader();

  /* "pysdif/_pysdif.pyx":656
 *     f.signatures = []
 *     f.frame_size = SdifSizeOfFrameHeader()
 *     f.num_matrices = 0             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
  __pyx_v_f->num_matrices = 0;

  /* "pysdif/_pysdif.pyx":657
 *     f.frame_size = SdifSizeOfFrameHeader()
 *     f.num_matrices = 0
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_f));
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.FrameW_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_f);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":748
 *     cdef SdifStatusE write_status
 * 
 *     def __cinit__(self, filename, mode="r", predefined_type=None):             # <<<<<<<<<<<<<<
 *         #assert mode in _SDIF_FILEMODE
 *         if mode == "r":
 */

static int __pyx_pf_6pysdif_7_pysdif_8SdifFile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_8SdifFile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_predefined_type = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  const char* __pyx_t_6;
  SdifFileModeET __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__predefined_type,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_n_s__r);
    values[2] = ((PyObject *)Py_None);
    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__filename);
      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__mode);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__predefined_type);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_predefined_type = values[2];
  } else {
    __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
    __pyx_v_predefined_type = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_predefined_type = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_filename = 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("__cinit__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":750
 *     def __cinit__(self, filename, mode="r", predefined_type=None):
 *         #assert mode in _SDIF_FILEMODE
 *         if mode == "r":             # <<<<<<<<<<<<<<
 *             if not os.path.exists(filename):
 *                 raise RuntimeError("path not found, cannot open sdif file for reading")
 */
  __pyx_t_1 = __Pyx_PyString_Equals(__pyx_v_mode, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":751
 *         #assert mode in _SDIF_FILEMODE
 *         if mode == "r":
 *             if not os.path.exists(filename):             # <<<<<<<<<<<<<<
 *                 raise RuntimeError("path not found, cannot open sdif file for reading")
 *         self.this = SdifFOpen(filename, _SDIF_FILEMODE[mode])
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __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_3)); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = (!__pyx_t_1);
    if (__pyx_t_5) {

      /* "pysdif/_pysdif.pyx":752
 *         if mode == "r":
 *             if not os.path.exists(filename):
 *                 raise RuntimeError("path not found, cannot open sdif file for reading")             # <<<<<<<<<<<<<<
 *         self.this = SdifFOpen(filename, _SDIF_FILEMODE[mode])
 * 
 */
      __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":753
 *             if not os.path.exists(filename):
 *                 raise RuntimeError("path not found, cannot open sdif file for reading")
 *         self.this = SdifFOpen(filename, _SDIF_FILEMODE[mode])             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, filename, mode="r", predefined_type=None):
 */
  __pyx_t_6 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_6 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_FILEMODE), __pyx_v_mode); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = ((SdifFileModeET)PyInt_AsLong(__pyx_t_4)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this = SdifFOpen(__pyx_t_6, __pyx_t_7);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":755
 *         self.this = SdifFOpen(filename, _SDIF_FILEMODE[mode])
 * 
 *     def __init__(self, filename, mode="r", predefined_type=None):             # <<<<<<<<<<<<<<
 *         if self.mode == eReadFile:
 *             self.init_read()
 */

static int __pyx_pf_6pysdif_7_pysdif_8SdifFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_8SdifFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_predefined_type = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__predefined_type,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_n_s__r);
    values[2] = ((PyObject *)Py_None);
    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__filename);
      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__mode);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__predefined_type);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_predefined_type = values[2];
  } else {
    __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
    __pyx_v_predefined_type = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_predefined_type = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_filename = 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("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":756
 * 
 *     def __init__(self, filename, mode="r", predefined_type=None):
 *         if self.mode == eReadFile:             # <<<<<<<<<<<<<<
 *             self.init_read()
 *             if not self.get_frame_types() and self.signature in SDIF_NEWTYPES:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(eReadFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "pysdif/_pysdif.pyx":757
 *     def __init__(self, filename, mode="r", predefined_type=None):
 *         if self.mode == eReadFile:
 *             self.init_read()             # <<<<<<<<<<<<<<
 *             if not self.get_frame_types() and self.signature in SDIF_NEWTYPES:
 *                 self.add_predefined_type(self.signature)
 */
    ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->init_read(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

    /* "pysdif/_pysdif.pyx":758
 *         if self.mode == eReadFile:
 *             self.init_read()
 *             if not self.get_frame_types() and self.signature in SDIF_NEWTYPES:             # <<<<<<<<<<<<<<
 *                 self.add_predefined_type(self.signature)
 *         elif self.mode == eWriteFile:
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_frame_types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = (!__pyx_t_4);
    if (__pyx_t_5) {
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__SDIF_NEWTYPES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_t_2))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_t_4;
    } else {
      __pyx_t_6 = __pyx_t_5;
    }
    if (__pyx_t_6) {

      /* "pysdif/_pysdif.pyx":759
 *             self.init_read()
 *             if not self.get_frame_types() and self.signature in SDIF_NEWTYPES:
 *                 self.add_predefined_type(self.signature)             # <<<<<<<<<<<<<<
 *         elif self.mode == eWriteFile:
 *             self.init_write()
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_predefined_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __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 = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }

  /* "pysdif/_pysdif.pyx":760
 *             if not self.get_frame_types() and self.signature in SDIF_NEWTYPES:
 *                 self.add_predefined_type(self.signature)
 *         elif self.mode == eWriteFile:             # <<<<<<<<<<<<<<
 *             self.init_write()
 *             if predefined_type is not None and predefined_type in SDIF_NEWTYPES:
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyInt_FromLong(eWriteFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "pysdif/_pysdif.pyx":761
 *                 self.add_predefined_type(self.signature)
 *         elif self.mode == eWriteFile:
 *             self.init_write()             # <<<<<<<<<<<<<<
 *             if predefined_type is not None and predefined_type in SDIF_NEWTYPES:
 *                 self.add_predefined_type(predefined_type)
 */
    ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->init_write(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

    /* "pysdif/_pysdif.pyx":762
 *         elif self.mode == eWriteFile:
 *             self.init_write()
 *             if predefined_type is not None and predefined_type in SDIF_NEWTYPES:             # <<<<<<<<<<<<<<
 *                 self.add_predefined_type(predefined_type)
 * 
 */
    __pyx_t_6 = (__pyx_v_predefined_type != Py_None);
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__SDIF_NEWTYPES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = ((PySequence_Contains(__pyx_t_3, __pyx_v_predefined_type))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_5;
    } else {
      __pyx_t_4 = __pyx_t_6;
    }
    if (__pyx_t_4) {

      /* "pysdif/_pysdif.pyx":763
 *             self.init_write()
 *             if predefined_type is not None and predefined_type in SDIF_NEWTYPES:
 *                 self.add_predefined_type(predefined_type)             # <<<<<<<<<<<<<<
 * 
 *     cdef void init_read(self):
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_predefined_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(__pyx_v_predefined_type);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_predefined_type);
      __Pyx_GIVEREF(__pyx_v_predefined_type);
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":765
 *                 self.add_predefined_type(predefined_type)
 * 
 *     cdef void init_read(self):             # <<<<<<<<<<<<<<
 *         SdifFReadGeneralHeader (self.this)
 *         SdifFReadAllASCIIChunks(self.this)
 */

static void __pyx_f_6pysdif_7_pysdif_8SdifFile_init_read(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_read");

  /* "pysdif/_pysdif.pyx":766
 * 
 *     cdef void init_read(self):
 *         SdifFReadGeneralHeader (self.this)             # <<<<<<<<<<<<<<
 *         SdifFReadAllASCIIChunks(self.this)
 *         self.eof = (self.this.CurrSignature == eEof)
 */
  SdifFReadGeneralHeader(__pyx_v_self->this);

  /* "pysdif/_pysdif.pyx":767
 *     cdef void init_read(self):
 *         SdifFReadGeneralHeader (self.this)
 *         SdifFReadAllASCIIChunks(self.this)             # <<<<<<<<<<<<<<
 *         self.eof = (self.this.CurrSignature == eEof)
 *         self.this.TextStream = stdout  # this is needed by the print functions
 */
  SdifFReadAllASCIIChunks(__pyx_v_self->this);

  /* "pysdif/_pysdif.pyx":768
 *         SdifFReadGeneralHeader (self.this)
 *         SdifFReadAllASCIIChunks(self.this)
 *         self.eof = (self.this.CurrSignature == eEof)             # <<<<<<<<<<<<<<
 *         self.this.TextStream = stdout  # this is needed by the print functions
 *         self.init_containers()
 */
  __pyx_v_self->eof = (__pyx_v_self->this->CurrSignature == eEof);

  /* "pysdif/_pysdif.pyx":769
 *         SdifFReadAllASCIIChunks(self.this)
 *         self.eof = (self.this.CurrSignature == eEof)
 *         self.this.TextStream = stdout  # this is needed by the print functions             # <<<<<<<<<<<<<<
 *         self.init_containers()
 *         self.frame_status = eFrameSignatureRead
 */
  __pyx_v_self->this->TextStream = stdout;

  /* "pysdif/_pysdif.pyx":770
 *         self.eof = (self.this.CurrSignature == eEof)
 *         self.this.TextStream = stdout  # this is needed by the print functions
 *         self.init_containers()             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameSignatureRead
 *         self.matrix_idx = 0
 */
  ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)__pyx_v_self->__pyx_vtab)->init_containers(__pyx_v_self);

  /* "pysdif/_pysdif.pyx":771
 *         self.this.TextStream = stdout  # this is needed by the print functions
 *         self.init_containers()
 *         self.frame_status = eFrameSignatureRead             # <<<<<<<<<<<<<<
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead
 */
  __pyx_v_self->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameSignatureRead;

  /* "pysdif/_pysdif.pyx":772
 *         self.init_containers()
 *         self.frame_status = eFrameSignatureRead
 *         self.matrix_idx = 0             # <<<<<<<<<<<<<<
 *         self.matrix_status = eMatrixNothingRead
 * 
 */
  __pyx_v_self->matrix_idx = 0;

  /* "pysdif/_pysdif.pyx":773
 *         self.frame_status = eFrameSignatureRead
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead             # <<<<<<<<<<<<<<
 * 
 *     cdef void init_containers(self):
 */
  __pyx_v_self->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixNothingRead;

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":775
 *         self.matrix_status = eMatrixNothingRead
 * 
 *     cdef void init_containers(self):             # <<<<<<<<<<<<<<
 *         self.frame = FrameR(self)
 *         self.matrix = Matrix(self)
 */

static void __pyx_f_6pysdif_7_pysdif_8SdifFile_init_containers(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_containers");

  /* "pysdif/_pysdif.pyx":776
 * 
 *     cdef void init_containers(self):
 *         self.frame = FrameR(self)             # <<<<<<<<<<<<<<
 *         self.matrix = Matrix(self)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_FrameR)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->frame);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->frame));
  __pyx_v_self->frame = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":777
 *     cdef void init_containers(self):
 *         self.frame = FrameR(self)
 *         self.matrix = Matrix(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef void init_write(self):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_Matrix)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->matrix);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->matrix));
  __pyx_v_self->matrix = ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("pysdif._pysdif.SdifFile.init_containers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":779
 *         self.matrix = Matrix(self)
 * 
 *     cdef void init_write(self):             # <<<<<<<<<<<<<<
 *         SdifFWriteGeneralHeader(self.this)
 *         self.write_status = eSdifGeneralHeader
 */

static void __pyx_f_6pysdif_7_pysdif_8SdifFile_init_write(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_write");

  /* "pysdif/_pysdif.pyx":780
 * 
 *     cdef void init_write(self):
 *         SdifFWriteGeneralHeader(self.this)             # <<<<<<<<<<<<<<
 *         self.write_status = eSdifGeneralHeader
 * 
 */
  SdifFWriteGeneralHeader(__pyx_v_self->this);

  /* "pysdif/_pysdif.pyx":781
 *     cdef void init_write(self):
 *         SdifFWriteGeneralHeader(self.this)
 *         self.write_status = eSdifGeneralHeader             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->write_status = __pyx_e_6pysdif_7_pysdif_eSdifGeneralHeader;

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":783
 *         self.write_status = eSdifGeneralHeader
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.frame = None
 *         self.close()  # fails silently if already closed
 */

static void __pyx_pf_6pysdif_7_pysdif_8SdifFile_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_6pysdif_7_pysdif_8SdifFile_2__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "pysdif/_pysdif.pyx":784
 * 
 *     def __dealloc__(self):
 *         self.frame = None             # <<<<<<<<<<<<<<
 *         self.close()  # fails silently if already closed
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame));
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)Py_None);

  /* "pysdif/_pysdif.pyx":785
 *     def __dealloc__(self):
 *         self.frame = None
 *         self.close()  # fails silently if already closed             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":787
 *         self.close()  # fails silently if already closed
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         if self.eof == SDIF_CLOSED:
 *             return
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_3close[] = "SdifFile.close(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close");

  /* "pysdif/_pysdif.pyx":788
 * 
 *     def close(self):
 *         if self.eof == SDIF_CLOSED:             # <<<<<<<<<<<<<<
 *             return
 *         # make sure we write the global header even if no
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->eof == __pyx_v_6pysdif_7_pysdif_SDIF_CLOSED);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":789
 *     def close(self):
 *         if self.eof == SDIF_CLOSED:
 *             return             # <<<<<<<<<<<<<<
 *         # make sure we write the global header even if no
 *         # new frames are written (the global chunks are automatically
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":793
 *         # new frames are written (the global chunks are automatically
 *         # written when a new frame is added to the sdiffile)
 *         if self.mode == eWriteFile:             # <<<<<<<<<<<<<<
 *             if self.write_status == eSdifGeneralHeader:
 *                 self.write_all_ascii_chunks()
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong(eWriteFile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __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_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":794
 *         # written when a new frame is added to the sdiffile)
 *         if self.mode == eWriteFile:
 *             if self.write_status == eSdifGeneralHeader:             # <<<<<<<<<<<<<<
 *                 self.write_all_ascii_chunks()
 *         SdifFClose(self.this)
 */
    __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->write_status == __pyx_e_6pysdif_7_pysdif_eSdifGeneralHeader);
    if (__pyx_t_1) {

      /* "pysdif/_pysdif.pyx":795
 *         if self.mode == eWriteFile:
 *             if self.write_status == eSdifGeneralHeader:
 *                 self.write_all_ascii_chunks()             # <<<<<<<<<<<<<<
 *         SdifFClose(self.this)
 *         self.eof = SDIF_CLOSED
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_17); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __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 = 795; __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_3); __pyx_t_3 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":796
 *             if self.write_status == eSdifGeneralHeader:
 *                 self.write_all_ascii_chunks()
 *         SdifFClose(self.this)             # <<<<<<<<<<<<<<
 *         self.eof = SDIF_CLOSED
 * 
 */
  SdifFClose(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":797
 *                 self.write_all_ascii_chunks()
 *         SdifFClose(self.this)
 *         self.eof = SDIF_CLOSED             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->eof = __pyx_v_6pysdif_7_pysdif_SDIF_CLOSED;

  __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("pysdif._pysdif.SdifFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":800
 * 
 *     property name:
 *         def __get__(self): return self.this.Name             # <<<<<<<<<<<<<<
 *     property mode:
 *         def __get__(self): return self.this.Mode
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4name___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->Name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":802
 *         def __get__(self): return self.this.Name
 *     property mode:
 *         def __get__(self): return self.this.Mode             # <<<<<<<<<<<<<<
 *     property is_seekable:
 *         def __get__(self): return self.this.isSeekable
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4mode___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4mode___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->Mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":804
 *         def __get__(self): return self.this.Mode
 *     property is_seekable:
 *         def __get__(self): return self.this.isSeekable             # <<<<<<<<<<<<<<
 *     property numerical_signature:
 *         def __get__(self): return self.this.CurrSignature
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11is_seekable___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11is_seekable___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->isSeekable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.is_seekable.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":806
 *         def __get__(self): return self.this.isSeekable
 *     property numerical_signature:
 *         def __get__(self): return self.this.CurrSignature             # <<<<<<<<<<<<<<
 *     property signature:
 *         def __get__(self): return sig2str(self.this.CurrSignature)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_19numerical_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_19numerical_signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrSignature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.numerical_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":808
 *         def __get__(self): return self.this.CurrSignature
 *     property signature:
 *         def __get__(self): return sig2str(self.this.CurrSignature)             # <<<<<<<<<<<<<<
 *     property prev_time:
 *         def __get__(self): return self.this.PrevTime
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrSignature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":810
 *         def __get__(self): return sig2str(self.this.CurrSignature)
 *     property prev_time:
 *         def __get__(self): return self.this.PrevTime             # <<<<<<<<<<<<<<
 *     property frame_pos:
 *         def __get__(self): return self.this.CurrFramPos
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9prev_time___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9prev_time___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->PrevTime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.prev_time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":812
 *         def __get__(self): return self.this.PrevTime
 *     property frame_pos:
 *         def __get__(self): return self.this.CurrFramPos             # <<<<<<<<<<<<<<
 *     property matrix_cols:
 *         def __get__(self): return self.this.CurrMtrxH.NbCol
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9frame_pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9frame_pos___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdiffPosT(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramPos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.frame_pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":814
 *         def __get__(self): return self.this.CurrFramPos
 *     property matrix_cols:
 *         def __get__(self): return self.this.CurrMtrxH.NbCol             # <<<<<<<<<<<<<<
 *     property matrix_rows:
 *         def __get__(self): return self.this.CurrMtrxH.NbRow
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11matrix_cols___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11matrix_cols___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrMtrxH->NbCol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_cols.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":816
 *         def __get__(self): return self.this.CurrMtrxH.NbCol
 *     property matrix_rows:
 *         def __get__(self): return self.this.CurrMtrxH.NbRow             # <<<<<<<<<<<<<<
 *     property matrix_data_type:
 *         def __get__(self): return self.this.CurrMtrxH.DataType
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11matrix_rows___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11matrix_rows___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrMtrxH->NbRow); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_rows.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":818
 *         def __get__(self): return self.this.CurrMtrxH.NbRow
 *     property matrix_data_type:
 *         def __get__(self): return self.this.CurrMtrxH.DataType             # <<<<<<<<<<<<<<
 *     property matrices_in_frame:
 *         def __get__(self): return self.this.CurrFramH.NbMatrix
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_16matrix_data_type___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_16matrix_data_type___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrMtrxH->DataType); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_data_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":820
 *         def __get__(self): return self.this.CurrMtrxH.DataType
 *     property matrices_in_frame:
 *         def __get__(self): return self.this.CurrFramH.NbMatrix             # <<<<<<<<<<<<<<
 *     property frame_id:
 *         def __get__(self): return self.this.CurrFramH.NumID
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_17matrices_in_frame___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_17matrices_in_frame___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->NbMatrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrices_in_frame.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":822
 *         def __get__(self): return self.this.CurrFramH.NbMatrix
 *     property frame_id:
 *         def __get__(self): return self.this.CurrFramH.NumID             # <<<<<<<<<<<<<<
 *     property pos:
 *         def __get__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_8frame_id___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_8frame_id___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->NumID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.frame_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":824
 *         def __get__(self): return self.this.CurrFramH.NumID
 *     property pos:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef SdiffPosT pos
 *             SdifFGetPos(self.this, &pos)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_3pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_3pos___get__(PyObject *__pyx_v_self) {
  SdiffPosT __pyx_v_pos;
  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("__get__");

  /* "pysdif/_pysdif.pyx":826
 *         def __get__(self):
 *             cdef SdiffPosT pos
 *             SdifFGetPos(self.this, &pos)             # <<<<<<<<<<<<<<
 *             return pos
 *         def __set__(self, long pos): SdifFSetPos(self.this, &pos)
 */
  SdifFGetPos(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, (&__pyx_v_pos));

  /* "pysdif/_pysdif.pyx":827
 *             cdef SdiffPosT pos
 *             SdifFGetPos(self.this, &pos)
 *             return pos             # <<<<<<<<<<<<<<
 *         def __set__(self, long pos): SdifFSetPos(self.this, &pos)
 *     property frame_numerical_signature:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdiffPosT(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":828
 *             SdifFGetPos(self.this, &pos)
 *             return pos
 *         def __set__(self, long pos): SdifFSetPos(self.this, &pos)             # <<<<<<<<<<<<<<
 *     property frame_numerical_signature:
 *         def __get__(self): return self.this.CurrFramH.Signature
 */

static int __pyx_pf_6pysdif_7_pysdif_8SdifFile_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos); /*proto*/
static int __pyx_pf_6pysdif_7_pysdif_8SdifFile_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos) {
  long __pyx_v_pos;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_pos); {
    __pyx_v_pos = __Pyx_PyInt_AsLong(__pyx_arg_pos); if (unlikely((__pyx_v_pos == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  SdifFSetPos(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, (&__pyx_v_pos));

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":830
 *         def __set__(self, long pos): SdifFSetPos(self.this, &pos)
 *     property frame_numerical_signature:
 *         def __get__(self): return self.this.CurrFramH.Signature             # <<<<<<<<<<<<<<
 *     property frame_signature:
 *         def __get__(self): return sig2str(self.this.CurrFramH.Signature)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_25frame_numerical_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_25frame_numerical_signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.frame_numerical_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":832
 *         def __get__(self): return self.this.CurrFramH.Signature
 *     property frame_signature:
 *         def __get__(self): return sig2str(self.this.CurrFramH.Signature)             # <<<<<<<<<<<<<<
 *     property matrix_numerical_signature:
 *         def __get__(self): return self.this.CurrMtrxH.Signature
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_15frame_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_15frame_signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.frame_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":834
 *         def __get__(self): return sig2str(self.this.CurrFramH.Signature)
 *     property matrix_numerical_signature:
 *         def __get__(self): return self.this.CurrMtrxH.Signature             # <<<<<<<<<<<<<<
 *     property matrix_signature:
 *         def __get__(self): return sig2str(self.this.CurrMtrxH.Signature)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_26matrix_numerical_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_26matrix_numerical_signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_to_py_SdifUInt4(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrMtrxH->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_numerical_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":836
 *         def __get__(self): return self.this.CurrMtrxH.Signature
 *     property matrix_signature:
 *         def __get__(self): return sig2str(self.this.CurrMtrxH.Signature)             # <<<<<<<<<<<<<<
 *     property time:
 *         def __get__(self): return self.this.CurrFramH.Time
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_16matrix_signature___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_16matrix_signature___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_sig2str(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrMtrxH->Signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_signature.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":838
 *         def __get__(self): return sig2str(self.this.CurrMtrxH.Signature)
 *     property time:
 *         def __get__(self): return self.this.CurrFramH.Time             # <<<<<<<<<<<<<<
 *     property last_error:
 *         def __get__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4time___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4time___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->Time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":840
 *         def __get__(self): return self.this.CurrFramH.Time
 *     property last_error:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef SdifErrorT* error = SdifFLastError(self.this)
 *             if error == NULL:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_10last_error___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_10last_error___get__(PyObject *__pyx_v_self) {
  SdifErrorT *__pyx_v_error;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":841
 *     property last_error:
 *         def __get__(self):
 *             cdef SdifErrorT* error = SdifFLastError(self.this)             # <<<<<<<<<<<<<<
 *             if error == NULL:
 *                 return None
 */
  __pyx_v_error = SdifFLastError(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":842
 *         def __get__(self):
 *             cdef SdifErrorT* error = SdifFLastError(self.this)
 *             if error == NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             return (error.Tag, error.Level)
 */
  __pyx_t_1 = (__pyx_v_error == NULL);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":843
 *             cdef SdifErrorT* error = SdifFLastError(self.this)
 *             if error == NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             return (error.Tag, error.Level)
 *     property frame_is_selected:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":844
 *             if error == NULL:
 *                 return None
 *             return (error.Tag, error.Level)             # <<<<<<<<<<<<<<
 *     property frame_is_selected:
 *         def __get__(self): return SdifFCurrFrameIsSelected (self.this)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_error->Tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_error->Level); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __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("pysdif._pysdif.SdifFile.last_error.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":846
 *             return (error.Tag, error.Level)
 *     property frame_is_selected:
 *         def __get__(self): return SdifFCurrFrameIsSelected (self.this)             # <<<<<<<<<<<<<<
 *     property matrix_is_selected:
 *         def __get__(self): return SdifFCurrMatrixIsSelected (self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_17frame_is_selected___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_17frame_is_selected___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(SdifFCurrFrameIsSelected(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.frame_is_selected.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":848
 *         def __get__(self): return SdifFCurrFrameIsSelected (self.this)
 *     property matrix_is_selected:
 *         def __get__(self): return SdifFCurrMatrixIsSelected (self.this)             # <<<<<<<<<<<<<<
 *     property number_of_NVTs:
 *         def __get__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_18matrix_is_selected___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_18matrix_is_selected___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(SdifFCurrMatrixIsSelected(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_is_selected.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":850
 *         def __get__(self): return SdifFCurrMatrixIsSelected (self.this)
 *     property number_of_NVTs:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if SdifNameValuesLIsNotEmpty(self.this.NameValues):
 *                 return SdifFNameValueNum(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_14number_of_NVTs___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_14number_of_NVTs___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  SdifUInt2 __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "pysdif/_pysdif.pyx":851
 *     property number_of_NVTs:
 *         def __get__(self):
 *             if SdifNameValuesLIsNotEmpty(self.this.NameValues):             # <<<<<<<<<<<<<<
 *                 return SdifFNameValueNum(self.this)
 *             else:
 */
  __pyx_t_1 = SdifNameValuesLIsNotEmpty(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->NameValues);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":852
 *         def __get__(self):
 *             if SdifNameValuesLIsNotEmpty(self.this.NameValues):
 *                 return SdifFNameValueNum(self.this)             # <<<<<<<<<<<<<<
 *             else:
 *                 return 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(SdifFNameValueNum(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":854
 *                 return SdifFNameValueNum(self.this)
 *             else:
 *                 return 0             # <<<<<<<<<<<<<<
 *     def read_frame_header(self):
 *         """
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.number_of_NVTs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":855
 *             else:
 *                 return 0
 *     def read_frame_header(self):             # <<<<<<<<<<<<<<
 *         """
 *         low level interface.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4read_frame_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_4read_frame_header[] = "SdifFile.read_frame_header(self)\n\n        low level interface.\n        read the frame header\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_4read_frame_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_frame_header");

  /* "pysdif/_pysdif.pyx":860
 *         read the frame header
 *         """
 *         self.finalize_frame()             # <<<<<<<<<<<<<<
 *         if self.eof == 1:
 *             return 0
 */
  ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->finalize_frame(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

  /* "pysdif/_pysdif.pyx":861
 *         """
 *         self.finalize_frame()
 *         if self.eof == 1:             # <<<<<<<<<<<<<<
 *             return 0
 *         self.frame_status = eFrameHeaderRead
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->eof == 1);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":862
 *         self.finalize_frame()
 *         if self.eof == 1:
 *             return 0             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameHeaderRead
 *         return SdifFReadFrameHeader(self.this)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":863
 *         if self.eof == 1:
 *             return 0
 *         self.frame_status = eFrameHeaderRead             # <<<<<<<<<<<<<<
 *         return SdifFReadFrameHeader(self.this)
 *     def skip_frame_data(self):
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameHeaderRead;

  /* "pysdif/_pysdif.pyx":864
 *             return 0
 *         self.frame_status = eFrameHeaderRead
 *         return SdifFReadFrameHeader(self.this)             # <<<<<<<<<<<<<<
 *     def skip_frame_data(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(SdifFReadFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.read_frame_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":865
 *         self.frame_status = eFrameHeaderRead
 *         return SdifFReadFrameHeader(self.this)
 *     def skip_frame_data(self):             # <<<<<<<<<<<<<<
 *         """
 *         low level interface.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_5skip_frame_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_5skip_frame_data[] = "SdifFile.skip_frame_data(self)\n\n        low level interface.\n        skip the frame with all the matrices it may contain.\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_5skip_frame_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  size_t __pyx_v_bytes_read;
  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("skip_frame_data");

  /* "pysdif/_pysdif.pyx":870
 *         skip the frame with all the matrices it may contain.
 *         """
 *         assert self.frame_status == eFrameHeaderRead             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameAllDataRead
 *         cdef size_t bytes_read = SdifFSkipFrameData (self.this)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status == __pyx_e_6pysdif_7_pysdif_eFrameHeaderRead))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "pysdif/_pysdif.pyx":871
 *         """
 *         assert self.frame_status == eFrameHeaderRead
 *         self.frame_status = eFrameAllDataRead             # <<<<<<<<<<<<<<
 *         cdef size_t bytes_read = SdifFSkipFrameData (self.this)
 *         self.finalize_frame()
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameAllDataRead;

  /* "pysdif/_pysdif.pyx":872
 *         assert self.frame_status == eFrameHeaderRead
 *         self.frame_status = eFrameAllDataRead
 *         cdef size_t bytes_read = SdifFSkipFrameData (self.this)             # <<<<<<<<<<<<<<
 *         self.finalize_frame()
 *         return bytes_read
 */
  __pyx_v_bytes_read = SdifFSkipFrameData(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":873
 *         self.frame_status = eFrameAllDataRead
 *         cdef size_t bytes_read = SdifFSkipFrameData (self.this)
 *         self.finalize_frame()             # <<<<<<<<<<<<<<
 *         return bytes_read
 * 
 */
  ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->finalize_frame(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

  /* "pysdif/_pysdif.pyx":874
 *         cdef size_t bytes_read = SdifFSkipFrameData (self.this)
 *         self.finalize_frame()
 *         return bytes_read             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void finalize_frame(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.skip_frame_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":876
 *         return bytes_read
 * 
 *     cdef inline void finalize_frame(self):             # <<<<<<<<<<<<<<
 *         # here we must make sure that we have read
 *         # the whole data before we try to
 */

static CYTHON_INLINE void __pyx_f_6pysdif_7_pysdif_8SdifFile_finalize_frame(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  int __pyx_v_i;
  size_t __pyx_v_bytes_read;
  int __pyx_v_status;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  SdifUInt4 __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("finalize_frame");

  /* "pysdif/_pysdif.pyx":882
 *         cdef int i
 *         cdef size_t bytes_read
 *         cdef int status = self.frame_status             # <<<<<<<<<<<<<<
 *         if status == eFrameSignatureRead:
 *             return
 */
  __pyx_v_status = __pyx_v_self->frame_status;

  /* "pysdif/_pysdif.pyx":883
 *         cdef size_t bytes_read
 *         cdef int status = self.frame_status
 *         if status == eFrameSignatureRead:             # <<<<<<<<<<<<<<
 *             return
 *         elif status == eFrameHeaderRead:
 */
  __pyx_t_1 = (__pyx_v_status == __pyx_e_6pysdif_7_pysdif_eFrameSignatureRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":884
 *         cdef int status = self.frame_status
 *         if status == eFrameSignatureRead:
 *             return             # <<<<<<<<<<<<<<
 *         elif status == eFrameHeaderRead:
 *             SdifFSkipFrameData(self.this)
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":885
 *         if status == eFrameSignatureRead:
 *             return
 *         elif status == eFrameHeaderRead:             # <<<<<<<<<<<<<<
 *             SdifFSkipFrameData(self.this)
 *         elif status == eFrameSomeDataRead:
 */
  __pyx_t_1 = (__pyx_v_status == __pyx_e_6pysdif_7_pysdif_eFrameHeaderRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":886
 *             return
 *         elif status == eFrameHeaderRead:
 *             SdifFSkipFrameData(self.this)             # <<<<<<<<<<<<<<
 *         elif status == eFrameSomeDataRead:
 *             if self.matrix_status < eMatrixDataRead:
 */
    SdifFSkipFrameData(__pyx_v_self->this);
    goto __pyx_L3;
  }

  /* "pysdif/_pysdif.pyx":887
 *         elif status == eFrameHeaderRead:
 *             SdifFSkipFrameData(self.this)
 *         elif status == eFrameSomeDataRead:             # <<<<<<<<<<<<<<
 *             if self.matrix_status < eMatrixDataRead:
 *                 SdifFSkipMatrixData(self.this)
 */
  __pyx_t_1 = (__pyx_v_status == __pyx_e_6pysdif_7_pysdif_eFrameSomeDataRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":888
 *             SdifFSkipFrameData(self.this)
 *         elif status == eFrameSomeDataRead:
 *             if self.matrix_status < eMatrixDataRead:             # <<<<<<<<<<<<<<
 *                 SdifFSkipMatrixData(self.this)
 *             for i in range(self.matrix_idx, self.this.CurrFramH.NbMatrix):
 */
    __pyx_t_1 = (__pyx_v_self->matrix_status < __pyx_e_6pysdif_7_pysdif_eMatrixDataRead);
    if (__pyx_t_1) {

      /* "pysdif/_pysdif.pyx":889
 *         elif status == eFrameSomeDataRead:
 *             if self.matrix_status < eMatrixDataRead:
 *                 SdifFSkipMatrixData(self.this)             # <<<<<<<<<<<<<<
 *             for i in range(self.matrix_idx, self.this.CurrFramH.NbMatrix):
 *                 SdifFSkipMatrix(self.this)
 */
      SdifFSkipMatrixData(__pyx_v_self->this);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pysdif/_pysdif.pyx":890
 *             if self.matrix_status < eMatrixDataRead:
 *                 SdifFSkipMatrixData(self.this)
 *             for i in range(self.matrix_idx, self.this.CurrFramH.NbMatrix):             # <<<<<<<<<<<<<<
 *                 SdifFSkipMatrix(self.this)
 *         self.matrix_idx = 0
 */
    __pyx_t_2 = __pyx_v_self->this->CurrFramH->NbMatrix;
    for (__pyx_t_3 = __pyx_v_self->matrix_idx; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "pysdif/_pysdif.pyx":891
 *                 SdifFSkipMatrixData(self.this)
 *             for i in range(self.matrix_idx, self.this.CurrFramH.NbMatrix):
 *                 SdifFSkipMatrix(self.this)             # <<<<<<<<<<<<<<
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead
 */
      SdifFSkipMatrix(__pyx_v_self->this);
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pysdif/_pysdif.pyx":892
 *             for i in range(self.matrix_idx, self.this.CurrFramH.NbMatrix):
 *                 SdifFSkipMatrix(self.this)
 *         self.matrix_idx = 0             # <<<<<<<<<<<<<<
 *         self.matrix_status = eMatrixNothingRead
 *         self.frame_status = eFrameNothingRead
 */
  __pyx_v_self->matrix_idx = 0;

  /* "pysdif/_pysdif.pyx":893
 *                 SdifFSkipMatrix(self.this)
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameNothingRead
 *         self.eof = SdifFGetSignature(self.this, &bytes_read) == eEof
 */
  __pyx_v_self->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixNothingRead;

  /* "pysdif/_pysdif.pyx":894
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead
 *         self.frame_status = eFrameNothingRead             # <<<<<<<<<<<<<<
 *         self.eof = SdifFGetSignature(self.this, &bytes_read) == eEof
 * 
 */
  __pyx_v_self->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameNothingRead;

  /* "pysdif/_pysdif.pyx":895
 *         self.matrix_status = eMatrixNothingRead
 *         self.frame_status = eFrameNothingRead
 *         self.eof = SdifFGetSignature(self.this, &bytes_read) == eEof             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void read_signature(self):
 */
  __pyx_v_self->eof = (SdifFGetSignature(__pyx_v_self->this, (&__pyx_v_bytes_read)) == eEof);

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":897
 *         self.eof = SdifFGetSignature(self.this, &bytes_read) == eEof
 * 
 *     cdef inline void read_signature(self):             # <<<<<<<<<<<<<<
 *         cdef size_t NbCharRead
 *         self.eof = SdifFGetSignature(self.this, &NbCharRead) == eEof
 */

static CYTHON_INLINE void __pyx_f_6pysdif_7_pysdif_8SdifFile_read_signature(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  size_t __pyx_v_NbCharRead;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_signature");

  /* "pysdif/_pysdif.pyx":899
 *     cdef inline void read_signature(self):
 *         cdef size_t NbCharRead
 *         self.eof = SdifFGetSignature(self.this, &NbCharRead) == eEof             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameSignatureRead
 * 
 */
  __pyx_v_self->eof = (SdifFGetSignature(__pyx_v_self->this, (&__pyx_v_NbCharRead)) == eEof);

  /* "pysdif/_pysdif.pyx":900
 *         cdef size_t NbCharRead
 *         self.eof = SdifFGetSignature(self.this, &NbCharRead) == eEof
 *         self.frame_status = eFrameSignatureRead             # <<<<<<<<<<<<<<
 * 
 *     def read_matrix_header(self):
 */
  __pyx_v_self->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameSignatureRead;

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":902
 *         self.frame_status = eFrameSignatureRead
 * 
 *     def read_matrix_header(self):             # <<<<<<<<<<<<<<
 *         """
 *         low level interface.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_6read_matrix_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_6read_matrix_header[] = "SdifFile.read_matrix_header(self)\n\n        low level interface.\n        read the matrix header (signature, number of rows and columns, etc.)\n        return the number of bytes read or 0 if no more matrices\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_6read_matrix_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_matrix_header");

  /* "pysdif/_pysdif.pyx":908
 *         return the number of bytes read or 0 if no more matrices
 *         """
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:             # <<<<<<<<<<<<<<
 *             return 0
 *         self.frame_status = eFrameSomeDataRead
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx == ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->NbMatrix);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":909
 *         """
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             return 0             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameSomeDataRead
 *         self.matrix_status = eMatrixHeaderRead
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":910
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             return 0
 *         self.frame_status = eFrameSomeDataRead             # <<<<<<<<<<<<<<
 *         self.matrix_status = eMatrixHeaderRead
 *         self.matrix_idx += 1
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameSomeDataRead;

  /* "pysdif/_pysdif.pyx":911
 *             return 0
 *         self.frame_status = eFrameSomeDataRead
 *         self.matrix_status = eMatrixHeaderRead             # <<<<<<<<<<<<<<
 *         self.matrix_idx += 1
 *         return SdifFReadMatrixHeader(self.this)
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead;

  /* "pysdif/_pysdif.pyx":912
 *         self.frame_status = eFrameSomeDataRead
 *         self.matrix_status = eMatrixHeaderRead
 *         self.matrix_idx += 1             # <<<<<<<<<<<<<<
 *         return SdifFReadMatrixHeader(self.this)
 * 
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx + 1);

  /* "pysdif/_pysdif.pyx":913
 *         self.matrix_status = eMatrixHeaderRead
 *         self.matrix_idx += 1
 *         return SdifFReadMatrixHeader(self.this)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void read_matrix_data(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(SdifFReadMatrixHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.read_matrix_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":915
 *         return SdifFReadMatrixHeader(self.this)
 * 
 *     cdef inline void read_matrix_data(self):             # <<<<<<<<<<<<<<
 *         self.matrix_status = eMatrixDataRead
 *         SdifFReadMatrixData(self.this)
 */

static CYTHON_INLINE void __pyx_f_6pysdif_7_pysdif_8SdifFile_read_matrix_data(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("read_matrix_data");

  /* "pysdif/_pysdif.pyx":916
 * 
 *     cdef inline void read_matrix_data(self):
 *         self.matrix_status = eMatrixDataRead             # <<<<<<<<<<<<<<
 *         SdifFReadMatrixData(self.this)
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 */
  __pyx_v_self->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixDataRead;

  /* "pysdif/_pysdif.pyx":917
 *     cdef inline void read_matrix_data(self):
 *         self.matrix_status = eMatrixDataRead
 *         SdifFReadMatrixData(self.this)             # <<<<<<<<<<<<<<
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead
 */
  SdifFReadMatrixData(__pyx_v_self->this);

  /* "pysdif/_pysdif.pyx":918
 *         self.matrix_status = eMatrixDataRead
 *         SdifFReadMatrixData(self.this)
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:             # <<<<<<<<<<<<<<
 *             self.frame_status = eFrameAllDataRead
 * 
 */
  __pyx_t_1 = (__pyx_v_self->matrix_idx == __pyx_v_self->this->CurrFramH->NbMatrix);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":919
 *         SdifFReadMatrixData(self.this)
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead             # <<<<<<<<<<<<<<
 * 
 *     def skip_matrix_data(self):
 */
    __pyx_v_self->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameAllDataRead;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":921
 *             self.frame_status = eFrameAllDataRead
 * 
 *     def skip_matrix_data(self):             # <<<<<<<<<<<<<<
 *         """
 *         low level interface.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_7skip_matrix_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_7skip_matrix_data[] = "SdifFile.skip_matrix_data(self)\n\n        low level interface.\n        skip the matrix data without reading it.\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_7skip_matrix_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  size_t __pyx_v_bytes_read;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("skip_matrix_data");

  /* "pysdif/_pysdif.pyx":926
 *         skip the matrix data without reading it.
 *         """
 *         self.matrix_status = eMatrixDataSkipped             # <<<<<<<<<<<<<<
 *         cdef size_t bytes_read = SdifFSkipMatrixData(self.this)
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixDataSkipped;

  /* "pysdif/_pysdif.pyx":927
 *         """
 *         self.matrix_status = eMatrixDataSkipped
 *         cdef size_t bytes_read = SdifFSkipMatrixData(self.this)             # <<<<<<<<<<<<<<
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead
 */
  __pyx_v_bytes_read = SdifFSkipMatrixData(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":928
 *         self.matrix_status = eMatrixDataSkipped
 *         cdef size_t bytes_read = SdifFSkipMatrixData(self.this)
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:             # <<<<<<<<<<<<<<
 *             self.frame_status = eFrameAllDataRead
 *         return bytes_read
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx == ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->NbMatrix);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":929
 *         cdef size_t bytes_read = SdifFSkipMatrixData(self.this)
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead             # <<<<<<<<<<<<<<
 *         return bytes_read
 * 
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameAllDataRead;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":930
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead
 *         return bytes_read             # <<<<<<<<<<<<<<
 * 
 *     def get_matrix_data(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.skip_matrix_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":932
 *         return bytes_read
 * 
 *     def get_matrix_data(self):             # <<<<<<<<<<<<<<
 *         """
 *         read the data of the current matrix as a numpy array
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_8get_matrix_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_8get_matrix_data[] = "SdifFile.get_matrix_data(self)\n\n        read the data of the current matrix as a numpy array\n        if the matrix-header was not read, it is read\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_8get_matrix_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_matrix_data");

  /* "pysdif/_pysdif.pyx":937
 *         if the matrix-header was not read, it is read
 *         """
 *         if self.matrix_status == eMatrixNothingRead:             # <<<<<<<<<<<<<<
 *             self.read_matrix_header()
 *         self.read_matrix_data()
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_status == __pyx_e_6pysdif_7_pysdif_eMatrixNothingRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":938
 *         """
 *         if self.matrix_status == eMatrixNothingRead:
 *             self.read_matrix_header()             # <<<<<<<<<<<<<<
 *         self.read_matrix_data()
 *         return _array_from_matrix_data_no_copy(self.this.CurrMtrxData)
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_matrix_header); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":939
 *         if self.matrix_status == eMatrixNothingRead:
 *             self.read_matrix_header()
 *         self.read_matrix_data()             # <<<<<<<<<<<<<<
 *         return _array_from_matrix_data_no_copy(self.this.CurrMtrxData)
 * 
 */
  ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->read_matrix_data(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

  /* "pysdif/_pysdif.pyx":940
 *             self.read_matrix_header()
 *         self.read_matrix_data()
 *         return _array_from_matrix_data_no_copy(self.this.CurrMtrxData)             # <<<<<<<<<<<<<<
 * 
 *     def skip_matrix(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_no_copy(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrMtrxData)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("pysdif._pysdif.SdifFile.get_matrix_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":942
 *         return _array_from_matrix_data_no_copy(self.this.CurrMtrxData)
 * 
 *     def skip_matrix(self):             # <<<<<<<<<<<<<<
 *         """
 *         skip the matrix altogether. this is a low-level function
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9skip_matrix(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_9skip_matrix[] = "SdifFile.skip_matrix(self)\n\n        skip the matrix altogether. this is a low-level function\n        only used when reading the data manually.\n        If you are iterating with \n        for frame in sdiffile:\n            for matrix in frame:\n                ... etc ...\n                \n        then it is not necessary to take care of this because the\n        SdifFile makes its own book-keeping and knows if something\n        needs to be skipped or not\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_9skip_matrix(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  size_t __pyx_v_bytes_read;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("skip_matrix");

  /* "pysdif/_pysdif.pyx":955
 *         needs to be skipped or not
 *         """
 *         cdef size_t bytes_read = SdifFSkipMatrix(self.this)             # <<<<<<<<<<<<<<
 *         self.matrix_idx += 1
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 */
  __pyx_v_bytes_read = SdifFSkipMatrix(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":956
 *         """
 *         cdef size_t bytes_read = SdifFSkipMatrix(self.this)
 *         self.matrix_idx += 1             # <<<<<<<<<<<<<<
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx + 1);

  /* "pysdif/_pysdif.pyx":957
 *         cdef size_t bytes_read = SdifFSkipMatrix(self.this)
 *         self.matrix_idx += 1
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:             # <<<<<<<<<<<<<<
 *             self.frame_status = eFrameAllDataRead
 *         return bytes_read
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx == ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->NbMatrix);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":958
 *         self.matrix_idx += 1
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead             # <<<<<<<<<<<<<<
 *         return bytes_read
 * 
 */
    ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameAllDataRead;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":959
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             self.frame_status = eFrameAllDataRead
 *         return bytes_read             # <<<<<<<<<<<<<<
 * 
 *     def status(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.skip_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":961
 *         return bytes_read
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         return (current-frame-status, current-matrix-index, current-matrix-status)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_10status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_10status[] = "SdifFile.status(self)\n\n        return (current-frame-status, current-matrix-index, current-matrix-status)\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_10status(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("status");

  /* "pysdif/_pysdif.pyx":965
 *         return (current-frame-status, current-matrix-index, current-matrix-status)
 *         """
 *         return self.frame_status, self.matrix_idx, self.matrix_status             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_status); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __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 = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":967
 *         return self.frame_status, self.matrix_idx, self.matrix_status
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 *     def __next__(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_11__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__");

  /* "pysdif/_pysdif.pyx":968
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         self.finalize_frame()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":969
 *     def __iter__(self):
 *         return self
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         self.finalize_frame()
 *         if self.eof == 1:
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_12__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_12__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__");

  /* "pysdif/_pysdif.pyx":970
 *         return self
 *     def __next__(self):
 *         self.finalize_frame()             # <<<<<<<<<<<<<<
 *         if self.eof == 1:
 *             raise StopIteration
 */
  ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->finalize_frame(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

  /* "pysdif/_pysdif.pyx":971
 *     def __next__(self):
 *         self.finalize_frame()
 *         if self.eof == 1:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self.frame_status = eFrameHeaderRead
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->eof == 1);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":972
 *         self.finalize_frame()
 *         if self.eof == 1:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameHeaderRead
 *         SdifFReadFrameHeader(self.this)
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":973
 *         if self.eof == 1:
 *             raise StopIteration
 *         self.frame_status = eFrameHeaderRead             # <<<<<<<<<<<<<<
 *         SdifFReadFrameHeader(self.this)
 *         return self.frame
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameHeaderRead;

  /* "pysdif/_pysdif.pyx":974
 *             raise StopIteration
 *         self.frame_status = eFrameHeaderRead
 *         SdifFReadFrameHeader(self.this)             # <<<<<<<<<<<<<<
 *         return self.frame
 * 
 */
  SdifFReadFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":975
 *         self.frame_status = eFrameHeaderRead
 *         SdifFReadFrameHeader(self.this)
 *         return self.frame             # <<<<<<<<<<<<<<
 * 
 *     def get_next_matrix(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->frame);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":977
 *         return self.frame
 * 
 *     def get_next_matrix(self):             # <<<<<<<<<<<<<<
 *         """
 *         read the next matrix header and return a matrix with its
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_13get_next_matrix(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_13get_next_matrix[] = "SdifFile.get_next_matrix(self)\n\n        read the next matrix header and return a matrix with its\n        data still not read. in particular, if the previous matrix\n        was not read fully, its data is skipped\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_13get_next_matrix(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_next_matrix");

  /* "pysdif/_pysdif.pyx":983
 *         was not read fully, its data is skipped
 *         """
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:             # <<<<<<<<<<<<<<
 *             return None
 *         if self.matrix_status == eMatrixHeaderRead:
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx == ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->CurrFramH->NbMatrix);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":984
 *         """
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             return None             # <<<<<<<<<<<<<<
 *         if self.matrix_status == eMatrixHeaderRead:
 *             SdifFSkipMatrixData(self.this)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":985
 *         if self.matrix_idx == self.this.CurrFramH.NbMatrix:
 *             return None
 *         if self.matrix_status == eMatrixHeaderRead:             # <<<<<<<<<<<<<<
 *             SdifFSkipMatrixData(self.this)
 *         SdifFReadMatrixHeader(self.this)
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_status == __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":986
 *             return None
 *         if self.matrix_status == eMatrixHeaderRead:
 *             SdifFSkipMatrixData(self.this)             # <<<<<<<<<<<<<<
 *         SdifFReadMatrixHeader(self.this)
 *         self.matrix_idx += 1
 */
    SdifFSkipMatrixData(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":987
 *         if self.matrix_status == eMatrixHeaderRead:
 *             SdifFSkipMatrixData(self.this)
 *         SdifFReadMatrixHeader(self.this)             # <<<<<<<<<<<<<<
 *         self.matrix_idx += 1
 *         self.matrix_status = eMatrixHeaderRead
 */
  SdifFReadMatrixHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":988
 *             SdifFSkipMatrixData(self.this)
 *         SdifFReadMatrixHeader(self.this)
 *         self.matrix_idx += 1             # <<<<<<<<<<<<<<
 *         self.matrix_status = eMatrixHeaderRead
 *         return self.matrix
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_idx + 1);

  /* "pysdif/_pysdif.pyx":989
 *         SdifFReadMatrixHeader(self.this)
 *         self.matrix_idx += 1
 *         self.matrix_status = eMatrixHeaderRead             # <<<<<<<<<<<<<<
 *         return self.matrix
 * 
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixHeaderRead;

  /* "pysdif/_pysdif.pyx":990
 *         self.matrix_idx += 1
 *         self.matrix_status = eMatrixHeaderRead
 *         return self.matrix             # <<<<<<<<<<<<<<
 * 
 *     def rewind(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->matrix);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":992
 *         return self.matrix
 * 
 *     def rewind(self):             # <<<<<<<<<<<<<<
 *         """
 *         rewind the SdifFile. after this function is called, the file
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_14rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_14rewind[] = "SdifFile.rewind(self)\n\n        rewind the SdifFile. after this function is called, the file\n        is in its starting frame (as if the file had been just open)\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_14rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rewind");

  /* "pysdif/_pysdif.pyx":997
 *         is in its starting frame (as if the file had been just open)
 *         """
 *         SdifFRewind(self.this)             # <<<<<<<<<<<<<<
 *         self.reinit()
 * 
 */
  SdifFRewind(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":998
 *         """
 *         SdifFRewind(self.this)
 *         self.reinit()             # <<<<<<<<<<<<<<
 * 
 *     def _rewind(self):
 */
  ((struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile *)((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->__pyx_vtab)->reinit(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self));

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1000
 *         self.reinit()
 * 
 *     def _rewind(self):             # <<<<<<<<<<<<<<
 *         SdifFRewind(self.this)
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_15_rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_15_rewind[] = "SdifFile._rewind(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_15_rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_rewind");

  /* "pysdif/_pysdif.pyx":1001
 * 
 *     def _rewind(self):
 *         SdifFRewind(self.this)             # <<<<<<<<<<<<<<
 * 
 *     cdef void reinit(self):
 */
  SdifFRewind(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1003
 *         SdifFRewind(self.this)
 * 
 *     cdef void reinit(self):             # <<<<<<<<<<<<<<
 *         self.frame = None
 *         self.matrix_idx = 0
 */

static void __pyx_f_6pysdif_7_pysdif_8SdifFile_reinit(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reinit");

  /* "pysdif/_pysdif.pyx":1004
 * 
 *     cdef void reinit(self):
 *         self.frame = None             # <<<<<<<<<<<<<<
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->frame);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->frame));
  __pyx_v_self->frame = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)Py_None);

  /* "pysdif/_pysdif.pyx":1005
 *     cdef void reinit(self):
 *         self.frame = None
 *         self.matrix_idx = 0             # <<<<<<<<<<<<<<
 *         self.matrix_status = eMatrixNothingRead
 *         SdifFReadGeneralHeader(self.this)
 */
  __pyx_v_self->matrix_idx = 0;

  /* "pysdif/_pysdif.pyx":1006
 *         self.frame = None
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead             # <<<<<<<<<<<<<<
 *         SdifFReadGeneralHeader(self.this)
 *         SdifFReadAllASCIIChunks(self.this)
 */
  __pyx_v_self->matrix_status = __pyx_e_6pysdif_7_pysdif_eMatrixNothingRead;

  /* "pysdif/_pysdif.pyx":1007
 *         self.matrix_idx = 0
 *         self.matrix_status = eMatrixNothingRead
 *         SdifFReadGeneralHeader(self.this)             # <<<<<<<<<<<<<<
 *         SdifFReadAllASCIIChunks(self.this)
 *         #self.read_general_header()
 */
  SdifFReadGeneralHeader(__pyx_v_self->this);

  /* "pysdif/_pysdif.pyx":1008
 *         self.matrix_status = eMatrixNothingRead
 *         SdifFReadGeneralHeader(self.this)
 *         SdifFReadAllASCIIChunks(self.this)             # <<<<<<<<<<<<<<
 *         #self.read_general_header()
 *         #self.read_all_ascii_chunks()
 */
  SdifFReadAllASCIIChunks(__pyx_v_self->this);

  /* "pysdif/_pysdif.pyx":1011
 *         #self.read_general_header()
 *         #self.read_all_ascii_chunks()
 *         self.eof = (self.this.CurrSignature == eEof)             # <<<<<<<<<<<<<<
 *         self.frame_status = eFrameSignatureRead
 * 
 */
  __pyx_v_self->eof = (__pyx_v_self->this->CurrSignature == eEof);

  /* "pysdif/_pysdif.pyx":1012
 *         #self.read_all_ascii_chunks()
 *         self.eof = (self.this.CurrSignature == eEof)
 *         self.frame_status = eFrameSignatureRead             # <<<<<<<<<<<<<<
 * 
 *     def _read_padding(self):
 */
  __pyx_v_self->frame_status = __pyx_e_6pysdif_7_pysdif_eFrameSignatureRead;

  __Pyx_RefNannyFinishContext();
}

/* "pysdif/_pysdif.pyx":1014
 *         self.frame_status = eFrameSignatureRead
 * 
 *     def _read_padding(self):             # <<<<<<<<<<<<<<
 *         return SdifFReadPadding(self.this, SdifFPaddingCalculate(self.this.Stream, self.this.Pos))
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_16_read_padding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_16_read_padding[] = "SdifFile._read_padding(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_16_read_padding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("_read_padding");

  /* "pysdif/_pysdif.pyx":1015
 * 
 *     def _read_padding(self):
 *         return SdifFReadPadding(self.this, SdifFPaddingCalculate(self.this.Stream, self.this.Pos))             # <<<<<<<<<<<<<<
 * 
 *     # .......................................................................
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(SdifFReadPadding(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, SdifFPaddingCalculate(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->Stream, ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->Pos))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile._read_padding", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1020
 *     # WRITING
 *     #
 *     def add_NVT(self, dict d):             # <<<<<<<<<<<<<<
 *         """
 *         the NVT is a place to put metadata about the file
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_17add_NVT(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_17add_NVT[] = "SdifFile.add_NVT(self, dict d)\n\n        the NVT is a place to put metadata about the file\n        it is a hash table: pairs of the sort (name: value)\n        \n        d is a python dictionary which is translated to a NVT\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_17add_NVT(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  const char* __pyx_t_8;
  const char* __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_NVT");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_d), (&PyDict_Type), 1, "d", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1027
 *         d is a python dictionary which is translated to a NVT
 *         """
 *         SdifNameValuesLNewTable(self.this.NameValues, _SdifNVTStreamID)             # <<<<<<<<<<<<<<
 *         for name, value in d.iteritems():
 *             value = str(value)
 */
  SdifNameValuesLNewTable(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->NameValues, 4294967293LL);

  /* "pysdif/_pysdif.pyx":1028
 *         """
 *         SdifNameValuesLNewTable(self.this.NameValues, _SdifNVTStreamID)
 *         for name, value in d.iteritems():             # <<<<<<<<<<<<<<
 *             value = str(value)
 *             SdifNameValuesLPutCurrNVT(self.this.NameValues, name, value)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_d));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_d);
  __pyx_t_2 = 0;
  __pyx_t_3 = PyDict_Size(__pyx_t_1);
  while (1) {
    if (unlikely(__pyx_t_3 != PyDict_Size(__pyx_t_1))) {
      PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), (&__pyx_t_4), (&__pyx_t_5))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_4));
    __Pyx_XDECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_4;
    __Pyx_INCREF(((PyObject *)__pyx_t_5));
    __Pyx_XDECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_5;

    /* "pysdif/_pysdif.pyx":1029
 *         SdifNameValuesLNewTable(self.this.NameValues, _SdifNVTStreamID)
 *         for name, value in d.iteritems():
 *             value = str(value)             # <<<<<<<<<<<<<<
 *             SdifNameValuesLPutCurrNVT(self.this.NameValues, name, value)
 * 
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pysdif/_pysdif.pyx":1030
 *         for name, value in d.iteritems():
 *             value = str(value)
 *             SdifNameValuesLPutCurrNVT(self.this.NameValues, name, value)             # <<<<<<<<<<<<<<
 * 
 *     def add_matrix_type(self, str signature, column_names):
 */
    __pyx_t_8 = PyBytes_AsString(__pyx_v_name); if (unlikely((__pyx_t_8 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = PyBytes_AsString(__pyx_v_value); if (unlikely((__pyx_t_9 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    SdifNameValuesLPutCurrNVT(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->NameValues, __pyx_t_8, __pyx_t_9);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_NVT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1032
 *             SdifNameValuesLPutCurrNVT(self.this.NameValues, name, value)
 * 
 *     def add_matrix_type(self, str signature, column_names):             # <<<<<<<<<<<<<<
 *         """
 *         sdiff.add_matrix_type("1ABC", "Column1, Column2")
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_18add_matrix_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_18add_matrix_type[] = "SdifFile.add_matrix_type(self, str signature, column_names)\n\n        sdiff.add_matrix_type(\"1ABC\", \"Column1, Column2\")\n        or\n        sdiff.add_matrix_type(\"1ABC\", [\"Column1\", \"Column2\"])\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_18add_matrix_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_column_names = 0;
  SdifMatrixTypeT *__pyx_v_mt;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__column_names,0};
  __Pyx_RefNannySetupContext("add_matrix_type");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__column_names);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_matrix_type", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __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), "add_matrix_type") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = ((PyObject*)values[0]);
    __pyx_v_column_names = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_signature = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_column_names = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_matrix_type", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_matrix_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_column_names);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signature), (&PyString_Type), 1, "signature", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1038
 *         sdiff.add_matrix_type("1ABC", ["Column1", "Column2"])
 *         """
 *         if isinstance(column_names, basestring):             # <<<<<<<<<<<<<<
 *             column_names = column_names.split(",")
 *         cdef SdifMatrixTypeT *mt = MatrixType_create(signature, column_names)
 */
  __pyx_t_1 = __pyx_builtin_basestring;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_column_names, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysdif/_pysdif.pyx":1039
 *         """
 *         if isinstance(column_names, basestring):
 *             column_names = column_names.split(",")             # <<<<<<<<<<<<<<
 *         cdef SdifMatrixTypeT *mt = MatrixType_create(signature, column_names)
 *         SdifPutMatrixType(self.this.MatrixTypesTable, mt)
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_column_names, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_column_names);
    __pyx_v_column_names = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":1040
 *         if isinstance(column_names, basestring):
 *             column_names = column_names.split(",")
 *         cdef SdifMatrixTypeT *mt = MatrixType_create(signature, column_names)             # <<<<<<<<<<<<<<
 *         SdifPutMatrixType(self.this.MatrixTypesTable, mt)
 *         # TODO: is this a memory leak? who destroys the MatrixType?
 */
  __pyx_v_mt = __pyx_f_6pysdif_7_pysdif_MatrixType_create(((PyObject *)__pyx_v_signature), __pyx_v_column_names);

  /* "pysdif/_pysdif.pyx":1041
 *             column_names = column_names.split(",")
 *         cdef SdifMatrixTypeT *mt = MatrixType_create(signature, column_names)
 *         SdifPutMatrixType(self.this.MatrixTypesTable, mt)             # <<<<<<<<<<<<<<
 *         # TODO: is this a memory leak? who destroys the MatrixType?
 *         #self.frame_status = eFrameInvalid
 */
  SdifPutMatrixType(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->MatrixTypesTable, __pyx_v_mt);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_matrix_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_column_names);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1045
 *         #self.frame_status = eFrameInvalid
 * 
 *     def add_frame_type(self, signature, components):             # <<<<<<<<<<<<<<
 *         """
 *         signature is a 4-char string
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_19add_frame_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_19add_frame_type[] = "SdifFile.add_frame_type(self, signature, components)\n\n        signature is a 4-char string\n        components is a sequence of Component or just a sequence\n        of tuples of the form (signature, name)\n        \n        alternatively it accepts the form defined in EaSDIF\n        add_frame_type(\"1NEW\", \"1NEW NewMatrix, 1FQ0 New1FQ0\")\n        \n        components are separated either by a ',' or by a ';'\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_19add_frame_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  PyObject *__pyx_v_components = 0;
  SdifFrameTypeT *__pyx_v_ft;
  PyObject *__pyx_v_component = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__components,0};
  __Pyx_RefNannySetupContext("add_frame_type");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__components);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_frame_type", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __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), "add_frame_type") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = values[0];
    __pyx_v_components = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_signature = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_components = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_frame_type", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_frame_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_components);

  /* "pysdif/_pysdif.pyx":1056
 *         components are separated either by a ',' or by a ';'
 *         """
 *         if isinstance(components, basestring):             # <<<<<<<<<<<<<<
 *             if ',' in components:
 *                 components = components.split(",")
 */
  __pyx_t_1 = __pyx_builtin_basestring;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_components, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pysdif/_pysdif.pyx":1057
 *         """
 *         if isinstance(components, basestring):
 *             if ',' in components:             # <<<<<<<<<<<<<<
 *                 components = components.split(",")
 *             else:
 */
    __pyx_t_2 = ((PySequence_Contains(__pyx_v_components, ((PyObject *)__pyx_kp_s_18)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "pysdif/_pysdif.pyx":1058
 *         if isinstance(components, basestring):
 *             if ',' in components:
 *                 components = components.split(",")             # <<<<<<<<<<<<<<
 *             else:
 *                 components = components.split(';')
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_components, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_components);
      __pyx_v_components = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pysdif/_pysdif.pyx":1060
 *                 components = components.split(",")
 *             else:
 *                 components = components.split(';')             # <<<<<<<<<<<<<<
 *             components = [component.split() for component in components]
 *         cdef SdifFrameTypeT *ft = FrameType_create(signature, components)
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_components, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_components);
      __pyx_v_components = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L7:;

    /* "pysdif/_pysdif.pyx":1061
 *             else:
 *                 components = components.split(';')
 *             components = [component.split() for component in components]             # <<<<<<<<<<<<<<
 *         cdef SdifFrameTypeT *ft = FrameType_create(signature, components)
 *         SdifPutFrameType(self.this.FrameTypesTable, ft)
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (PyList_CheckExact(__pyx_v_components) || PyTuple_CheckExact(__pyx_v_components)) {
      __pyx_t_3 = __pyx_v_components; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_components); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else if (PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF(__pyx_v_component);
      __pyx_v_component = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_component, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_v_components);
    __pyx_v_components = ((PyObject *)__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":1062
 *                 components = components.split(';')
 *             components = [component.split() for component in components]
 *         cdef SdifFrameTypeT *ft = FrameType_create(signature, components)             # <<<<<<<<<<<<<<
 *         SdifPutFrameType(self.this.FrameTypesTable, ft)
 *         # TODO: is this a memory leak? who destroys the FrameType?
 */
  __pyx_v_ft = __pyx_f_6pysdif_7_pysdif_FrameType_create(__pyx_v_signature, __pyx_v_components);

  /* "pysdif/_pysdif.pyx":1063
 *             components = [component.split() for component in components]
 *         cdef SdifFrameTypeT *ft = FrameType_create(signature, components)
 *         SdifPutFrameType(self.this.FrameTypesTable, ft)             # <<<<<<<<<<<<<<
 *         # TODO: is this a memory leak? who destroys the FrameType?
 *         #Mself.frame_status = eFrameInvalid
 */
  SdifPutFrameType(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->FrameTypesTable, __pyx_v_ft);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_frame_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_component);
  __Pyx_XDECREF(__pyx_v_components);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1067
 *         #Mself.frame_status = eFrameInvalid
 * 
 *     def clone_type_definitions(self, SdifFile source):             # <<<<<<<<<<<<<<
 *         """
 *         clone the frame and matrix type definitions of source_sdiffile
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_20clone_type_definitions(PyObject *__pyx_v_self, PyObject *__pyx_v_source); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_20clone_type_definitions[] = "SdifFile.clone_type_definitions(self, SdifFile source)\n\n        clone the frame and matrix type definitions of source_sdiffile\n        NB: this must be called only for writing mode before any frame \n        has been written\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_20clone_type_definitions(PyObject *__pyx_v_self, PyObject *__pyx_v_source) {
  PyObject *__pyx_v_frametypes = NULL;
  PyObject *__pyx_v_matrixtypes = NULL;
  PyObject *__pyx_v_frametype = NULL;
  PyObject *__pyx_v_matrixtype = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clone_type_definitions");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_6pysdif_7_pysdif_SdifFile, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1073
 *         has been written
 *         """
 *         frametypes = source.get_frame_types()             # <<<<<<<<<<<<<<
 *         matrixtypes = source.get_matrix_types()
 *         for frametype in frametypes:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__get_frame_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_frametypes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1074
 *         """
 *         frametypes = source.get_frame_types()
 *         matrixtypes = source.get_matrix_types()             # <<<<<<<<<<<<<<
 *         for frametype in frametypes:
 *             self.add_frame_type(frametype.signature, frametype.components)
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__get_matrix_types); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_matrixtypes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1075
 *         frametypes = source.get_frame_types()
 *         matrixtypes = source.get_matrix_types()
 *         for frametype in frametypes:             # <<<<<<<<<<<<<<
 *             self.add_frame_type(frametype.signature, frametype.components)
 *         for matrixtype in matrixtypes:
 */
  if (PyList_CheckExact(__pyx_v_frametypes) || PyTuple_CheckExact(__pyx_v_frametypes)) {
    __pyx_t_1 = __pyx_v_frametypes; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_frametypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF(__pyx_v_frametype);
    __pyx_v_frametype = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pysdif/_pysdif.pyx":1076
 *         matrixtypes = source.get_matrix_types()
 *         for frametype in frametypes:
 *             self.add_frame_type(frametype.signature, frametype.components)             # <<<<<<<<<<<<<<
 *         for matrixtype in matrixtypes:
 *             self.add_matrix_type(matrixtype.signature, matrixtype.column_names)
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_frame_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_frametype, __pyx_n_s__signature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_frametype, __pyx_n_s__components); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1077
 *         for frametype in frametypes:
 *             self.add_frame_type(frametype.signature, frametype.components)
 *         for matrixtype in matrixtypes:             # <<<<<<<<<<<<<<
 *             self.add_matrix_type(matrixtype.signature, matrixtype.column_names)
 *         #self.write_all_ascii_chunks()  # this is not necessary since it will be called when the first frame is written
 */
  if (PyList_CheckExact(__pyx_v_matrixtypes) || PyTuple_CheckExact(__pyx_v_matrixtypes)) {
    __pyx_t_1 = __pyx_v_matrixtypes; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_matrixtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
    } else {
      __pyx_t_6 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_XDECREF(__pyx_v_matrixtype);
    __pyx_v_matrixtype = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pysdif/_pysdif.pyx":1078
 *             self.add_frame_type(frametype.signature, frametype.components)
 *         for matrixtype in matrixtypes:
 *             self.add_matrix_type(matrixtype.signature, matrixtype.column_names)             # <<<<<<<<<<<<<<
 *         #self.write_all_ascii_chunks()  # this is not necessary since it will be called when the first frame is written
 * 
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_matrix_type); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_matrixtype, __pyx_n_s__signature); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_matrixtype, __pyx_n_s__column_names); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_7 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.clone_type_definitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_frametypes);
  __Pyx_XDECREF(__pyx_v_matrixtypes);
  __Pyx_XDECREF(__pyx_v_frametype);
  __Pyx_XDECREF(__pyx_v_matrixtype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1081
 *         #self.write_all_ascii_chunks()  # this is not necessary since it will be called when the first frame is written
 * 
 *     def clone_NVTs(self, SdifFile source):             # <<<<<<<<<<<<<<
 *         """
 *         clone the NVT from source (an open SdifFile)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_21clone_NVTs(PyObject *__pyx_v_self, PyObject *__pyx_v_source); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_21clone_NVTs[] = "SdifFile.clone_NVTs(self, SdifFile source)\n\n        clone the NVT from source (an open SdifFile)\n        \n        NB: If you do not plan to midify the type definitions included\n        in the source file, it's better to call 'clone_definitions', which\n        clones everything but the data, so you can do\n        new_sdif = SdifFile(\"out.sdif\", \"w\")\n        new_sdif.clone_definitions(old_sdif)\n        for frame in old_sdif:\n            new_frame = new_sdif.new_frame(frame.signature, frame.time)\n            ... etc ...\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_21clone_NVTs(PyObject *__pyx_v_self, PyObject *__pyx_v_source) {
  PyObject *__pyx_v_nvt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clone_NVTs");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_6pysdif_7_pysdif_SdifFile, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1094
 *             ... etc ...
 *         """
 *         for nvt in source.get_NVTs():             # <<<<<<<<<<<<<<
 *             self.add_NVT(nvt)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__get_NVTs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF(__pyx_v_nvt);
    __pyx_v_nvt = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pysdif/_pysdif.pyx":1095
 *         """
 *         for nvt in source.get_NVTs():
 *             self.add_NVT(nvt)             # <<<<<<<<<<<<<<
 * 
 *     def clone_definitions(self, SdifFile source):
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_NVT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_nvt);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_nvt);
    __Pyx_GIVEREF(__pyx_v_nvt);
    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.clone_NVTs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nvt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1097
 *             self.add_NVT(nvt)
 * 
 *     def clone_definitions(self, SdifFile source):             # <<<<<<<<<<<<<<
 *         """
 *         clone both NVT(s) and frame and matrix definitions from source,
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_22clone_definitions(PyObject *__pyx_v_self, PyObject *__pyx_v_source); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_22clone_definitions[] = "SdifFile.clone_definitions(self, SdifFile source)\n\n        clone both NVT(s) and frame and matrix definitions from source,\n        so after calling this function you can start creating frames\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_22clone_definitions(PyObject *__pyx_v_self, PyObject *__pyx_v_source) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("clone_definitions");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_6pysdif_7_pysdif_SdifFile, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1102
 *         so after calling this function you can start creating frames
 *         """
 *         self.clone_NVTs(source)             # <<<<<<<<<<<<<<
 *         self.clone_type_definitions(source)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__clone_NVTs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __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 = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_source);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
  __Pyx_GIVEREF(__pyx_v_source);
  __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 = 1102; __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;

  /* "pysdif/_pysdif.pyx":1103
 *         """
 *         self.clone_NVTs(source)
 *         self.clone_type_definitions(source)             # <<<<<<<<<<<<<<
 * 
 *     def clone_frames(self, SdifFile source, tuple signatures_to_clone=None):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_23); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_source);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
  __Pyx_GIVEREF(__pyx_v_source);
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.clone_definitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1105
 *         self.clone_type_definitions(source)
 * 
 *     def clone_frames(self, SdifFile source, tuple signatures_to_clone=None):             # <<<<<<<<<<<<<<
 *         """
 *         clone all the frames in source which are included in
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_23clone_frames(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_23clone_frames[] = "SdifFile.clone_frames(self, SdifFile source, tuple signatures_to_clone=None)\n\n        clone all the frames in source which are included in \n        @signatures_to_clone -- if this is not defined, clone \n        everything\n        \n        NB: the use case for this function is when you want to\n        modify some of the metadata but leave the data itself\n        unmodified\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_23clone_frames(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_source = 0;
  PyObject *__pyx_v_signatures_to_clone = 0;
  PyObject *__pyx_v_frame0 = NULL;
  PyObject *__pyx_v_frame1 = NULL;
  PyObject *__pyx_v_matrix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__signatures_to_clone,0};
  __Pyx_RefNannySetupContext("clone_frames");
  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__source);
      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__signatures_to_clone);
        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), "clone_frames") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)values[0]);
    __pyx_v_signatures_to_clone = ((PyObject*)values[1]);
  } else {
    __pyx_v_signatures_to_clone = ((PyObject*)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_signatures_to_clone = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)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("clone_frames", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.clone_frames", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_6pysdif_7_pysdif_SdifFile, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signatures_to_clone), (&PyTuple_Type), 1, "signatures_to_clone", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1116
 *         """
 *         # TODO : optimize this method
 *         if signatures_to_clone is not None:             # <<<<<<<<<<<<<<
 *             for frame0 in source:
 *                 if frame0.signature in signatures_to_clone:
 */
  __pyx_t_1 = (__pyx_v_signatures_to_clone != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":1117
 *         # TODO : optimize this method
 *         if signatures_to_clone is not None:
 *             for frame0 in source:             # <<<<<<<<<<<<<<
 *                 if frame0.signature in signatures_to_clone:
 *                     frame1 = self.new_frame(frame0.signature, frame0.time)
 */
    if (PyList_CheckExact(((PyObject *)__pyx_v_source)) || PyTuple_CheckExact(((PyObject *)__pyx_v_source))) {
      __pyx_t_2 = ((PyObject *)__pyx_v_source); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_source)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_2)) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
      } else if (PyTuple_CheckExact(__pyx_t_2)) {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF(__pyx_v_frame0);
      __pyx_v_frame0 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pysdif/_pysdif.pyx":1118
 *         if signatures_to_clone is not None:
 *             for frame0 in source:
 *                 if frame0.signature in signatures_to_clone:             # <<<<<<<<<<<<<<
 *                     frame1 = self.new_frame(frame0.signature, frame0.time)
 *                     for matrix in frame0:
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_frame0, __pyx_n_s__signature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = ((PySequence_Contains(((PyObject *)__pyx_v_signatures_to_clone), __pyx_t_5))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "pysdif/_pysdif.pyx":1119
 *             for frame0 in source:
 *                 if frame0.signature in signatures_to_clone:
 *                     frame1 = self.new_frame(frame0.signature, frame0.time)             # <<<<<<<<<<<<<<
 *                     for matrix in frame0:
 *                         frame1.add_matrix(matrix.signature, matrix.get_data())
 */
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__new_frame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_frame0, __pyx_n_s__signature); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_frame0, __pyx_n_s__time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_v_frame1);
        __pyx_v_frame1 = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pysdif/_pysdif.pyx":1120
 *                 if frame0.signature in signatures_to_clone:
 *                     frame1 = self.new_frame(frame0.signature, frame0.time)
 *                     for matrix in frame0:             # <<<<<<<<<<<<<<
 *                         frame1.add_matrix(matrix.signature, matrix.get_data())
 *                     frame1.write()
 */
        if (PyList_CheckExact(__pyx_v_frame0) || PyTuple_CheckExact(__pyx_v_frame0)) {
          __pyx_t_7 = __pyx_v_frame0; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0;
          __pyx_t_10 = NULL;
        } else {
          __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_frame0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext;
        }
        for (;;) {
          if (PyList_CheckExact(__pyx_t_7)) {
            if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
          } else if (PyTuple_CheckExact(__pyx_t_7)) {
            if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
          } else {
            __pyx_t_8 = __pyx_t_10(__pyx_t_7);
            if (unlikely(!__pyx_t_8)) {
              if (PyErr_Occurred()) {
                if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_8);
          }
          __Pyx_XDECREF(__pyx_v_matrix);
          __pyx_v_matrix = __pyx_t_8;
          __pyx_t_8 = 0;

          /* "pysdif/_pysdif.pyx":1121
 *                     frame1 = self.new_frame(frame0.signature, frame0.time)
 *                     for matrix in frame0:
 *                         frame1.add_matrix(matrix.signature, matrix.get_data())             # <<<<<<<<<<<<<<
 *                     frame1.write()
 *         else:
 */
          __pyx_t_8 = PyObject_GetAttr(__pyx_v_frame1, __pyx_n_s__add_matrix); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_5 = PyObject_GetAttr(__pyx_v_matrix, __pyx_n_s__signature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = PyObject_GetAttr(__pyx_v_matrix, __pyx_n_s__get_data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_11 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__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_11);
          __Pyx_GIVEREF(__pyx_t_11);
          __pyx_t_5 = 0;
          __pyx_t_11 = 0;
          __pyx_t_11 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "pysdif/_pysdif.pyx":1122
 *                     for matrix in frame0:
 *                         frame1.add_matrix(matrix.signature, matrix.get_data())
 *                     frame1.write()             # <<<<<<<<<<<<<<
 *         else:
 *             for frame0 in source:
 */
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_frame1, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":1124
 *                     frame1.write()
 *         else:
 *             for frame0 in source:             # <<<<<<<<<<<<<<
 *                 frame1 = self.new_frame(frame0.signature, frame0.time)
 *                 for matrix in frame0:
 */
    if (PyList_CheckExact(((PyObject *)__pyx_v_source)) || PyTuple_CheckExact(((PyObject *)__pyx_v_source))) {
      __pyx_t_2 = ((PyObject *)__pyx_v_source); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_source)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_2)) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_11); __pyx_t_3++;
      } else if (PyTuple_CheckExact(__pyx_t_2)) {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_11); __pyx_t_3++;
      } else {
        __pyx_t_11 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_11)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_v_frame0);
      __pyx_v_frame0 = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "pysdif/_pysdif.pyx":1125
 *         else:
 *             for frame0 in source:
 *                 frame1 = self.new_frame(frame0.signature, frame0.time)             # <<<<<<<<<<<<<<
 *                 for matrix in frame0:
 *                     frame1.add_matrix(matrix.signature, matrix.get_data())
 */
      __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__new_frame); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_frame0, __pyx_n_s__signature); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_frame0, __pyx_n_s__time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_7 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_v_frame1);
      __pyx_v_frame1 = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "pysdif/_pysdif.pyx":1126
 *             for frame0 in source:
 *                 frame1 = self.new_frame(frame0.signature, frame0.time)
 *                 for matrix in frame0:             # <<<<<<<<<<<<<<
 *                     frame1.add_matrix(matrix.signature, matrix.get_data())
 *                 frame1.write()
 */
      if (PyList_CheckExact(__pyx_v_frame0) || PyTuple_CheckExact(__pyx_v_frame0)) {
        __pyx_t_6 = __pyx_v_frame0; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_frame0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext;
      }
      for (;;) {
        if (PyList_CheckExact(__pyx_t_6)) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
        } else if (PyTuple_CheckExact(__pyx_t_6)) {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
        } else {
          __pyx_t_8 = __pyx_t_10(__pyx_t_6);
          if (unlikely(!__pyx_t_8)) {
            if (PyErr_Occurred()) {
              if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_XDECREF(__pyx_v_matrix);
        __pyx_v_matrix = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "pysdif/_pysdif.pyx":1127
 *                 frame1 = self.new_frame(frame0.signature, frame0.time)
 *                 for matrix in frame0:
 *                     frame1.add_matrix(matrix.signature, matrix.get_data())             # <<<<<<<<<<<<<<
 *                 frame1.write()
 * 
 */
        __pyx_t_8 = PyObject_GetAttr(__pyx_v_frame1, __pyx_n_s__add_matrix); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_11 = PyObject_GetAttr(__pyx_v_matrix, __pyx_n_s__signature); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_7 = PyObject_GetAttr(__pyx_v_matrix, __pyx_n_s__get_data); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        __pyx_t_11 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pysdif/_pysdif.pyx":1128
 *                 for matrix in frame0:
 *                     frame1.add_matrix(matrix.signature, matrix.get_data())
 *                 frame1.write()             # <<<<<<<<<<<<<<
 * 
 *     def add_streamID(self, unsigned int numid, char *source, char *treeway):
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_frame1, __pyx_n_s__write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.clone_frames", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_frame0);
  __Pyx_XDECREF(__pyx_v_frame1);
  __Pyx_XDECREF(__pyx_v_matrix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1130
 *                 frame1.write()
 * 
 *     def add_streamID(self, unsigned int numid, char *source, char *treeway):             # <<<<<<<<<<<<<<
 *         """
 *         this method is only there for completion. it seems to be only used in old
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_24add_streamID(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_24add_streamID[] = "SdifFile.add_streamID(self, unsigned int numid, char *source, char *treeway)\n\n        this method is only there for completion. it seems to be only used in old\n        sdif types\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_24add_streamID(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_numid;
  char *__pyx_v_source;
  char *__pyx_v_treeway;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__numid,&__pyx_n_s__source,&__pyx_n_s__treeway,0};
  __Pyx_RefNannySetupContext("add_streamID");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__numid);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_streamID", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__treeway);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("add_streamID", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __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), "add_streamID") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_numid = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_numid == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_source = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_source) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_treeway = PyBytes_AsString(values[2]); if (unlikely((!__pyx_v_treeway) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_numid = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_numid == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_source = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_source) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_treeway = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((!__pyx_v_treeway) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_streamID", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_streamID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":1136
 *         """
 *         SdifStreamIDTablePutSID(self.this.StreamIDsTable,
 *             numid, source, treeway)             # <<<<<<<<<<<<<<
 * 
 *     def add_predefined_type(self, predefined_type='RBEP'):
 */
  SdifStreamIDTablePutSID(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->StreamIDsTable, __pyx_v_numid, __pyx_v_source, __pyx_v_treeway);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1138
 *             numid, source, treeway)
 * 
 *     def add_predefined_type(self, predefined_type='RBEP'):             # <<<<<<<<<<<<<<
 *         """
 *         Add a predefined type to this SdifFile.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_25add_predefined_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_25add_predefined_type[] = "SdifFile.add_predefined_type(self, predefined_type='RBEP')\n\n        Add a predefined type to this SdifFile.\n        This type must be already defined in the global\n        variable SDIF_NEWTYPES.\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_25add_predefined_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_predefined_type = 0;
  PyObject *__pyx_v_frame_types = NULL;
  PyObject *__pyx_v_matrix_types = NULL;
  PyObject *__pyx_v_frame_type = NULL;
  PyObject *__pyx_v_matrix_type = 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)(PyObject *);
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__predefined_type,0};
  __Pyx_RefNannySetupContext("add_predefined_type");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_n_s__RBEP);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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__predefined_type);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_predefined_type") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_predefined_type = values[0];
  } else {
    __pyx_v_predefined_type = ((PyObject *)__pyx_n_s__RBEP);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_predefined_type = 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("add_predefined_type", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_predefined_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "pysdif/_pysdif.pyx":1144
 *         variable SDIF_NEWTYPES.
 *         """
 *         frame_types, matrix_types = get_predefined_frames_and_matrices(predefined_type)             # <<<<<<<<<<<<<<
 *         if frame_types is not None:
 *             # type exists
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_24); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __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 = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_predefined_type);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_predefined_type);
  __Pyx_GIVEREF(__pyx_v_predefined_type);
  __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 = 1144; __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;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_unpacking_done:;
  }
  __pyx_v_frame_types = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_matrix_types = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1145
 *         """
 *         frame_types, matrix_types = get_predefined_frames_and_matrices(predefined_type)
 *         if frame_types is not None:             # <<<<<<<<<<<<<<
 *             # type exists
 *             for frame_type in frame_types:
 */
  __pyx_t_6 = (__pyx_v_frame_types != Py_None);
  if (__pyx_t_6) {

    /* "pysdif/_pysdif.pyx":1147
 *         if frame_types is not None:
 *             # type exists
 *             for frame_type in frame_types:             # <<<<<<<<<<<<<<
 *                 self.add_frame_type(*frame_type)
 *             for matrix_type in matrix_types:
 */
    if (PyList_CheckExact(__pyx_v_frame_types) || PyTuple_CheckExact(__pyx_v_frame_types)) {
      __pyx_t_3 = __pyx_v_frame_types; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_frame_types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
      } else if (PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
      } else {
        __pyx_t_1 = __pyx_t_8(__pyx_t_3);
        if (unlikely(!__pyx_t_1)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF(__pyx_v_frame_type);
      __pyx_v_frame_type = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pysdif/_pysdif.pyx":1148
 *             # type exists
 *             for frame_type in frame_types:
 *                 self.add_frame_type(*frame_type)             # <<<<<<<<<<<<<<
 *             for matrix_type in matrix_types:
 *                 self.add_matrix_type(*matrix_type)
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_frame_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PySequence_Tuple(__pyx_v_frame_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pysdif/_pysdif.pyx":1149
 *             for frame_type in frame_types:
 *                 self.add_frame_type(*frame_type)
 *             for matrix_type in matrix_types:             # <<<<<<<<<<<<<<
 *                 self.add_matrix_type(*matrix_type)
 *         else:
 */
    if (PyList_CheckExact(__pyx_v_matrix_types) || PyTuple_CheckExact(__pyx_v_matrix_types)) {
      __pyx_t_3 = __pyx_v_matrix_types; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_matrix_types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++;
      } else if (PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++;
      } else {
        __pyx_t_4 = __pyx_t_8(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF(__pyx_v_matrix_type);
      __pyx_v_matrix_type = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysdif/_pysdif.pyx":1150
 *                 self.add_frame_type(*frame_type)
 *             for matrix_type in matrix_types:
 *                 self.add_matrix_type(*matrix_type)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Definition of sdif type not found")
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_matrix_type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PySequence_Tuple(__pyx_v_matrix_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "pysdif/_pysdif.pyx":1152
 *                 self.add_matrix_type(*matrix_type)
 *         else:
 *             raise ValueError("Definition of sdif type not found")             # <<<<<<<<<<<<<<
 * 
 *     def write_all_ascii_chunks(self):
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L8:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.add_predefined_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_frame_types);
  __Pyx_XDECREF(__pyx_v_matrix_types);
  __Pyx_XDECREF(__pyx_v_frame_type);
  __Pyx_XDECREF(__pyx_v_matrix_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1154
 *             raise ValueError("Definition of sdif type not found")
 * 
 *     def write_all_ascii_chunks(self):             # <<<<<<<<<<<<<<
 *         """
 *         low level interface.
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_26write_all_ascii_chunks(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_26write_all_ascii_chunks[] = "SdifFile.write_all_ascii_chunks(self)\n\n        low level interface.\n        Once the NVTs and matrix and frame definitions have been added to the SdifFile,\n        this methods writes them all together to disk and the SdifFile is ready to accept\n        new frames.\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_26write_all_ascii_chunks(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("write_all_ascii_chunks");

  /* "pysdif/_pysdif.pyx":1161
 *         new frames.
 *         """
 *         if self.write_status != eSdifGeneralHeader:             # <<<<<<<<<<<<<<
 *             return
 *         SdifFWriteAllASCIIChunks(self.this)
 */
  __pyx_t_1 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->write_status != __pyx_e_6pysdif_7_pysdif_eSdifGeneralHeader);
  if (__pyx_t_1) {

    /* "pysdif/_pysdif.pyx":1162
 *         """
 *         if self.write_status != eSdifGeneralHeader:
 *             return             # <<<<<<<<<<<<<<
 *         SdifFWriteAllASCIIChunks(self.this)
 *         self.write_status = eSdifAllASCIIChunks
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pysdif/_pysdif.pyx":1163
 *         if self.write_status != eSdifGeneralHeader:
 *             return
 *         SdifFWriteAllASCIIChunks(self.this)             # <<<<<<<<<<<<<<
 *         self.write_status = eSdifAllASCIIChunks
 * 
 */
  SdifFWriteAllASCIIChunks(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":1164
 *             return
 *         SdifFWriteAllASCIIChunks(self.this)
 *         self.write_status = eSdifAllASCIIChunks             # <<<<<<<<<<<<<<
 * 
 *     def new_frame(self, str signature, SdifFloat8 time, SdifUInt4 streamID=0):
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->write_status = __pyx_e_6pysdif_7_pysdif_eSdifAllASCIIChunks;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1166
 *         self.write_status = eSdifAllASCIIChunks
 * 
 *     def new_frame(self, str signature, SdifFloat8 time, SdifUInt4 streamID=0):             # <<<<<<<<<<<<<<
 *         """
 *         create a new frame with the given signature and at the given time
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_27new_frame(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_27new_frame[] = "SdifFile.new_frame(self, str signature, SdifFloat8 time, SdifUInt4 streamID=0)\n\n        create a new frame with the given signature and at the given time\n        \n        new_frame = sdiffile.new_frame('1SIG', time_now)\n        new_frame.add_matrix(...)\n        new_frame.write()\n        \n        if you know that you will write only one matrix, you can call\n        \n        sdiffile.new_frame_one_matrix(frame_sig, time_now, matrix_sig, data)\n        \n        and this will do the same as the three method calls above\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_27new_frame(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_signature = 0;
  SdifFloat8 __pyx_v_time;
  SdifUInt4 __pyx_v_streamID;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  SdifSignature __pyx_t_7;
  struct __pyx_opt_args_6pysdif_7_pysdif_FrameW_new __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__signature,&__pyx_n_s__time,&__pyx_n_s__streamID,0};
  __Pyx_RefNannySetupContext("new_frame");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    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__signature);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__time);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("new_frame", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__streamID);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "new_frame") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_signature = ((PyObject*)values[0]);
    __pyx_v_time = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_time == (SdifFloat8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[2]) {
      __pyx_v_streamID = __Pyx_PyInt_from_py_SdifUInt4(values[2]); if (unlikely((__pyx_v_streamID == (SdifUInt4)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_streamID = ((SdifUInt4)0);
    }
  } else {
    __pyx_v_streamID = ((SdifUInt4)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_streamID = __Pyx_PyInt_from_py_SdifUInt4(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_streamID == (SdifUInt4)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2:
      __pyx_v_time = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_time == (SdifFloat8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_v_signature = ((PyObject*)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("new_frame", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.new_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_signature), (&PyString_Type), 1, "signature", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1183
 *         # defining the global header (ascii chunks) so verify that
 *         # we have written it
 *         assert self.mode == eWriteFile or self.mode == eReadWriteFile             # <<<<<<<<<<<<<<
 *         if self.write_status == eSdifGeneralHeader:
 *             self.write_all_ascii_chunks()
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(eWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyInt_FromLong(eReadWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (unlikely(!__pyx_t_6)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "pysdif/_pysdif.pyx":1184
 *         # we have written it
 *         assert self.mode == eWriteFile or self.mode == eReadWriteFile
 *         if self.write_status == eSdifGeneralHeader:             # <<<<<<<<<<<<<<
 *             self.write_all_ascii_chunks()
 *         return FrameW_new(self, str2signature(signature), time, streamID)
 */
  __pyx_t_6 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->write_status == __pyx_e_6pysdif_7_pysdif_eSdifGeneralHeader);
  if (__pyx_t_6) {

    /* "pysdif/_pysdif.pyx":1185
 *         assert self.mode == eWriteFile or self.mode == eReadWriteFile
 *         if self.write_status == eSdifGeneralHeader:
 *             self.write_all_ascii_chunks()             # <<<<<<<<<<<<<<
 *         return FrameW_new(self, str2signature(signature), time, streamID)
 * 
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":1186
 *         if self.write_status == eSdifGeneralHeader:
 *             self.write_all_ascii_chunks()
 *         return FrameW_new(self, str2signature(signature), time, streamID)             # <<<<<<<<<<<<<<
 * 
 *     def new_frame_one_matrix(self, bytes frame_sig, SdifFloat8 time, bytes matrix_sig, c_numpy.ndarray data_array, SdifUInt4 streamID=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__str2signature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __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 = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_signature));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_signature));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_signature));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_7 = __Pyx_PyInt_from_py_SdifUInt4(__pyx_t_3); if (unlikely((__pyx_t_7 == (SdifSignature)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8.__pyx_n = 1;
  __pyx_t_8.streamID = __pyx_v_streamID;
  __pyx_t_3 = ((PyObject *)__pyx_f_6pysdif_7_pysdif_FrameW_new(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self), __pyx_t_7, __pyx_v_time, &__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.new_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1188
 *         return FrameW_new(self, str2signature(signature), time, streamID)
 * 
 *     def new_frame_one_matrix(self, bytes frame_sig, SdifFloat8 time, bytes matrix_sig, c_numpy.ndarray data_array, SdifUInt4 streamID=0):             # <<<<<<<<<<<<<<
 *         """
 *         create a frame containing only one matrix and write it
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_28new_frame_one_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_28new_frame_one_matrix[] = "SdifFile.new_frame_one_matrix(self, bytes frame_sig, SdifFloat8 time, bytes matrix_sig, ndarray data_array, SdifUInt4 streamID=0)\n\n        create a frame containing only one matrix and write it\n        This method creates the frame, creates a new matrix\n        in the frame and writes it to disk, all at once\n        \n        NB: use this method when you want to create a frame which\n        contains only one matrix, like a 1TRC frame. It is more efficient\n        than calling new_frame, add_matrix, write (see method 'new_frame')\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_28new_frame_one_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_frame_sig = 0;
  SdifFloat8 __pyx_v_time;
  PyObject *__pyx_v_matrix_sig = 0;
  PyArrayObject *__pyx_v_data_array = 0;
  SdifUInt4 __pyx_v_streamID;
  size_t __pyx_v_frame_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__frame_sig,&__pyx_n_s__time,&__pyx_n_s__matrix_sig,&__pyx_n_s__data_array,&__pyx_n_s__streamID,0};
  __Pyx_RefNannySetupContext("new_frame_one_matrix");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      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:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frame_sig);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__time);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("new_frame_one_matrix", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__matrix_sig);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("new_frame_one_matrix", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_array);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("new_frame_one_matrix", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__streamID);
        if (value) { values[4] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "new_frame_one_matrix") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_frame_sig = ((PyObject*)values[0]);
    __pyx_v_time = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_time == (SdifFloat8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_matrix_sig = ((PyObject*)values[2]);
    __pyx_v_data_array = ((PyArrayObject *)values[3]);
    if (values[4]) {
      __pyx_v_streamID = __Pyx_PyInt_from_py_SdifUInt4(values[4]); if (unlikely((__pyx_v_streamID == (SdifUInt4)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_streamID = ((SdifUInt4)0);
    }
  } else {
    __pyx_v_streamID = ((SdifUInt4)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5:
      __pyx_v_streamID = __Pyx_PyInt_from_py_SdifUInt4(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_streamID == (SdifUInt4)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  4:
      __pyx_v_data_array = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3));
      __pyx_v_matrix_sig = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 2));
      __pyx_v_time = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_time == (SdifFloat8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_v_frame_sig = ((PyObject*)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("new_frame_one_matrix", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.new_frame_one_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_frame_sig), (&PyBytes_Type), 1, "frame_sig", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_matrix_sig), (&PyBytes_Type), 1, "matrix_sig", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data_array), __pyx_ptype_5numpy_ndarray, 1, "data_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1198
 *         than calling new_frame, add_matrix, write (see method 'new_frame')
 *         """
 *         assert self.mode == eWriteFile or self.mode == eReadWriteFile             # <<<<<<<<<<<<<<
 *         if self.write_status == eSdifGeneralHeader:
 *             self.write_all_ascii_chunks()
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(eWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyInt_FromLong(eReadWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (unlikely(!__pyx_t_6)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "pysdif/_pysdif.pyx":1199
 *         """
 *         assert self.mode == eWriteFile or self.mode == eReadWriteFile
 *         if self.write_status == eSdifGeneralHeader:             # <<<<<<<<<<<<<<
 *             self.write_all_ascii_chunks()
 *         cdef size_t frame_size = SdifSizeOfFrameHeader() + SdifSizeOfMatrix(
 */
  __pyx_t_6 = (((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->write_status == __pyx_e_6pysdif_7_pysdif_eSdifGeneralHeader);
  if (__pyx_t_6) {

    /* "pysdif/_pysdif.pyx":1200
 *         assert self.mode == eWriteFile or self.mode == eReadWriteFile
 *         if self.write_status == eSdifGeneralHeader:
 *             self.write_all_ascii_chunks()             # <<<<<<<<<<<<<<
 *         cdef size_t frame_size = SdifSizeOfFrameHeader() + SdifSizeOfMatrix(
 *             <SdifDataTypeET>(dtype_numpy2sdif(data_array.descr.type_num)),
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pysdif/_pysdif.pyx":1203
 *         cdef size_t frame_size = SdifSizeOfFrameHeader() + SdifSizeOfMatrix(
 *             <SdifDataTypeET>(dtype_numpy2sdif(data_array.descr.type_num)),
 *             data_array.shape[0], data_array.shape[1] # rows, cols             # <<<<<<<<<<<<<<
 *         )
 *         SdifFSetCurrFrameHeader(self.this, _str2sig(frame_sig), frame_size, 1, streamID, time)
 */
  __pyx_v_frame_size = (SdifSizeOfFrameHeader() + SdifSizeOfMatrix(((SdifDataTypeET)__pyx_f_6pysdif_7_pysdif_dtype_numpy2sdif(__pyx_v_data_array->descr->type_num)), (__pyx_v_data_array->dimensions[0]), (__pyx_v_data_array->dimensions[1])));

  /* "pysdif/_pysdif.pyx":1205
 *             data_array.shape[0], data_array.shape[1] # rows, cols
 *         )
 *         SdifFSetCurrFrameHeader(self.this, _str2sig(frame_sig), frame_size, 1, streamID, time)             # <<<<<<<<<<<<<<
 *         SdifFWriteFrameHeader(self.this)
 *         SdifFWriteMatrix(self.this,
 */
  __pyx_t_7 = PyBytes_AsString(((PyObject *)__pyx_v_frame_sig)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  SdifFSetCurrFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, __pyx_f_6pysdif_7_pysdif__str2sig(__pyx_t_7), __pyx_v_frame_size, 1, __pyx_v_streamID, __pyx_v_time);

  /* "pysdif/_pysdif.pyx":1206
 *         )
 *         SdifFSetCurrFrameHeader(self.this, _str2sig(frame_sig), frame_size, 1, streamID, time)
 *         SdifFWriteFrameHeader(self.this)             # <<<<<<<<<<<<<<
 *         SdifFWriteMatrix(self.this,
 *             _str2sig(matrix_sig),
 */
  SdifFWriteFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  /* "pysdif/_pysdif.pyx":1208
 *         SdifFWriteFrameHeader(self.this)
 *         SdifFWriteMatrix(self.this,
 *             _str2sig(matrix_sig),             # <<<<<<<<<<<<<<
 *             <SdifDataTypeET>dtype_numpy2sdif(data_array.descr.type_num),
 *             data_array.shape[0], data_array.shape[1],   # rows, cols
 */
  __pyx_t_7 = PyBytes_AsString(((PyObject *)__pyx_v_matrix_sig)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pysdif/_pysdif.pyx":1211
 *             <SdifDataTypeET>dtype_numpy2sdif(data_array.descr.type_num),
 *             data_array.shape[0], data_array.shape[1],   # rows, cols
 *             data_array.data)             # <<<<<<<<<<<<<<
 *         self.write_status = eSdifMatrixData
 * 
 */
  SdifFWriteMatrix(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, __pyx_f_6pysdif_7_pysdif__str2sig(__pyx_t_7), ((SdifDataTypeET)__pyx_f_6pysdif_7_pysdif_dtype_numpy2sdif(__pyx_v_data_array->descr->type_num)), (__pyx_v_data_array->dimensions[0]), (__pyx_v_data_array->dimensions[1]), __pyx_v_data_array->data);

  /* "pysdif/_pysdif.pyx":1212
 *             data_array.shape[0], data_array.shape[1],   # rows, cols
 *             data_array.data)
 *         self.write_status = eSdifMatrixData             # <<<<<<<<<<<<<<
 * 
 *     # low level functions to print info
 */
  ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->write_status = __pyx_e_6pysdif_7_pysdif_eSdifMatrixData;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.new_frame_one_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1215
 * 
 *     # low level functions to print info
 *     def print_NVT(self): SdifFPrintAllNameValueNVT(self.this)             # <<<<<<<<<<<<<<
 *     def print_general_header(self): SdifFPrintGeneralHeader(self.this)
 *     def print_all_ascii_chunks(self): SdifFPrintAllASCIIChunks(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_29print_NVT(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_29print_NVT[] = "SdifFile.print_NVT(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_29print_NVT(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_NVT");
  SdifFPrintAllNameValueNVT(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1216
 *     # low level functions to print info
 *     def print_NVT(self): SdifFPrintAllNameValueNVT(self.this)
 *     def print_general_header(self): SdifFPrintGeneralHeader(self.this)             # <<<<<<<<<<<<<<
 *     def print_all_ascii_chunks(self): SdifFPrintAllASCIIChunks(self.this)
 *     def print_all_types(self): SdifFPrintAllType(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_30print_general_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_30print_general_header[] = "SdifFile.print_general_header(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_30print_general_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_general_header");
  SdifFPrintGeneralHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1217
 *     def print_NVT(self): SdifFPrintAllNameValueNVT(self.this)
 *     def print_general_header(self): SdifFPrintGeneralHeader(self.this)
 *     def print_all_ascii_chunks(self): SdifFPrintAllASCIIChunks(self.this)             # <<<<<<<<<<<<<<
 *     def print_all_types(self): SdifFPrintAllType(self.this)
 *     def print_matrix_header(self): SdifFPrintMatrixHeader(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_31print_all_ascii_chunks(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_31print_all_ascii_chunks[] = "SdifFile.print_all_ascii_chunks(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_31print_all_ascii_chunks(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_all_ascii_chunks");
  SdifFPrintAllASCIIChunks(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1218
 *     def print_general_header(self): SdifFPrintGeneralHeader(self.this)
 *     def print_all_ascii_chunks(self): SdifFPrintAllASCIIChunks(self.this)
 *     def print_all_types(self): SdifFPrintAllType(self.this)             # <<<<<<<<<<<<<<
 *     def print_matrix_header(self): SdifFPrintMatrixHeader(self.this)
 *     def print_one_row(self): SdifFPrintOneRow(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_32print_all_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_32print_all_types[] = "SdifFile.print_all_types(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_32print_all_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_all_types");
  SdifFPrintAllType(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1219
 *     def print_all_ascii_chunks(self): SdifFPrintAllASCIIChunks(self.this)
 *     def print_all_types(self): SdifFPrintAllType(self.this)
 *     def print_matrix_header(self): SdifFPrintMatrixHeader(self.this)             # <<<<<<<<<<<<<<
 *     def print_one_row(self): SdifFPrintOneRow(self.this)
 *     def print_frame_header(self): SdifFPrintFrameHeader(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_33print_matrix_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_33print_matrix_header[] = "SdifFile.print_matrix_header(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_33print_matrix_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_matrix_header");
  SdifFPrintMatrixHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1220
 *     def print_all_types(self): SdifFPrintAllType(self.this)
 *     def print_matrix_header(self): SdifFPrintMatrixHeader(self.this)
 *     def print_one_row(self): SdifFPrintOneRow(self.this)             # <<<<<<<<<<<<<<
 *     def print_frame_header(self): SdifFPrintFrameHeader(self.this)
 *     def print_all_stream_ID(self): SdifFPrintAllStreamID(self.this)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_34print_one_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_34print_one_row[] = "SdifFile.print_one_row(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_34print_one_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_one_row");
  SdifFPrintOneRow(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1221
 *     def print_matrix_header(self): SdifFPrintMatrixHeader(self.this)
 *     def print_one_row(self): SdifFPrintOneRow(self.this)
 *     def print_frame_header(self): SdifFPrintFrameHeader(self.this)             # <<<<<<<<<<<<<<
 *     def print_all_stream_ID(self): SdifFPrintAllStreamID(self.this)
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_35print_frame_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_35print_frame_header[] = "SdifFile.print_frame_header(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_35print_frame_header(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_frame_header");
  SdifFPrintFrameHeader(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1222
 *     def print_one_row(self): SdifFPrintOneRow(self.this)
 *     def print_frame_header(self): SdifFPrintFrameHeader(self.this)
 *     def print_all_stream_ID(self): SdifFPrintAllStreamID(self.this)             # <<<<<<<<<<<<<<
 * 
 *     def frame_types_to_string(self):
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_36print_all_stream_ID(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_36print_all_stream_ID[] = "SdifFile.print_all_stream_ID(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_36print_all_stream_ID(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_all_stream_ID");
  SdifFPrintAllStreamID(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1224
 *     def print_all_stream_ID(self): SdifFPrintAllStreamID(self.this)
 * 
 *     def frame_types_to_string(self):             # <<<<<<<<<<<<<<
 *         """
 *         returns a string with all frame types
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_37frame_types_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_37frame_types_to_string[] = "SdifFile.frame_types_to_string(self)\n\n        returns a string with all frame types\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_37frame_types_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  SdifStringT *__pyx_v_sdifstr;
  PyObject *__pyx_v_out = NULL;
  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("frame_types_to_string");

  /* "pysdif/_pysdif.pyx":1229
 *         """
 *         cdef SdifStringT *sdifstr
 *         sdifstr = SdifStringNew()             # <<<<<<<<<<<<<<
 *         SdifFAllFrameTypeToSdifString(self.this, sdifstr)
 *         out = PyString_from_SdifString(sdifstr)
 */
  __pyx_v_sdifstr = SdifStringNew();

  /* "pysdif/_pysdif.pyx":1230
 *         cdef SdifStringT *sdifstr
 *         sdifstr = SdifStringNew()
 *         SdifFAllFrameTypeToSdifString(self.this, sdifstr)             # <<<<<<<<<<<<<<
 *         out = PyString_from_SdifString(sdifstr)
 *         SdifStringFree(sdifstr)
 */
  SdifFAllFrameTypeToSdifString(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, __pyx_v_sdifstr);

  /* "pysdif/_pysdif.pyx":1231
 *         sdifstr = SdifStringNew()
 *         SdifFAllFrameTypeToSdifString(self.this, sdifstr)
 *         out = PyString_from_SdifString(sdifstr)             # <<<<<<<<<<<<<<
 *         SdifStringFree(sdifstr)
 *         return out
 */
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_PyString_from_SdifString(__pyx_v_sdifstr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1232
 *         SdifFAllFrameTypeToSdifString(self.this, sdifstr)
 *         out = PyString_from_SdifString(sdifstr)
 *         SdifStringFree(sdifstr)             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  SdifStringFree(__pyx_v_sdifstr);

  /* "pysdif/_pysdif.pyx":1233
 *         out = PyString_from_SdifString(sdifstr)
 *         SdifStringFree(sdifstr)
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def get_frame_types(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.frame_types_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1235
 *         return out
 * 
 *     def get_frame_types(self):             # <<<<<<<<<<<<<<
 *         """
 *         returns a list of frame type definitions (1FTD)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_38get_frame_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_38get_frame_types[] = "SdifFile.get_frame_types(self)\n\n        returns a list of frame type definitions (1FTD)\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_38get_frame_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("get_frame_types");

  /* "pysdif/_pysdif.pyx":1239
 *         returns a list of frame type definitions (1FTD)
 *         """
 *         return FrameTypesTable_to_list(self.this.FrameTypesTable)             # <<<<<<<<<<<<<<
 * 
 *     def matrix_types_to_string(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_FrameTypesTable_to_list(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->FrameTypesTable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.get_frame_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1241
 *         return FrameTypesTable_to_list(self.this.FrameTypesTable)
 * 
 *     def matrix_types_to_string(self):             # <<<<<<<<<<<<<<
 *         """ returns a string with all matrix types"""
 *         cdef SdifStringT *sdifstr
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_39matrix_types_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_39matrix_types_to_string[] = "SdifFile.matrix_types_to_string(self)\n returns a string with all matrix types";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_39matrix_types_to_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  SdifStringT *__pyx_v_sdifstr;
  PyObject *__pyx_v_out = NULL;
  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("matrix_types_to_string");

  /* "pysdif/_pysdif.pyx":1244
 *         """ returns a string with all matrix types"""
 *         cdef SdifStringT *sdifstr
 *         sdifstr = SdifStringNew()             # <<<<<<<<<<<<<<
 *         SdifFAllMatrixTypeToSdifString(self.this, sdifstr)
 *         out = PyString_from_SdifString(sdifstr)
 */
  __pyx_v_sdifstr = SdifStringNew();

  /* "pysdif/_pysdif.pyx":1245
 *         cdef SdifStringT *sdifstr
 *         sdifstr = SdifStringNew()
 *         SdifFAllMatrixTypeToSdifString(self.this, sdifstr)             # <<<<<<<<<<<<<<
 *         out = PyString_from_SdifString(sdifstr)
 *         SdifStringFree(sdifstr)
 */
  SdifFAllMatrixTypeToSdifString(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this, __pyx_v_sdifstr);

  /* "pysdif/_pysdif.pyx":1246
 *         sdifstr = SdifStringNew()
 *         SdifFAllMatrixTypeToSdifString(self.this, sdifstr)
 *         out = PyString_from_SdifString(sdifstr)             # <<<<<<<<<<<<<<
 *         SdifStringFree(sdifstr)
 *         return out
 */
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_PyString_from_SdifString(__pyx_v_sdifstr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1247
 *         SdifFAllMatrixTypeToSdifString(self.this, sdifstr)
 *         out = PyString_from_SdifString(sdifstr)
 *         SdifStringFree(sdifstr)             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  SdifStringFree(__pyx_v_sdifstr);

  /* "pysdif/_pysdif.pyx":1248
 *         out = PyString_from_SdifString(sdifstr)
 *         SdifStringFree(sdifstr)
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def get_matrix_types(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.matrix_types_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1250
 *         return out
 * 
 *     def get_matrix_types(self):             # <<<<<<<<<<<<<<
 *         """
 *         returns a list of matrix type definitions (1MTD)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_40get_matrix_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_40get_matrix_types[] = "SdifFile.get_matrix_types(self)\n\n        returns a list of matrix type definitions (1MTD)\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_40get_matrix_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("get_matrix_types");

  /* "pysdif/_pysdif.pyx":1254
 *         returns a list of matrix type definitions (1MTD)
 *         """
 *         return MatrixTypesTable_to_list(self.this.MatrixTypesTable)             # <<<<<<<<<<<<<<
 * 
 *     def get_NVTs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_MatrixTypesTable_to_list(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->MatrixTypesTable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.get_matrix_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1256
 *         return MatrixTypesTable_to_list(self.this.MatrixTypesTable)
 * 
 *     def get_NVTs(self):             # <<<<<<<<<<<<<<
 *         """
 *         return a list with all devined NameValueTables
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_41get_NVTs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_41get_NVTs[] = "SdifFile.get_NVTs(self)\n\n        return a list with all devined NameValueTables \n        each NVT is converted to a python dict\n        ";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_41get_NVTs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("get_NVTs");

  /* "pysdif/_pysdif.pyx":1261
 *         each NVT is converted to a python dict
 *         """
 *         return valuetables_to_dicts (self.this.NameValues)             # <<<<<<<<<<<<<<
 * 
 *     def get_stream_IDs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_valuetables_to_dicts(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->NameValues); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.get_NVTs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1263
 *         return valuetables_to_dicts (self.this.NameValues)
 * 
 *     def get_stream_IDs(self):             # <<<<<<<<<<<<<<
 *         return streamidtable_to_list(self.this.StreamIDsTable)
 * 
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_42get_stream_IDs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8SdifFile_42get_stream_IDs[] = "SdifFile.get_stream_IDs(self)";
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_42get_stream_IDs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("get_stream_IDs");

  /* "pysdif/_pysdif.pyx":1264
 * 
 *     def get_stream_IDs(self):
 *         return streamidtable_to_list(self.this.StreamIDsTable)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pysdif_7_pysdif_streamidtable_to_list(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->this->StreamIDsTable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.get_stream_IDs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":740
 * 
 *     cdef SdifFileT *this
 *     cdef readonly int eof             # <<<<<<<<<<<<<<
 *     cdef FrameR frame
 *     cdef Matrix matrix
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_3eof___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pysdif_7_pysdif_8SdifFile_3eof___get__(PyObject *__pyx_v_self) {
  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("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_v_self)->eof); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysdif._pysdif.SdifFile.eof.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1269
 * # -----------------------------------------------------------------------------------------------
 * 
 * def test_bench_read_sdif1(filename):             # <<<<<<<<<<<<<<
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_5test_bench_read_sdif1(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_5test_bench_read_sdif1[] = "test_bench_read_sdif1(filename)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_5test_bench_read_sdif1 = {__Pyx_NAMESTR("test_bench_read_sdif1"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_5test_bench_read_sdif1, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_5test_bench_read_sdif1)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_5test_bench_read_sdif1(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_sdif_file = NULL;
  int __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_bench_read_sdif1");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1270
 * 
 * def test_bench_read_sdif1(filename):
 *     sdif_file = SdifFile(filename)             # <<<<<<<<<<<<<<
 *     cdef int n
 *     while sdif_file.read_frame_header():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_SdifFile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_sdif_file = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1272
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 *     while sdif_file.read_frame_header():             # <<<<<<<<<<<<<<
 *         for n in range(sdif_file.matrices_in_frame):
 *             sdif_file.get_matrix_data()
 */
  while (1) {
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__read_frame_header); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) break;

    /* "pysdif/_pysdif.pyx":1273
 *     cdef int n
 *     while sdif_file.read_frame_header():
 *         for n in range(sdif_file.matrices_in_frame):             # <<<<<<<<<<<<<<
 *             sdif_file.get_matrix_data()
 *     sdif_file.close()
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__matrices_in_frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_n = __pyx_t_5;

      /* "pysdif/_pysdif.pyx":1274
 *     while sdif_file.read_frame_header():
 *         for n in range(sdif_file.matrices_in_frame):
 *             sdif_file.get_matrix_data()             # <<<<<<<<<<<<<<
 *     sdif_file.close()
 * 
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__get_matrix_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }

  /* "pysdif/_pysdif.pyx":1275
 *         for n in range(sdif_file.matrices_in_frame):
 *             sdif_file.get_matrix_data()
 *     sdif_file.close()             # <<<<<<<<<<<<<<
 * 
 * def test_bench_read_sdif2(filename):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysdif._pysdif.test_bench_read_sdif1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sdif_file);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1277
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif2(filename):             # <<<<<<<<<<<<<<
 *     # this is the slowest version
 *     sdif_file = SdifFile(filename)
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_6test_bench_read_sdif2(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_6test_bench_read_sdif2[] = "test_bench_read_sdif2(filename)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_6test_bench_read_sdif2 = {__Pyx_NAMESTR("test_bench_read_sdif2"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6test_bench_read_sdif2, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6test_bench_read_sdif2)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_6test_bench_read_sdif2(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_sdif_file = NULL;
  PyObject *__pyx_v_frame = NULL;
  PyObject *__pyx_v_matrix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_bench_read_sdif2");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1279
 * def test_bench_read_sdif2(filename):
 *     # this is the slowest version
 *     sdif_file = SdifFile(filename)             # <<<<<<<<<<<<<<
 *     for frame in sdif_file:
 *         for matrix in frame:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_SdifFile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_sdif_file = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1280
 *     # this is the slowest version
 *     sdif_file = SdifFile(filename)
 *     for frame in sdif_file:             # <<<<<<<<<<<<<<
 *         for matrix in frame:
 *             matrix.get_data()
 */
  if (PyList_CheckExact(((PyObject *)__pyx_v_sdif_file)) || PyTuple_CheckExact(((PyObject *)__pyx_v_sdif_file))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_sdif_file); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_sdif_file)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_frame);
    __pyx_v_frame = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysdif/_pysdif.pyx":1281
 *     sdif_file = SdifFile(filename)
 *     for frame in sdif_file:
 *         for matrix in frame:             # <<<<<<<<<<<<<<
 *             matrix.get_data()
 *     sdif_file.close()
 */
    if (PyList_CheckExact(__pyx_v_frame) || PyTuple_CheckExact(__pyx_v_frame)) {
      __pyx_t_1 = __pyx_v_frame; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
      } else if (PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_1);
        if (unlikely(!__pyx_t_7)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF(__pyx_v_matrix);
      __pyx_v_matrix = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pysdif/_pysdif.pyx":1282
 *     for frame in sdif_file:
 *         for matrix in frame:
 *             matrix.get_data()             # <<<<<<<<<<<<<<
 *     sdif_file.close()
 * 
 */
      __pyx_t_7 = PyObject_GetAttr(__pyx_v_matrix, __pyx_n_s__get_data); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1283
 *         for matrix in frame:
 *             matrix.get_data()
 *     sdif_file.close()             # <<<<<<<<<<<<<<
 * 
 * def test_bench_read_sdif6(filename):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pysdif._pysdif.test_bench_read_sdif2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sdif_file);
  __Pyx_XDECREF(__pyx_v_frame);
  __Pyx_XDECREF(__pyx_v_matrix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1285
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif6(filename):             # <<<<<<<<<<<<<<
 *     """
 *     this is pure c, has no overhead at all and thus is a good
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_7test_bench_read_sdif6(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_7test_bench_read_sdif6[] = "test_bench_read_sdif6(filename)\n\n    this is pure c, has no overhead at all and thus is a good\n    reference to measure the other implementations.\n    at the moment, the best we get at the python \n    interpreter is 1.227 (22,7%) slower than pure c\n    ";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_7test_bench_read_sdif6 = {__Pyx_NAMESTR("test_bench_read_sdif6"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_7test_bench_read_sdif6, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_7test_bench_read_sdif6)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_7test_bench_read_sdif6(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  int __pyx_v_n;
  size_t __pyx_v_char_read;
  SdifFileT *__pyx_v_f;
  int __pyx_v_eof;
  PyArrayObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  const char* __pyx_t_1;
  int __pyx_t_2;
  SdifUInt4 __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_bench_read_sdif6");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1294
 *     cdef int n
 *     cdef size_t char_read
 *     cdef SdifFileT *f = SdifFOpen(filename, eReadFile)             # <<<<<<<<<<<<<<
 *     SdifFReadGeneralHeader(f)
 *     SdifFReadAllASCIIChunks(f)
 */
  __pyx_t_1 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_1 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_f = SdifFOpen(__pyx_t_1, eReadFile);

  /* "pysdif/_pysdif.pyx":1295
 *     cdef size_t char_read
 *     cdef SdifFileT *f = SdifFOpen(filename, eReadFile)
 *     SdifFReadGeneralHeader(f)             # <<<<<<<<<<<<<<
 *     SdifFReadAllASCIIChunks(f)
 *     cdef int eof = (f.CurrSignature == eEof)
 */
  SdifFReadGeneralHeader(__pyx_v_f);

  /* "pysdif/_pysdif.pyx":1296
 *     cdef SdifFileT *f = SdifFOpen(filename, eReadFile)
 *     SdifFReadGeneralHeader(f)
 *     SdifFReadAllASCIIChunks(f)             # <<<<<<<<<<<<<<
 *     cdef int eof = (f.CurrSignature == eEof)
 *     while eof == 0:
 */
  SdifFReadAllASCIIChunks(__pyx_v_f);

  /* "pysdif/_pysdif.pyx":1297
 *     SdifFReadGeneralHeader(f)
 *     SdifFReadAllASCIIChunks(f)
 *     cdef int eof = (f.CurrSignature == eEof)             # <<<<<<<<<<<<<<
 *     while eof == 0:
 *         SdifFReadFrameHeader(f)
 */
  __pyx_v_eof = (__pyx_v_f->CurrSignature == eEof);

  /* "pysdif/_pysdif.pyx":1298
 *     SdifFReadAllASCIIChunks(f)
 *     cdef int eof = (f.CurrSignature == eEof)
 *     while eof == 0:             # <<<<<<<<<<<<<<
 *         SdifFReadFrameHeader(f)
 *         for n in range(f.CurrFramH.NbMatrix):
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_eof == 0);
    if (!__pyx_t_2) break;

    /* "pysdif/_pysdif.pyx":1299
 *     cdef int eof = (f.CurrSignature == eEof)
 *     while eof == 0:
 *         SdifFReadFrameHeader(f)             # <<<<<<<<<<<<<<
 *         for n in range(f.CurrFramH.NbMatrix):
 *             SdifFReadMatrixHeader(f)
 */
    SdifFReadFrameHeader(__pyx_v_f);

    /* "pysdif/_pysdif.pyx":1300
 *     while eof == 0:
 *         SdifFReadFrameHeader(f)
 *         for n in range(f.CurrFramH.NbMatrix):             # <<<<<<<<<<<<<<
 *             SdifFReadMatrixHeader(f)
 *             SdifFReadMatrixData(f)
 */
    __pyx_t_3 = __pyx_v_f->CurrFramH->NbMatrix;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_n = __pyx_t_4;

      /* "pysdif/_pysdif.pyx":1301
 *         SdifFReadFrameHeader(f)
 *         for n in range(f.CurrFramH.NbMatrix):
 *             SdifFReadMatrixHeader(f)             # <<<<<<<<<<<<<<
 *             SdifFReadMatrixData(f)
 *             # it is not totally pure c in the sense that at this
 */
      SdifFReadMatrixHeader(__pyx_v_f);

      /* "pysdif/_pysdif.pyx":1302
 *         for n in range(f.CurrFramH.NbMatrix):
 *             SdifFReadMatrixHeader(f)
 *             SdifFReadMatrixData(f)             # <<<<<<<<<<<<<<
 *             # it is not totally pure c in the sense that at this
 *             # point we have a numpy array which we could use in
 */
      SdifFReadMatrixData(__pyx_v_f);

      /* "pysdif/_pysdif.pyx":1306
 *             # point we have a numpy array which we could use in
 *             # python.
 *             data = _array_from_matrix_data_no_copy(f.CurrMtrxData)             # <<<<<<<<<<<<<<
 *         eof = SdifFGetSignature(f, &char_read) == eEof
 *     SdifFClose(f)
 */
      __pyx_t_5 = ((PyObject *)__pyx_f_6pysdif_7_pysdif__array_from_matrix_data_no_copy(__pyx_v_f->CurrMtrxData)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF(((PyObject *)__pyx_v_data));
      __pyx_v_data = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;
    }

    /* "pysdif/_pysdif.pyx":1307
 *             # python.
 *             data = _array_from_matrix_data_no_copy(f.CurrMtrxData)
 *         eof = SdifFGetSignature(f, &char_read) == eEof             # <<<<<<<<<<<<<<
 *     SdifFClose(f)
 * 
 */
    __pyx_v_eof = (SdifFGetSignature(__pyx_v_f, (&__pyx_v_char_read)) == eEof);
  }

  /* "pysdif/_pysdif.pyx":1308
 *             data = _array_from_matrix_data_no_copy(f.CurrMtrxData)
 *         eof = SdifFGetSignature(f, &char_read) == eEof
 *     SdifFClose(f)             # <<<<<<<<<<<<<<
 * 
 * def test_bench_read_sdif3(filename):
 */
  SdifFClose(__pyx_v_f);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysdif._pysdif.test_bench_read_sdif6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1310
 *     SdifFClose(f)
 * 
 * def test_bench_read_sdif3(filename):             # <<<<<<<<<<<<<<
 *     # fastest, 4 is almost the same, 2 is twice as slow...,
 *     # it should be different for frames which have
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_8test_bench_read_sdif3(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_8test_bench_read_sdif3[] = "test_bench_read_sdif3(filename)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_8test_bench_read_sdif3 = {__Pyx_NAMESTR("test_bench_read_sdif3"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8test_bench_read_sdif3, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8test_bench_read_sdif3)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_8test_bench_read_sdif3(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_sdif_file = NULL;
  int __pyx_v_n;
  PyObject *__pyx_v_frame = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_bench_read_sdif3");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1314
 *     # it should be different for frames which have
 *     # many matrices but that is really the exception.
 *     sdif_file = SdifFile(filename)             # <<<<<<<<<<<<<<
 *     cdef int n
 *     for frame in sdif_file:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_SdifFile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_sdif_file = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1316
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 *     for frame in sdif_file:             # <<<<<<<<<<<<<<
 *         for n in range(len(frame)):
 *             sdif_file.get_next_matrix().get_data()
 */
  if (PyList_CheckExact(((PyObject *)__pyx_v_sdif_file)) || PyTuple_CheckExact(((PyObject *)__pyx_v_sdif_file))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_sdif_file); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_sdif_file)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_frame);
    __pyx_v_frame = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysdif/_pysdif.pyx":1317
 *     cdef int n
 *     for frame in sdif_file:
 *         for n in range(len(frame)):             # <<<<<<<<<<<<<<
 *             sdif_file.get_next_matrix().get_data()
 *     sdif_file.close()
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_frame); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_n = __pyx_t_6;

      /* "pysdif/_pysdif.pyx":1318
 *     for frame in sdif_file:
 *         for n in range(len(frame)):
 *             sdif_file.get_next_matrix().get_data()             # <<<<<<<<<<<<<<
 *     sdif_file.close()
 * 
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__get_next_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__get_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1319
 *         for n in range(len(frame)):
 *             sdif_file.get_next_matrix().get_data()
 *     sdif_file.close()             # <<<<<<<<<<<<<<
 * 
 * def test_bench_read_sdif4(filename):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.test_bench_read_sdif3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sdif_file);
  __Pyx_XDECREF(__pyx_v_frame);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1321
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif4(filename):             # <<<<<<<<<<<<<<
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_9test_bench_read_sdif4(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_9test_bench_read_sdif4[] = "test_bench_read_sdif4(filename)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_9test_bench_read_sdif4 = {__Pyx_NAMESTR("test_bench_read_sdif4"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_9test_bench_read_sdif4, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_9test_bench_read_sdif4)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_9test_bench_read_sdif4(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_sdif_file = NULL;
  int __pyx_v_n;
  PyObject *__pyx_v_frame = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_bench_read_sdif4");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1322
 * 
 * def test_bench_read_sdif4(filename):
 *     sdif_file = SdifFile(filename)             # <<<<<<<<<<<<<<
 *     cdef int n
 *     for frame in sdif_file:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_SdifFile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_sdif_file = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1324
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 *     for frame in sdif_file:             # <<<<<<<<<<<<<<
 *         for n in range(len(frame)):
 *             frame.next().get_data()
 */
  if (PyList_CheckExact(((PyObject *)__pyx_v_sdif_file)) || PyTuple_CheckExact(((PyObject *)__pyx_v_sdif_file))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_sdif_file); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_sdif_file)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_frame);
    __pyx_v_frame = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysdif/_pysdif.pyx":1325
 *     cdef int n
 *     for frame in sdif_file:
 *         for n in range(len(frame)):             # <<<<<<<<<<<<<<
 *             frame.next().get_data()
 *     sdif_file.close()
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_frame); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_n = __pyx_t_6;

      /* "pysdif/_pysdif.pyx":1326
 *     for frame in sdif_file:
 *         for n in range(len(frame)):
 *             frame.next().get_data()             # <<<<<<<<<<<<<<
 *     sdif_file.close()
 * 
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_frame, __pyx_n_s__next); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__get_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1327
 *         for n in range(len(frame)):
 *             frame.next().get_data()
 *     sdif_file.close()             # <<<<<<<<<<<<<<
 * 
 * def test_bench_read_sdif5(filename):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.test_bench_read_sdif4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sdif_file);
  __Pyx_XDECREF(__pyx_v_frame);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1329
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif5(filename):             # <<<<<<<<<<<<<<
 *     # this is the fastest for common case where a frame has only one matrix
 *     # and you do not need to check the signature of each matrix
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_10test_bench_read_sdif5(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_10test_bench_read_sdif5[] = "test_bench_read_sdif5(filename)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_10test_bench_read_sdif5 = {__Pyx_NAMESTR("test_bench_read_sdif5"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_10test_bench_read_sdif5, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_10test_bench_read_sdif5)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_10test_bench_read_sdif5(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_sdif_file = NULL;
  PyObject *__pyx_v_frame = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_bench_read_sdif5");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1333
 *     # and you do not need to check the signature of each matrix
 *     # (since the matrix-header and the data are read in one function-call)
 *     sdif_file = SdifFile(filename)             # <<<<<<<<<<<<<<
 *     for frame in sdif_file:
 *         frame.get_matrix_data() # assume that there is only one matrix per frame
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_SdifFile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_sdif_file = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1334
 *     # (since the matrix-header and the data are read in one function-call)
 *     sdif_file = SdifFile(filename)
 *     for frame in sdif_file:             # <<<<<<<<<<<<<<
 *         frame.get_matrix_data() # assume that there is only one matrix per frame
 *     sdif_file.close()
 */
  if (PyList_CheckExact(((PyObject *)__pyx_v_sdif_file)) || PyTuple_CheckExact(((PyObject *)__pyx_v_sdif_file))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_sdif_file); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_sdif_file)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_frame);
    __pyx_v_frame = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysdif/_pysdif.pyx":1335
 *     sdif_file = SdifFile(filename)
 *     for frame in sdif_file:
 *         frame.get_matrix_data() # assume that there is only one matrix per frame             # <<<<<<<<<<<<<<
 *     sdif_file.close()
 * 
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_frame, __pyx_n_s__get_matrix_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1336
 *     for frame in sdif_file:
 *         frame.get_matrix_data() # assume that there is only one matrix per frame
 *     sdif_file.close()             # <<<<<<<<<<<<<<
 * 
 * def test_write(filename):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sdif_file), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysdif._pysdif.test_bench_read_sdif5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sdif_file);
  __Pyx_XDECREF(__pyx_v_frame);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysdif/_pysdif.pyx":1338
 *     sdif_file.close()
 * 
 * def test_write(filename):             # <<<<<<<<<<<<<<
 *     s = SdifFile(filename, "w")
 *     s.add_matrix_type("1MTX", "ColumnaA")
 */

static PyObject *__pyx_pf_6pysdif_7_pysdif_11test_write(PyObject *__pyx_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pysdif_7_pysdif_11test_write[] = "test_write(filename)";
static PyMethodDef __pyx_mdef_6pysdif_7_pysdif_11test_write = {__Pyx_NAMESTR("test_write"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_11test_write, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_11test_write)};
static PyObject *__pyx_pf_6pysdif_7_pysdif_11test_write(PyObject *__pyx_self, PyObject *__pyx_v_filename) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *__pyx_v_s = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_frame = 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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test_write");
  __pyx_self = __pyx_self;

  /* "pysdif/_pysdif.pyx":1339
 * 
 * def test_write(filename):
 *     s = SdifFile(filename, "w")             # <<<<<<<<<<<<<<
 *     s.add_matrix_type("1MTX", "ColumnaA")
 *     s.add_frame_type("1ABC", "1MTX pupu")
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__w));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pysdif_7_pysdif_SdifFile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_s = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1340
 * def test_write(filename):
 *     s = SdifFile(filename, "w")
 *     s.add_matrix_type("1MTX", "ColumnaA")             # <<<<<<<<<<<<<<
 *     s.add_frame_type("1ABC", "1MTX pupu")
 *     s.add_NVT({"meta":"data"})
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_s), __pyx_n_s__add_matrix_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1341
 *     s = SdifFile(filename, "w")
 *     s.add_matrix_type("1MTX", "ColumnaA")
 *     s.add_frame_type("1ABC", "1MTX pupu")             # <<<<<<<<<<<<<<
 *     s.add_NVT({"meta":"data"})
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_s), __pyx_n_s__add_frame_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":1342
 *     s.add_matrix_type("1MTX", "ColumnaA")
 *     s.add_frame_type("1ABC", "1MTX pupu")
 *     s.add_NVT({"meta":"data"})             # <<<<<<<<<<<<<<
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)
 *     m.resize((5, 1))
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_s), __pyx_n_s__add_NVT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__meta), ((PyObject *)__pyx_n_s__data)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1343
 *     s.add_frame_type("1ABC", "1MTX pupu")
 *     s.add_NVT({"meta":"data"})
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)             # <<<<<<<<<<<<<<
 *     m.resize((5, 1))
 *     frame = s.new_frame("1ABC", 0.0)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(0.1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(0.3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(0.7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(0.4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyList_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_7, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_7, 4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
  __pyx_t_7 = 0;
  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __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_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_v_m = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pysdif/_pysdif.pyx":1344
 *     s.add_NVT({"meta":"data"})
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)
 *     m.resize((5, 1))             # <<<<<<<<<<<<<<
 *     frame = s.new_frame("1ABC", 0.0)
 *     frame.add_matrix("1MTX", m)
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pysdif/_pysdif.pyx":1345
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)
 *     m.resize((5, 1))
 *     frame = s.new_frame("1ABC", 0.0)             # <<<<<<<<<<<<<<
 *     frame.add_matrix("1MTX", m)
 *     frame.write()
 */
  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_s), __pyx_n_s__new_frame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s__1ABC));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s__1ABC));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__1ABC));
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_v_frame = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pysdif/_pysdif.pyx":1346
 *     m.resize((5, 1))
 *     frame = s.new_frame("1ABC", 0.0)
 *     frame.add_matrix("1MTX", m)             # <<<<<<<<<<<<<<
 *     frame.write()
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_frame, __pyx_n_s__add_matrix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s__1MTX));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s__1MTX));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__1MTX));
  __Pyx_INCREF(__pyx_v_m);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_m);
  __Pyx_GIVEREF(__pyx_v_m);
  __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pysdif/_pysdif.pyx":1347
 *     frame = s.new_frame("1ABC", 0.0)
 *     frame.add_matrix("1MTX", m)
 *     frame.write()             # <<<<<<<<<<<<<<
 */
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_frame, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysdif._pysdif.test_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_frame);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":190
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # 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) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__");
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":196
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = (__pyx_v_info == NULL);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":199
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":200
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":202
 *             cdef bint little_endian = ((<char*>&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));

  /* "numpy.pxd":204
 *             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)));
  if (__pyx_t_1) {

    /* "numpy.pxd":205
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "numpy.pxd":207
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L6:;

  /* "numpy.pxd":209
 *                 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);
  if (__pyx_t_1) {

    /* "numpy.pxd":210
 * 
 *             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_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":211
 *             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_33), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "numpy.pxd":213
 *                 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);
  if (__pyx_t_3) {

    /* "numpy.pxd":214
 * 
 *             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_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":215
 *             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_35), 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, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "numpy.pxd":217
 *                 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));

  /* "numpy.pxd":218
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "numpy.pxd":219
 *             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.
 */
  if (__pyx_v_copy_shape) {

    /* "numpy.pxd":222
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_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)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "numpy.pxd":223
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_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":224
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "numpy.pxd":225
 *                 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]);

      /* "numpy.pxd":226
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
    }
    goto __pyx_L9;
  }
  /*else*/ {

    /* "numpy.pxd":228
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));

    /* "numpy.pxd":229
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>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_L9:;

  /* "numpy.pxd":230
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "numpy.pxd":231
 *                 info.shape = <Py_ssize_t*>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));

  /* "numpy.pxd":232
 *             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)));

  /* "numpy.pxd":235
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":236
 *             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;

  /* "numpy.pxd":240
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "numpy.pxd":242
 *             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);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":244
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "numpy.pxd":247
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L12:;

  /* "numpy.pxd":249
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "numpy.pxd":250
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "numpy.pxd":251
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":252
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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 == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "numpy.pxd":253
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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_37), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "numpy.pxd":254
 *                     (descr.byteorder == '<' 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) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L15;
    }

    /* "numpy.pxd":255
 *                     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) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L15;
    }

    /* "numpy.pxd":256
 *                 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) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L15;
    }

    /* "numpy.pxd":257
 *                 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) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L15;
    }

    /* "numpy.pxd":258
 *                 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) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L15;
    }

    /* "numpy.pxd":259
 *                 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) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L15;
    }

    /* "numpy.pxd":260
 *                 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) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L15;
    }

    /* "numpy.pxd":261
 *                 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) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L15;
    }

    /* "numpy.pxd":262
 *                 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) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":263
 *                 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) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":264
 *                 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) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L15;
    }

    /* "numpy.pxd":265
 *                 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) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L15;
    }

    /* "numpy.pxd":266
 *                 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) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L15;
    }

    /* "numpy.pxd":267
 *                 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) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L15;
    }

    /* "numpy.pxd":268
 *                 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) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L15;
    }

    /* "numpy.pxd":269
 *                 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) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L15;
    }

    /* "numpy.pxd":270
 *                 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) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "numpy.pxd":272
 *                 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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_38), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __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 = 272; __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_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __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, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L15:;

    /* "numpy.pxd":273
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "numpy.pxd":274
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "numpy.pxd":276
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":277
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":278
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # 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":281
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":282
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L13:;

  __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_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  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 != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":284
 *                 f[0] = 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) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");

  /* "numpy.pxd":285
 * 
 *         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));
  if (__pyx_t_1) {

    /* "numpy.pxd":286
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":287
 *             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)));
  if (__pyx_t_1) {

    /* "numpy.pxd":288
 *                 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
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":764
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  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("PyArray_MultiIterNew1");

  /* "numpy.pxd":765
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * 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 = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":767
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2");

  /* "numpy.pxd":768
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * 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 = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":770
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3");

  /* "numpy.pxd":771
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * 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 = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":773
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4");

  /* "numpy.pxd":774
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * 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 = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":776
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5");

  /* "numpy.pxd":777
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * 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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":779
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

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 = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __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;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring");

  /* "numpy.pxd":786
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":787
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":790
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  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 = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":791
 * 
 *     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 = 791; __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 = 791; __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":792
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_fields);
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __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":794
 *         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 = 794; __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 = 794; __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 = 794; __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 = 794; __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "numpy.pxd":795
 * 
 *         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
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "numpy.pxd":797
 *             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)):
 *             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;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (!__pyx_t_7) {

      /* "numpy.pxd":798
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "numpy.pxd":799
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_41), 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, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "numpy.pxd":809
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             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 = 809; __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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_6) break;

      /* "numpy.pxd":810
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "numpy.pxd":811
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "numpy.pxd":812
 *             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);
    }

    /* "numpy.pxd":814
 *             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);

    /* "numpy.pxd":816
 *         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) {

      /* "numpy.pxd":817
 * 
 *         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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "numpy.pxd":818
 *         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) {

        /* "numpy.pxd":819
 *             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_43), NULL); 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_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "numpy.pxd":822
 * 
 *             # 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 = 822; __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_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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "numpy.pxd":823
 *             # 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 = 823; __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_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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "numpy.pxd":824
 *             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 = 824; __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_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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "numpy.pxd":825
 *             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 = 825; __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_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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "numpy.pxd":826
 *             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 = 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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "numpy.pxd":827
 *             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 = 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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "numpy.pxd":828
 *             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 = 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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "numpy.pxd":829
 *             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 = 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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "numpy.pxd":830
 *             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 = 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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "numpy.pxd":831
 *             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 = 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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "numpy.pxd":832
 *             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 = 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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "numpy.pxd":833
 *             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 = 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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "numpy.pxd":834
 *             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 = 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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "numpy.pxd":835
 *             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 = 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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":836
 *             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 = 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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":837
 *             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 = 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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":838
 *             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 = 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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "numpy.pxd":840
 *             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_38), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__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 = 840; __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, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "numpy.pxd":841
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "numpy.pxd":845
 *             # 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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_11;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":846
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __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_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __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":961
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

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");

  /* "numpy.pxd":963
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  if (__pyx_t_1) {

    /* "numpy.pxd":964
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":966
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "numpy.pxd":967
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "numpy.pxd":968
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "numpy.pxd":969
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":971
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

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");

  /* "numpy.pxd":972
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "numpy.pxd":973
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":975
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_6pysdif_7_pysdif_StreamID(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  if (__pyx_pf_6pysdif_7_pysdif_8StreamID___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_StreamID(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_6pysdif_7_pysdif_8StreamID_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8StreamID_numid(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8StreamID_5numid___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8StreamID_source(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8StreamID_6source___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8StreamID_treeway(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8StreamID_7treeway___get__(o);
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_StreamID[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_StreamID[] = {
  {(char *)"numid", __pyx_getprop_6pysdif_7_pysdif_8StreamID_numid, 0, 0, 0},
  {(char *)"source", __pyx_getprop_6pysdif_7_pysdif_8StreamID_source, 0, 0, 0},
  {(char *)"treeway", __pyx_getprop_6pysdif_7_pysdif_8StreamID_treeway, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_StreamID = {
  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_StreamID = {
  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_StreamID = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_StreamID = {
  #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_6pysdif_7_pysdif_StreamID = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.StreamID"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_StreamID), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_StreamID, /*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_6pysdif_7_pysdif_8StreamID_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_StreamID, /*tp_as_number*/
  &__pyx_tp_as_sequence_StreamID, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_StreamID, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_StreamID, /*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_6pysdif_7_pysdif_StreamID, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_StreamID, /*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_6pysdif_7_pysdif_StreamID, /*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 struct __pyx_vtabstruct_6pysdif_7_pysdif_MatrixTypeDefinition __pyx_vtable_6pysdif_7_pysdif_MatrixTypeDefinition;

static PyObject *__pyx_tp_new_6pysdif_7_pysdif_MatrixTypeDefinition(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pysdif_7_pysdif_MatrixTypeDefinition;
  p->signature = Py_None; Py_INCREF(Py_None);
  p->column_names = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_MatrixTypeDefinition(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *p = (struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)o;
  Py_XDECREF(p->signature);
  Py_XDECREF(((PyObject *)p->column_names));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_MatrixTypeDefinition(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *p = (struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)o;
  if (p->signature) {
    e = (*v)(p->signature, a); if (e) return e;
  }
  if (p->column_names) {
    e = (*v)(p->column_names, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_MatrixTypeDefinition(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *p = (struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->signature);
  p->signature = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->column_names);
  p->column_names = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_20MatrixTypeDefinition_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature___get__(o);
}

static int __pyx_setprop_6pysdif_7_pysdif_20MatrixTypeDefinition_signature(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature_1__set__(o, v);
  }
  else {
    return __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_9signature_2__del__(o);
  }
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_20MatrixTypeDefinition_column_names(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names___get__(o);
}

static int __pyx_setprop_6pysdif_7_pysdif_20MatrixTypeDefinition_column_names(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names_1__set__(o, v);
  }
  else {
    return __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_12column_names_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_MatrixTypeDefinition[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_MatrixTypeDefinition[] = {
  {(char *)"signature", __pyx_getprop_6pysdif_7_pysdif_20MatrixTypeDefinition_signature, __pyx_setprop_6pysdif_7_pysdif_20MatrixTypeDefinition_signature, __Pyx_DOCSTR(__pyx_k_44), 0},
  {(char *)"column_names", __pyx_getprop_6pysdif_7_pysdif_20MatrixTypeDefinition_column_names, __pyx_setprop_6pysdif_7_pysdif_20MatrixTypeDefinition_column_names, __Pyx_DOCSTR(__pyx_k_45), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_MatrixTypeDefinition = {
  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_MatrixTypeDefinition = {
  __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_3__len__, /*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_MatrixTypeDefinition = {
  __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_MatrixTypeDefinition = {
  #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_6pysdif_7_pysdif_MatrixTypeDefinition = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.MatrixTypeDefinition"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_MatrixTypeDefinition, /*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_6pysdif_7_pysdif_20MatrixTypeDefinition_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_MatrixTypeDefinition, /*tp_as_number*/
  &__pyx_tp_as_sequence_MatrixTypeDefinition, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MatrixTypeDefinition, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_MatrixTypeDefinition, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("MatrixTypeDefinition(signature, column_names)"), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_MatrixTypeDefinition, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_MatrixTypeDefinition, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition_2__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_MatrixTypeDefinition, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_MatrixTypeDefinition, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_6pysdif_7_pysdif_20MatrixTypeDefinition___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pysdif_7_pysdif_MatrixTypeDefinition, /*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 PyObject *__pyx_tp_new_6pysdif_7_pysdif_Component(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_Component *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_Component *)o);
  p->signature = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_Component(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_Component *p = (struct __pyx_obj_6pysdif_7_pysdif_Component *)o;
  Py_XDECREF(((PyObject *)p->signature));
  Py_XDECREF(((PyObject *)p->name));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_Component(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_Component *p = (struct __pyx_obj_6pysdif_7_pysdif_Component *)o;
  if (p->signature) {
    e = (*v)(p->signature, a); if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_Component(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_Component *p = (struct __pyx_obj_6pysdif_7_pysdif_Component *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->signature);
  p->signature = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->name);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_9Component_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_9Component_9signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_9Component_name(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_9Component_4name___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_9Component_num(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_9Component_3num___get__(o);
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_Component[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_Component[] = {
  {(char *)"signature", __pyx_getprop_6pysdif_7_pysdif_9Component_signature, 0, __Pyx_DOCSTR(__pyx_k_46), 0},
  {(char *)"name", __pyx_getprop_6pysdif_7_pysdif_9Component_name, 0, __Pyx_DOCSTR(__pyx_k_47), 0},
  {(char *)"num", __pyx_getprop_6pysdif_7_pysdif_9Component_num, 0, __Pyx_DOCSTR(__pyx_k_48), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Component = {
  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_Component = {
  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_Component = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Component = {
  #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_6pysdif_7_pysdif_Component = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.Component"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_Component), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_Component, /*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_6pysdif_7_pysdif_9Component_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Component, /*tp_as_number*/
  &__pyx_tp_as_sequence_Component, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Component, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Component, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Component(str signature, str name)"), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_Component, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_Component, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_Component, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_Component, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_6pysdif_7_pysdif_9Component___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pysdif_7_pysdif_Component, /*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 PyObject *__pyx_tp_new_6pysdif_7_pysdif_FrameTypeDefinition(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)o);
  p->signature = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->components = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_FrameTypeDefinition(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)o;
  Py_XDECREF(((PyObject *)p->signature));
  Py_XDECREF(((PyObject *)p->components));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_FrameTypeDefinition(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)o;
  if (p->signature) {
    e = (*v)(p->signature, a); if (e) return e;
  }
  if (p->components) {
    e = (*v)(p->components, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_FrameTypeDefinition(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->signature);
  p->signature = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->components);
  p->components = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_19FrameTypeDefinition_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature___get__(o);
}

static int __pyx_setprop_6pysdif_7_pysdif_19FrameTypeDefinition_signature(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature_1__set__(o, v);
  }
  else {
    return __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_9signature_2__del__(o);
  }
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_19FrameTypeDefinition_components(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components___get__(o);
}

static int __pyx_setprop_6pysdif_7_pysdif_19FrameTypeDefinition_components(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components_1__set__(o, v);
  }
  else {
    return __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_10components_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_FrameTypeDefinition[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_FrameTypeDefinition[] = {
  {(char *)"signature", __pyx_getprop_6pysdif_7_pysdif_19FrameTypeDefinition_signature, __pyx_setprop_6pysdif_7_pysdif_19FrameTypeDefinition_signature, __Pyx_DOCSTR(__pyx_k_46), 0},
  {(char *)"components", __pyx_getprop_6pysdif_7_pysdif_19FrameTypeDefinition_components, __pyx_setprop_6pysdif_7_pysdif_19FrameTypeDefinition_components, __Pyx_DOCSTR(__pyx_k_49), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_FrameTypeDefinition = {
  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_FrameTypeDefinition = {
  __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_3__len__, /*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_FrameTypeDefinition = {
  __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_FrameTypeDefinition = {
  #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_6pysdif_7_pysdif_FrameTypeDefinition = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.FrameTypeDefinition"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_FrameTypeDefinition), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_FrameTypeDefinition, /*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_6pysdif_7_pysdif_19FrameTypeDefinition_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_FrameTypeDefinition, /*tp_as_number*/
  &__pyx_tp_as_sequence_FrameTypeDefinition, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_FrameTypeDefinition, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_FrameTypeDefinition, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("FrameTypeDefinition(signature, components)"), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_FrameTypeDefinition, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_FrameTypeDefinition, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition_2__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_FrameTypeDefinition, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_FrameTypeDefinition, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_6pysdif_7_pysdif_19FrameTypeDefinition___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pysdif_7_pysdif_FrameTypeDefinition, /*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 PyObject *__pyx_tp_new_6pysdif_7_pysdif_FrameR(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameR *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)o);
  p->source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_6pysdif_7_pysdif_6FrameR___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_FrameR(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameR *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameR *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_6pysdif_7_pysdif_6FrameR_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->source));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_FrameR(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_FrameR *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameR *)o;
  if (p->source) {
    e = (*v)(((PyObject*)p->source), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_FrameR(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameR *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameR *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->source);
  p->source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_9signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_numerical_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_19numerical_signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_size(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_4size___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_num_matrices(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_12num_matrices___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_id(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_2id___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_time(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_4time___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6FrameR_matrix_idx(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6FrameR_10matrix_idx___get__(o);
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_FrameR[] = {
  {__Pyx_NAMESTR("matrix_exists"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6FrameR_3matrix_exists, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6FrameR_3matrix_exists)},
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6FrameR_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6FrameR_5__next__)},
  {__Pyx_NAMESTR("get_matrix_data"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6FrameR_6get_matrix_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6FrameR_6get_matrix_data)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_FrameR[] = {
  {(char *)"signature", __pyx_getprop_6pysdif_7_pysdif_6FrameR_signature, 0, 0, 0},
  {(char *)"numerical_signature", __pyx_getprop_6pysdif_7_pysdif_6FrameR_numerical_signature, 0, 0, 0},
  {(char *)"size", __pyx_getprop_6pysdif_7_pysdif_6FrameR_size, 0, 0, 0},
  {(char *)"num_matrices", __pyx_getprop_6pysdif_7_pysdif_6FrameR_num_matrices, 0, 0, 0},
  {(char *)"id", __pyx_getprop_6pysdif_7_pysdif_6FrameR_id, 0, 0, 0},
  {(char *)"time", __pyx_getprop_6pysdif_7_pysdif_6FrameR_time, 0, 0, 0},
  {(char *)"matrix_idx", __pyx_getprop_6pysdif_7_pysdif_6FrameR_matrix_idx, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_FrameR = {
  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_FrameR = {
  __pyx_pf_6pysdif_7_pysdif_6FrameR_2__len__, /*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_FrameR = {
  __pyx_pf_6pysdif_7_pysdif_6FrameR_2__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_FrameR = {
  #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_6pysdif_7_pysdif_FrameR = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.FrameR"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_FrameR), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_FrameR, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_FrameR, /*tp_as_number*/
  &__pyx_tp_as_sequence_FrameR, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_FrameR, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_FrameR, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    FrameR is really an iterator class,\n    to be able to iterate through matrices. FrameR\n    keeps a connection to its source SdifFile but all\n    managing and indexing is done by the SdifFile, to\n    keep things central. In particular, the matrices \n    resulting from calling its 'next()' method (or iterating\n    with 'for') have no connection to the FrameR and talk \n    directly to the SdifFile, which, eventually, updates\n    the FrameR if needed.\n    It is only used for reading and, in particular, one\n    would never create a FrameR but receive it as result of\n    iterating through a SdifFile\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_FrameR, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_FrameR, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_6pysdif_7_pysdif_6FrameR_4__iter__, /*tp_iter*/
  __pyx_pf_6pysdif_7_pysdif_6FrameR_5__next__, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_FrameR, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_FrameR, /*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_6pysdif_7_pysdif_FrameR, /*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 struct __pyx_vtabstruct_6pysdif_7_pysdif_SdifFile __pyx_vtable_6pysdif_7_pysdif_SdifFile;

static PyObject *__pyx_tp_new_6pysdif_7_pysdif_SdifFile(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pysdif_7_pysdif_SdifFile;
  p->frame = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)Py_None); Py_INCREF(Py_None);
  p->matrix = ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_6pysdif_7_pysdif_8SdifFile___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_SdifFile(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *p = (struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_6pysdif_7_pysdif_8SdifFile_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->frame));
  Py_XDECREF(((PyObject *)p->matrix));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_SdifFile(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *p = (struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)o;
  if (p->frame) {
    e = (*v)(((PyObject*)p->frame), a); if (e) return e;
  }
  if (p->matrix) {
    e = (*v)(((PyObject*)p->matrix), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_SdifFile(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_SdifFile *p = (struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->frame);
  p->frame = ((struct __pyx_obj_6pysdif_7_pysdif_FrameR *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->matrix);
  p->matrix = ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_name(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_4name___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_mode(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_4mode___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_is_seekable(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_11is_seekable___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_numerical_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_19numerical_signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_9signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_prev_time(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_9prev_time___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_pos(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_9frame_pos___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_cols(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_11matrix_cols___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_rows(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_11matrix_rows___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_data_type(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_16matrix_data_type___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrices_in_frame(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_17matrices_in_frame___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_id(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_8frame_id___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_pos(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_3pos___get__(o);
}

static int __pyx_setprop_6pysdif_7_pysdif_8SdifFile_pos(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6pysdif_7_pysdif_8SdifFile_3pos_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_numerical_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_25frame_numerical_signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_15frame_signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_numerical_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_26matrix_numerical_signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_16matrix_signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_time(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_4time___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_last_error(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_10last_error___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_is_selected(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_17frame_is_selected___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_is_selected(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_18matrix_is_selected___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_number_of_NVTs(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_14number_of_NVTs___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_8SdifFile_eof(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_8SdifFile_3eof___get__(o);
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_SdifFile[] = {
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_3close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_3close)},
  {__Pyx_NAMESTR("read_frame_header"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_4read_frame_header, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_4read_frame_header)},
  {__Pyx_NAMESTR("skip_frame_data"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_5skip_frame_data, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_5skip_frame_data)},
  {__Pyx_NAMESTR("read_matrix_header"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_6read_matrix_header, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_6read_matrix_header)},
  {__Pyx_NAMESTR("skip_matrix_data"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_7skip_matrix_data, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_7skip_matrix_data)},
  {__Pyx_NAMESTR("get_matrix_data"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_8get_matrix_data, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_8get_matrix_data)},
  {__Pyx_NAMESTR("skip_matrix"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_9skip_matrix, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_9skip_matrix)},
  {__Pyx_NAMESTR("status"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_10status, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_10status)},
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_12__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_next_matrix"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_13get_next_matrix, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_13get_next_matrix)},
  {__Pyx_NAMESTR("rewind"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_14rewind, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_14rewind)},
  {__Pyx_NAMESTR("_rewind"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_15_rewind, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_15_rewind)},
  {__Pyx_NAMESTR("_read_padding"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_16_read_padding, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_16_read_padding)},
  {__Pyx_NAMESTR("add_NVT"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_17add_NVT, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_17add_NVT)},
  {__Pyx_NAMESTR("add_matrix_type"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_18add_matrix_type, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_18add_matrix_type)},
  {__Pyx_NAMESTR("add_frame_type"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_19add_frame_type, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_19add_frame_type)},
  {__Pyx_NAMESTR("clone_type_definitions"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_20clone_type_definitions, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_20clone_type_definitions)},
  {__Pyx_NAMESTR("clone_NVTs"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_21clone_NVTs, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_21clone_NVTs)},
  {__Pyx_NAMESTR("clone_definitions"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_22clone_definitions, METH_O, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_22clone_definitions)},
  {__Pyx_NAMESTR("clone_frames"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_23clone_frames, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_23clone_frames)},
  {__Pyx_NAMESTR("add_streamID"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_24add_streamID, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_24add_streamID)},
  {__Pyx_NAMESTR("add_predefined_type"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_25add_predefined_type, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_25add_predefined_type)},
  {__Pyx_NAMESTR("write_all_ascii_chunks"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_26write_all_ascii_chunks, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_26write_all_ascii_chunks)},
  {__Pyx_NAMESTR("new_frame"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_27new_frame, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_27new_frame)},
  {__Pyx_NAMESTR("new_frame_one_matrix"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_28new_frame_one_matrix, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_28new_frame_one_matrix)},
  {__Pyx_NAMESTR("print_NVT"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_29print_NVT, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_29print_NVT)},
  {__Pyx_NAMESTR("print_general_header"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_30print_general_header, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_30print_general_header)},
  {__Pyx_NAMESTR("print_all_ascii_chunks"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_31print_all_ascii_chunks, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_31print_all_ascii_chunks)},
  {__Pyx_NAMESTR("print_all_types"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_32print_all_types, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_32print_all_types)},
  {__Pyx_NAMESTR("print_matrix_header"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_33print_matrix_header, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_33print_matrix_header)},
  {__Pyx_NAMESTR("print_one_row"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_34print_one_row, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_34print_one_row)},
  {__Pyx_NAMESTR("print_frame_header"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_35print_frame_header, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_35print_frame_header)},
  {__Pyx_NAMESTR("print_all_stream_ID"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_36print_all_stream_ID, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_36print_all_stream_ID)},
  {__Pyx_NAMESTR("frame_types_to_string"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_37frame_types_to_string, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_37frame_types_to_string)},
  {__Pyx_NAMESTR("get_frame_types"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_38get_frame_types, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_38get_frame_types)},
  {__Pyx_NAMESTR("matrix_types_to_string"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_39matrix_types_to_string, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_39matrix_types_to_string)},
  {__Pyx_NAMESTR("get_matrix_types"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_40get_matrix_types, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_40get_matrix_types)},
  {__Pyx_NAMESTR("get_NVTs"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_41get_NVTs, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_41get_NVTs)},
  {__Pyx_NAMESTR("get_stream_IDs"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_8SdifFile_42get_stream_IDs, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_8SdifFile_42get_stream_IDs)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_SdifFile[] = {
  {(char *)"name", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_name, 0, 0, 0},
  {(char *)"mode", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_mode, 0, 0, 0},
  {(char *)"is_seekable", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_is_seekable, 0, 0, 0},
  {(char *)"numerical_signature", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_numerical_signature, 0, 0, 0},
  {(char *)"signature", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_signature, 0, 0, 0},
  {(char *)"prev_time", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_prev_time, 0, 0, 0},
  {(char *)"frame_pos", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_pos, 0, 0, 0},
  {(char *)"matrix_cols", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_cols, 0, 0, 0},
  {(char *)"matrix_rows", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_rows, 0, 0, 0},
  {(char *)"matrix_data_type", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_data_type, 0, 0, 0},
  {(char *)"matrices_in_frame", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrices_in_frame, 0, 0, 0},
  {(char *)"frame_id", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_id, 0, 0, 0},
  {(char *)"pos", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_pos, __pyx_setprop_6pysdif_7_pysdif_8SdifFile_pos, 0, 0},
  {(char *)"frame_numerical_signature", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_numerical_signature, 0, 0, 0},
  {(char *)"frame_signature", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_signature, 0, 0, 0},
  {(char *)"matrix_numerical_signature", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_numerical_signature, 0, 0, 0},
  {(char *)"matrix_signature", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_signature, 0, 0, 0},
  {(char *)"time", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_time, 0, 0, 0},
  {(char *)"last_error", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_last_error, 0, 0, 0},
  {(char *)"frame_is_selected", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_frame_is_selected, 0, 0, 0},
  {(char *)"matrix_is_selected", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_matrix_is_selected, 0, 0, 0},
  {(char *)"number_of_NVTs", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_number_of_NVTs, 0, 0, 0},
  {(char *)"eof", __pyx_getprop_6pysdif_7_pysdif_8SdifFile_eof, 0, __Pyx_DOCSTR(__pyx_k_50), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SdifFile = {
  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_SdifFile = {
  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_SdifFile = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SdifFile = {
  #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_6pysdif_7_pysdif_SdifFile = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.SdifFile"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_SdifFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_SdifFile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_SdifFile, /*tp_as_number*/
  &__pyx_tp_as_sequence_SdifFile, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SdifFile, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SdifFile, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("SdifFile(filename, mode='r', predefined_type=None)\n\n    SdifFile(filename, mode=\"r\")\n    \n    mode is \"r\":read | \"w\": write | \"wr\" or \"rw\":read-write\n    \n    this is the low level interface for reading and writing sdif files\n    it mirrors the sdif library quite transparently so that the example files\n    and utilities using it can be directly translated with it. in particular\n    it does not create any intermediate objects, even the data of the matrices\n    is a numpy array mapped to the c array read from disk, so no allocation takes\n    place. \n    \n    to read for ex. 1TRC format:\n    \n    sdif_file = SdifFile('filename.sdif')\n    sig1TRC = str2signature(\"1TRC\")\n    while not sdif_file.eof:\n        sdif_file.read_frame_header()\n        if sdif_file.frame_numerical_signature) == sig1TRC:\n            print sdif_file.time\n            for n in range(sdif_file.matrices_in_frame):\n                sdif_file.read_matrix_header()\n                if sdif_file.matrix_numerical_signature == sig1TRC:\n                    data = sdif_file.get_matrix_data() \n                    # data is now a numpy array but you must copy the data if \n                    # you intend to keep it after you have read the matrix.\n                    # One you read a new matrix, this data will be no longer valid\n                    print data\n        \n    a more natural way:\n    \n    sdif_file = SdifFile('filename.sdif')\n    for frame in sdif_file:\n        if frame.signature == \"1TRC\":\n            print frame.time\n            for matrix in frame:\n                if matrix.signature == \"1TRC\":\n                    print matrix.get_data()\n    \n    the frames and the matrices resulting from the iteration\n    are only guaranteed to be valid as long as no new frames and matrices are read\n    \n    to write a SdifFile:\n    \n    f = SdifFile('new_sdif.sdif', 'w')\n    # these are optional\n    f.add_NVT({\n        'name' : 'my name',\n        'date' : time.asctime(time.localtime())\n    })\n    f.add_frame_type('1NEW', '1ABC NewMatrix, 1FQ0 New1FQ0')\n    f.add_matrix_type('1ABC', 'Column1, Column2')\n    # now you can begin adding frames\n    frame = f.new_frame('1NEW', time_now)\n    frame.add_matrix('1ABC', array([\n        [0,     1.2],\n        [3.5,   8.13],\n        ...\n        ]))\n    frame.write()\n    \n    # say we just want to take the data from an existing\n    # sdiffile, modify it and write it back\n    in_sdif = SdifFile(\"existing-file.sdif\")\n    out_sdif = SdifFile(\"outfile.sdif\", \"w\")\n    out_sdif.clone_definitions(in_sdif)\n    for in_frame in in_sdif:\n        if in_frame.signature == \"1NEW\":\n            new_frame = out_sdif.new_frame(\"1NEW\", in_frame.time)\n            in_data = in_frame.get_matrix_data() # we know there is only one matrix\n            # multiply the second column by 0.5\n            in_data[:,1] *= 0.5\n            new_frame.add_matrix('1ABC', in_data)\n            new_frame.write()\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_SdifFile, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_SdifFile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_6pysdif_7_pysdif_8SdifFile_11__iter__, /*tp_iter*/
  __pyx_pf_6pysdif_7_pysdif_8SdifFile_12__next__, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_SdifFile, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_SdifFile, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_6pysdif_7_pysdif_8SdifFile_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pysdif_7_pysdif_SdifFile, /*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 PyObject *__pyx_tp_new_6pysdif_7_pysdif_Matrix(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_Matrix *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_Matrix *)o);
  p->source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None); Py_INCREF(Py_None);
  p->data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_6pysdif_7_pysdif_6Matrix___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_Matrix(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_Matrix *p = (struct __pyx_obj_6pysdif_7_pysdif_Matrix *)o;
  Py_XDECREF(((PyObject *)p->source));
  Py_XDECREF(((PyObject *)p->data));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_Matrix(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_Matrix *p = (struct __pyx_obj_6pysdif_7_pysdif_Matrix *)o;
  if (p->source) {
    e = (*v)(((PyObject*)p->source), a); if (e) return e;
  }
  if (p->data) {
    e = (*v)(((PyObject*)p->data), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_Matrix(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_Matrix *p = (struct __pyx_obj_6pysdif_7_pysdif_Matrix *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->source);
  p->source = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->data);
  p->data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6Matrix_rows(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6Matrix_4rows___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6Matrix_cols(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6Matrix_4cols___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6Matrix_dtype(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6Matrix_5dtype___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6Matrix_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6Matrix_9signature___get__(o);
}

static PyObject *__pyx_getprop_6pysdif_7_pysdif_6Matrix_numerical_signature(PyObject *o, void *x) {
  return __pyx_pf_6pysdif_7_pysdif_6Matrix_19numerical_signature___get__(o);
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_Matrix[] = {
  {__Pyx_NAMESTR("get_data"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6Matrix_1get_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6Matrix_1get_data)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6Matrix_2copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6Matrix_2copy)},
  {__Pyx_NAMESTR("skip"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6Matrix_3skip, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6Matrix_3skip)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pysdif_7_pysdif_Matrix[] = {
  {(char *)"rows", __pyx_getprop_6pysdif_7_pysdif_6Matrix_rows, 0, 0, 0},
  {(char *)"cols", __pyx_getprop_6pysdif_7_pysdif_6Matrix_cols, 0, 0, 0},
  {(char *)"dtype", __pyx_getprop_6pysdif_7_pysdif_6Matrix_dtype, 0, 0, 0},
  {(char *)"signature", __pyx_getprop_6pysdif_7_pysdif_6Matrix_signature, 0, 0, 0},
  {(char *)"numerical_signature", __pyx_getprop_6pysdif_7_pysdif_6Matrix_numerical_signature, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Matrix = {
  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_Matrix = {
  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_Matrix = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Matrix = {
  #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_6pysdif_7_pysdif_Matrix = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.Matrix"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_Matrix), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_Matrix, /*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_6pysdif_7_pysdif_6Matrix_4__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Matrix, /*tp_as_number*/
  &__pyx_tp_as_sequence_Matrix, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Matrix, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Matrix, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Matrix is only a placeholder class to\n    iterate through data while reading a SdifFile\n    \n    in particular the default behaviour is that\n    when you are given a Matrix, this is only valid\n    until a new one is read.\n    \n    See the methods 'get_data' and 'copy' for a better\n    explanation of how to make the data in the Matrix \n    persistent\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_Matrix, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_Matrix, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_Matrix, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pysdif_7_pysdif_Matrix, /*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_6pysdif_7_pysdif_Matrix, /*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 PyObject *__pyx_tp_new_6pysdif_7_pysdif_FrameW(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameW *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pysdif_7_pysdif_FrameW *)o);
  p->sdiffile = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None); Py_INCREF(Py_None);
  p->matrices = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->signatures = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pysdif_7_pysdif_FrameW(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameW *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameW *)o;
  Py_XDECREF(((PyObject *)p->sdiffile));
  Py_XDECREF(((PyObject *)p->matrices));
  Py_XDECREF(((PyObject *)p->signatures));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pysdif_7_pysdif_FrameW(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pysdif_7_pysdif_FrameW *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameW *)o;
  if (p->sdiffile) {
    e = (*v)(((PyObject*)p->sdiffile), a); if (e) return e;
  }
  if (p->matrices) {
    e = (*v)(p->matrices, a); if (e) return e;
  }
  if (p->signatures) {
    e = (*v)(p->signatures, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pysdif_7_pysdif_FrameW(PyObject *o) {
  struct __pyx_obj_6pysdif_7_pysdif_FrameW *p = (struct __pyx_obj_6pysdif_7_pysdif_FrameW *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->sdiffile);
  p->sdiffile = ((struct __pyx_obj_6pysdif_7_pysdif_SdifFile *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->matrices);
  p->matrices = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->signatures);
  p->signatures = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6pysdif_7_pysdif_FrameW[] = {
  {__Pyx_NAMESTR("add_matrix"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6FrameW_1add_matrix, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6FrameW_1add_matrix)},
  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_6pysdif_7_pysdif_6FrameW_2write, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pysdif_7_pysdif_6FrameW_2write)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_FrameW = {
  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_FrameW = {
  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_FrameW = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_FrameW = {
  #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_6pysdif_7_pysdif_FrameW = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pysdif._pysdif.FrameW"), /*tp_name*/
  sizeof(struct __pyx_obj_6pysdif_7_pysdif_FrameW), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pysdif_7_pysdif_FrameW, /*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_6pysdif_7_pysdif_6FrameW___repr__, /*tp_repr*/
  &__pyx_tp_as_number_FrameW, /*tp_as_number*/
  &__pyx_tp_as_sequence_FrameW, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_FrameW, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_FrameW, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    FrameW : class to write frames to a SdifFile\n    \n    one does not create instances of this class directly but\n    you get an instance by calling\n    frame_to_write = sdiffile.new_frame(signature, time, streamID)\n    \n    then:\n    frame_to_write.add_matrix(signature, numpy_array)\n    \n    and last:\n    frame_to_write.write()   # this writes it to the sdiffile\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pysdif_7_pysdif_FrameW, /*tp_traverse*/
  __pyx_tp_clear_6pysdif_7_pysdif_FrameW, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pysdif_7_pysdif_FrameW, /*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_6pysdif_7_pysdif_FrameW, /*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[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_pysdif"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1},
  {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 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_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
  {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
  {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
  {&__pyx_kp_u_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0, 0},
  {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_u_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_n_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 1},
  {&__pyx_n_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 1},
  {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
  {&__pyx_n_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 1},
  {&__pyx_n_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 1},
  {&__pyx_n_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 1},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
  {&__pyx_n_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 1},
  {&__pyx_n_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 1},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_kp_s__1ABC, __pyx_k__1ABC, sizeof(__pyx_k__1ABC), 0, 0, 1, 0},
  {&__pyx_kp_s__1MTX, __pyx_k__1MTX, sizeof(__pyx_k__1MTX), 0, 0, 1, 0},
  {&__pyx_n_s__ColumnaA, __pyx_k__ColumnaA, sizeof(__pyx_k__ColumnaA), 0, 0, 1, 1},
  {&__pyx_n_s__NPY_ULONg, __pyx_k__NPY_ULONg, sizeof(__pyx_k__NPY_ULONg), 0, 0, 1, 1},
  {&__pyx_n_s__RBEP, __pyx_k__RBEP, sizeof(__pyx_k__RBEP), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__SDIF_NEWTYPES, __pyx_k__SDIF_NEWTYPES, sizeof(__pyx_k__SDIF_NEWTYPES), 0, 0, 1, 1},
  {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____file__, __pyx_k____file__, sizeof(__pyx_k____file__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s___cleanup, __pyx_k___cleanup, sizeof(__pyx_k___cleanup), 0, 0, 1, 1},
  {&__pyx_n_s___init, __pyx_k___init, sizeof(__pyx_k___init), 0, 0, 1, 1},
  {&__pyx_n_s__add_NVT, __pyx_k__add_NVT, sizeof(__pyx_k__add_NVT), 0, 0, 1, 1},
  {&__pyx_n_s__add_frame_type, __pyx_k__add_frame_type, sizeof(__pyx_k__add_frame_type), 0, 0, 1, 1},
  {&__pyx_n_s__add_matrix, __pyx_k__add_matrix, sizeof(__pyx_k__add_matrix), 0, 0, 1, 1},
  {&__pyx_n_s__add_matrix_type, __pyx_k__add_matrix_type, sizeof(__pyx_k__add_matrix_type), 0, 0, 1, 1},
  {&__pyx_n_s__add_predefined_type, __pyx_k__add_predefined_type, sizeof(__pyx_k__add_predefined_type), 0, 0, 1, 1},
  {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
  {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1},
  {&__pyx_n_s__c_numpy, __pyx_k__c_numpy, sizeof(__pyx_k__c_numpy), 0, 0, 1, 1},
  {&__pyx_n_s__char, __pyx_k__char, sizeof(__pyx_k__char), 0, 0, 1, 1},
  {&__pyx_n_s__clone_NVTs, __pyx_k__clone_NVTs, sizeof(__pyx_k__clone_NVTs), 0, 0, 1, 1},
  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  {&__pyx_n_s__cols, __pyx_k__cols, sizeof(__pyx_k__cols), 0, 0, 1, 1},
  {&__pyx_n_s__column_names, __pyx_k__column_names, sizeof(__pyx_k__column_names), 0, 0, 1, 1},
  {&__pyx_n_s__components, __pyx_k__components, sizeof(__pyx_k__components), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__data_array, __pyx_k__data_array, sizeof(__pyx_k__data_array), 0, 0, 1, 1},
  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
  {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
  {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1},
  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
  {&__pyx_n_s__frame_sig, __pyx_k__frame_sig, sizeof(__pyx_k__frame_sig), 0, 0, 1, 1},
  {&__pyx_n_s__frame_types, __pyx_k__frame_types, sizeof(__pyx_k__frame_types), 0, 0, 1, 1},
  {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
  {&__pyx_n_s__get_NVTs, __pyx_k__get_NVTs, sizeof(__pyx_k__get_NVTs), 0, 0, 1, 1},
  {&__pyx_n_s__get_data, __pyx_k__get_data, sizeof(__pyx_k__get_data), 0, 0, 1, 1},
  {&__pyx_n_s__get_frame_types, __pyx_k__get_frame_types, sizeof(__pyx_k__get_frame_types), 0, 0, 1, 1},
  {&__pyx_n_s__get_matrix_data, __pyx_k__get_matrix_data, sizeof(__pyx_k__get_matrix_data), 0, 0, 1, 1},
  {&__pyx_n_s__get_matrix_types, __pyx_k__get_matrix_types, sizeof(__pyx_k__get_matrix_types), 0, 0, 1, 1},
  {&__pyx_n_s__get_next_matrix, __pyx_k__get_next_matrix, sizeof(__pyx_k__get_next_matrix), 0, 0, 1, 1},
  {&__pyx_n_s__int16, __pyx_k__int16, sizeof(__pyx_k__int16), 0, 0, 1, 1},
  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
  {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1},
  {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1},
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__matrices_in_frame, __pyx_k__matrices_in_frame, sizeof(__pyx_k__matrices_in_frame), 0, 0, 1, 1},
  {&__pyx_n_s__matrix_sig, __pyx_k__matrix_sig, sizeof(__pyx_k__matrix_sig), 0, 0, 1, 1},
  {&__pyx_n_s__matrix_types, __pyx_k__matrix_types, sizeof(__pyx_k__matrix_types), 0, 0, 1, 1},
  {&__pyx_n_s__meta, __pyx_k__meta, sizeof(__pyx_k__meta), 0, 0, 1, 1},
  {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__new_frame, __pyx_k__new_frame, sizeof(__pyx_k__new_frame), 0, 0, 1, 1},
  {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1},
  {&__pyx_n_s__numid, __pyx_k__numid, sizeof(__pyx_k__numid), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
  {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
  {&__pyx_n_s__predefined_type, __pyx_k__predefined_type, sizeof(__pyx_k__predefined_type), 0, 0, 1, 1},
  {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__read_frame_header, __pyx_k__read_frame_header, sizeof(__pyx_k__read_frame_header), 0, 0, 1, 1},
  {&__pyx_n_s__read_matrix_header, __pyx_k__read_matrix_header, sizeof(__pyx_k__read_matrix_header), 0, 0, 1, 1},
  {&__pyx_n_s__resize, __pyx_k__resize, sizeof(__pyx_k__resize), 0, 0, 1, 1},
  {&__pyx_n_s__rows, __pyx_k__rows, sizeof(__pyx_k__rows), 0, 0, 1, 1},
  {&__pyx_n_s__rw, __pyx_k__rw, sizeof(__pyx_k__rw), 0, 0, 1, 1},
  {&__pyx_n_s__sep, __pyx_k__sep, sizeof(__pyx_k__sep), 0, 0, 1, 1},
  {&__pyx_n_s__signature, __pyx_k__signature, sizeof(__pyx_k__signature), 0, 0, 1, 1},
  {&__pyx_n_s__signature2str, __pyx_k__signature2str, sizeof(__pyx_k__signature2str), 0, 0, 1, 1},
  {&__pyx_n_s__signatures_to_clone, __pyx_k__signatures_to_clone, sizeof(__pyx_k__signatures_to_clone), 0, 0, 1, 1},
  {&__pyx_n_s__skip_matrix_data, __pyx_k__skip_matrix_data, sizeof(__pyx_k__skip_matrix_data), 0, 0, 1, 1},
  {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1},
  {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
  {&__pyx_n_s__str2signature, __pyx_k__str2signature, sizeof(__pyx_k__str2signature), 0, 0, 1, 1},
  {&__pyx_n_s__streamID, __pyx_k__streamID, sizeof(__pyx_k__streamID), 0, 0, 1, 1},
  {&__pyx_n_s__test_write, __pyx_k__test_write, sizeof(__pyx_k__test_write), 0, 0, 1, 1},
  {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1},
  {&__pyx_n_s__treeway, __pyx_k__treeway, sizeof(__pyx_k__treeway), 0, 0, 1, 1},
  {&__pyx_n_s__uint16, __pyx_k__uint16, sizeof(__pyx_k__uint16), 0, 0, 1, 1},
  {&__pyx_n_s__uint32, __pyx_k__uint32, sizeof(__pyx_k__uint32), 0, 0, 1, 1},
  {&__pyx_n_s__uint64, __pyx_k__uint64, sizeof(__pyx_k__uint64), 0, 0, 1, 1},
  {&__pyx_n_s__uint8, __pyx_k__uint8, sizeof(__pyx_k__uint8), 0, 0, 1, 1},
  {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
  {&__pyx_n_s__wr, __pyx_k__wr, sizeof(__pyx_k__wr), 0, 0, 1, 1},
  {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __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[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_basestring = __Pyx_GetName(__pyx_b, __pyx_n_s__basestring); if (!__pyx_builtin_basestring) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __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[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "pysdif/_pysdif.pyx":210
 * 
 * cdef StreamID_fromSdifStreadIDT(SdifStreamIDT *this):
 *     cdef StreamID out = StreamID(-1, None, None)  # create a wrapper             # <<<<<<<<<<<<<<
 *     out.this = this
 *     out.own_this = 0
 */
  __pyx_k_tuple_2 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

  /* "pysdif/_pysdif.pyx":482
 *         new matrix is read
 *         """
 *         cdef Matrix new = Matrix(None)             # <<<<<<<<<<<<<<
 *         new.data = self.get_data().copy()
 *         new._signature = self.source_this.CurrMtrxH.Signature
 */
  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));

  /* "pysdif/_pysdif.pyx":752
 *         if mode == "r":
 *             if not os.path.exists(filename):
 *                 raise RuntimeError("path not found, cannot open sdif file for reading")             # <<<<<<<<<<<<<<
 *         self.this = SdifFOpen(filename, _SDIF_FILEMODE[mode])
 * 
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "pysdif/_pysdif.pyx":1039
 *         """
 *         if isinstance(column_names, basestring):
 *             column_names = column_names.split(",")             # <<<<<<<<<<<<<<
 *         cdef SdifMatrixTypeT *mt = MatrixType_create(signature, column_names)
 *         SdifPutMatrixType(self.this.MatrixTypesTable, mt)
 */
  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "pysdif/_pysdif.pyx":1058
 *         if isinstance(components, basestring):
 *             if ',' in components:
 *                 components = components.split(",")             # <<<<<<<<<<<<<<
 *             else:
 *                 components = components.split(';')
 */
  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

  /* "pysdif/_pysdif.pyx":1060
 *                 components = components.split(",")
 *             else:
 *                 components = components.split(';')             # <<<<<<<<<<<<<<
 *             components = [component.split() for component in components]
 *         cdef SdifFrameTypeT *ft = FrameType_create(signature, components)
 */
  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "pysdif/_pysdif.pyx":1152
 *                 self.add_matrix_type(*matrix_type)
 *         else:
 *             raise ValueError("Definition of sdif type not found")             # <<<<<<<<<<<<<<
 * 
 *     def write_all_ascii_chunks(self):
 */
  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));

  /* "pysdif/_pysdif.pyx":1340
 * def test_write(filename):
 *     s = SdifFile(filename, "w")
 *     s.add_matrix_type("1MTX", "ColumnaA")             # <<<<<<<<<<<<<<
 *     s.add_frame_type("1ABC", "1MTX pupu")
 *     s.add_NVT({"meta":"data"})
 */
  __pyx_k_tuple_27 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s__1MTX));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s__1MTX));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__1MTX));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ColumnaA));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 1, ((PyObject *)__pyx_n_s__ColumnaA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ColumnaA));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));

  /* "pysdif/_pysdif.pyx":1341
 *     s = SdifFile(filename, "w")
 *     s.add_matrix_type("1MTX", "ColumnaA")
 *     s.add_frame_type("1ABC", "1MTX pupu")             # <<<<<<<<<<<<<<
 *     s.add_NVT({"meta":"data"})
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)
 */
  __pyx_k_tuple_29 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s__1ABC));
  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s__1ABC));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__1ABC));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
  PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_kp_s_28));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));

  /* "pysdif/_pysdif.pyx":1344
 *     s.add_NVT({"meta":"data"})
 *     m = numpy.array([0.0, 0.1, 0.3, 0.7, 0.4], dtype=float)
 *     m.resize((5, 1))             # <<<<<<<<<<<<<<
 *     frame = s.new_frame("1ABC", 0.0)
 *     frame.add_matrix("1MTX", m)
 */
  __pyx_k_tuple_30 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30));
  __Pyx_INCREF(__pyx_int_5);
  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, __pyx_int_5);
  __Pyx_GIVEREF(__pyx_int_5);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_30, 1, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
  __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31));
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_30));
  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_k_tuple_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));

  /* "numpy.pxd":211
 *             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_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_32));
  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_u_32));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));

  /* "numpy.pxd":215
 *             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_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_34));
  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_u_34));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_34));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));

  /* "numpy.pxd":253
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_36));
  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_u_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));

  /* "numpy.pxd":795
 * 
 *         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
 */
  __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_39));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_u_39));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_39));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));

  /* "numpy.pxd":799
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_36));
  PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_u_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));

  /* "numpy.pxd":819
 *             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_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_42));
  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_u_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));

  /* "pysdif/_pysdif.pyx":326
 * SDIF_NEWTYPES = {
 *     'RBEP': {
 *         'frame_types':[('RBEP', 'RBEP ReassignedBandEnhancedPartials')],             # <<<<<<<<<<<<<<
 *         'matrix_types':[('RBEP', 'Index, Frequency, Amplitude, Phase, Bandwidth, Offset')]
 *         }
 */
  __pyx_k_tuple_54 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RBEP));
  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_n_s__RBEP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RBEP));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
  PyTuple_SET_ITEM(__pyx_k_tuple_54, 1, ((PyObject *)__pyx_kp_s_53));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));

  /* "pysdif/_pysdif.pyx":327
 *     'RBEP': {
 *         'frame_types':[('RBEP', 'RBEP ReassignedBandEnhancedPartials')],
 *         'matrix_types':[('RBEP', 'Index, Frequency, Amplitude, Phase, Bandwidth, Offset')]             # <<<<<<<<<<<<<<
 *         }
 * }
 */
  __pyx_k_tuple_56 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_56));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RBEP));
  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_n_s__RBEP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RBEP));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
  PyTuple_SET_ITEM(__pyx_k_tuple_56, 1, ((PyObject *)__pyx_kp_s_55));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_257 = PyInt_FromLong(257); if (unlikely(!__pyx_int_257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_258 = PyInt_FromLong(258); if (unlikely(!__pyx_int_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_260 = PyInt_FromLong(260); if (unlikely(!__pyx_int_260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_264 = PyInt_FromLong(264); if (unlikely(!__pyx_int_264)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_513 = PyInt_FromLong(513); if (unlikely(!__pyx_int_513)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_514 = PyInt_FromLong(514); if (unlikely(!__pyx_int_514)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_516 = PyInt_FromLong(516); if (unlikely(!__pyx_int_516)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_520 = PyInt_FromLong(520); if (unlikely(!__pyx_int_520)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_769 = PyInt_FromLong(769); if (unlikely(!__pyx_int_769)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_pysdif(void); /*proto*/
PyMODINIT_FUNC init_pysdif(void)
#else
PyMODINIT_FUNC PyInit__pysdif(void); /*proto*/
PyMODINIT_FUNC PyInit__pysdif(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__pysdif(void)");
  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;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_pysdif"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #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);
  #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 (__pyx_module_is_main_pysdif___pysdif) {
    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;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- 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 ---*/
  __pyx_v_6pysdif_7_pysdif__SDIF_FILEMODE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_6pysdif_7_pysdif__SDIF_DATATYPES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_6pysdif_7_pysdif__SDIF_TO_NUMPY_TYPENUM = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_StreamID) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "StreamID", (PyObject *)&__pyx_type_6pysdif_7_pysdif_StreamID) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_StreamID = &__pyx_type_6pysdif_7_pysdif_StreamID;
  __pyx_vtabptr_6pysdif_7_pysdif_MatrixTypeDefinition = &__pyx_vtable_6pysdif_7_pysdif_MatrixTypeDefinition;
  __pyx_vtable_6pysdif_7_pysdif_MatrixTypeDefinition.toSdifMatrixType = (SdifMatrixTypeT *(*)(struct __pyx_obj_6pysdif_7_pysdif_MatrixTypeDefinition *))__pyx_f_6pysdif_7_pysdif_20MatrixTypeDefinition_toSdifMatrixType;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_MatrixTypeDefinition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pysdif_7_pysdif_MatrixTypeDefinition.tp_dict, __pyx_vtabptr_6pysdif_7_pysdif_MatrixTypeDefinition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "MatrixTypeDefinition", (PyObject *)&__pyx_type_6pysdif_7_pysdif_MatrixTypeDefinition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_MatrixTypeDefinition = &__pyx_type_6pysdif_7_pysdif_MatrixTypeDefinition;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_Component) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Component", (PyObject *)&__pyx_type_6pysdif_7_pysdif_Component) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_Component = &__pyx_type_6pysdif_7_pysdif_Component;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_FrameTypeDefinition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "FrameTypeDefinition", (PyObject *)&__pyx_type_6pysdif_7_pysdif_FrameTypeDefinition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_FrameTypeDefinition = &__pyx_type_6pysdif_7_pysdif_FrameTypeDefinition;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_FrameR) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6pysdif_7_pysdif_FrameR, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6pysdif_7_pysdif_6FrameR_5__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pysdif_7_pysdif_6FrameR_5__next__.doc = __pyx_doc_6pysdif_7_pysdif_6FrameR_5__next__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pysdif_7_pysdif_6FrameR_5__next__;
    }
  }
  if (__Pyx_SetAttrString(__pyx_m, "FrameR", (PyObject *)&__pyx_type_6pysdif_7_pysdif_FrameR) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_FrameR = &__pyx_type_6pysdif_7_pysdif_FrameR;
  __pyx_vtabptr_6pysdif_7_pysdif_SdifFile = &__pyx_vtable_6pysdif_7_pysdif_SdifFile;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.init_read = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_init_read;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.init_containers = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_init_containers;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.init_write = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_init_write;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.finalize_frame = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_finalize_frame;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.read_signature = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_read_signature;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.read_matrix_data = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_read_matrix_data;
  __pyx_vtable_6pysdif_7_pysdif_SdifFile.reinit = (void (*)(struct __pyx_obj_6pysdif_7_pysdif_SdifFile *))__pyx_f_6pysdif_7_pysdif_8SdifFile_reinit;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_SdifFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pysdif_7_pysdif_SdifFile.tp_dict, __pyx_vtabptr_6pysdif_7_pysdif_SdifFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SdifFile", (PyObject *)&__pyx_type_6pysdif_7_pysdif_SdifFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_SdifFile = &__pyx_type_6pysdif_7_pysdif_SdifFile;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_Matrix) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Matrix", (PyObject *)&__pyx_type_6pysdif_7_pysdif_Matrix) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_Matrix = &__pyx_type_6pysdif_7_pysdif_Matrix;
  if (PyType_Ready(&__pyx_type_6pysdif_7_pysdif_FrameW) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "FrameW", (PyObject *)&__pyx_type_6pysdif_7_pysdif_FrameW) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pysdif_7_pysdif_FrameW = &__pyx_type_6pysdif_7_pysdif_FrameW;
  /*--- 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 = 151; __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 = 161; __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 = 165; __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 = 174; __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 = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "pysdif/_pysdif.pyx":11
 *     void import_array()
 * 
 * import os.path             # <<<<<<<<<<<<<<
 * import numpy
 * cimport numpy as c_numpy
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_51), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":12
 * 
 * import os.path
 * import numpy             # <<<<<<<<<<<<<<
 * cimport numpy as c_numpy
 * from numpy cimport ndarray, npy_intp
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":27
 * # ----------------------------------------------------------------------------------
 * 
 * cdef int SDIF_CLOSED = 2             # <<<<<<<<<<<<<<
 * cdef int _g_sdif_initiated = 0
 * 
 */
  __pyx_v_6pysdif_7_pysdif_SDIF_CLOSED = 2;

  /* "pysdif/_pysdif.pyx":28
 * 
 * cdef int SDIF_CLOSED = 2
 * cdef int _g_sdif_initiated = 0             # <<<<<<<<<<<<<<
 * 
 * cdef dict _SDIF_FILEMODE = {
 */
  __pyx_v_6pysdif_7_pysdif__g_sdif_initiated = 0;

  /* "pysdif/_pysdif.pyx":30
 * cdef int _g_sdif_initiated = 0
 * 
 * cdef dict _SDIF_FILEMODE = {             # <<<<<<<<<<<<<<
 *     'r' : eReadFile,
 *     'w' : eWriteFile,
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "pysdif/_pysdif.pyx":31
 * 
 * cdef dict _SDIF_FILEMODE = {
 *     'r' : eReadFile,             # <<<<<<<<<<<<<<
 *     'w' : eWriteFile,
 *     'rw': eReadWriteFile,
 */
  __pyx_t_2 = PyInt_FromLong(eReadFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__r), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":32
 * cdef dict _SDIF_FILEMODE = {
 *     'r' : eReadFile,
 *     'w' : eWriteFile,             # <<<<<<<<<<<<<<
 *     'rw': eReadWriteFile,
 *     'wr': eReadWriteFile
 */
  __pyx_t_2 = PyInt_FromLong(eWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__w), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":33
 *     'r' : eReadFile,
 *     'w' : eWriteFile,
 *     'rw': eReadWriteFile,             # <<<<<<<<<<<<<<
 *     'wr': eReadWriteFile
 * }
 */
  __pyx_t_2 = PyInt_FromLong(eReadWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__rw), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":35
 *     'rw': eReadWriteFile,
 *     'wr': eReadWriteFile
 * }             # <<<<<<<<<<<<<<
 * 
 * cdef dict _SDIF_DATATYPES = {
 */
  __pyx_t_2 = PyInt_FromLong(eReadWriteFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__wr), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XGOTREF(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_FILEMODE));
  __Pyx_DECREF(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_FILEMODE));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_v_6pysdif_7_pysdif__SDIF_FILEMODE = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":37
 * }
 * 
 * cdef dict _SDIF_DATATYPES = {             # <<<<<<<<<<<<<<
 *     0x0301:"char",
 *     0x0004:"float32",
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_769, ((PyObject *)__pyx_n_s__char)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_257, ((PyObject *)__pyx_n_s__int8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_258, ((PyObject *)__pyx_n_s__int16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_260, ((PyObject *)__pyx_n_s__int32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_264, ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_513, ((PyObject *)__pyx_n_s__uint8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_514, ((PyObject *)__pyx_n_s__uint16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_516, ((PyObject *)__pyx_n_s__uint32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_520, ((PyObject *)__pyx_n_s__uint64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_DATATYPES));
  __Pyx_DECREF(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_DATATYPES));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_v_6pysdif_7_pysdif__SDIF_DATATYPES = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":51
 *     }
 * 
 * cdef dict _SDIF_TO_NUMPY_TYPENUM = {             # <<<<<<<<<<<<<<
 *     0x0301:c_numpy.NPY_BYTE,
 *     0x0004:c_numpy.NPY_FLOAT,
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "pysdif/_pysdif.pyx":52
 * 
 * cdef dict _SDIF_TO_NUMPY_TYPENUM = {
 *     0x0301:c_numpy.NPY_BYTE,             # <<<<<<<<<<<<<<
 *     0x0004:c_numpy.NPY_FLOAT,
 *     0x0008:c_numpy.NPY_DOUBLE,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_769, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":53
 * cdef dict _SDIF_TO_NUMPY_TYPENUM = {
 *     0x0301:c_numpy.NPY_BYTE,
 *     0x0004:c_numpy.NPY_FLOAT,             # <<<<<<<<<<<<<<
 *     0x0008:c_numpy.NPY_DOUBLE,
 *     0x0101:c_numpy.NPY_BYTE,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":54
 *     0x0301:c_numpy.NPY_BYTE,
 *     0x0004:c_numpy.NPY_FLOAT,
 *     0x0008:c_numpy.NPY_DOUBLE,             # <<<<<<<<<<<<<<
 *     0x0101:c_numpy.NPY_BYTE,
 *     0x0102:c_numpy.NPY_SHORT,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":55
 *     0x0004:c_numpy.NPY_FLOAT,
 *     0x0008:c_numpy.NPY_DOUBLE,
 *     0x0101:c_numpy.NPY_BYTE,             # <<<<<<<<<<<<<<
 *     0x0102:c_numpy.NPY_SHORT,
 *     0x0104:c_numpy.NPY_INT,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_257, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":56
 *     0x0008:c_numpy.NPY_DOUBLE,
 *     0x0101:c_numpy.NPY_BYTE,
 *     0x0102:c_numpy.NPY_SHORT,             # <<<<<<<<<<<<<<
 *     0x0104:c_numpy.NPY_INT,
 *     0x0108:c_numpy.NPY_LONG,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_258, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":57
 *     0x0101:c_numpy.NPY_BYTE,
 *     0x0102:c_numpy.NPY_SHORT,
 *     0x0104:c_numpy.NPY_INT,             # <<<<<<<<<<<<<<
 *     0x0108:c_numpy.NPY_LONG,
 *     0x0201:c_numpy.NPY_UBYTE,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_260, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":58
 *     0x0102:c_numpy.NPY_SHORT,
 *     0x0104:c_numpy.NPY_INT,
 *     0x0108:c_numpy.NPY_LONG,             # <<<<<<<<<<<<<<
 *     0x0201:c_numpy.NPY_UBYTE,
 *     0x0202:c_numpy.NPY_USHORT,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_264, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":59
 *     0x0104:c_numpy.NPY_INT,
 *     0x0108:c_numpy.NPY_LONG,
 *     0x0201:c_numpy.NPY_UBYTE,             # <<<<<<<<<<<<<<
 *     0x0202:c_numpy.NPY_USHORT,
 *     0x0204:c_numpy.NPY_UINT,
 */
  __pyx_t_2 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_513, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":60
 *     0x0108:c_numpy.NPY_LONG,
 *     0x0201:c_numpy.NPY_UBYTE,
 *     0x0202:c_numpy.NPY_USHORT,             # <<<<<<<<<<<<<<
 *     0x0204:c_numpy.NPY_UINT,
 *     0x0208:c_numpy.NPY_ULONG
 */
  __pyx_t_2 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_514, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":61
 *     0x0201:c_numpy.NPY_UBYTE,
 *     0x0202:c_numpy.NPY_USHORT,
 *     0x0204:c_numpy.NPY_UINT,             # <<<<<<<<<<<<<<
 *     0x0208:c_numpy.NPY_ULONG
 *     }
 */
  __pyx_t_2 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_516, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysdif/_pysdif.pyx":62
 *     0x0202:c_numpy.NPY_USHORT,
 *     0x0204:c_numpy.NPY_UINT,
 *     0x0208:c_numpy.NPY_ULONG             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_2 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_520, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XGOTREF(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_TO_NUMPY_TYPENUM));
  __Pyx_DECREF(((PyObject *)__pyx_v_6pysdif_7_pysdif__SDIF_TO_NUMPY_TYPENUM));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_v_6pysdif_7_pysdif__SDIF_TO_NUMPY_TYPENUM = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":99
 *        ((<unsigned int>(sig[3])) & 0xff))
 * 
 * def signature2str(SdifSignature signature):             # <<<<<<<<<<<<<<
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_signature2str, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__signature2str, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":105
 *     return PyString_FromStringAndSize(SdifSignatureToString(signature), 4)
 * 
 * def str2signature(s):             # <<<<<<<<<<<<<<
 *     return _str2sig(s)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_1str2signature, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__str2signature, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":324
 * # ----------------------------------------------------------------------
 * 
 * SDIF_NEWTYPES = {             # <<<<<<<<<<<<<<
 *     'RBEP': {
 *         'frame_types':[('RBEP', 'RBEP ReassignedBandEnhancedPartials')],
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "pysdif/_pysdif.pyx":325
 * 
 * SDIF_NEWTYPES = {
 *     'RBEP': {             # <<<<<<<<<<<<<<
 *         'frame_types':[('RBEP', 'RBEP ReassignedBandEnhancedPartials')],
 *         'matrix_types':[('RBEP', 'Index, Frequency, Amplitude, Phase, Bandwidth, Offset')]
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));

  /* "pysdif/_pysdif.pyx":326
 * SDIF_NEWTYPES = {
 *     'RBEP': {
 *         'frame_types':[('RBEP', 'RBEP ReassignedBandEnhancedPartials')],             # <<<<<<<<<<<<<<
 *         'matrix_types':[('RBEP', 'Index, Frequency, Amplitude, Phase, Bandwidth, Offset')]
 *         }
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_54));
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_54));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__frame_types), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "pysdif/_pysdif.pyx":327
 *     'RBEP': {
 *         'frame_types':[('RBEP', 'RBEP ReassignedBandEnhancedPartials')],
 *         'matrix_types':[('RBEP', 'Index, Frequency, Amplitude, Phase, Bandwidth, Offset')]             # <<<<<<<<<<<<<<
 *         }
 * }
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_56));
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_56));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__matrix_types), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RBEP), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SDIF_NEWTYPES, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":331
 * }
 * 
 * def get_predefined_frames_and_matrices(sdiftype):             # <<<<<<<<<<<<<<
 *     t = SDIF_NEWTYPES.get(sdiftype)
 *     if t:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_2get_predefined_frames_and_matrices, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __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 = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":340
 * # ----------------------------------------------------------------------
 * 
 * def _init():             # <<<<<<<<<<<<<<
 *     """initialize the sdif library (SdifGenInit) and initialize the numpy API"""
 *     global _g_sdif_initiated
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_3_init, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":354
 *     return _g_sdif_initiated
 * 
 * def _cleanup():             # <<<<<<<<<<<<<<
 *     SdifGenKill()
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_4_cleanup, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cleanup, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":460
 *                 return self._signature
 * 
 *     def get_data(self, copy=True):             # <<<<<<<<<<<<<<
 *         """
 *         read the data from the matrix as a numpy array
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_10 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":564
 *         self.source.matrix_status = eMatrixHeaderRead
 *         return self.source.matrix
 *     def get_matrix_data(self, copy=True):             # <<<<<<<<<<<<<<
 *         """
 *         optimized method for frames which only have one matrix.
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_13 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1269
 * # -----------------------------------------------------------------------------------------------
 * 
 * def test_bench_read_sdif1(filename):             # <<<<<<<<<<<<<<
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_5test_bench_read_sdif1, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_57, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1277
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif2(filename):             # <<<<<<<<<<<<<<
 *     # this is the slowest version
 *     sdif_file = SdifFile(filename)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_6test_bench_read_sdif2, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_58, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1285
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif6(filename):             # <<<<<<<<<<<<<<
 *     """
 *     this is pure c, has no overhead at all and thus is a good
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_7test_bench_read_sdif6, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_59, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1310
 *     SdifFClose(f)
 * 
 * def test_bench_read_sdif3(filename):             # <<<<<<<<<<<<<<
 *     # fastest, 4 is almost the same, 2 is twice as slow...,
 *     # it should be different for frames which have
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_8test_bench_read_sdif3, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_60, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1321
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif4(filename):             # <<<<<<<<<<<<<<
 *     sdif_file = SdifFile(filename)
 *     cdef int n
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_9test_bench_read_sdif4, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_61, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1329
 *     sdif_file.close()
 * 
 * def test_bench_read_sdif5(filename):             # <<<<<<<<<<<<<<
 *     # this is the fastest for common case where a frame has only one matrix
 *     # and you do not need to check the signature of each matrix
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_10test_bench_read_sdif5, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_62, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1338
 *     sdif_file.close()
 * 
 * def test_write(filename):             # <<<<<<<<<<<<<<
 *     s = SdifFile(filename, "w")
 *     s.add_matrix_type("1MTX", "ColumnaA")
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pysdif_7_pysdif_11test_write, NULL, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__test_write, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysdif/_pysdif.pyx":1
 * #cython: embedsignature=True             # <<<<<<<<<<<<<<
 * 
 * from stdio cimport *
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "numpy.pxd":971
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    __Pyx_AddTraceback("init pysdif._pysdif", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pysdif._pysdif");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* 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) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

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;
}

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)
{
    Py_ssize_t num_expected;
    const char *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%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));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    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) {
                    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;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}


static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    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;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    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;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        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);
            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:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        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;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else if (PyErr_Occurred()) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

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));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    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_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        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
    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);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE SdifUInt4 __Pyx_PyInt_from_py_SdifUInt4(PyObject* x) {
    const SdifUInt4 neg_one = (SdifUInt4)-1, const_zero = (SdifUInt4)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(SdifUInt4) == sizeof(char)) {
        if (is_unsigned)
            return (SdifUInt4)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (SdifUInt4)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(SdifUInt4) == sizeof(short)) {
        if (is_unsigned)
            return (SdifUInt4)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (SdifUInt4)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(SdifUInt4) == sizeof(int)) {
        if (is_unsigned)
            return (SdifUInt4)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (SdifUInt4)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(SdifUInt4) == sizeof(long)) {
        if (is_unsigned)
            return (SdifUInt4)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (SdifUInt4)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(SdifUInt4) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (SdifUInt4)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (SdifUInt4)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        SdifUInt4 val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (SdifUInt4)-1;
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_SdifUInt4(SdifUInt4 val) {
    const SdifUInt4 neg_one = (SdifUInt4)-1, const_zero = (SdifUInt4)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(SdifUInt4) == sizeof(char))  ||
        (sizeof(SdifUInt4) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(SdifUInt4) == sizeof(int)) ||
               (sizeof(SdifUInt4) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(SdifUInt4) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(SdifUInt4),
                                     little, !is_unsigned);
    }
}

#if PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    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;
    }
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                return -1;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            return -1;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0 &&
                isspace(Py_CHARMASK(s[len-1])) &&
                s[len-1] != ' ')
                    PyFile_SoftSpace(f, 0);
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            return -1;
        PyFile_SoftSpace(f, 0);
    }
    return 0;
}

#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");
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItemString(kwargs, "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) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}

#endif

#if PY_MAJOR_VERSION < 3

static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    return 0;
    /* the line below is just to avoid compiler
     * 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);
    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_Py_intptr_t(Py_intptr_t val) {
    const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(Py_intptr_t) == sizeof(char))  ||
        (sizeof(Py_intptr_t) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(Py_intptr_t) == sizeof(int)) ||
               (sizeof(Py_intptr_t) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyBytes_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
            else
                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
        } else {
            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
            else
                return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
        } else {
            int result = PyUnicode_Compare(s1, s2);
            if ((result == -1) && unlikely(PyErr_Occurred()))
                return -1;
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_SdiffPosT(SdiffPosT val) {
    const SdiffPosT neg_one = (SdiffPosT)-1, const_zero = (SdiffPosT)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(SdiffPosT) == sizeof(char))  ||
        (sizeof(SdiffPosT) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(SdiffPosT) == sizeof(int)) ||
               (sizeof(SdiffPosT) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(SdiffPosT) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(SdiffPosT),
                                     little, !is_unsigned);
    }
}

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

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 (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

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 (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            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 (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

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 (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

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 (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            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 (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

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 (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

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 (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            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 (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, 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 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;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];

    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
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    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;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    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);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = 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,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

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 (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 (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  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)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   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");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
