diff --git a/README.md b/README.md index 2b5bee19..41d72542 100644 --- a/README.md +++ b/README.md @@ -3,20 +3,58 @@ Abstract: ========= -This Module imports MDF files (Measured Data Format V3.x and V4.x), typically from INCA (ETAS), CANape or CANOe. It is widely used in automotive industry to record data from ECUs. The main module mdfreader.py inherits from 2 modules (One pair for each MDF version X) : The first one to read the file's blocks descriptions (mdfinfoX) and the second (mdfXreader) to read the raw data from the file. It can optionally run multithreaded. It was built in mind to process efficiently big amount of data in a batch, endurance evaluation files for data mining. +This module imports MDF files (Measured Data Format V3.x and V4.x), typically +from INCA (ETAS), CANape or CANoe. It is widely used in the automotive industry +to record data from ECUs. The main module `mdfreader.py` inherits from two +module pairs (one per MDF version): the first reads the file's block structure +(`mdfinfoX`), and the second reads the raw data (`mdfXreader`). It can +optionally run multithreaded and was designed for efficient batch processing of +large endurance-evaluation files for data mining. + +Performance: +============ +When Cython is available (strongly recommended), mdfreader uses several +low-level optimisations: + +* **Fast CN/CC/SI/TX metadata reader** (`read_cn_chain_fast` in `dataRead.pyx`): + walks the entire MDF4 channel linked list in a single Cython function using + POSIX `pread()` (no Python file-object dispatch, no GIL during I/O) and + C packed-struct `memcpy` parsing. A fast `` bytes scan replaces + `lxml.objectify` for the common MD-block pattern (~95% of files). Result: + **3–4× speedup** on large files compared to the pure-Python path. + +* **SymBufReader**: a Cython bidirectional-buffered wrapper around the raw file + object. MDF4 metadata blocks are linked by backward-pointing pointers; + `SymBufReader` keeps a 64 KB buffer centred on the current position so that + most seeks are served from cache without a kernel `read()`. + +* **Vectorised data reading**: sorted channel groups are read in a single + `readinto()` call into a flat `uint8` buffer that is then reinterpreted as a + structured record array — zero copies, no per-chunk Python loop. + +Typical timings on a 184 MB / 36 000-channel MDF4 file: + +| Scenario | Time | +|-------------------|--------| +| Pure Python path | ~1.9 s | +| v4.2 with Cython | ~1.9 s | +| v4.3 (this version) | **~0.6 s** | The structure of the mdf object inheriting from python dict =========================================================== -for each channel: mdf[channelName] below keys exist -* data: numpy array -* unit: unit name -* master : master channel name of channelName -* masterType : type of master channel (time, angle, distance, etc.) -* description : description of channel -* conversion: (exist when reading with convertAfterRead=False) dictionary describing how to convert raw data into meaningful/physical data +For each channel `mdf[channelName]` the following keys exist: -mdf object main attribute: masterChannelList, a dict containing a list of channel names per datagroup +| Key | Description | +|-----|-------------| +| `data` | numpy array of channel values | +| `unit` | unit string | +| `master` | name of the master (time/angle/…) channel | +| `masterType` | master channel type: 0=None, 1=Time, 2=Angle, 3=Distance, 4=Index | +| `description` | channel description string | +| `conversion` | present when `convert_after_read=False`; dict describing raw→physical mapping | +`mdf.masterChannelList` is a dict mapping each master channel name to the list +of channels sampled at the same raster. Mdfreader module methods: ========================= @@ -25,58 +63,83 @@ Mdfreader module methods: * plot one channel, several channels on one graph (list) or several channels on subplots (list of lists) It is also possible to export mdf data into: -* CSV file (excel dialect by default) -* NetCDF file for a compatibility with Uniplot for instance (needs netcdf4, Scientific.IO) -* HDF5 (needs h5py) -* Excel 95 to 2003 (needs xlwt, extremely slooow, be careful about data size) -* Excel 2007/2010 (needs openpyxl, can be also slow with big files) -* Matlab .mat (needs hdf5storage) -* MDF file. It allows you to create, convert or modify data, units, description and save it again. -* Pandas dataframe(s) (only in command line, not in mdfconverter). One dataframe per raster. +* CSV file (Excel dialect by default) +* NetCDF file for compatibility with Uniplot (needs `netcdf4`, `Scientific.IO`) +* HDF5 (needs `h5py`) +* Excel 95–2003 (needs `xlwt` — very slow for large files) +* Excel 2007/2010 (needs `openpyxl` — can also be slow with large files) +* Matlab `.mat` (needs `hdf5storage`) +* MDF file — allows creating, converting or modifying data, units and descriptions +* Pandas DataFrame(s) (command line only, not in mdfconverter) — one DataFrame per raster Compatibility: ============== -This code is compatible for python 3.4+ -Evaluated for Windows and Linux platforms (x86 and AMD64) +Python 3.9+ — tested on Linux and Windows (x86-64) Requirements: ============= -Mdfreader is mostly relying on numpy/scipy/matplotlib and lxml for parsing the metadata in mdf version 4.x files +Core: `numpy`, `lxml`, `sympy` -Reading channels defined by a formula will require sympy. +`lxml` is used for MDF4 metadata XML blocks. When Cython is compiled, the fast +path handles the common `` pattern directly from bytes and only falls +back to `lxml` for complex XML (CDATA, namespaces). -Cython is strongly advised and allows to compile dataRead module for reading quickly exotic data (not byte aligned or containing hidden bytes) or only a list of channels. However, if cython compilation fails, bitarray becomes required (slower, pure python and maybe not so robust as not so much tested). +Reading channels defined by a formula requires `sympy`. -Export requirements (optional): scipy, csv, h5py, hdf5storage, xlwt(3), openpyxl, pandas +Cython is strongly advised. It compiles `dataRead.pyx`, which provides: +* fast metadata parsing via `pread()` + C packed structs +* the `SymBufReader` bidirectional file buffer +* bit-exact reading for non-byte-aligned or record-padded channels +* VLSD/VLSC string data reading helpers -Blosc for data compression (optional) +If Cython compilation fails, `bitarray` is used as a fallback (slower, pure Python). -Mdfconverter graphical user interface requires PyQt (versions 4 or 5) +Export requirements (optional): `scipy`, `h5py`, `hdf5storage`, `openpyxl`, `pandas`, `fastparquet` + +Data compression in memory (optional): `blosc` + +Graphical converter: `PyQt5` Installation: ============= -pip package existing: +From PyPI: ```shell pip install mdfreader ``` -or from source cloned from github from instance +From source: ```shell +pip install cython numpy # build prerequisites +python setup.py build_ext --inplace python setup.py develop ``` -Graphical interface: mdfconverter (PyQt4 and PyQt5) +Graphical interface: mdfconverter ================================== -User interface in PyQt4 or PyQt5 to convert batch of files is part of package. You can launch it with command 'mdfconverter' from shell. By right clicking a channel in the interface list, you can plot it. You can also drag-drop channels between columns to tune import list. Channel list from a .lab text file can be imported. You can optionally merge several files into one and even resample all of them. - -Others: -======= -In the case of big files or lack of memory, you can optionally: -* Read only a channel list (argument channel_list = ['channel', 'list'], you can get the file channel list without loading data with mdfinfo) -* Keep raw data as stored in mdf without data type conversion (argument convert_after_read=False). Data will then be converted on the fly by the other functions (plot, export_to..., get_channel_data, etc.) but raw data type will remain as in mdf file along with conversion information. -* Compress data in memory with blosc with argument compression. Default compression level is 9. -* Create a mdf dict with its metadata but without data (argument no_data_loading=True). Data will be read from file on demand by mdfreader methods (in general by get_channel_data method) - -For great data visualization, dataPlugin for Veusz (from 1.16, http://home.gna.org/veusz/) is also existing ; please follow instructions from Veusz documentation and plugin file's header. +A PyQt5 GUI to convert batches of files. Launch with: +```shell +mdfconverter +``` +Right-click a channel in the list to plot it. Channels can be dragged between +columns. A `.lab` channel-list file can be imported. Multiple files can be +merged into one and resampled. + +Memory-saving options: +====================== +For large files or limited memory: + +* **Channel list only** — pass `channel_list=['ch1', 'ch2']`; call + `mdfreader.MdfInfo(file)` to get the full channel list without loading data. +* **Raw data mode** — pass `convert_after_read=False`; data stays as stored in + the MDF file and is converted on-the-fly by `get_channel_data`, `plot`, + `export_to_*`, etc. +* **Blosc compression** — pass `compression=True` (default level 9) to compress + data in memory after reading. +* **No-data skeleton** — pass `no_data_loading=True` to build the channel + metadata dict without reading any samples; data is fetched on demand via + `get_channel_data`. + +For data visualisation, a dataPlugin for Veusz (≥ 1.16) is also available; +follow the instructions in Veusz's documentation and the plugin file's header. Command example in ipython: =========================== diff --git a/dataRead.c b/dataRead.c index a478b147..7ea3b82f 100644 --- a/dataRead.c +++ b/dataRead.c @@ -1243,6 +1243,8 @@ static CYTHON_INLINE float __PYX_NAN() { #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" #include +#include +#include #include "pythread.h" #include #ifdef _OPENMP @@ -1568,6 +1570,13 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; +/* None.proto */ +#if defined(__GNUC__) +#define __Pyx_PACKED __attribute__((__packed__)) +#else +#define __Pyx_PACKED +#endif + /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS @@ -1856,6 +1865,7 @@ static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_fro /* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ +struct __pyx_obj_8dataRead_SymBufReader; struct __pyx_array_obj; struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; @@ -1878,6 +1888,209 @@ typedef int (*__pyx_t_5numpy_NpyIter_IterNextFunc)(NpyIter *); * cdef extern from "numpy/arrayobject.h": */ typedef void (*__pyx_t_5numpy_NpyIter_GetMultiIndexFunc)(NpyIter *, npy_intp *); +struct __pyx_t_8dataRead__CNFixedHdr; +struct __pyx_t_8dataRead__CNData; +struct __pyx_t_8dataRead__CCFixedHdr; +struct __pyx_t_8dataRead__CCData; +struct __pyx_t_8dataRead__SIBlock; +struct __pyx_t_8dataRead__TXHdr; + +/* "dataRead.pyx":145 + * # _CNFixedHdr 88 bytes: 24-byte common header + 8 standard CN link fields. + * # Extra links (attachments, default-X) follow at offset 88 when link_count > 8. + * cdef packed struct _CNFixedHdr: # <<<<<<<<<<<<<< + * char id[4] # b'##CN' + * uint32_t reserved # padding (0) + */ +#if defined(__SUNPRO_C) + #pragma pack(1) +#elif !defined(__GNUC__) + #pragma pack(push, 1) +#endif +struct __Pyx_PACKED __pyx_t_8dataRead__CNFixedHdr { + char id[4]; + uint32_t reserved; + uint64_t length; + uint64_t link_count; + uint64_t cn_cn_next; + uint64_t cn_composition; + uint64_t cn_tx_name; + uint64_t cn_si_source; + uint64_t cn_cc_conversion; + uint64_t cn_data; + uint64_t cn_md_unit; + uint64_t cn_md_comment; +}; +#if defined(__SUNPRO_C) + #pragma pack() +#elif !defined(__GNUC__) + #pragma pack(pop) +#endif + +/* "dataRead.pyx":161 + * + * # _CNData 72 bytes: data section located at offset 24 + link_count*8. + * cdef packed struct _CNData: # <<<<<<<<<<<<<< + * uint8_t cn_type # 0=fixed-length, 1=VLSD, 2=master, + * # 3=virtual master, 4=sync, 5=MLSD, + */ +#if defined(__SUNPRO_C) + #pragma pack(1) +#elif !defined(__GNUC__) + #pragma pack(push, 1) +#endif +struct __Pyx_PACKED __pyx_t_8dataRead__CNData { + uint8_t cn_type; + uint8_t cn_sync_type; + uint8_t cn_data_type; + uint8_t cn_bit_offset; + uint32_t cn_byte_offset; + uint32_t cn_bit_count; + uint32_t cn_flags; + uint32_t cn_invalid_bit_pos; + uint8_t cn_precision; + uint8_t cn_reserved; + uint16_t cn_attachment_count; + double cn_val_range_min; + double cn_val_range_max; + double cn_limit_min; + double cn_limit_max; + double cn_limit_ext_min; + double cn_limit_ext_max; +}; +#if defined(__SUNPRO_C) + #pragma pack() +#elif !defined(__GNUC__) + #pragma pack(pop) +#endif + +/* "dataRead.pyx":184 + * # _CCFixedHdr 56 bytes: 24-byte header + 4 standard CC link fields. + * # Additional cc_ref links follow at offset 56 when link_count > 4. + * cdef packed struct _CCFixedHdr: # <<<<<<<<<<<<<< + * char id[4] # b'##CC' + * uint32_t reserved + */ +#if defined(__SUNPRO_C) + #pragma pack(1) +#elif !defined(__GNUC__) + #pragma pack(push, 1) +#endif +struct __Pyx_PACKED __pyx_t_8dataRead__CCFixedHdr { + char id[4]; + uint32_t reserved; + uint64_t length; + uint64_t link_count; + uint64_t cc_tx_name; + uint64_t cc_md_unit; + uint64_t cc_md_comment; + uint64_t cc_cc_inverse; +}; +#if defined(__SUNPRO_C) + #pragma pack() +#elif !defined(__GNUC__) + #pragma pack(pop) +#endif + +/* "dataRead.pyx":196 + * # _CCData 24 bytes: data section at offset 24 + link_count*8. + * # cc_val doubles and cc_ref links follow after this section. + * cdef packed struct _CCData: # <<<<<<<<<<<<<< + * uint8_t cc_type # 0=identity, 1=linear, 2=rational, 3=formula, + * # 4=tab-interp, 5=tab, 6=rangevalue, + */ +#if defined(__SUNPRO_C) + #pragma pack(1) +#elif !defined(__GNUC__) + #pragma pack(push, 1) +#endif +struct __Pyx_PACKED __pyx_t_8dataRead__CCData { + uint8_t cc_type; + uint8_t cc_precision; + uint16_t cc_flags; + uint16_t cc_ref_count; + uint16_t cc_val_count; + double cc_phy_range_min; + double cc_phy_range_max; +}; +#if defined(__SUNPRO_C) + #pragma pack() +#elif !defined(__GNUC__) + #pragma pack(pop) +#endif + +/* "dataRead.pyx":209 + * + * # _SIBlock 56 bytes total: 24-byte header + 3 link fields + 8 data bytes. + * cdef packed struct _SIBlock: # <<<<<<<<<<<<<< + * char id[4] # b'##SI' + * uint32_t reserved + */ +#if defined(__SUNPRO_C) + #pragma pack(1) +#elif !defined(__GNUC__) + #pragma pack(push, 1) +#endif +struct __Pyx_PACKED __pyx_t_8dataRead__SIBlock { + char id[4]; + uint32_t reserved; + uint64_t length; + uint64_t link_count; + uint64_t si_tx_name; + uint64_t si_tx_path; + uint64_t si_md_comment; + uint8_t si_type; + uint8_t si_bus_type; + uint8_t si_flags; + char si_reserved[5]; +}; +#if defined(__SUNPRO_C) + #pragma pack() +#elif !defined(__GNUC__) + #pragma pack(pop) +#endif + +/* "dataRead.pyx":225 + * # _TXHdr 24-byte common header shared by TX (plain text) and MD (XML) blocks. + * # The text/XML payload immediately follows at offset 24. + * cdef packed struct _TXHdr: # <<<<<<<<<<<<<< + * char id[4] # b'##TX' (plain text) or b'##MD' (XML) + * uint32_t reserved + */ +#if defined(__SUNPRO_C) + #pragma pack(1) +#elif !defined(__GNUC__) + #pragma pack(push, 1) +#endif +struct __Pyx_PACKED __pyx_t_8dataRead__TXHdr { + char id[4]; + uint32_t reserved; + uint64_t length; + uint64_t link_count; +}; +#if defined(__SUNPRO_C) + #pragma pack() +#elif !defined(__GNUC__) + #pragma pack(pop) +#endif + +/* "dataRead.pyx":26 + * DEF SYM_BUF_SIZE = 65536 # 64 KB same default as Rust SymBufReader + * + * cdef class SymBufReader: # <<<<<<<<<<<<<< + * """Bidirectional-buffered wrapper around a Python file object. + * + */ +struct __pyx_obj_8dataRead_SymBufReader { + PyObject_HEAD + struct __pyx_vtabstruct_8dataRead_SymBufReader *__pyx_vtab; + PyObject *_fid; + unsigned char _buf[0x10000]; + Py_ssize_t _buf_start; + Py_ssize_t _buf_len; + Py_ssize_t _pos; +}; + /* "View.MemoryView":114 * @cython.collection_type("sequence") @@ -1956,6 +2169,20 @@ struct __pyx_memoryviewslice_obj { +/* "dataRead.pyx":26 + * DEF SYM_BUF_SIZE = 65536 # 64 KB same default as Rust SymBufReader + * + * cdef class SymBufReader: # <<<<<<<<<<<<<< + * """Bidirectional-buffered wrapper around a Python file object. + * + */ + +struct __pyx_vtabstruct_8dataRead_SymBufReader { + int (*_fill)(struct __pyx_obj_8dataRead_SymBufReader *, Py_ssize_t); +}; +static struct __pyx_vtabstruct_8dataRead_SymBufReader *__pyx_vtabptr_8dataRead_SymBufReader; + + /* "View.MemoryView":114 * @cython.collection_type("sequence") * @cname("__pyx_array") @@ -2149,6 +2376,39 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, P /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + /* TupleAndListFromArray.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); @@ -2477,22 +2737,6 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -2518,23 +2762,6 @@ static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); #endif -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS @@ -2589,6 +2816,119 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +/* decode_c_string_utf16.proto */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} + +/* decode_c_bytes.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( + const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); + +/* decode_bytes.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_bytes( + PyObject* string, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + char* as_c_string; + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + as_c_string = PyBytes_AS_STRING(string); + size = PyBytes_GET_SIZE(string); +#else + if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { + return NULL; + } +#endif + return __Pyx_decode_c_bytes( + as_c_string, size, + start, stop, encoding, errors, decode_func); +} + +/* UnpackUnboundCMethod.proto */ +typedef struct { + PyObject *type; + PyObject **method_name; + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; + +/* CallUnboundCMethod1.proto */ +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* CallUnboundCMethod2.proto */ +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* PyObject_Unicode.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) +#else +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj)) +#endif + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* SliceTupleAndList.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); +#else +#define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) +#define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) +#endif + +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + /* PyUnicodeContains.proto */ static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) { int result = PyUnicode_Contains(text, substring); @@ -2673,23 +3013,6 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); -/* UnpackUnboundCMethod.proto */ -typedef struct { - PyObject *type; - PyObject **method_name; - PyCFunction func; - PyObject *method; - int flag; -} __Pyx_CachedCFunction; - -/* CallUnboundCMethod1.proto */ -static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); -#else -#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) -#endif - /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); @@ -2701,67 +3024,6 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, /* PyIntCompare.proto */ static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_bytes.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* decode_bytes.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_bytes( - PyObject* string, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - char* as_c_string; - Py_ssize_t size; -#if CYTHON_ASSUME_SAFE_MACROS - as_c_string = PyBytes_AS_STRING(string); - size = PyBytes_GET_SIZE(string); -#else - if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { - return NULL; - } -#endif - return __Pyx_decode_c_bytes( - as_c_string, size, - start, stop, encoding, errors, decode_func); -} - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 - L->ob_item[len] = x; - #else - PyList_SET_ITEM(list, len, x); - #endif - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - /* PyObjectCall2Args.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); @@ -3192,6 +3454,9 @@ static CYTHON_INLINE int __pyx_memview_set_nn_uint16_t(const char *itemp, PyObje #endif #endif +/* CIntFromPy.proto */ +static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *); + /* MemviewSliceCopyTemplate.proto */ static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, @@ -3224,6 +3489,12 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *); + /* CIntFromPy.proto */ static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *); @@ -3234,14 +3505,32 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG( static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value); +/* CIntFromPy.proto */ +static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value); + /* CIntFromPy.proto */ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *); @@ -3254,18 +3543,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char valu /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value); -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); @@ -3321,6 +3601,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObjec static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static int __pyx_f_8dataRead_12SymBufReader__fill(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, Py_ssize_t __pyx_v_pos); /* proto*/ /* Module declarations from "libc.string" */ @@ -3346,6 +3627,10 @@ static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__p /* Module declarations from "cpython.bytes" */ +/* Module declarations from "posix.types" */ + +/* Module declarations from "posix.unistd" */ + /* Module declarations from "cython.view" */ /* Module declarations from "cython.dataclasses" */ @@ -3361,6 +3646,9 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static PyObject *__pyx_f_8dataRead__fast_read_tx(int, uint64_t); /*proto*/ +static PyObject *__pyx_f_8dataRead__fast_read_tx_or_md(int, uint64_t); /*proto*/ +static PyObject *__pyx_f_8dataRead__fast_read_si(int, uint64_t); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_half(char const *, PyObject *, unsigned PY_LONG_LONG, unsigned long, unsigned long, unsigned char); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_chalf(char const *, PyObject *, unsigned PY_LONG_LONG, unsigned long, unsigned long, unsigned char); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_float(char const *, PyObject *, unsigned PY_LONG_LONG, unsigned long, unsigned long, unsigned char); /*proto*/ @@ -3380,6 +3668,10 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_array(char const *, PyObje static CYTHON_INLINE PyObject *__pyx_f_8dataRead_unsorted_read4(char const *, PyObject *, PyObject *, unsigned short, unsigned PY_LONG_LONG, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_byte_length(char const *, unsigned PY_LONG_LONG *, unsigned long *, unsigned long, unsigned PY_LONG_LONG); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_string_length(char const *, unsigned PY_LONG_LONG *, unsigned long *, unsigned long, unsigned PY_LONG_LONG, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_vd_equalize_string(char const *, PyObject *, PyObject *, unsigned long, unsigned PY_LONG_LONG, unsigned short); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_vd_equalize_bytes(char const *, PyObject *, PyObject *, unsigned long, unsigned PY_LONG_LONG); /*proto*/ +static PyObject *__pyx_f_8dataRead___pyx_unpickle_SymBufReader__set_state(struct __pyx_obj_8dataRead_SymBufReader *, PyObject *); /*proto*/ +static int __Pyx_carray_from_py_unsigned_char(PyObject *, unsigned char *, Py_ssize_t); /*proto*/ static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -3435,16 +3727,18 @@ int __pyx_module_is_main_dataRead = 0; /* Implementation of "dataRead" */ /* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_AttributeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_MemoryError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_OverflowError; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_ImportError; /* #### Code section: string_decls ### */ static const char __pyx_k_[] = ": "; @@ -3454,44 +3748,83 @@ static const char __pyx_k_S[] = "S"; static const char __pyx_k_U[] = "U{}"; static const char __pyx_k_V[] = "V"; static const char __pyx_k_c[] = "c"; +static const char __pyx_k_i[] = "i"; +static const char __pyx_k_m[] = "m"; +static const char __pyx_k_n[] = "n"; +static const char __pyx_k_s[] = "s"; +static const char __pyx_k_CC[] = "##CC"; +static const char __pyx_k_CN[] = "##CN"; +static const char __pyx_k_SI[] = "##SI"; +static const char __pyx_k_TX[] = ""; static const char __pyx_k__2[] = "."; static const char __pyx_k__3[] = "*"; static const char __pyx_k__6[] = "'"; static const char __pyx_k__7[] = ")"; +static const char __pyx_k_fd[] = "fd"; static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; +static const char __pyx_k_BUS[] = "BUS"; +static const char __pyx_k_CAN[] = "CAN"; +static const char __pyx_k_ECU[] = "ECU"; +static const char __pyx_k_I_O[] = "I/O"; +static const char __pyx_k_LIN[] = "LIN"; +static const char __pyx_k_USB[] = "USB"; static const char __pyx_k_V_2[] = "V{}"; -static const char __pyx_k__11[] = "\000"; -static const char __pyx_k__29[] = "?"; +static const char __pyx_k__12[] = ""; +static const char __pyx_k__13[] = "\000"; +static const char __pyx_k__53[] = "?"; static const char __pyx_k_abc[] = "abc"; static const char __pyx_k_and[] = " and "; static const char __pyx_k_big[] = "big"; +static const char __pyx_k_bom[] = "bom"; static const char __pyx_k_buf[] = "buf"; +static const char __pyx_k_end[] = "end"; +static const char __pyx_k_fid[] = "fid"; +static const char __pyx_k_get[] = "get"; static const char __pyx_k_got[] = " (got "; +static const char __pyx_k_lnk[] = "lnk"; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; +static const char __pyx_k_pos[] = "pos"; +static const char __pyx_k_rad[] = "rad"; static const char __pyx_k_rec[] = "rec"; static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_tmp[] = "tmp"; +static const char __pyx_k_MOST[] = "MOST"; +static const char __pyx_k_NONE[] = "NONE"; +static const char __pyx_k_SI_2[] = "SI"; +static const char __pyx_k_TOOL[] = "TOOL"; +static const char __pyx_k_TX_2[] = ""; +static const char __pyx_k_TX_3[] = "TX"; +static const char __pyx_k_USER[] = "USER"; static const char __pyx_k_VLSD[] = "VLSD"; static const char __pyx_k_base[] = "base"; +static const char __pyx_k_data[] = "data"; static const char __pyx_k_dict[] = "__dict__"; +static const char __pyx_k_find[] = "find"; static const char __pyx_k_info[] = "info"; static const char __pyx_k_keys[] = "keys"; +static const char __pyx_k_lxml[] = "lxml"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mode[] = "mode"; static const char __pyx_k_name[] = "name"; static const char __pyx_k_ndim[] = "ndim"; static const char __pyx_k_pack[] = "pack"; +static const char __pyx_k_read[] = "read"; +static const char __pyx_k_seek[] = "seek"; +static const char __pyx_k_self[] = "self"; static const char __pyx_k_size[] = "size"; static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; +static const char __pyx_k_tell[] = "tell"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_unit[] = "unit"; static const char __pyx_k_view[] = "view"; static const char __pyx_k_ASCII[] = "ASCII"; static const char __pyx_k_Flags[] = "Flags"; +static const char __pyx_k_OTHER[] = "OTHER"; static const char __pyx_k_array[] = "array"; static const char __pyx_k_class[] = "__class__"; static const char __pyx_k_count[] = "count"; @@ -3500,49 +3833,87 @@ static const char __pyx_k_empty[] = "empty"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; static const char __pyx_k_index[] = "index"; +static const char __pyx_k_nread[] = "nread"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_order[] = "order"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_rjust[] = "rjust"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_start[] = "start"; +static const char __pyx_k_state[] = "state"; static const char __pyx_k_utf_8[] = "utf-8"; static const char __pyx_k_zeros[] = "zeros"; +static const char __pyx_k_CNunit[] = "CNunit"; +static const char __pyx_k_K_LINE[] = "K_LINE"; static const char __pyx_k_append[] = "append"; +static const char __pyx_k_cc_dat[] = "cc_dat"; +static const char __pyx_k_cc_hdr[] = "cc_hdr"; +static const char __pyx_k_cc_ptr[] = "cc_ptr"; +static const char __pyx_k_cc_val[] = "cc_val"; +static const char __pyx_k_cn_dat[] = "cn_dat"; +static const char __pyx_k_cn_hdr[] = "cn_hdr"; +static const char __pyx_k_cn_key[] = "cn_key"; static const char __pyx_k_decode[] = "decode"; +static const char __pyx_k_dict_2[] = "_dict"; static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; +static const char __pyx_k_errors[] = "errors"; +static const char __pyx_k_fileno[] = "fileno"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_length[] = "length"; static const char __pyx_k_little[] = "little"; static const char __pyx_k_name_2[] = "__name__"; +static const char __pyx_k_offset[] = "offset"; static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_record[] = "record"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_rstrip[] = "rstrip"; +static const char __pyx_k_si_ptr[] = "si_ptr"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_uint16[] = "uint16"; static const char __pyx_k_unpack[] = "unpack"; static const char __pyx_k_update[] = "update"; static const char __pyx_k_utf_16[] = ""; static const char __pyx_k_VLSD_CG_signal_data_type[] = "VLSD_CG_signal_data_type"; static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; +static const char __pyx_k_pyx_unpickle_SymBufReader[] = "__pyx_unpickle_SymBufReader"; static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; +static const char __pyx_k_SymBufReader___reduce_cython[] = "SymBufReader.__reduce_cython__"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; +static const char __pyx_k_SymBufReader___setstate_cython[] = "SymBufReader.__setstate_cython__"; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; @@ -3654,6 +4101,7 @@ static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __red static const char __pyx_k_numpy__core_multiarray_failed_to[] = "numpy._core.multiarray failed to import"; static const char __pyx_k_numpy__core_umath_failed_to_impo[] = "numpy._core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_2[] = "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))"; /* #### Code section: decls ### */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ @@ -3696,13 +4144,26 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_8dataRead_sorted_data_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tmp, unsigned short __pyx_v_bit_count, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, PyObject *__pyx_v_array); /* proto */ -static PyObject *__pyx_pf_8dataRead_2unsorted_data_read4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_record, PyObject *__pyx_v_info, PyObject *__pyx_v_tmp, unsigned short __pyx_v_record_id_size, unsigned PY_LONG_LONG __pyx_v_data_block_length); /* proto */ -static PyObject *__pyx_pf_8dataRead_4sd_data_read(CYTHON_UNUSED PyObject *__pyx_self, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_sd_block, CYTHON_UNUSED unsigned PY_LONG_LONG __pyx_v_sd_block_length, unsigned PY_LONG_LONG __pyx_v_n_records); /* proto */ +static int __pyx_pf_8dataRead_12SymBufReader___init__(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, PyObject *__pyx_v_fid); /* proto */ +static PyObject *__pyx_pf_8dataRead_12SymBufReader_2seek(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, Py_ssize_t __pyx_v_pos, int __pyx_v_whence); /* proto */ +static PyObject *__pyx_pf_8dataRead_12SymBufReader_4tell(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8dataRead_12SymBufReader_6read(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, Py_ssize_t __pyx_v_n); /* proto */ +static PyObject *__pyx_pf_8dataRead_12SymBufReader_8fileno(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8dataRead_12SymBufReader_10__reduce_cython__(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8dataRead_12SymBufReader_12__setstate_cython__(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_8dataRead_read_cn_chain_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fid, uint64_t __pyx_v_first_pointer, PyObject *__pyx_v_si_cache, int __pyx_v_minimal, int __pyx_v_channel_name_list); /* proto */ +static PyObject *__pyx_pf_8dataRead_2sorted_data_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tmp, unsigned short __pyx_v_bit_count, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, PyObject *__pyx_v_array); /* proto */ +static PyObject *__pyx_pf_8dataRead_4unsorted_data_read4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_record, PyObject *__pyx_v_info, PyObject *__pyx_v_tmp, unsigned short __pyx_v_record_id_size, unsigned PY_LONG_LONG __pyx_v_data_block_length); /* proto */ +static PyObject *__pyx_pf_8dataRead_6sd_data_read(CYTHON_UNUSED PyObject *__pyx_self, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_sd_block, CYTHON_UNUSED unsigned PY_LONG_LONG __pyx_v_sd_block_length, unsigned PY_LONG_LONG __pyx_v_n_records); /* proto */ +static PyObject *__pyx_pf_8dataRead_8vd_data_read(CYTHON_UNUSED PyObject *__pyx_self, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_vd_block, PyObject *__pyx_v_offsets_array, PyObject *__pyx_v_sizes_array, unsigned PY_LONG_LONG __pyx_v_n_records); /* proto */ +static PyObject *__pyx_pf_8dataRead_10__pyx_unpickle_SymBufReader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_8dataRead_SymBufReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type_find = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0}; static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_update = {0, 0, 0, 0, 0}; /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ @@ -3778,11 +4239,17 @@ typedef struct { #if CYTHON_USE_MODULE_STATE #endif #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_8dataRead_SymBufReader; PyObject *__pyx_type___pyx_array; PyObject *__pyx_type___pyx_MemviewEnum; PyObject *__pyx_type___pyx_memoryview; PyObject *__pyx_type___pyx_memoryviewslice; #endif + PyTypeObject *__pyx_ptype_8dataRead_SymBufReader; PyTypeObject *__pyx_array_type; PyTypeObject *__pyx_MemviewEnum_type; PyTypeObject *__pyx_memoryview_type; @@ -3791,38 +4258,75 @@ typedef struct { PyObject *__pyx_n_s_ASCII; PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_n_s_AttributeError; + PyObject *__pyx_n_u_BUS; PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; PyObject *__pyx_n_u_C; + PyObject *__pyx_n_u_CAN; + PyObject *__pyx_kp_b_CC; PyObject *__pyx_n_s_CGrecordLength; + PyObject *__pyx_kp_b_CN; + PyObject *__pyx_n_s_CNcomment; + PyObject *__pyx_n_s_CNunit; PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; PyObject *__pyx_kp_u_Cannot_index_with_type; PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; PyObject *__pyx_n_s_Channel; + PyObject *__pyx_n_u_Comment; PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_n_u_ECU; + PyObject *__pyx_n_u_ETHERNET; PyObject *__pyx_n_s_Ellipsis; PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_n_u_FLEXRAY; PyObject *__pyx_n_s_Flags; PyObject *__pyx_n_u_ISO8859; + PyObject *__pyx_kp_u_ISO_8859_1; + PyObject *__pyx_kp_u_I_O; PyObject *__pyx_n_s_ImportError; PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2; PyObject *__pyx_n_s_IndexError; PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_u_K_LINE; + PyObject *__pyx_n_u_LIN; + PyObject *__pyx_n_u_MOST; PyObject *__pyx_n_s_MemoryError; PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_n_u_NONE; PyObject *__pyx_n_b_O; + PyObject *__pyx_n_u_OTHER; PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_OverflowError; PyObject *__pyx_n_s_PickleError; PyObject *__pyx_n_u_S; + PyObject *__pyx_kp_b_SI; + PyObject *__pyx_n_u_SI_2; + PyObject *__pyx_n_s_SI_BUS_MAP; + PyObject *__pyx_n_s_SI_TYPE_MAP; PyObject *__pyx_n_s_Sequence; PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_SymBufReader; + PyObject *__pyx_n_s_SymBufReader___reduce_cython; + PyObject *__pyx_n_s_SymBufReader___setstate_cython; + PyObject *__pyx_n_s_SymBufReader_fileno; + PyObject *__pyx_n_s_SymBufReader_read; + PyObject *__pyx_n_s_SymBufReader_seek; + PyObject *__pyx_n_s_SymBufReader_tell; + PyObject *__pyx_n_u_TOOL; + PyObject *__pyx_kp_b_TX; + PyObject *__pyx_kp_b_TX_2; + PyObject *__pyx_n_s_TX_3; PyObject *__pyx_n_s_TypeError; PyObject *__pyx_kp_u_U; + PyObject *__pyx_n_u_USB; + PyObject *__pyx_n_u_USER; PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; PyObject *__pyx_n_u_V; PyObject *__pyx_n_s_VLSD; @@ -3834,11 +4338,13 @@ typedef struct { PyObject *__pyx_kp_u_V_2; PyObject *__pyx_n_s_ValueError; PyObject *__pyx_n_s_View_MemoryView; - PyObject *__pyx_kp_b__11; - PyObject *__pyx_kp_u__11; + PyObject *__pyx_kp_b__12; + PyObject *__pyx_kp_u__12; + PyObject *__pyx_kp_b__13; + PyObject *__pyx_kp_u__13; PyObject *__pyx_kp_u__2; - PyObject *__pyx_n_s__29; PyObject *__pyx_n_s__3; + PyObject *__pyx_n_s__53; PyObject *__pyx_kp_u__6; PyObject *__pyx_kp_u__7; PyObject *__pyx_n_s_abc; @@ -3848,12 +4354,15 @@ typedef struct { PyObject *__pyx_n_s_array; PyObject *__pyx_n_s_asarray; PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_available; PyObject *__pyx_n_s_base; PyObject *__pyx_n_u_big; PyObject *__pyx_n_s_bit_count; PyObject *__pyx_n_s_bit_offset; PyObject *__pyx_n_s_bit_stream; + PyObject *__pyx_n_u_bom; PyObject *__pyx_n_s_buf; + PyObject *__pyx_n_s_buf_end; PyObject *__pyx_n_s_byteOffset; PyObject *__pyx_n_s_byte_length; PyObject *__pyx_n_s_byteorder; @@ -3861,45 +4370,114 @@ typedef struct { PyObject *__pyx_n_s_c; PyObject *__pyx_n_u_c; PyObject *__pyx_n_s_c_format_structure; + PyObject *__pyx_n_u_cc_cc_inverse; + PyObject *__pyx_n_s_cc_dat; + PyObject *__pyx_n_s_cc_data_offset; + PyObject *__pyx_n_s_cc_dict; + PyObject *__pyx_n_u_cc_flags; + PyObject *__pyx_n_s_cc_hdr; + PyObject *__pyx_n_u_cc_md_comment; + PyObject *__pyx_n_u_cc_md_unit; + PyObject *__pyx_n_u_cc_phy_range_max; + PyObject *__pyx_n_u_cc_phy_range_min; + PyObject *__pyx_n_u_cc_precision; + PyObject *__pyx_n_s_cc_ptr; + PyObject *__pyx_n_u_cc_ref_count; + PyObject *__pyx_n_u_cc_tx_name; + PyObject *__pyx_n_u_cc_type; + PyObject *__pyx_n_u_cc_val; + PyObject *__pyx_n_s_cc_val_buf; + PyObject *__pyx_n_u_cc_val_count; + PyObject *__pyx_n_s_cc_val_list; PyObject *__pyx_n_u_channel; PyObject *__pyx_n_u_channelName; PyObject *__pyx_n_s_channelNames; PyObject *__pyx_n_s_channel_format; PyObject *__pyx_n_s_channel_name; + PyObject *__pyx_n_s_channel_name_list; PyObject *__pyx_n_s_channel_name_set; PyObject *__pyx_n_s_class; PyObject *__pyx_n_s_class_getitem; PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_u_cn_at_reference; + PyObject *__pyx_n_u_cn_attachment_count; + PyObject *__pyx_n_u_cn_bit_count; + PyObject *__pyx_n_u_cn_bit_offset; + PyObject *__pyx_n_u_cn_byte_offset; + PyObject *__pyx_n_u_cn_cc_conversion; + PyObject *__pyx_n_u_cn_cn_next; + PyObject *__pyx_n_u_cn_composition; + PyObject *__pyx_n_s_cn_dat; + PyObject *__pyx_n_u_cn_data; + PyObject *__pyx_n_u_cn_data_type; + PyObject *__pyx_n_u_cn_default_x; + PyObject *__pyx_n_s_cn_dict; + PyObject *__pyx_n_u_cn_flags; + PyObject *__pyx_n_s_cn_hdr; + PyObject *__pyx_n_u_cn_invalid_bit_pos; + PyObject *__pyx_n_s_cn_key; + PyObject *__pyx_n_s_cn_key_neg; + PyObject *__pyx_n_s_cn_key_uint; + PyObject *__pyx_n_u_cn_md_comment; + PyObject *__pyx_n_u_cn_md_unit; + PyObject *__pyx_n_s_cn_name; + PyObject *__pyx_n_u_cn_precision; + PyObject *__pyx_n_u_cn_reserved; + PyObject *__pyx_n_u_cn_si_source; + PyObject *__pyx_n_u_cn_sync_type; + PyObject *__pyx_n_u_cn_tx_name; + PyObject *__pyx_n_u_cn_type; + PyObject *__pyx_n_u_cn_val_range_max; + PyObject *__pyx_n_u_cn_val_range_min; PyObject *__pyx_n_s_collections; PyObject *__pyx_kp_s_collections_abc; PyObject *__pyx_kp_s_contiguous_and_direct; PyObject *__pyx_kp_s_contiguous_and_indirect; PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_data; PyObject *__pyx_n_s_dataRead; PyObject *__pyx_kp_s_dataRead_pyx; PyObject *__pyx_n_s_data_block_length; PyObject *__pyx_n_s_data_format; + PyObject *__pyx_n_s_data_offset; + PyObject *__pyx_n_s_dbl_ptr; PyObject *__pyx_n_s_decode; + PyObject *__pyx_n_s_desc_str; + PyObject *__pyx_n_u_description; PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dict_2; PyObject *__pyx_kp_u_disable; PyObject *__pyx_n_s_dtype; PyObject *__pyx_n_s_dtype_is_object; PyObject *__pyx_n_s_empty; PyObject *__pyx_kp_u_enable; PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_end; PyObject *__pyx_n_s_enumerate; PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_errors; + PyObject *__pyx_n_s_extra_buf; + PyObject *__pyx_n_s_extra_links; + PyObject *__pyx_n_s_fd; + PyObject *__pyx_n_s_fid; + PyObject *__pyx_n_s_fileno; + PyObject *__pyx_n_s_find; + PyObject *__pyx_n_s_first_pointer; PyObject *__pyx_n_s_flags; PyObject *__pyx_n_s_float16; PyObject *__pyx_n_s_format; PyObject *__pyx_n_s_fortran; PyObject *__pyx_n_u_fortran; PyObject *__pyx_n_s_frombuffer; + PyObject *__pyx_n_s_fromstring; PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_get; PyObject *__pyx_n_s_getstate; PyObject *__pyx_kp_u_got; PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_i; PyObject *__pyx_n_s_id; + PyObject *__pyx_n_u_id; PyObject *__pyx_n_s_import; PyObject *__pyx_n_s_index; PyObject *__pyx_n_s_info; @@ -3909,20 +4487,31 @@ typedef struct { PyObject *__pyx_n_s_itemsize; PyObject *__pyx_kp_s_itemsize_0_for_cython_array; PyObject *__pyx_n_s_keys; + PyObject *__pyx_n_u_length; + PyObject *__pyx_n_u_link_count; PyObject *__pyx_n_u_little; + PyObject *__pyx_n_s_lnk; + PyObject *__pyx_n_s_lxml; + PyObject *__pyx_n_u_m; PyObject *__pyx_n_s_main; PyObject *__pyx_n_s_max_len; PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_minimal; PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_n; PyObject *__pyx_n_s_nBytes_aligned; PyObject *__pyx_n_s_n_bytes; + PyObject *__pyx_n_s_n_extra; PyObject *__pyx_n_s_n_records; PyObject *__pyx_n_s_name; + PyObject *__pyx_n_u_name; PyObject *__pyx_n_s_name_2; PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_u_needs_completion; PyObject *__pyx_n_s_new; PyObject *__pyx_kp_s_no_default___reduce___due_to_non; PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nread; PyObject *__pyx_n_s_numberOfRecords; PyObject *__pyx_n_s_number_of_records; PyObject *__pyx_n_s_numpy; @@ -3930,10 +4519,15 @@ typedef struct { PyObject *__pyx_kp_u_numpy__core_umath_failed_to_impo; PyObject *__pyx_n_s_numpy_format; PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_objectify; + PyObject *__pyx_n_s_offset; + PyObject *__pyx_n_s_offsets_array; PyObject *__pyx_n_s_order; PyObject *__pyx_n_s_pack; PyObject *__pyx_n_s_pickle; PyObject *__pyx_n_s_pointer; + PyObject *__pyx_n_u_pointer; + PyObject *__pyx_n_s_pos; PyObject *__pyx_n_s_pos_byte_beg; PyObject *__pyx_n_s_pos_byte_end; PyObject *__pyx_n_s_position; @@ -3943,8 +4537,12 @@ typedef struct { PyObject *__pyx_n_s_pyx_state; PyObject *__pyx_n_s_pyx_type; PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_unpickle_SymBufReader; PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_u_rad; PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_read; + PyObject *__pyx_n_s_read_cn_chain_fast; PyObject *__pyx_n_s_rec; PyObject *__pyx_n_s_record; PyObject *__pyx_n_u_record; @@ -3960,19 +4558,37 @@ typedef struct { PyObject *__pyx_n_s_reduce_cython; PyObject *__pyx_n_s_reduce_ex; PyObject *__pyx_n_s_register; + PyObject *__pyx_n_u_replace; + PyObject *__pyx_n_s_results; PyObject *__pyx_n_s_rjust; PyObject *__pyx_n_s_rstrip; + PyObject *__pyx_n_u_s; PyObject *__pyx_n_s_sd_block; PyObject *__pyx_n_s_sd_block_length; PyObject *__pyx_n_s_sd_data_read; + PyObject *__pyx_n_s_seek; + PyObject *__pyx_n_s_self; PyObject *__pyx_n_s_setstate; PyObject *__pyx_n_s_setstate_cython; PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_u_si_bus_type; + PyObject *__pyx_n_s_si_cache; + PyObject *__pyx_n_s_si_dict; + PyObject *__pyx_n_u_si_flags; + PyObject *__pyx_n_u_si_md_comment; + PyObject *__pyx_n_s_si_ptr; + PyObject *__pyx_n_u_si_tx_name; + PyObject *__pyx_n_u_si_tx_path; + PyObject *__pyx_n_u_si_type; PyObject *__pyx_n_s_signal_data_type; PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_sizes_array; PyObject *__pyx_n_s_sorted_data_read; + PyObject *__pyx_n_u_source_name; + PyObject *__pyx_n_u_source_path; PyObject *__pyx_n_s_spec; PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_state; PyObject *__pyx_n_s_step; PyObject *__pyx_n_s_stop; PyObject *__pyx_kp_s_strided_and_direct; @@ -3982,42 +4598,61 @@ typedef struct { PyObject *__pyx_n_s_struct; PyObject *__pyx_n_s_swap_flag; PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_tell; PyObject *__pyx_n_s_test; PyObject *__pyx_n_s_tmp; PyObject *__pyx_n_s_uint16; PyObject *__pyx_kp_s_unable_to_allocate_array_data; PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_u_unit; + PyObject *__pyx_n_s_unit_str; PyObject *__pyx_n_s_unpack; PyObject *__pyx_n_s_unsorted_data_read4; PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_use_setstate; PyObject *__pyx_kp_u_utf_16; PyObject *__pyx_kp_u_utf_16_2; + PyObject *__pyx_kp_u_utf_16_be; + PyObject *__pyx_kp_u_utf_16_le; PyObject *__pyx_kp_u_utf_8; PyObject *__pyx_n_s_values; + PyObject *__pyx_n_s_vd_block; + PyObject *__pyx_n_s_vd_data_read; PyObject *__pyx_n_s_version_info; PyObject *__pyx_n_s_view; PyObject *__pyx_n_s_vlsd_len; + PyObject *__pyx_n_s_whence; PyObject *__pyx_n_s_zeros; PyObject *__pyx_int_0; PyObject *__pyx_int_1; PyObject *__pyx_int_2; PyObject *__pyx_int_3; + PyObject *__pyx_int_4; + PyObject *__pyx_int_5; PyObject *__pyx_int_6; PyObject *__pyx_int_7; PyObject *__pyx_int_8; PyObject *__pyx_int_9; PyObject *__pyx_int_33; + PyObject *__pyx_int_187; + PyObject *__pyx_int_191; + PyObject *__pyx_int_239; + PyObject *__pyx_int_254; + PyObject *__pyx_int_255; + PyObject *__pyx_int_65536; + PyObject *__pyx_int_55633519; PyObject *__pyx_int_112105877; + PyObject *__pyx_int_120882827; PyObject *__pyx_int_136983863; PyObject *__pyx_int_184977713; + PyObject *__pyx_int_218071849; PyObject *__pyx_int_neg_1; PyObject *__pyx_slice__5; PyObject *__pyx_tuple__4; PyObject *__pyx_tuple__8; PyObject *__pyx_tuple__9; PyObject *__pyx_tuple__10; - PyObject *__pyx_tuple__12; - PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__11; PyObject *__pyx_tuple__14; PyObject *__pyx_tuple__15; PyObject *__pyx_tuple__16; @@ -4026,13 +4661,37 @@ typedef struct { PyObject *__pyx_tuple__19; PyObject *__pyx_tuple__20; PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__22; PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__24; PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__26; PyObject *__pyx_tuple__27; - PyObject *__pyx_codeobj__22; - PyObject *__pyx_codeobj__24; - PyObject *__pyx_codeobj__26; - PyObject *__pyx_codeobj__28; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__33; + PyObject *__pyx_tuple__35; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__40; + PyObject *__pyx_tuple__42; + PyObject *__pyx_tuple__44; + PyObject *__pyx_tuple__46; + PyObject *__pyx_tuple__48; + PyObject *__pyx_tuple__50; + PyObject *__pyx_codeobj__29; + PyObject *__pyx_codeobj__31; + PyObject *__pyx_codeobj__34; + PyObject *__pyx_codeobj__36; + PyObject *__pyx_codeobj__37; + PyObject *__pyx_codeobj__39; + PyObject *__pyx_codeobj__41; + PyObject *__pyx_codeobj__43; + PyObject *__pyx_codeobj__45; + PyObject *__pyx_codeobj__47; + PyObject *__pyx_codeobj__49; + PyObject *__pyx_codeobj__51; + PyObject *__pyx_codeobj__52; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -4091,6 +4750,8 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_8dataRead_SymBufReader); + Py_CLEAR(clear_module_state->__pyx_type_8dataRead_SymBufReader); Py_CLEAR(clear_module_state->__pyx_array_type); Py_CLEAR(clear_module_state->__pyx_type___pyx_array); Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); @@ -4103,38 +4764,75 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_n_s_AttributeError); + Py_CLEAR(clear_module_state->__pyx_n_u_BUS); Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); Py_CLEAR(clear_module_state->__pyx_n_u_C); + Py_CLEAR(clear_module_state->__pyx_n_u_CAN); + Py_CLEAR(clear_module_state->__pyx_kp_b_CC); Py_CLEAR(clear_module_state->__pyx_n_s_CGrecordLength); + Py_CLEAR(clear_module_state->__pyx_kp_b_CN); + Py_CLEAR(clear_module_state->__pyx_n_s_CNcomment); + Py_CLEAR(clear_module_state->__pyx_n_s_CNunit); Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); Py_CLEAR(clear_module_state->__pyx_n_s_Channel); + Py_CLEAR(clear_module_state->__pyx_n_u_Comment); Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_u_ECU); + Py_CLEAR(clear_module_state->__pyx_n_u_ETHERNET); Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_u_FLEXRAY); Py_CLEAR(clear_module_state->__pyx_n_s_Flags); Py_CLEAR(clear_module_state->__pyx_n_u_ISO8859); + Py_CLEAR(clear_module_state->__pyx_kp_u_ISO_8859_1); + Py_CLEAR(clear_module_state->__pyx_kp_u_I_O); Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2); Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_u_K_LINE); + Py_CLEAR(clear_module_state->__pyx_n_u_LIN); + Py_CLEAR(clear_module_state->__pyx_n_u_MOST); Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_n_u_NONE); Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_n_u_OTHER); Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_OverflowError); Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); Py_CLEAR(clear_module_state->__pyx_n_u_S); + Py_CLEAR(clear_module_state->__pyx_kp_b_SI); + Py_CLEAR(clear_module_state->__pyx_n_u_SI_2); + Py_CLEAR(clear_module_state->__pyx_n_s_SI_BUS_MAP); + Py_CLEAR(clear_module_state->__pyx_n_s_SI_TYPE_MAP); Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader_fileno); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader_read); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader_seek); + Py_CLEAR(clear_module_state->__pyx_n_s_SymBufReader_tell); + Py_CLEAR(clear_module_state->__pyx_n_u_TOOL); + Py_CLEAR(clear_module_state->__pyx_kp_b_TX); + Py_CLEAR(clear_module_state->__pyx_kp_b_TX_2); + Py_CLEAR(clear_module_state->__pyx_n_s_TX_3); Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); Py_CLEAR(clear_module_state->__pyx_kp_u_U); + Py_CLEAR(clear_module_state->__pyx_n_u_USB); + Py_CLEAR(clear_module_state->__pyx_n_u_USER); Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); Py_CLEAR(clear_module_state->__pyx_n_u_V); Py_CLEAR(clear_module_state->__pyx_n_s_VLSD); @@ -4146,11 +4844,13 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_u_V_2); Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); - Py_CLEAR(clear_module_state->__pyx_kp_b__11); - Py_CLEAR(clear_module_state->__pyx_kp_u__11); + Py_CLEAR(clear_module_state->__pyx_kp_b__12); + Py_CLEAR(clear_module_state->__pyx_kp_u__12); + Py_CLEAR(clear_module_state->__pyx_kp_b__13); + Py_CLEAR(clear_module_state->__pyx_kp_u__13); Py_CLEAR(clear_module_state->__pyx_kp_u__2); - Py_CLEAR(clear_module_state->__pyx_n_s__29); Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_n_s__53); Py_CLEAR(clear_module_state->__pyx_kp_u__6); Py_CLEAR(clear_module_state->__pyx_kp_u__7); Py_CLEAR(clear_module_state->__pyx_n_s_abc); @@ -4160,12 +4860,15 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_array); Py_CLEAR(clear_module_state->__pyx_n_s_asarray); Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_available); Py_CLEAR(clear_module_state->__pyx_n_s_base); Py_CLEAR(clear_module_state->__pyx_n_u_big); Py_CLEAR(clear_module_state->__pyx_n_s_bit_count); Py_CLEAR(clear_module_state->__pyx_n_s_bit_offset); Py_CLEAR(clear_module_state->__pyx_n_s_bit_stream); + Py_CLEAR(clear_module_state->__pyx_n_u_bom); Py_CLEAR(clear_module_state->__pyx_n_s_buf); + Py_CLEAR(clear_module_state->__pyx_n_s_buf_end); Py_CLEAR(clear_module_state->__pyx_n_s_byteOffset); Py_CLEAR(clear_module_state->__pyx_n_s_byte_length); Py_CLEAR(clear_module_state->__pyx_n_s_byteorder); @@ -4173,45 +4876,114 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_c); Py_CLEAR(clear_module_state->__pyx_n_u_c); Py_CLEAR(clear_module_state->__pyx_n_s_c_format_structure); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_cc_inverse); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_dat); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_data_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_dict); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_hdr); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_md_comment); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_md_unit); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_phy_range_max); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_phy_range_min); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_precision); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_ptr); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_ref_count); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_tx_name); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_type); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_val); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_val_buf); + Py_CLEAR(clear_module_state->__pyx_n_u_cc_val_count); + Py_CLEAR(clear_module_state->__pyx_n_s_cc_val_list); Py_CLEAR(clear_module_state->__pyx_n_u_channel); Py_CLEAR(clear_module_state->__pyx_n_u_channelName); Py_CLEAR(clear_module_state->__pyx_n_s_channelNames); Py_CLEAR(clear_module_state->__pyx_n_s_channel_format); Py_CLEAR(clear_module_state->__pyx_n_s_channel_name); + Py_CLEAR(clear_module_state->__pyx_n_s_channel_name_list); Py_CLEAR(clear_module_state->__pyx_n_s_channel_name_set); Py_CLEAR(clear_module_state->__pyx_n_s_class); Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_at_reference); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_attachment_count); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_bit_count); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_bit_offset); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_byte_offset); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_cc_conversion); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_cn_next); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_composition); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_dat); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_data); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_data_type); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_default_x); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_dict); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_hdr); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_invalid_bit_pos); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_key); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_key_neg); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_key_uint); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_md_comment); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_md_unit); + Py_CLEAR(clear_module_state->__pyx_n_s_cn_name); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_precision); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_reserved); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_si_source); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_sync_type); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_tx_name); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_type); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_val_range_max); + Py_CLEAR(clear_module_state->__pyx_n_u_cn_val_range_min); Py_CLEAR(clear_module_state->__pyx_n_s_collections); Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_data); Py_CLEAR(clear_module_state->__pyx_n_s_dataRead); Py_CLEAR(clear_module_state->__pyx_kp_s_dataRead_pyx); Py_CLEAR(clear_module_state->__pyx_n_s_data_block_length); Py_CLEAR(clear_module_state->__pyx_n_s_data_format); + Py_CLEAR(clear_module_state->__pyx_n_s_data_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_dbl_ptr); Py_CLEAR(clear_module_state->__pyx_n_s_decode); + Py_CLEAR(clear_module_state->__pyx_n_s_desc_str); + Py_CLEAR(clear_module_state->__pyx_n_u_description); Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dict_2); Py_CLEAR(clear_module_state->__pyx_kp_u_disable); Py_CLEAR(clear_module_state->__pyx_n_s_dtype); Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); Py_CLEAR(clear_module_state->__pyx_n_s_empty); Py_CLEAR(clear_module_state->__pyx_kp_u_enable); Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_end); Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_errors); + Py_CLEAR(clear_module_state->__pyx_n_s_extra_buf); + Py_CLEAR(clear_module_state->__pyx_n_s_extra_links); + Py_CLEAR(clear_module_state->__pyx_n_s_fd); + Py_CLEAR(clear_module_state->__pyx_n_s_fid); + Py_CLEAR(clear_module_state->__pyx_n_s_fileno); + Py_CLEAR(clear_module_state->__pyx_n_s_find); + Py_CLEAR(clear_module_state->__pyx_n_s_first_pointer); Py_CLEAR(clear_module_state->__pyx_n_s_flags); Py_CLEAR(clear_module_state->__pyx_n_s_float16); Py_CLEAR(clear_module_state->__pyx_n_s_format); Py_CLEAR(clear_module_state->__pyx_n_s_fortran); Py_CLEAR(clear_module_state->__pyx_n_u_fortran); Py_CLEAR(clear_module_state->__pyx_n_s_frombuffer); + Py_CLEAR(clear_module_state->__pyx_n_s_fromstring); Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_get); Py_CLEAR(clear_module_state->__pyx_n_s_getstate); Py_CLEAR(clear_module_state->__pyx_kp_u_got); Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_i); Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_u_id); Py_CLEAR(clear_module_state->__pyx_n_s_import); Py_CLEAR(clear_module_state->__pyx_n_s_index); Py_CLEAR(clear_module_state->__pyx_n_s_info); @@ -4221,20 +4993,31 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); Py_CLEAR(clear_module_state->__pyx_n_s_keys); + Py_CLEAR(clear_module_state->__pyx_n_u_length); + Py_CLEAR(clear_module_state->__pyx_n_u_link_count); Py_CLEAR(clear_module_state->__pyx_n_u_little); + Py_CLEAR(clear_module_state->__pyx_n_s_lnk); + Py_CLEAR(clear_module_state->__pyx_n_s_lxml); + Py_CLEAR(clear_module_state->__pyx_n_u_m); Py_CLEAR(clear_module_state->__pyx_n_s_main); Py_CLEAR(clear_module_state->__pyx_n_s_max_len); Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_minimal); Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_n); Py_CLEAR(clear_module_state->__pyx_n_s_nBytes_aligned); Py_CLEAR(clear_module_state->__pyx_n_s_n_bytes); + Py_CLEAR(clear_module_state->__pyx_n_s_n_extra); Py_CLEAR(clear_module_state->__pyx_n_s_n_records); Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_u_name); Py_CLEAR(clear_module_state->__pyx_n_s_name_2); Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_u_needs_completion); Py_CLEAR(clear_module_state->__pyx_n_s_new); Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nread); Py_CLEAR(clear_module_state->__pyx_n_s_numberOfRecords); Py_CLEAR(clear_module_state->__pyx_n_s_number_of_records); Py_CLEAR(clear_module_state->__pyx_n_s_numpy); @@ -4242,10 +5025,15 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_u_numpy__core_umath_failed_to_impo); Py_CLEAR(clear_module_state->__pyx_n_s_numpy_format); Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_objectify); + Py_CLEAR(clear_module_state->__pyx_n_s_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_offsets_array); Py_CLEAR(clear_module_state->__pyx_n_s_order); Py_CLEAR(clear_module_state->__pyx_n_s_pack); Py_CLEAR(clear_module_state->__pyx_n_s_pickle); Py_CLEAR(clear_module_state->__pyx_n_s_pointer); + Py_CLEAR(clear_module_state->__pyx_n_u_pointer); + Py_CLEAR(clear_module_state->__pyx_n_s_pos); Py_CLEAR(clear_module_state->__pyx_n_s_pos_byte_beg); Py_CLEAR(clear_module_state->__pyx_n_s_pos_byte_end); Py_CLEAR(clear_module_state->__pyx_n_s_position); @@ -4255,8 +5043,12 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_SymBufReader); Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_u_rad); Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_read); + Py_CLEAR(clear_module_state->__pyx_n_s_read_cn_chain_fast); Py_CLEAR(clear_module_state->__pyx_n_s_rec); Py_CLEAR(clear_module_state->__pyx_n_s_record); Py_CLEAR(clear_module_state->__pyx_n_u_record); @@ -4272,19 +5064,37 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_u_replace); + Py_CLEAR(clear_module_state->__pyx_n_s_results); Py_CLEAR(clear_module_state->__pyx_n_s_rjust); Py_CLEAR(clear_module_state->__pyx_n_s_rstrip); + Py_CLEAR(clear_module_state->__pyx_n_u_s); Py_CLEAR(clear_module_state->__pyx_n_s_sd_block); Py_CLEAR(clear_module_state->__pyx_n_s_sd_block_length); Py_CLEAR(clear_module_state->__pyx_n_s_sd_data_read); + Py_CLEAR(clear_module_state->__pyx_n_s_seek); + Py_CLEAR(clear_module_state->__pyx_n_s_self); Py_CLEAR(clear_module_state->__pyx_n_s_setstate); Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_u_si_bus_type); + Py_CLEAR(clear_module_state->__pyx_n_s_si_cache); + Py_CLEAR(clear_module_state->__pyx_n_s_si_dict); + Py_CLEAR(clear_module_state->__pyx_n_u_si_flags); + Py_CLEAR(clear_module_state->__pyx_n_u_si_md_comment); + Py_CLEAR(clear_module_state->__pyx_n_s_si_ptr); + Py_CLEAR(clear_module_state->__pyx_n_u_si_tx_name); + Py_CLEAR(clear_module_state->__pyx_n_u_si_tx_path); + Py_CLEAR(clear_module_state->__pyx_n_u_si_type); Py_CLEAR(clear_module_state->__pyx_n_s_signal_data_type); Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_sizes_array); Py_CLEAR(clear_module_state->__pyx_n_s_sorted_data_read); + Py_CLEAR(clear_module_state->__pyx_n_u_source_name); + Py_CLEAR(clear_module_state->__pyx_n_u_source_path); Py_CLEAR(clear_module_state->__pyx_n_s_spec); Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_state); Py_CLEAR(clear_module_state->__pyx_n_s_step); Py_CLEAR(clear_module_state->__pyx_n_s_stop); Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); @@ -4294,42 +5104,61 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_struct); Py_CLEAR(clear_module_state->__pyx_n_s_swap_flag); Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_tell); Py_CLEAR(clear_module_state->__pyx_n_s_test); Py_CLEAR(clear_module_state->__pyx_n_s_tmp); Py_CLEAR(clear_module_state->__pyx_n_s_uint16); Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_u_unit); + Py_CLEAR(clear_module_state->__pyx_n_s_unit_str); Py_CLEAR(clear_module_state->__pyx_n_s_unpack); Py_CLEAR(clear_module_state->__pyx_n_s_unsorted_data_read4); Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_use_setstate); Py_CLEAR(clear_module_state->__pyx_kp_u_utf_16); Py_CLEAR(clear_module_state->__pyx_kp_u_utf_16_2); + Py_CLEAR(clear_module_state->__pyx_kp_u_utf_16_be); + Py_CLEAR(clear_module_state->__pyx_kp_u_utf_16_le); Py_CLEAR(clear_module_state->__pyx_kp_u_utf_8); Py_CLEAR(clear_module_state->__pyx_n_s_values); + Py_CLEAR(clear_module_state->__pyx_n_s_vd_block); + Py_CLEAR(clear_module_state->__pyx_n_s_vd_data_read); Py_CLEAR(clear_module_state->__pyx_n_s_version_info); Py_CLEAR(clear_module_state->__pyx_n_s_view); Py_CLEAR(clear_module_state->__pyx_n_s_vlsd_len); + Py_CLEAR(clear_module_state->__pyx_n_s_whence); Py_CLEAR(clear_module_state->__pyx_n_s_zeros); Py_CLEAR(clear_module_state->__pyx_int_0); Py_CLEAR(clear_module_state->__pyx_int_1); Py_CLEAR(clear_module_state->__pyx_int_2); Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_4); + Py_CLEAR(clear_module_state->__pyx_int_5); Py_CLEAR(clear_module_state->__pyx_int_6); Py_CLEAR(clear_module_state->__pyx_int_7); Py_CLEAR(clear_module_state->__pyx_int_8); Py_CLEAR(clear_module_state->__pyx_int_9); Py_CLEAR(clear_module_state->__pyx_int_33); + Py_CLEAR(clear_module_state->__pyx_int_187); + Py_CLEAR(clear_module_state->__pyx_int_191); + Py_CLEAR(clear_module_state->__pyx_int_239); + Py_CLEAR(clear_module_state->__pyx_int_254); + Py_CLEAR(clear_module_state->__pyx_int_255); + Py_CLEAR(clear_module_state->__pyx_int_65536); + Py_CLEAR(clear_module_state->__pyx_int_55633519); Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_120882827); Py_CLEAR(clear_module_state->__pyx_int_136983863); Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_218071849); Py_CLEAR(clear_module_state->__pyx_int_neg_1); Py_CLEAR(clear_module_state->__pyx_slice__5); Py_CLEAR(clear_module_state->__pyx_tuple__4); Py_CLEAR(clear_module_state->__pyx_tuple__8); Py_CLEAR(clear_module_state->__pyx_tuple__9); Py_CLEAR(clear_module_state->__pyx_tuple__10); - Py_CLEAR(clear_module_state->__pyx_tuple__12); - Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__11); Py_CLEAR(clear_module_state->__pyx_tuple__14); Py_CLEAR(clear_module_state->__pyx_tuple__15); Py_CLEAR(clear_module_state->__pyx_tuple__16); @@ -4338,13 +5167,37 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_tuple__19); Py_CLEAR(clear_module_state->__pyx_tuple__20); Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__24); Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__26); Py_CLEAR(clear_module_state->__pyx_tuple__27); - Py_CLEAR(clear_module_state->__pyx_codeobj__22); - Py_CLEAR(clear_module_state->__pyx_codeobj__24); - Py_CLEAR(clear_module_state->__pyx_codeobj__26); - Py_CLEAR(clear_module_state->__pyx_codeobj__28); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__33); + Py_CLEAR(clear_module_state->__pyx_tuple__35); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__40); + Py_CLEAR(clear_module_state->__pyx_tuple__42); + Py_CLEAR(clear_module_state->__pyx_tuple__44); + Py_CLEAR(clear_module_state->__pyx_tuple__46); + Py_CLEAR(clear_module_state->__pyx_tuple__48); + Py_CLEAR(clear_module_state->__pyx_tuple__50); + Py_CLEAR(clear_module_state->__pyx_codeobj__29); + Py_CLEAR(clear_module_state->__pyx_codeobj__31); + Py_CLEAR(clear_module_state->__pyx_codeobj__34); + Py_CLEAR(clear_module_state->__pyx_codeobj__36); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__39); + Py_CLEAR(clear_module_state->__pyx_codeobj__41); + Py_CLEAR(clear_module_state->__pyx_codeobj__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__45); + Py_CLEAR(clear_module_state->__pyx_codeobj__47); + Py_CLEAR(clear_module_state->__pyx_codeobj__49); + Py_CLEAR(clear_module_state->__pyx_codeobj__51); + Py_CLEAR(clear_module_state->__pyx_codeobj__52); return 0; } #endif @@ -4381,6 +5234,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_8dataRead_SymBufReader); + Py_VISIT(traverse_module_state->__pyx_type_8dataRead_SymBufReader); Py_VISIT(traverse_module_state->__pyx_array_type); Py_VISIT(traverse_module_state->__pyx_type___pyx_array); Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); @@ -4393,38 +5248,75 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_n_s_AttributeError); + Py_VISIT(traverse_module_state->__pyx_n_u_BUS); Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); Py_VISIT(traverse_module_state->__pyx_n_u_C); + Py_VISIT(traverse_module_state->__pyx_n_u_CAN); + Py_VISIT(traverse_module_state->__pyx_kp_b_CC); Py_VISIT(traverse_module_state->__pyx_n_s_CGrecordLength); + Py_VISIT(traverse_module_state->__pyx_kp_b_CN); + Py_VISIT(traverse_module_state->__pyx_n_s_CNcomment); + Py_VISIT(traverse_module_state->__pyx_n_s_CNunit); Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); Py_VISIT(traverse_module_state->__pyx_n_s_Channel); + Py_VISIT(traverse_module_state->__pyx_n_u_Comment); Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_u_ECU); + Py_VISIT(traverse_module_state->__pyx_n_u_ETHERNET); Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_u_FLEXRAY); Py_VISIT(traverse_module_state->__pyx_n_s_Flags); Py_VISIT(traverse_module_state->__pyx_n_u_ISO8859); + Py_VISIT(traverse_module_state->__pyx_kp_u_ISO_8859_1); + Py_VISIT(traverse_module_state->__pyx_kp_u_I_O); Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2); Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_u_K_LINE); + Py_VISIT(traverse_module_state->__pyx_n_u_LIN); + Py_VISIT(traverse_module_state->__pyx_n_u_MOST); Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_n_u_NONE); Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_n_u_OTHER); Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_OverflowError); Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); Py_VISIT(traverse_module_state->__pyx_n_u_S); + Py_VISIT(traverse_module_state->__pyx_kp_b_SI); + Py_VISIT(traverse_module_state->__pyx_n_u_SI_2); + Py_VISIT(traverse_module_state->__pyx_n_s_SI_BUS_MAP); + Py_VISIT(traverse_module_state->__pyx_n_s_SI_TYPE_MAP); Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader_fileno); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader_read); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader_seek); + Py_VISIT(traverse_module_state->__pyx_n_s_SymBufReader_tell); + Py_VISIT(traverse_module_state->__pyx_n_u_TOOL); + Py_VISIT(traverse_module_state->__pyx_kp_b_TX); + Py_VISIT(traverse_module_state->__pyx_kp_b_TX_2); + Py_VISIT(traverse_module_state->__pyx_n_s_TX_3); Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); Py_VISIT(traverse_module_state->__pyx_kp_u_U); + Py_VISIT(traverse_module_state->__pyx_n_u_USB); + Py_VISIT(traverse_module_state->__pyx_n_u_USER); Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); Py_VISIT(traverse_module_state->__pyx_n_u_V); Py_VISIT(traverse_module_state->__pyx_n_s_VLSD); @@ -4436,11 +5328,13 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_u_V_2); Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); - Py_VISIT(traverse_module_state->__pyx_kp_b__11); - Py_VISIT(traverse_module_state->__pyx_kp_u__11); + Py_VISIT(traverse_module_state->__pyx_kp_b__12); + Py_VISIT(traverse_module_state->__pyx_kp_u__12); + Py_VISIT(traverse_module_state->__pyx_kp_b__13); + Py_VISIT(traverse_module_state->__pyx_kp_u__13); Py_VISIT(traverse_module_state->__pyx_kp_u__2); - Py_VISIT(traverse_module_state->__pyx_n_s__29); Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_n_s__53); Py_VISIT(traverse_module_state->__pyx_kp_u__6); Py_VISIT(traverse_module_state->__pyx_kp_u__7); Py_VISIT(traverse_module_state->__pyx_n_s_abc); @@ -4450,12 +5344,15 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_array); Py_VISIT(traverse_module_state->__pyx_n_s_asarray); Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_available); Py_VISIT(traverse_module_state->__pyx_n_s_base); Py_VISIT(traverse_module_state->__pyx_n_u_big); Py_VISIT(traverse_module_state->__pyx_n_s_bit_count); Py_VISIT(traverse_module_state->__pyx_n_s_bit_offset); Py_VISIT(traverse_module_state->__pyx_n_s_bit_stream); + Py_VISIT(traverse_module_state->__pyx_n_u_bom); Py_VISIT(traverse_module_state->__pyx_n_s_buf); + Py_VISIT(traverse_module_state->__pyx_n_s_buf_end); Py_VISIT(traverse_module_state->__pyx_n_s_byteOffset); Py_VISIT(traverse_module_state->__pyx_n_s_byte_length); Py_VISIT(traverse_module_state->__pyx_n_s_byteorder); @@ -4463,45 +5360,114 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_c); Py_VISIT(traverse_module_state->__pyx_n_u_c); Py_VISIT(traverse_module_state->__pyx_n_s_c_format_structure); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_cc_inverse); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_dat); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_data_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_dict); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_hdr); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_md_comment); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_md_unit); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_phy_range_max); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_phy_range_min); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_precision); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_ptr); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_ref_count); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_tx_name); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_type); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_val); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_val_buf); + Py_VISIT(traverse_module_state->__pyx_n_u_cc_val_count); + Py_VISIT(traverse_module_state->__pyx_n_s_cc_val_list); Py_VISIT(traverse_module_state->__pyx_n_u_channel); Py_VISIT(traverse_module_state->__pyx_n_u_channelName); Py_VISIT(traverse_module_state->__pyx_n_s_channelNames); Py_VISIT(traverse_module_state->__pyx_n_s_channel_format); Py_VISIT(traverse_module_state->__pyx_n_s_channel_name); + Py_VISIT(traverse_module_state->__pyx_n_s_channel_name_list); Py_VISIT(traverse_module_state->__pyx_n_s_channel_name_set); Py_VISIT(traverse_module_state->__pyx_n_s_class); Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_at_reference); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_attachment_count); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_bit_count); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_bit_offset); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_byte_offset); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_cc_conversion); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_cn_next); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_composition); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_dat); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_data); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_data_type); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_default_x); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_dict); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_hdr); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_invalid_bit_pos); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_key); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_key_neg); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_key_uint); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_md_comment); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_md_unit); + Py_VISIT(traverse_module_state->__pyx_n_s_cn_name); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_precision); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_reserved); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_si_source); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_sync_type); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_tx_name); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_type); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_val_range_max); + Py_VISIT(traverse_module_state->__pyx_n_u_cn_val_range_min); Py_VISIT(traverse_module_state->__pyx_n_s_collections); Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_data); Py_VISIT(traverse_module_state->__pyx_n_s_dataRead); Py_VISIT(traverse_module_state->__pyx_kp_s_dataRead_pyx); Py_VISIT(traverse_module_state->__pyx_n_s_data_block_length); Py_VISIT(traverse_module_state->__pyx_n_s_data_format); + Py_VISIT(traverse_module_state->__pyx_n_s_data_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_dbl_ptr); Py_VISIT(traverse_module_state->__pyx_n_s_decode); + Py_VISIT(traverse_module_state->__pyx_n_s_desc_str); + Py_VISIT(traverse_module_state->__pyx_n_u_description); Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dict_2); Py_VISIT(traverse_module_state->__pyx_kp_u_disable); Py_VISIT(traverse_module_state->__pyx_n_s_dtype); Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); Py_VISIT(traverse_module_state->__pyx_n_s_empty); Py_VISIT(traverse_module_state->__pyx_kp_u_enable); Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_end); Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_errors); + Py_VISIT(traverse_module_state->__pyx_n_s_extra_buf); + Py_VISIT(traverse_module_state->__pyx_n_s_extra_links); + Py_VISIT(traverse_module_state->__pyx_n_s_fd); + Py_VISIT(traverse_module_state->__pyx_n_s_fid); + Py_VISIT(traverse_module_state->__pyx_n_s_fileno); + Py_VISIT(traverse_module_state->__pyx_n_s_find); + Py_VISIT(traverse_module_state->__pyx_n_s_first_pointer); Py_VISIT(traverse_module_state->__pyx_n_s_flags); Py_VISIT(traverse_module_state->__pyx_n_s_float16); Py_VISIT(traverse_module_state->__pyx_n_s_format); Py_VISIT(traverse_module_state->__pyx_n_s_fortran); Py_VISIT(traverse_module_state->__pyx_n_u_fortran); Py_VISIT(traverse_module_state->__pyx_n_s_frombuffer); + Py_VISIT(traverse_module_state->__pyx_n_s_fromstring); Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_get); Py_VISIT(traverse_module_state->__pyx_n_s_getstate); Py_VISIT(traverse_module_state->__pyx_kp_u_got); Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_i); Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_u_id); Py_VISIT(traverse_module_state->__pyx_n_s_import); Py_VISIT(traverse_module_state->__pyx_n_s_index); Py_VISIT(traverse_module_state->__pyx_n_s_info); @@ -4511,20 +5477,31 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); Py_VISIT(traverse_module_state->__pyx_n_s_keys); + Py_VISIT(traverse_module_state->__pyx_n_u_length); + Py_VISIT(traverse_module_state->__pyx_n_u_link_count); Py_VISIT(traverse_module_state->__pyx_n_u_little); + Py_VISIT(traverse_module_state->__pyx_n_s_lnk); + Py_VISIT(traverse_module_state->__pyx_n_s_lxml); + Py_VISIT(traverse_module_state->__pyx_n_u_m); Py_VISIT(traverse_module_state->__pyx_n_s_main); Py_VISIT(traverse_module_state->__pyx_n_s_max_len); Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_minimal); Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_n); Py_VISIT(traverse_module_state->__pyx_n_s_nBytes_aligned); Py_VISIT(traverse_module_state->__pyx_n_s_n_bytes); + Py_VISIT(traverse_module_state->__pyx_n_s_n_extra); Py_VISIT(traverse_module_state->__pyx_n_s_n_records); Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_u_name); Py_VISIT(traverse_module_state->__pyx_n_s_name_2); Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_u_needs_completion); Py_VISIT(traverse_module_state->__pyx_n_s_new); Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nread); Py_VISIT(traverse_module_state->__pyx_n_s_numberOfRecords); Py_VISIT(traverse_module_state->__pyx_n_s_number_of_records); Py_VISIT(traverse_module_state->__pyx_n_s_numpy); @@ -4532,10 +5509,15 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_u_numpy__core_umath_failed_to_impo); Py_VISIT(traverse_module_state->__pyx_n_s_numpy_format); Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_objectify); + Py_VISIT(traverse_module_state->__pyx_n_s_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_offsets_array); Py_VISIT(traverse_module_state->__pyx_n_s_order); Py_VISIT(traverse_module_state->__pyx_n_s_pack); Py_VISIT(traverse_module_state->__pyx_n_s_pickle); Py_VISIT(traverse_module_state->__pyx_n_s_pointer); + Py_VISIT(traverse_module_state->__pyx_n_u_pointer); + Py_VISIT(traverse_module_state->__pyx_n_s_pos); Py_VISIT(traverse_module_state->__pyx_n_s_pos_byte_beg); Py_VISIT(traverse_module_state->__pyx_n_s_pos_byte_end); Py_VISIT(traverse_module_state->__pyx_n_s_position); @@ -4545,8 +5527,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_SymBufReader); Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_u_rad); Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_read); + Py_VISIT(traverse_module_state->__pyx_n_s_read_cn_chain_fast); Py_VISIT(traverse_module_state->__pyx_n_s_rec); Py_VISIT(traverse_module_state->__pyx_n_s_record); Py_VISIT(traverse_module_state->__pyx_n_u_record); @@ -4562,19 +5548,37 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_u_replace); + Py_VISIT(traverse_module_state->__pyx_n_s_results); Py_VISIT(traverse_module_state->__pyx_n_s_rjust); Py_VISIT(traverse_module_state->__pyx_n_s_rstrip); + Py_VISIT(traverse_module_state->__pyx_n_u_s); Py_VISIT(traverse_module_state->__pyx_n_s_sd_block); Py_VISIT(traverse_module_state->__pyx_n_s_sd_block_length); Py_VISIT(traverse_module_state->__pyx_n_s_sd_data_read); + Py_VISIT(traverse_module_state->__pyx_n_s_seek); + Py_VISIT(traverse_module_state->__pyx_n_s_self); Py_VISIT(traverse_module_state->__pyx_n_s_setstate); Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_u_si_bus_type); + Py_VISIT(traverse_module_state->__pyx_n_s_si_cache); + Py_VISIT(traverse_module_state->__pyx_n_s_si_dict); + Py_VISIT(traverse_module_state->__pyx_n_u_si_flags); + Py_VISIT(traverse_module_state->__pyx_n_u_si_md_comment); + Py_VISIT(traverse_module_state->__pyx_n_s_si_ptr); + Py_VISIT(traverse_module_state->__pyx_n_u_si_tx_name); + Py_VISIT(traverse_module_state->__pyx_n_u_si_tx_path); + Py_VISIT(traverse_module_state->__pyx_n_u_si_type); Py_VISIT(traverse_module_state->__pyx_n_s_signal_data_type); Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_sizes_array); Py_VISIT(traverse_module_state->__pyx_n_s_sorted_data_read); + Py_VISIT(traverse_module_state->__pyx_n_u_source_name); + Py_VISIT(traverse_module_state->__pyx_n_u_source_path); Py_VISIT(traverse_module_state->__pyx_n_s_spec); Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_state); Py_VISIT(traverse_module_state->__pyx_n_s_step); Py_VISIT(traverse_module_state->__pyx_n_s_stop); Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); @@ -4584,42 +5588,61 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_struct); Py_VISIT(traverse_module_state->__pyx_n_s_swap_flag); Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_tell); Py_VISIT(traverse_module_state->__pyx_n_s_test); Py_VISIT(traverse_module_state->__pyx_n_s_tmp); Py_VISIT(traverse_module_state->__pyx_n_s_uint16); Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_u_unit); + Py_VISIT(traverse_module_state->__pyx_n_s_unit_str); Py_VISIT(traverse_module_state->__pyx_n_s_unpack); Py_VISIT(traverse_module_state->__pyx_n_s_unsorted_data_read4); Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_use_setstate); Py_VISIT(traverse_module_state->__pyx_kp_u_utf_16); Py_VISIT(traverse_module_state->__pyx_kp_u_utf_16_2); + Py_VISIT(traverse_module_state->__pyx_kp_u_utf_16_be); + Py_VISIT(traverse_module_state->__pyx_kp_u_utf_16_le); Py_VISIT(traverse_module_state->__pyx_kp_u_utf_8); Py_VISIT(traverse_module_state->__pyx_n_s_values); + Py_VISIT(traverse_module_state->__pyx_n_s_vd_block); + Py_VISIT(traverse_module_state->__pyx_n_s_vd_data_read); Py_VISIT(traverse_module_state->__pyx_n_s_version_info); Py_VISIT(traverse_module_state->__pyx_n_s_view); Py_VISIT(traverse_module_state->__pyx_n_s_vlsd_len); + Py_VISIT(traverse_module_state->__pyx_n_s_whence); Py_VISIT(traverse_module_state->__pyx_n_s_zeros); Py_VISIT(traverse_module_state->__pyx_int_0); Py_VISIT(traverse_module_state->__pyx_int_1); Py_VISIT(traverse_module_state->__pyx_int_2); Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_4); + Py_VISIT(traverse_module_state->__pyx_int_5); Py_VISIT(traverse_module_state->__pyx_int_6); Py_VISIT(traverse_module_state->__pyx_int_7); Py_VISIT(traverse_module_state->__pyx_int_8); Py_VISIT(traverse_module_state->__pyx_int_9); Py_VISIT(traverse_module_state->__pyx_int_33); + Py_VISIT(traverse_module_state->__pyx_int_187); + Py_VISIT(traverse_module_state->__pyx_int_191); + Py_VISIT(traverse_module_state->__pyx_int_239); + Py_VISIT(traverse_module_state->__pyx_int_254); + Py_VISIT(traverse_module_state->__pyx_int_255); + Py_VISIT(traverse_module_state->__pyx_int_65536); + Py_VISIT(traverse_module_state->__pyx_int_55633519); Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_120882827); Py_VISIT(traverse_module_state->__pyx_int_136983863); Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_218071849); Py_VISIT(traverse_module_state->__pyx_int_neg_1); Py_VISIT(traverse_module_state->__pyx_slice__5); Py_VISIT(traverse_module_state->__pyx_tuple__4); Py_VISIT(traverse_module_state->__pyx_tuple__8); Py_VISIT(traverse_module_state->__pyx_tuple__9); Py_VISIT(traverse_module_state->__pyx_tuple__10); - Py_VISIT(traverse_module_state->__pyx_tuple__12); - Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__11); Py_VISIT(traverse_module_state->__pyx_tuple__14); Py_VISIT(traverse_module_state->__pyx_tuple__15); Py_VISIT(traverse_module_state->__pyx_tuple__16); @@ -4628,13 +5651,37 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_tuple__19); Py_VISIT(traverse_module_state->__pyx_tuple__20); Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__24); Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__26); Py_VISIT(traverse_module_state->__pyx_tuple__27); - Py_VISIT(traverse_module_state->__pyx_codeobj__22); - Py_VISIT(traverse_module_state->__pyx_codeobj__24); - Py_VISIT(traverse_module_state->__pyx_codeobj__26); - Py_VISIT(traverse_module_state->__pyx_codeobj__28); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__33); + Py_VISIT(traverse_module_state->__pyx_tuple__35); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__40); + Py_VISIT(traverse_module_state->__pyx_tuple__42); + Py_VISIT(traverse_module_state->__pyx_tuple__44); + Py_VISIT(traverse_module_state->__pyx_tuple__46); + Py_VISIT(traverse_module_state->__pyx_tuple__48); + Py_VISIT(traverse_module_state->__pyx_tuple__50); + Py_VISIT(traverse_module_state->__pyx_codeobj__29); + Py_VISIT(traverse_module_state->__pyx_codeobj__31); + Py_VISIT(traverse_module_state->__pyx_codeobj__34); + Py_VISIT(traverse_module_state->__pyx_codeobj__36); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__39); + Py_VISIT(traverse_module_state->__pyx_codeobj__41); + Py_VISIT(traverse_module_state->__pyx_codeobj__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__45); + Py_VISIT(traverse_module_state->__pyx_codeobj__47); + Py_VISIT(traverse_module_state->__pyx_codeobj__49); + Py_VISIT(traverse_module_state->__pyx_codeobj__51); + Py_VISIT(traverse_module_state->__pyx_codeobj__52); return 0; } #endif @@ -4710,11 +5757,17 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #if CYTHON_USE_MODULE_STATE #endif #if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type_8dataRead_SymBufReader __pyx_mstate_global->__pyx_type_8dataRead_SymBufReader #define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array #define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum #define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview #define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice #endif +#define __pyx_ptype_8dataRead_SymBufReader __pyx_mstate_global->__pyx_ptype_8dataRead_SymBufReader #define __pyx_array_type __pyx_mstate_global->__pyx_array_type #define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type #define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type @@ -4723,38 +5776,75 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII #define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi #define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_n_s_AttributeError __pyx_mstate_global->__pyx_n_s_AttributeError +#define __pyx_n_u_BUS __pyx_mstate_global->__pyx_n_u_BUS #define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri #define __pyx_n_u_C __pyx_mstate_global->__pyx_n_u_C +#define __pyx_n_u_CAN __pyx_mstate_global->__pyx_n_u_CAN +#define __pyx_kp_b_CC __pyx_mstate_global->__pyx_kp_b_CC #define __pyx_n_s_CGrecordLength __pyx_mstate_global->__pyx_n_s_CGrecordLength +#define __pyx_kp_b_CN __pyx_mstate_global->__pyx_kp_b_CN +#define __pyx_n_s_CNcomment __pyx_mstate_global->__pyx_n_s_CNcomment +#define __pyx_n_s_CNunit __pyx_mstate_global->__pyx_n_s_CNunit #define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is #define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor #define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi #define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type #define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with #define __pyx_n_s_Channel __pyx_mstate_global->__pyx_n_s_Channel +#define __pyx_n_u_Comment __pyx_mstate_global->__pyx_n_u_Comment #define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_u_ECU __pyx_mstate_global->__pyx_n_u_ECU +#define __pyx_n_u_ETHERNET __pyx_mstate_global->__pyx_n_u_ETHERNET #define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis #define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_u_FLEXRAY __pyx_mstate_global->__pyx_n_u_FLEXRAY #define __pyx_n_s_Flags __pyx_mstate_global->__pyx_n_s_Flags #define __pyx_n_u_ISO8859 __pyx_mstate_global->__pyx_n_u_ISO8859 +#define __pyx_kp_u_ISO_8859_1 __pyx_mstate_global->__pyx_kp_u_ISO_8859_1 +#define __pyx_kp_u_I_O __pyx_mstate_global->__pyx_kp_u_I_O #define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError #define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2 #define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError #define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d #define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte #define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr #define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_u_K_LINE __pyx_mstate_global->__pyx_n_u_K_LINE +#define __pyx_n_u_LIN __pyx_mstate_global->__pyx_n_u_LIN +#define __pyx_n_u_MOST __pyx_mstate_global->__pyx_n_u_MOST #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError #define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x #define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_n_u_NONE __pyx_mstate_global->__pyx_n_u_NONE #define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_n_u_OTHER __pyx_mstate_global->__pyx_n_u_OTHER #define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_OverflowError __pyx_mstate_global->__pyx_n_s_OverflowError #define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError #define __pyx_n_u_S __pyx_mstate_global->__pyx_n_u_S +#define __pyx_kp_b_SI __pyx_mstate_global->__pyx_kp_b_SI +#define __pyx_n_u_SI_2 __pyx_mstate_global->__pyx_n_u_SI_2 +#define __pyx_n_s_SI_BUS_MAP __pyx_mstate_global->__pyx_n_s_SI_BUS_MAP +#define __pyx_n_s_SI_TYPE_MAP __pyx_mstate_global->__pyx_n_s_SI_TYPE_MAP #define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence #define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_SymBufReader __pyx_mstate_global->__pyx_n_s_SymBufReader +#define __pyx_n_s_SymBufReader___reduce_cython __pyx_mstate_global->__pyx_n_s_SymBufReader___reduce_cython +#define __pyx_n_s_SymBufReader___setstate_cython __pyx_mstate_global->__pyx_n_s_SymBufReader___setstate_cython +#define __pyx_n_s_SymBufReader_fileno __pyx_mstate_global->__pyx_n_s_SymBufReader_fileno +#define __pyx_n_s_SymBufReader_read __pyx_mstate_global->__pyx_n_s_SymBufReader_read +#define __pyx_n_s_SymBufReader_seek __pyx_mstate_global->__pyx_n_s_SymBufReader_seek +#define __pyx_n_s_SymBufReader_tell __pyx_mstate_global->__pyx_n_s_SymBufReader_tell +#define __pyx_n_u_TOOL __pyx_mstate_global->__pyx_n_u_TOOL +#define __pyx_kp_b_TX __pyx_mstate_global->__pyx_kp_b_TX +#define __pyx_kp_b_TX_2 __pyx_mstate_global->__pyx_kp_b_TX_2 +#define __pyx_n_s_TX_3 __pyx_mstate_global->__pyx_n_s_TX_3 #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError #define __pyx_kp_u_U __pyx_mstate_global->__pyx_kp_u_U +#define __pyx_n_u_USB __pyx_mstate_global->__pyx_n_u_USB +#define __pyx_n_u_USER __pyx_mstate_global->__pyx_n_u_USER #define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object #define __pyx_n_u_V __pyx_mstate_global->__pyx_n_u_V #define __pyx_n_s_VLSD __pyx_mstate_global->__pyx_n_s_VLSD @@ -4766,11 +5856,13 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_u_V_2 __pyx_mstate_global->__pyx_kp_u_V_2 #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError #define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView -#define __pyx_kp_b__11 __pyx_mstate_global->__pyx_kp_b__11 -#define __pyx_kp_u__11 __pyx_mstate_global->__pyx_kp_u__11 +#define __pyx_kp_b__12 __pyx_mstate_global->__pyx_kp_b__12 +#define __pyx_kp_u__12 __pyx_mstate_global->__pyx_kp_u__12 +#define __pyx_kp_b__13 __pyx_mstate_global->__pyx_kp_b__13 +#define __pyx_kp_u__13 __pyx_mstate_global->__pyx_kp_u__13 #define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 -#define __pyx_n_s__29 __pyx_mstate_global->__pyx_n_s__29 #define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_n_s__53 __pyx_mstate_global->__pyx_n_s__53 #define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 #define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 #define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc @@ -4780,12 +5872,15 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_array __pyx_mstate_global->__pyx_n_s_array #define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_available __pyx_mstate_global->__pyx_n_s_available #define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base #define __pyx_n_u_big __pyx_mstate_global->__pyx_n_u_big #define __pyx_n_s_bit_count __pyx_mstate_global->__pyx_n_s_bit_count #define __pyx_n_s_bit_offset __pyx_mstate_global->__pyx_n_s_bit_offset #define __pyx_n_s_bit_stream __pyx_mstate_global->__pyx_n_s_bit_stream +#define __pyx_n_u_bom __pyx_mstate_global->__pyx_n_u_bom #define __pyx_n_s_buf __pyx_mstate_global->__pyx_n_s_buf +#define __pyx_n_s_buf_end __pyx_mstate_global->__pyx_n_s_buf_end #define __pyx_n_s_byteOffset __pyx_mstate_global->__pyx_n_s_byteOffset #define __pyx_n_s_byte_length __pyx_mstate_global->__pyx_n_s_byte_length #define __pyx_n_s_byteorder __pyx_mstate_global->__pyx_n_s_byteorder @@ -4793,45 +5888,114 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c #define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c #define __pyx_n_s_c_format_structure __pyx_mstate_global->__pyx_n_s_c_format_structure +#define __pyx_n_u_cc_cc_inverse __pyx_mstate_global->__pyx_n_u_cc_cc_inverse +#define __pyx_n_s_cc_dat __pyx_mstate_global->__pyx_n_s_cc_dat +#define __pyx_n_s_cc_data_offset __pyx_mstate_global->__pyx_n_s_cc_data_offset +#define __pyx_n_s_cc_dict __pyx_mstate_global->__pyx_n_s_cc_dict +#define __pyx_n_u_cc_flags __pyx_mstate_global->__pyx_n_u_cc_flags +#define __pyx_n_s_cc_hdr __pyx_mstate_global->__pyx_n_s_cc_hdr +#define __pyx_n_u_cc_md_comment __pyx_mstate_global->__pyx_n_u_cc_md_comment +#define __pyx_n_u_cc_md_unit __pyx_mstate_global->__pyx_n_u_cc_md_unit +#define __pyx_n_u_cc_phy_range_max __pyx_mstate_global->__pyx_n_u_cc_phy_range_max +#define __pyx_n_u_cc_phy_range_min __pyx_mstate_global->__pyx_n_u_cc_phy_range_min +#define __pyx_n_u_cc_precision __pyx_mstate_global->__pyx_n_u_cc_precision +#define __pyx_n_s_cc_ptr __pyx_mstate_global->__pyx_n_s_cc_ptr +#define __pyx_n_u_cc_ref_count __pyx_mstate_global->__pyx_n_u_cc_ref_count +#define __pyx_n_u_cc_tx_name __pyx_mstate_global->__pyx_n_u_cc_tx_name +#define __pyx_n_u_cc_type __pyx_mstate_global->__pyx_n_u_cc_type +#define __pyx_n_u_cc_val __pyx_mstate_global->__pyx_n_u_cc_val +#define __pyx_n_s_cc_val_buf __pyx_mstate_global->__pyx_n_s_cc_val_buf +#define __pyx_n_u_cc_val_count __pyx_mstate_global->__pyx_n_u_cc_val_count +#define __pyx_n_s_cc_val_list __pyx_mstate_global->__pyx_n_s_cc_val_list #define __pyx_n_u_channel __pyx_mstate_global->__pyx_n_u_channel #define __pyx_n_u_channelName __pyx_mstate_global->__pyx_n_u_channelName #define __pyx_n_s_channelNames __pyx_mstate_global->__pyx_n_s_channelNames #define __pyx_n_s_channel_format __pyx_mstate_global->__pyx_n_s_channel_format #define __pyx_n_s_channel_name __pyx_mstate_global->__pyx_n_s_channel_name +#define __pyx_n_s_channel_name_list __pyx_mstate_global->__pyx_n_s_channel_name_list #define __pyx_n_s_channel_name_set __pyx_mstate_global->__pyx_n_s_channel_name_set #define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_u_cn_at_reference __pyx_mstate_global->__pyx_n_u_cn_at_reference +#define __pyx_n_u_cn_attachment_count __pyx_mstate_global->__pyx_n_u_cn_attachment_count +#define __pyx_n_u_cn_bit_count __pyx_mstate_global->__pyx_n_u_cn_bit_count +#define __pyx_n_u_cn_bit_offset __pyx_mstate_global->__pyx_n_u_cn_bit_offset +#define __pyx_n_u_cn_byte_offset __pyx_mstate_global->__pyx_n_u_cn_byte_offset +#define __pyx_n_u_cn_cc_conversion __pyx_mstate_global->__pyx_n_u_cn_cc_conversion +#define __pyx_n_u_cn_cn_next __pyx_mstate_global->__pyx_n_u_cn_cn_next +#define __pyx_n_u_cn_composition __pyx_mstate_global->__pyx_n_u_cn_composition +#define __pyx_n_s_cn_dat __pyx_mstate_global->__pyx_n_s_cn_dat +#define __pyx_n_u_cn_data __pyx_mstate_global->__pyx_n_u_cn_data +#define __pyx_n_u_cn_data_type __pyx_mstate_global->__pyx_n_u_cn_data_type +#define __pyx_n_u_cn_default_x __pyx_mstate_global->__pyx_n_u_cn_default_x +#define __pyx_n_s_cn_dict __pyx_mstate_global->__pyx_n_s_cn_dict +#define __pyx_n_u_cn_flags __pyx_mstate_global->__pyx_n_u_cn_flags +#define __pyx_n_s_cn_hdr __pyx_mstate_global->__pyx_n_s_cn_hdr +#define __pyx_n_u_cn_invalid_bit_pos __pyx_mstate_global->__pyx_n_u_cn_invalid_bit_pos +#define __pyx_n_s_cn_key __pyx_mstate_global->__pyx_n_s_cn_key +#define __pyx_n_s_cn_key_neg __pyx_mstate_global->__pyx_n_s_cn_key_neg +#define __pyx_n_s_cn_key_uint __pyx_mstate_global->__pyx_n_s_cn_key_uint +#define __pyx_n_u_cn_md_comment __pyx_mstate_global->__pyx_n_u_cn_md_comment +#define __pyx_n_u_cn_md_unit __pyx_mstate_global->__pyx_n_u_cn_md_unit +#define __pyx_n_s_cn_name __pyx_mstate_global->__pyx_n_s_cn_name +#define __pyx_n_u_cn_precision __pyx_mstate_global->__pyx_n_u_cn_precision +#define __pyx_n_u_cn_reserved __pyx_mstate_global->__pyx_n_u_cn_reserved +#define __pyx_n_u_cn_si_source __pyx_mstate_global->__pyx_n_u_cn_si_source +#define __pyx_n_u_cn_sync_type __pyx_mstate_global->__pyx_n_u_cn_sync_type +#define __pyx_n_u_cn_tx_name __pyx_mstate_global->__pyx_n_u_cn_tx_name +#define __pyx_n_u_cn_type __pyx_mstate_global->__pyx_n_u_cn_type +#define __pyx_n_u_cn_val_range_max __pyx_mstate_global->__pyx_n_u_cn_val_range_max +#define __pyx_n_u_cn_val_range_min __pyx_mstate_global->__pyx_n_u_cn_val_range_min #define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections #define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc #define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct #define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect #define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data #define __pyx_n_s_dataRead __pyx_mstate_global->__pyx_n_s_dataRead #define __pyx_kp_s_dataRead_pyx __pyx_mstate_global->__pyx_kp_s_dataRead_pyx #define __pyx_n_s_data_block_length __pyx_mstate_global->__pyx_n_s_data_block_length #define __pyx_n_s_data_format __pyx_mstate_global->__pyx_n_s_data_format +#define __pyx_n_s_data_offset __pyx_mstate_global->__pyx_n_s_data_offset +#define __pyx_n_s_dbl_ptr __pyx_mstate_global->__pyx_n_s_dbl_ptr #define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode +#define __pyx_n_s_desc_str __pyx_mstate_global->__pyx_n_s_desc_str +#define __pyx_n_u_description __pyx_mstate_global->__pyx_n_u_description #define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dict_2 __pyx_mstate_global->__pyx_n_s_dict_2 #define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable #define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype #define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object #define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable #define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end #define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate #define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_errors __pyx_mstate_global->__pyx_n_s_errors +#define __pyx_n_s_extra_buf __pyx_mstate_global->__pyx_n_s_extra_buf +#define __pyx_n_s_extra_links __pyx_mstate_global->__pyx_n_s_extra_links +#define __pyx_n_s_fd __pyx_mstate_global->__pyx_n_s_fd +#define __pyx_n_s_fid __pyx_mstate_global->__pyx_n_s_fid +#define __pyx_n_s_fileno __pyx_mstate_global->__pyx_n_s_fileno +#define __pyx_n_s_find __pyx_mstate_global->__pyx_n_s_find +#define __pyx_n_s_first_pointer __pyx_mstate_global->__pyx_n_s_first_pointer #define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags #define __pyx_n_s_float16 __pyx_mstate_global->__pyx_n_s_float16 #define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format #define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran #define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran #define __pyx_n_s_frombuffer __pyx_mstate_global->__pyx_n_s_frombuffer +#define __pyx_n_s_fromstring __pyx_mstate_global->__pyx_n_s_fromstring #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get #define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate #define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got #define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i #define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_u_id __pyx_mstate_global->__pyx_n_u_id #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import #define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index #define __pyx_n_s_info __pyx_mstate_global->__pyx_n_s_info @@ -4841,20 +6005,31 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize #define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array #define __pyx_n_s_keys __pyx_mstate_global->__pyx_n_s_keys +#define __pyx_n_u_length __pyx_mstate_global->__pyx_n_u_length +#define __pyx_n_u_link_count __pyx_mstate_global->__pyx_n_u_link_count #define __pyx_n_u_little __pyx_mstate_global->__pyx_n_u_little +#define __pyx_n_s_lnk __pyx_mstate_global->__pyx_n_s_lnk +#define __pyx_n_s_lxml __pyx_mstate_global->__pyx_n_s_lxml +#define __pyx_n_u_m __pyx_mstate_global->__pyx_n_u_m #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main #define __pyx_n_s_max_len __pyx_mstate_global->__pyx_n_s_max_len #define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_minimal __pyx_mstate_global->__pyx_n_s_minimal #define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n #define __pyx_n_s_nBytes_aligned __pyx_mstate_global->__pyx_n_s_nBytes_aligned #define __pyx_n_s_n_bytes __pyx_mstate_global->__pyx_n_s_n_bytes +#define __pyx_n_s_n_extra __pyx_mstate_global->__pyx_n_s_n_extra #define __pyx_n_s_n_records __pyx_mstate_global->__pyx_n_s_n_records #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_u_name __pyx_mstate_global->__pyx_n_u_name #define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 #define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_u_needs_completion __pyx_mstate_global->__pyx_n_u_needs_completion #define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new #define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non #define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nread __pyx_mstate_global->__pyx_n_s_nread #define __pyx_n_s_numberOfRecords __pyx_mstate_global->__pyx_n_s_numberOfRecords #define __pyx_n_s_number_of_records __pyx_mstate_global->__pyx_n_s_number_of_records #define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy @@ -4862,10 +6037,15 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo #define __pyx_n_s_numpy_format __pyx_mstate_global->__pyx_n_s_numpy_format #define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_objectify __pyx_mstate_global->__pyx_n_s_objectify +#define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset +#define __pyx_n_s_offsets_array __pyx_mstate_global->__pyx_n_s_offsets_array #define __pyx_n_s_order __pyx_mstate_global->__pyx_n_s_order #define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack #define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle #define __pyx_n_s_pointer __pyx_mstate_global->__pyx_n_s_pointer +#define __pyx_n_u_pointer __pyx_mstate_global->__pyx_n_u_pointer +#define __pyx_n_s_pos __pyx_mstate_global->__pyx_n_s_pos #define __pyx_n_s_pos_byte_beg __pyx_mstate_global->__pyx_n_s_pos_byte_beg #define __pyx_n_s_pos_byte_end __pyx_mstate_global->__pyx_n_s_pos_byte_end #define __pyx_n_s_position __pyx_mstate_global->__pyx_n_s_position @@ -4875,8 +6055,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state #define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type #define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_unpickle_SymBufReader __pyx_mstate_global->__pyx_n_s_pyx_unpickle_SymBufReader #define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_u_rad __pyx_mstate_global->__pyx_n_u_rad #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read +#define __pyx_n_s_read_cn_chain_fast __pyx_mstate_global->__pyx_n_s_read_cn_chain_fast #define __pyx_n_s_rec __pyx_mstate_global->__pyx_n_s_rec #define __pyx_n_s_record __pyx_mstate_global->__pyx_n_s_record #define __pyx_n_u_record __pyx_mstate_global->__pyx_n_u_record @@ -4892,19 +6076,37 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex #define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_u_replace __pyx_mstate_global->__pyx_n_u_replace +#define __pyx_n_s_results __pyx_mstate_global->__pyx_n_s_results #define __pyx_n_s_rjust __pyx_mstate_global->__pyx_n_s_rjust #define __pyx_n_s_rstrip __pyx_mstate_global->__pyx_n_s_rstrip +#define __pyx_n_u_s __pyx_mstate_global->__pyx_n_u_s #define __pyx_n_s_sd_block __pyx_mstate_global->__pyx_n_s_sd_block #define __pyx_n_s_sd_block_length __pyx_mstate_global->__pyx_n_s_sd_block_length #define __pyx_n_s_sd_data_read __pyx_mstate_global->__pyx_n_s_sd_data_read +#define __pyx_n_s_seek __pyx_mstate_global->__pyx_n_s_seek +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self #define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate #define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython #define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_u_si_bus_type __pyx_mstate_global->__pyx_n_u_si_bus_type +#define __pyx_n_s_si_cache __pyx_mstate_global->__pyx_n_s_si_cache +#define __pyx_n_s_si_dict __pyx_mstate_global->__pyx_n_s_si_dict +#define __pyx_n_u_si_flags __pyx_mstate_global->__pyx_n_u_si_flags +#define __pyx_n_u_si_md_comment __pyx_mstate_global->__pyx_n_u_si_md_comment +#define __pyx_n_s_si_ptr __pyx_mstate_global->__pyx_n_s_si_ptr +#define __pyx_n_u_si_tx_name __pyx_mstate_global->__pyx_n_u_si_tx_name +#define __pyx_n_u_si_tx_path __pyx_mstate_global->__pyx_n_u_si_tx_path +#define __pyx_n_u_si_type __pyx_mstate_global->__pyx_n_u_si_type #define __pyx_n_s_signal_data_type __pyx_mstate_global->__pyx_n_s_signal_data_type #define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_sizes_array __pyx_mstate_global->__pyx_n_s_sizes_array #define __pyx_n_s_sorted_data_read __pyx_mstate_global->__pyx_n_s_sorted_data_read +#define __pyx_n_u_source_name __pyx_mstate_global->__pyx_n_u_source_name +#define __pyx_n_u_source_path __pyx_mstate_global->__pyx_n_u_source_path #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state #define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step #define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop #define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct @@ -4914,42 +6116,61 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct #define __pyx_n_s_swap_flag __pyx_mstate_global->__pyx_n_s_swap_flag #define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_tell __pyx_mstate_global->__pyx_n_s_tell #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test #define __pyx_n_s_tmp __pyx_mstate_global->__pyx_n_s_tmp #define __pyx_n_s_uint16 __pyx_mstate_global->__pyx_n_s_uint16 #define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data #define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_u_unit __pyx_mstate_global->__pyx_n_u_unit +#define __pyx_n_s_unit_str __pyx_mstate_global->__pyx_n_s_unit_str #define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack #define __pyx_n_s_unsorted_data_read4 __pyx_mstate_global->__pyx_n_s_unsorted_data_read4 #define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_use_setstate __pyx_mstate_global->__pyx_n_s_use_setstate #define __pyx_kp_u_utf_16 __pyx_mstate_global->__pyx_kp_u_utf_16 #define __pyx_kp_u_utf_16_2 __pyx_mstate_global->__pyx_kp_u_utf_16_2 +#define __pyx_kp_u_utf_16_be __pyx_mstate_global->__pyx_kp_u_utf_16_be +#define __pyx_kp_u_utf_16_le __pyx_mstate_global->__pyx_kp_u_utf_16_le #define __pyx_kp_u_utf_8 __pyx_mstate_global->__pyx_kp_u_utf_8 #define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values +#define __pyx_n_s_vd_block __pyx_mstate_global->__pyx_n_s_vd_block +#define __pyx_n_s_vd_data_read __pyx_mstate_global->__pyx_n_s_vd_data_read #define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info #define __pyx_n_s_view __pyx_mstate_global->__pyx_n_s_view #define __pyx_n_s_vlsd_len __pyx_mstate_global->__pyx_n_s_vlsd_len +#define __pyx_n_s_whence __pyx_mstate_global->__pyx_n_s_whence #define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 #define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 #define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_4 __pyx_mstate_global->__pyx_int_4 +#define __pyx_int_5 __pyx_mstate_global->__pyx_int_5 #define __pyx_int_6 __pyx_mstate_global->__pyx_int_6 #define __pyx_int_7 __pyx_mstate_global->__pyx_int_7 #define __pyx_int_8 __pyx_mstate_global->__pyx_int_8 #define __pyx_int_9 __pyx_mstate_global->__pyx_int_9 #define __pyx_int_33 __pyx_mstate_global->__pyx_int_33 +#define __pyx_int_187 __pyx_mstate_global->__pyx_int_187 +#define __pyx_int_191 __pyx_mstate_global->__pyx_int_191 +#define __pyx_int_239 __pyx_mstate_global->__pyx_int_239 +#define __pyx_int_254 __pyx_mstate_global->__pyx_int_254 +#define __pyx_int_255 __pyx_mstate_global->__pyx_int_255 +#define __pyx_int_65536 __pyx_mstate_global->__pyx_int_65536 +#define __pyx_int_55633519 __pyx_mstate_global->__pyx_int_55633519 #define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_120882827 __pyx_mstate_global->__pyx_int_120882827 #define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 #define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_218071849 __pyx_mstate_global->__pyx_int_218071849 #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 #define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 #define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 #define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 -#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 -#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 #define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 #define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 #define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 @@ -4958,15 +6179,378 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 #define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 #define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 #define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 #define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 #define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 -#define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22 -#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 -#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 -#define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 +#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 +#define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 +#define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 +#define __pyx_tuple__46 __pyx_mstate_global->__pyx_tuple__46 +#define __pyx_tuple__48 __pyx_mstate_global->__pyx_tuple__48 +#define __pyx_tuple__50 __pyx_mstate_global->__pyx_tuple__50 +#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 +#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 +#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 +#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 +#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 +#define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 +#define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 +#define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45 +#define __pyx_codeobj__47 __pyx_mstate_global->__pyx_codeobj__47 +#define __pyx_codeobj__49 __pyx_mstate_global->__pyx_codeobj__49 +#define __pyx_codeobj__51 __pyx_mstate_global->__pyx_codeobj__51 +#define __pyx_codeobj__52 __pyx_mstate_global->__pyx_codeobj__52 /* #### Code section: module_code ### */ +/* "carray.from_py":79 + * + * @cname("__Pyx_carray_from_py_unsigned_char") + * cdef int __Pyx_carray_from_py_unsigned_char(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: + */ + +static int __Pyx_carray_from_py_unsigned_char(PyObject *__pyx_v_o, unsigned char *__pyx_v_v, Py_ssize_t __pyx_v_length) { + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + unsigned char __pyx_t_11; + char const *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_carray_from_py_unsigned_char", 1); + + /* "carray.from_py":80 + * @cname("__Pyx_carray_from_py_unsigned_char") + * cdef int __Pyx_carray_from_py_unsigned_char(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length # <<<<<<<<<<<<<< + * try: + * i = len(o) + */ + __pyx_v_i = __pyx_v_length; + + /* "carray.from_py":81 + * cdef int __Pyx_carray_from_py_unsigned_char(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "carray.from_py":82 + * cdef Py_ssize_t i = length + * try: + * i = len(o) # <<<<<<<<<<<<<< + * except (TypeError, OverflowError): + * pass + */ + __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 82, __pyx_L3_error) + __pyx_v_i = __pyx_t_4; + + /* "carray.from_py":81 + * cdef int __Pyx_carray_from_py_unsigned_char(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "carray.from_py":83 + * try: + * i = len(o) + * except (TypeError, OverflowError): # <<<<<<<<<<<<<< + * pass + * if i == length: + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_OverflowError); + if (__pyx_t_5) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L4_exception_handled; + } + goto __pyx_L5_except_error; + + /* "carray.from_py":81 + * cdef int __Pyx_carray_from_py_unsigned_char(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L8_try_end:; + } + + /* "carray.from_py":85 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: + */ + __pyx_t_6 = (__pyx_v_i == __pyx_v_length); + if (__pyx_t_6) { + + /* "carray.from_py":86 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 86, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 86, __pyx_L1_error) + #endif + if (__pyx_t_8 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(1, 86, __pyx_L1_error) + #else + __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 86, __pyx_L1_error) + #endif + if (__pyx_t_8 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(1, 86, __pyx_L1_error) + #else + __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } + } else { + __pyx_t_10 = __pyx_t_9(__pyx_t_7); + if (unlikely(!__pyx_t_10)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 86, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10); + __pyx_t_10 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = (__pyx_t_4 + 1); + + /* "carray.from_py":87 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item + */ + __pyx_t_6 = (__pyx_v_i >= __pyx_v_length); + if (__pyx_t_6) { + + /* "carray.from_py":88 + * for i, item in enumerate(o): + * if i >= length: + * break # <<<<<<<<<<<<<< + * v[i] = item + * else: + */ + goto __pyx_L11_break; + + /* "carray.from_py":87 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item + */ + } + + /* "carray.from_py":89 + * if i >= length: + * break + * v[i] = item # <<<<<<<<<<<<<< + * else: + * i += 1 # convert index to length + */ + __pyx_t_11 = __Pyx_PyInt_As_unsigned_char(__pyx_v_item); if (unlikely((__pyx_t_11 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L1_error) + (__pyx_v_v[__pyx_v_i]) = __pyx_t_11; + + /* "carray.from_py":86 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L13_for_else; + __pyx_L11_break:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_for_end; + /*else*/ { + __pyx_L13_for_else:; + + /* "carray.from_py":91 + * v[i] = item + * else: + * i += 1 # convert index to length # <<<<<<<<<<<<<< + * if i == length: + * return 0 + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "carray.from_py":92 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_6 = (__pyx_v_i == __pyx_v_length); + if (__pyx_t_6) { + + /* "carray.from_py":93 + * i += 1 # convert index to length + * if i == length: + * return 0 # <<<<<<<<<<<<<< + * + * PyErr_Format( + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "carray.from_py":92 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * + */ + } + } + __pyx_L14_for_end:; + + /* "carray.from_py":85 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: + */ + } + + /* "carray.from_py":98 + * IndexError, + * ("too many values found during array assignment, expected %zd" + * if i >= length else # <<<<<<<<<<<<<< + * "not enough values found during array assignment, expected %zd, got %zd"), + * length, i) + */ + __pyx_t_6 = (__pyx_v_i >= __pyx_v_length); + if (__pyx_t_6) { + __pyx_t_12 = ((char const *)"too many values found during array assignment, expected %zd"); + } else { + __pyx_t_12 = ((char const *)"not enough values found during array assignment, expected %zd, got %zd"); + } + + /* "carray.from_py":95 + * return 0 + * + * PyErr_Format( # <<<<<<<<<<<<<< + * IndexError, + * ("too many values found during array assignment, expected %zd" + */ + __pyx_t_7 = PyErr_Format(__pyx_builtin_IndexError, __pyx_t_12, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "carray.from_py":79 + * + * @cname("__Pyx_carray_from_py_unsigned_char") + * cdef int __Pyx_carray_from_py_unsigned_char(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "View.MemoryView":131 * cdef bint dtype_is_object * @@ -20285,4754 +21869,5751 @@ static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObjec return __pyx_r; } -/* "dataRead.pyx":12 - * cimport cython +/* "dataRead.pyx":38 + * cdef Py_ssize_t _pos # logical file position (cursor) * - * @cython.boundscheck(False) # <<<<<<<<<<<<<< - * @cython.wraparound(False) - * def sorted_data_read(bytes tmp, unsigned short bit_count, + * def __init__(self, fid): # <<<<<<<<<<<<<< + * self._fid = fid + * self._buf_start = 0 */ /* Python wrapper */ -static PyObject *__pyx_pw_8dataRead_1sorted_data_read(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -PyDoc_STRVAR(__pyx_doc_8dataRead_sorted_data_read, "dataRead function to read in cython a channel from a byte stream\n\n Parameters\n ------------\n tmp : bytes\n byte stream\n bit_count : unsigned short\n number of bit taken by the channel in the record\n signal_data_type : unsigned short\n int to describe data type\n record_format : string\n basic numpy dtype description of data type, used to create\n returned numpy ndarray\n number_of_records : unsigned long long\n number of records in byte stream\n record_byte_size : unsigned long\n number of bytes taken by one record repeated in byte stream\n bit_offset : unsigned char\n bit offset of data in C aligned bytes\n pos_byte_beg : unsigned long\n beginning byte position of channel in record\n n_bytes : unsigned long\n bytes length of channel in record\n array : boolean\n reads an array, not a vector\n\n Returns\n -------\n ndarray of type record_format with number_of_records records.\n Byte order is swapped if necessary to match machine byte order before bits offset and masking\n "); -static PyMethodDef __pyx_mdef_8dataRead_1sorted_data_read = {"sorted_data_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_1sorted_data_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_sorted_data_read}; -static PyObject *__pyx_pw_8dataRead_1sorted_data_read(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v_tmp = 0; - unsigned short __pyx_v_bit_count; - unsigned short __pyx_v_signal_data_type; - PyObject *__pyx_v_record_format = 0; - unsigned PY_LONG_LONG __pyx_v_number_of_records; - unsigned long __pyx_v_record_byte_size; - unsigned char __pyx_v_bit_offset; - unsigned long __pyx_v_pos_byte_beg; - unsigned long __pyx_v_n_bytes; - PyObject *__pyx_v_array = 0; - #if !CYTHON_METH_FASTCALL +static int __pyx_pw_8dataRead_12SymBufReader_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_8dataRead_12SymBufReader_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fid = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sorted_data_read (wrapper)", 0); - #if !CYTHON_METH_FASTCALL + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tmp,&__pyx_n_s_bit_count,&__pyx_n_s_signal_data_type,&__pyx_n_s_record_format,&__pyx_n_s_number_of_records,&__pyx_n_s_record_byte_size,&__pyx_n_s_bit_offset,&__pyx_n_s_pos_byte_beg,&__pyx_n_s_n_bytes,&__pyx_n_s_array,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fid,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { - case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tmp)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fid)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bit_count)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 1); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_signal_data_type)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 2); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record_format)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 3); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number_of_records)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 4); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record_byte_size)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 5); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bit_offset)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 6); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pos_byte_beg)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 7); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_bytes)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 8); __PYX_ERR(0, 12, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_array)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 9); __PYX_ERR(0, 12, __pyx_L3_error) - } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sorted_data_read") < 0)) __PYX_ERR(0, 12, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) } - } else if (unlikely(__pyx_nargs != 10)) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); - values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); - values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); - values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); - values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_tmp = ((PyObject*)values[0]); - __pyx_v_bit_count = __Pyx_PyInt_As_unsigned_short(values[1]); if (unlikely((__pyx_v_bit_count == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L3_error) - __pyx_v_signal_data_type = __Pyx_PyInt_As_unsigned_short(values[2]); if (unlikely((__pyx_v_signal_data_type == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error) - __pyx_v_record_format = ((PyObject*)values[3]); - __pyx_v_number_of_records = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[4]); if (unlikely((__pyx_v_number_of_records == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error) - __pyx_v_record_byte_size = __Pyx_PyInt_As_unsigned_long(values[5]); if (unlikely((__pyx_v_record_byte_size == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) - __pyx_v_bit_offset = __Pyx_PyInt_As_unsigned_char(values[6]); if (unlikely((__pyx_v_bit_offset == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) - __pyx_v_pos_byte_beg = __Pyx_PyInt_As_unsigned_long(values[7]); if (unlikely((__pyx_v_pos_byte_beg == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error) - __pyx_v_n_bytes = __Pyx_PyInt_As_unsigned_long(values[8]); if (unlikely((__pyx_v_n_bytes == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error) - __pyx_v_array = values[9]; + __pyx_v_fid = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, __pyx_nargs); __PYX_ERR(0, 12, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } - __Pyx_AddTraceback("dataRead.sorted_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.SymBufReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tmp), (&PyBytes_Type), 1, "tmp", 1))) __PYX_ERR(0, 14, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record_format), (&PyUnicode_Type), 1, "record_format", 1))) __PYX_ERR(0, 15, __pyx_L1_error) - __pyx_r = __pyx_pf_8dataRead_sorted_data_read(__pyx_self, __pyx_v_tmp, __pyx_v_bit_count, __pyx_v_signal_data_type, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_bit_offset, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_array); + __pyx_r = __pyx_pf_8dataRead_12SymBufReader___init__(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self), __pyx_v_fid); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8dataRead_sorted_data_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tmp, unsigned short __pyx_v_bit_count, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, PyObject *__pyx_v_array) { - char const *__pyx_v_bit_stream; - CYTHON_UNUSED long __pyx_v_swap_flag; - PyObject *__pyx_r = NULL; +static int __pyx_pf_8dataRead_12SymBufReader___init__(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, PyObject *__pyx_v_fid) { + int __pyx_r; __Pyx_RefNannyDeclarations - char *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + __Pyx_RefNannySetupContext("__init__", 1); + + /* "dataRead.pyx":39 + * + * def __init__(self, fid): + * self._fid = fid # <<<<<<<<<<<<<< + * self._buf_start = 0 + * self._buf_len = 0 + */ + __Pyx_INCREF(__pyx_v_fid); + __Pyx_GIVEREF(__pyx_v_fid); + __Pyx_GOTREF(__pyx_v_self->_fid); + __Pyx_DECREF(__pyx_v_self->_fid); + __pyx_v_self->_fid = __pyx_v_fid; + + /* "dataRead.pyx":40 + * def __init__(self, fid): + * self._fid = fid + * self._buf_start = 0 # <<<<<<<<<<<<<< + * self._buf_len = 0 + * self._pos = 0 + */ + __pyx_v_self->_buf_start = 0; + + /* "dataRead.pyx":41 + * self._fid = fid + * self._buf_start = 0 + * self._buf_len = 0 # <<<<<<<<<<<<<< + * self._pos = 0 + * + */ + __pyx_v_self->_buf_len = 0; + + /* "dataRead.pyx":42 + * self._buf_start = 0 + * self._buf_len = 0 + * self._pos = 0 # <<<<<<<<<<<<<< + * + * cdef int _fill(self, Py_ssize_t pos) except -1: + */ + __pyx_v_self->_pos = 0; + + /* "dataRead.pyx":38 + * cdef Py_ssize_t _pos # logical file position (cursor) + * + * def __init__(self, fid): # <<<<<<<<<<<<<< + * self._fid = fid + * self._buf_start = 0 + */ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":44 + * self._pos = 0 + * + * cdef int _fill(self, Py_ssize_t pos) except -1: # <<<<<<<<<<<<<< + * """Refill _buf centred on pos, reading from the underlying file.""" + * cdef Py_ssize_t start = pos - (SYM_BUF_SIZE >> 1) + */ + +static int __pyx_f_8dataRead_12SymBufReader__fill(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, Py_ssize_t __pyx_v_pos) { + Py_ssize_t __pyx_v_start; + PyObject *__pyx_v_raw = 0; + Py_ssize_t __pyx_v_n; + 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; - unsigned char __pyx_t_6; + PyObject *__pyx_t_5 = NULL; + unsigned int __pyx_t_6; + Py_ssize_t __pyx_t_7; + unsigned char const *__pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sorted_data_read", 1); - - /* "dataRead.pyx":49 - * Byte order is swapped if necessary to match machine byte order before bits offset and masking - * """ - * cdef const char* bit_stream = PyBytes_AsString(tmp) # <<<<<<<<<<<<<< - * if not array: - * if 'V' in record_format or 'S' in record_format or record_format is None: - */ - __pyx_t_1 = PyBytes_AsString(__pyx_v_tmp); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 49, __pyx_L1_error) - __pyx_v_bit_stream = __pyx_t_1; + __Pyx_RefNannySetupContext("_fill", 1); - /* "dataRead.pyx":50 - * """ - * cdef const char* bit_stream = PyBytes_AsString(tmp) - * if not array: # <<<<<<<<<<<<<< - * if 'V' in record_format or 'S' in record_format or record_format is None: - * return read_byte(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":46 + * cdef int _fill(self, Py_ssize_t pos) except -1: + * """Refill _buf centred on pos, reading from the underlying file.""" + * cdef Py_ssize_t start = pos - (SYM_BUF_SIZE >> 1) # <<<<<<<<<<<<<< + * cdef bytes raw + * cdef Py_ssize_t n */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_array); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 50, __pyx_L1_error) - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { + __pyx_v_start = (__pyx_v_pos - 0x8000); - /* "dataRead.pyx":51 - * cdef const char* bit_stream = PyBytes_AsString(tmp) - * if not array: - * if 'V' in record_format or 'S' in record_format or record_format is None: # <<<<<<<<<<<<<< - * return read_byte(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + /* "dataRead.pyx":49 + * cdef bytes raw + * cdef Py_ssize_t n + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * self._fid.seek(start) */ - if (unlikely(__pyx_v_record_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 51, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_V, __pyx_v_record_format, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 51, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - if (unlikely(__pyx_v_record_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 51, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_S, __pyx_v_record_format, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 51, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_record_format == ((PyObject*)Py_None)); - __pyx_t_3 = __pyx_t_2; - __pyx_L5_bool_binop_done:; - if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "dataRead.pyx":52 - * if not array: - * if 'V' in record_format or 'S' in record_format or record_format is None: - * return read_byte(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * elif signal_data_type in (4, 5) and n_bytes == 4: # float + /* "dataRead.pyx":50 + * cdef Py_ssize_t n + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * self._fid.seek(start) + * raw = self._fid.read(SYM_BUF_SIZE) */ - __Pyx_XDECREF(__pyx_r); + __pyx_v_start = 0; - /* "dataRead.pyx":53 - * if 'V' in record_format or 'S' in record_format or record_format is None: - * return read_byte(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) # <<<<<<<<<<<<<< - * elif signal_data_type in (4, 5) and n_bytes == 4: # float - * if (byteorder == 'little' and signal_data_type == 4) or \ + /* "dataRead.pyx":49 + * cdef bytes raw + * cdef Py_ssize_t n + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * self._fid.seek(start) */ - __pyx_t_4 = __pyx_f_8dataRead_read_byte(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + } - /* "dataRead.pyx":51 - * cdef const char* bit_stream = PyBytes_AsString(tmp) - * if not array: - * if 'V' in record_format or 'S' in record_format or record_format is None: # <<<<<<<<<<<<<< - * return read_byte(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + /* "dataRead.pyx":51 + * if start < 0: + * start = 0 + * self._fid.seek(start) # <<<<<<<<<<<<<< + * raw = self._fid.read(SYM_BUF_SIZE) + * n = len(raw) */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_fid, __pyx_n_s_seek); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":54 - * return read_byte(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * elif signal_data_type in (4, 5) and n_bytes == 4: # float # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): + /* "dataRead.pyx":52 + * start = 0 + * self._fid.seek(start) + * raw = self._fid.read(SYM_BUF_SIZE) # <<<<<<<<<<<<<< + * n = len(raw) + * memcpy(self._buf, raw, n) */ - switch (__pyx_v_signal_data_type) { - case 4: - case 5: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; - } - __pyx_t_5 = __pyx_t_2; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L8_bool_binop_done; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_fid, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } - __pyx_t_5 = (__pyx_v_n_bytes == 4); - __pyx_t_3 = __pyx_t_5; - __pyx_L8_bool_binop_done:; - if (__pyx_t_3) { - - /* "dataRead.pyx":55 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * elif signal_data_type in (4, 5) and n_bytes == 4: # float - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_float(bit_stream, record_format, number_of_records, - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - goto __pyx_L12_next_or; - } else { - } - __pyx_t_5 = (__pyx_v_signal_data_type == 4); - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_L12_next_or:; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_int_65536}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_v_raw = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "dataRead.pyx":56 - * elif signal_data_type in (4, 5) and n_bytes == 4: # float - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): # <<<<<<<<<<<<<< - * return read_float(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) + /* "dataRead.pyx":53 + * self._fid.seek(start) + * raw = self._fid.read(SYM_BUF_SIZE) + * n = len(raw) # <<<<<<<<<<<<<< + * memcpy(self._buf, raw, n) + * self._buf_start = start */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_signal_data_type == 5); - __pyx_t_3 = __pyx_t_5; - __pyx_L11_bool_binop_done:; + if (unlikely(__pyx_v_raw == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 53, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_GET_SIZE(__pyx_v_raw); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_v_n = __pyx_t_7; - /* "dataRead.pyx":55 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * elif signal_data_type in (4, 5) and n_bytes == 4: # float - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_float(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":54 + * raw = self._fid.read(SYM_BUF_SIZE) + * n = len(raw) + * memcpy(self._buf, raw, n) # <<<<<<<<<<<<<< + * self._buf_start = start + * self._buf_len = n */ - if (__pyx_t_3) { + if (unlikely(__pyx_v_raw == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(0, 54, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyBytes_AsUString(__pyx_v_raw); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error) + (void)(memcpy(__pyx_v_self->_buf, ((unsigned char const *)__pyx_t_8), __pyx_v_n)); - /* "dataRead.pyx":57 - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): - * return read_float(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 0) - * else: # swap bytes + /* "dataRead.pyx":55 + * n = len(raw) + * memcpy(self._buf, raw, n) + * self._buf_start = start # <<<<<<<<<<<<<< + * self._buf_len = n + * return 0 */ - __Pyx_XDECREF(__pyx_r); + __pyx_v_self->_buf_start = __pyx_v_start; - /* "dataRead.pyx":58 - * (byteorder == 'big' and signal_data_type == 5): - * return read_float(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_float(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":56 + * memcpy(self._buf, raw, n) + * self._buf_start = start + * self._buf_len = n # <<<<<<<<<<<<<< + * return 0 + * */ - __pyx_t_4 = __pyx_f_8dataRead_read_float(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_v_self->_buf_len = __pyx_v_n; - /* "dataRead.pyx":55 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * elif signal_data_type in (4, 5) and n_bytes == 4: # float - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_float(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":57 + * self._buf_start = start + * self._buf_len = n + * return 0 # <<<<<<<<<<<<<< + * + * def seek(self, Py_ssize_t pos, int whence=0): */ - } + __pyx_r = 0; + goto __pyx_L0; - /* "dataRead.pyx":60 - * record_byte_size, pos_byte_beg, 0) - * else: # swap bytes - * return read_float(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 8: # double + /* "dataRead.pyx":44 + * self._pos = 0 + * + * cdef int _fill(self, Py_ssize_t pos) except -1: # <<<<<<<<<<<<<< + * """Refill _buf centred on pos, reading from the underlying file.""" + * cdef Py_ssize_t start = pos - (SYM_BUF_SIZE >> 1) */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":61 - * else: # swap bytes - * return read_float(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (4, 5) and n_bytes == 8: # double - * if (byteorder == 'little' and signal_data_type == 4) or \ - */ - __pyx_t_4 = __pyx_f_8dataRead_read_float(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dataRead.SymBufReader._fill", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_raw); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":54 - * return read_byte(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * elif signal_data_type in (4, 5) and n_bytes == 4: # float # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): +/* "dataRead.pyx":59 + * return 0 + * + * def seek(self, Py_ssize_t pos, int whence=0): # <<<<<<<<<<<<<< + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: */ - } - /* "dataRead.pyx":62 - * return read_float(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 8: # double # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): - */ - switch (__pyx_v_signal_data_type) { - case 4: - case 5: - __pyx_t_5 = 1; - break; - default: - __pyx_t_5 = 0; - break; +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_12SymBufReader_3seek(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_8dataRead_12SymBufReader_2seek, "Update logical cursor; does NOT touch the underlying file."); +static PyMethodDef __pyx_mdef_8dataRead_12SymBufReader_3seek = {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_3seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_12SymBufReader_2seek}; +static PyObject *__pyx_pw_8dataRead_12SymBufReader_3seek(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + Py_ssize_t __pyx_v_pos; + int __pyx_v_whence; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("seek (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_whence,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pos)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_whence); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek") < 0)) __PYX_ERR(0, 59, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_t_2 = __pyx_t_5; - if (__pyx_t_2) { + __pyx_v_pos = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_pos == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + if (values[1]) { + __pyx_v_whence = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L15_bool_binop_done; + __pyx_v_whence = ((int)0); } - __pyx_t_2 = (__pyx_v_n_bytes == 8); - __pyx_t_3 = __pyx_t_2; - __pyx_L15_bool_binop_done:; - if (__pyx_t_3) { - - /* "dataRead.pyx":63 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 8: # double - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_double(bit_stream, record_format, number_of_records, - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_2) { - goto __pyx_L19_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_signal_data_type == 4); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L18_bool_binop_done; - } - __pyx_L19_next_or:; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.SymBufReader.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8dataRead_12SymBufReader_2seek(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self), __pyx_v_pos, __pyx_v_whence); - /* "dataRead.pyx":64 - * elif signal_data_type in (4, 5) and n_bytes == 8: # double - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): # <<<<<<<<<<<<<< - * return read_double(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L18_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_signal_data_type == 5); - __pyx_t_3 = __pyx_t_2; - __pyx_L18_bool_binop_done:; + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":63 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 8: # double - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_double(bit_stream, record_format, number_of_records, - */ - if (__pyx_t_3) { +static PyObject *__pyx_pf_8dataRead_12SymBufReader_2seek(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, Py_ssize_t __pyx_v_pos, int __pyx_v_whence) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("seek", 1); - /* "dataRead.pyx":65 - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): - * return read_double(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 0) - * else: # swap bytes + /* "dataRead.pyx":61 + * def seek(self, Py_ssize_t pos, int whence=0): + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: # <<<<<<<<<<<<<< + * self._pos = pos + * elif whence == 1: */ - __Pyx_XDECREF(__pyx_r); + switch (__pyx_v_whence) { + case 0: - /* "dataRead.pyx":66 - * (byteorder == 'big' and signal_data_type == 5): - * return read_double(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_double(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":62 + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: + * self._pos = pos # <<<<<<<<<<<<<< + * elif whence == 1: + * self._pos += pos */ - __pyx_t_4 = __pyx_f_8dataRead_read_double(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_v_self->_pos = __pyx_v_pos; - /* "dataRead.pyx":63 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 8: # double - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_double(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":61 + * def seek(self, Py_ssize_t pos, int whence=0): + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: # <<<<<<<<<<<<<< + * self._pos = pos + * elif whence == 1: */ - } + break; + case 1: - /* "dataRead.pyx":68 - * record_byte_size, pos_byte_beg, 0) - * else: # swap bytes - * return read_double(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision + /* "dataRead.pyx":64 + * self._pos = pos + * elif whence == 1: + * self._pos += pos # <<<<<<<<<<<<<< + * else: # whence == 2 (from end) + * self._fid.seek(0, 2) */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + __pyx_v_self->_pos = (__pyx_v_self->_pos + __pyx_v_pos); - /* "dataRead.pyx":69 - * else: # swap bytes - * return read_double(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision - * if (byteorder == 'little' and signal_data_type == 4) or \ + /* "dataRead.pyx":63 + * if whence == 0: + * self._pos = pos + * elif whence == 1: # <<<<<<<<<<<<<< + * self._pos += pos + * else: # whence == 2 (from end) */ - __pyx_t_4 = __pyx_f_8dataRead_read_double(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + break; + default: - /* "dataRead.pyx":62 - * return read_float(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 8: # double # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): + /* "dataRead.pyx":66 + * self._pos += pos + * else: # whence == 2 (from end) + * self._fid.seek(0, 2) # <<<<<<<<<<<<<< + * self._pos = self._fid.tell() + pos + * return self._pos */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_fid, __pyx_n_s_seek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __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; - /* "dataRead.pyx":70 - * return read_double(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): + /* "dataRead.pyx":67 + * else: # whence == 2 (from end) + * self._fid.seek(0, 2) + * self._pos = self._fid.tell() + pos # <<<<<<<<<<<<<< + * return self._pos + * */ - switch (__pyx_v_signal_data_type) { - case 4: - case 5: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_fid, __pyx_n_s_tell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_4 = 1; + } } - __pyx_t_5 = __pyx_t_2; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __pyx_t_5 = (__pyx_v_n_bytes == 2); - __pyx_t_3 = __pyx_t_5; - __pyx_L22_bool_binop_done:; - if (__pyx_t_3) { - - /* "dataRead.pyx":71 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_half(bit_stream, record_format, number_of_records, - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - goto __pyx_L26_next_or; - } else { - } - __pyx_t_5 = (__pyx_v_signal_data_type == 4); - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_L26_next_or:; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __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_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->_pos = __pyx_t_5; + break; + } - /* "dataRead.pyx":72 - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): # <<<<<<<<<<<<<< - * return read_half(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) + /* "dataRead.pyx":68 + * self._fid.seek(0, 2) + * self._pos = self._fid.tell() + pos + * return self._pos # <<<<<<<<<<<<<< + * + * def tell(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_signal_data_type == 5); - __pyx_t_3 = __pyx_t_5; - __pyx_L25_bool_binop_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "dataRead.pyx":71 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_half(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":59 + * return 0 + * + * def seek(self, Py_ssize_t pos, int whence=0): # <<<<<<<<<<<<<< + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: */ - if (__pyx_t_3) { - /* "dataRead.pyx":73 - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): - * return read_half(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 0) - * else: # swap bytes - */ - __Pyx_XDECREF(__pyx_r); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dataRead.SymBufReader.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":74 - * (byteorder == 'big' and signal_data_type == 5): - * return read_half(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_half(bit_stream, record_format, number_of_records, +/* "dataRead.pyx":70 + * return self._pos + * + * def tell(self): # <<<<<<<<<<<<<< + * return self._pos + * */ - __pyx_t_4 = __pyx_f_8dataRead_read_half(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - /* "dataRead.pyx":71 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision - * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 5): - * return read_half(bit_stream, record_format, number_of_records, - */ - } - - /* "dataRead.pyx":76 - * record_byte_size, pos_byte_beg, 0) - * else: # swap bytes - * return read_half(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_12SymBufReader_5tell(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_8dataRead_12SymBufReader_5tell = {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_5tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8dataRead_12SymBufReader_5tell(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("tell (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("tell", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "tell", 0))) return NULL; + __pyx_r = __pyx_pf_8dataRead_12SymBufReader_4tell(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self)); - /* "dataRead.pyx":77 - * else: # swap bytes - * return read_half(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char - * return read_unsigned_char(bit_stream, record_format, number_of_records, - */ - __pyx_t_4 = __pyx_f_8dataRead_read_half(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":70 - * return read_double(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 4) or \ - * (byteorder == 'big' and signal_data_type == 5): - */ - } +static PyObject *__pyx_pf_8dataRead_12SymBufReader_4tell(struct __pyx_obj_8dataRead_SymBufReader *__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("tell", 1); - /* "dataRead.pyx":78 - * return read_half(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char # <<<<<<<<<<<<<< - * return read_unsigned_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) + /* "dataRead.pyx":71 + * + * def tell(self): + * return self._pos # <<<<<<<<<<<<<< + * + * def read(self, Py_ssize_t n=-1): */ - switch (__pyx_v_signal_data_type) { - case 0: - case 1: - case 13: - __pyx_t_5 = 1; - break; - default: - __pyx_t_5 = 0; - break; - } - __pyx_t_2 = __pyx_t_5; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L29_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_n_bytes == 1); - __pyx_t_3 = __pyx_t_2; - __pyx_L29_bool_binop_done:; - if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "dataRead.pyx":79 - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char - * return read_unsigned_char(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char + /* "dataRead.pyx":70 + * return self._pos + * + * def tell(self): # <<<<<<<<<<<<<< + * return self._pos + * */ - __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":80 - * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char - * return read_unsigned_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) # <<<<<<<<<<<<<< - * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char - * return read_signed_char(bit_stream, record_format, number_of_records, - */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_char(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dataRead.SymBufReader.tell", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":78 - * return read_half(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 1) - * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char # <<<<<<<<<<<<<< - * return read_unsigned_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) +/* "dataRead.pyx":73 + * return self._pos + * + * def read(self, Py_ssize_t n=-1): # <<<<<<<<<<<<<< + * """Return up to n bytes from the current position (or all if n<0).""" + * cdef Py_ssize_t pos = self._pos */ - } - /* "dataRead.pyx":81 - * return read_unsigned_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char # <<<<<<<<<<<<<< - * return read_signed_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - */ - switch (__pyx_v_signal_data_type) { - case 2: - case 3: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_12SymBufReader_7read(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_8dataRead_12SymBufReader_6read, "Return up to n bytes from the current position (or all if n<0)."); +static PyMethodDef __pyx_mdef_8dataRead_12SymBufReader_7read = {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_7read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_12SymBufReader_6read}; +static PyObject *__pyx_pw_8dataRead_12SymBufReader_7read(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + Py_ssize_t __pyx_v_n; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n); + if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read") < 0)) __PYX_ERR(0, 73, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_t_5 = __pyx_t_2; - if (__pyx_t_5) { + if (values[0]) { + __pyx_v_n = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_n == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L31_bool_binop_done; + __pyx_v_n = ((Py_ssize_t)-1L); } - __pyx_t_5 = (__pyx_v_n_bytes == 1); - __pyx_t_3 = __pyx_t_5; - __pyx_L31_bool_binop_done:; - if (__pyx_t_3) { + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 73, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.SymBufReader.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8dataRead_12SymBufReader_6read(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self), __pyx_v_n); - /* "dataRead.pyx":82 - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char - * return read_signed_char(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short - */ - __Pyx_XDECREF(__pyx_r); + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":83 - * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char - * return read_signed_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) # <<<<<<<<<<<<<< - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short - * if (byteorder == 'little' and signal_data_type == 0) or \ - */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_char(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; +static PyObject *__pyx_pf_8dataRead_12SymBufReader_6read(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, Py_ssize_t __pyx_v_n) { + Py_ssize_t __pyx_v_pos; + Py_ssize_t __pyx_v_buf_end; + Py_ssize_t __pyx_v_offset; + Py_ssize_t __pyx_v_available; + Py_ssize_t __pyx_v_end; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read", 1); + + /* "dataRead.pyx":75 + * def read(self, Py_ssize_t n=-1): + * """Return up to n bytes from the current position (or all if n<0).""" + * cdef Py_ssize_t pos = self._pos # <<<<<<<<<<<<<< + * cdef Py_ssize_t buf_end, offset, available, end + * buf_end = self._buf_start + self._buf_len + */ + __pyx_t_1 = __pyx_v_self->_pos; + __pyx_v_pos = __pyx_t_1; + + /* "dataRead.pyx":77 + * cdef Py_ssize_t pos = self._pos + * cdef Py_ssize_t buf_end, offset, available, end + * buf_end = self._buf_start + self._buf_len # <<<<<<<<<<<<<< + * # Fast path: serve directly from buffer + * if self._buf_len > 0 and self._buf_start <= pos < buf_end: + */ + __pyx_v_buf_end = (__pyx_v_self->_buf_start + __pyx_v_self->_buf_len); + + /* "dataRead.pyx":79 + * buf_end = self._buf_start + self._buf_len + * # Fast path: serve directly from buffer + * if self._buf_len > 0 and self._buf_start <= pos < buf_end: # <<<<<<<<<<<<<< + * offset = pos - self._buf_start + * available = self._buf_len - offset + */ + __pyx_t_3 = (__pyx_v_self->_buf_len > 0); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_self->_buf_start <= __pyx_v_pos); + if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_pos < __pyx_v_buf_end); + } + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { - /* "dataRead.pyx":81 - * return read_unsigned_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char # <<<<<<<<<<<<<< - * return read_signed_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) + /* "dataRead.pyx":80 + * # Fast path: serve directly from buffer + * if self._buf_len > 0 and self._buf_start <= pos < buf_end: + * offset = pos - self._buf_start # <<<<<<<<<<<<<< + * available = self._buf_len - offset + * if n < 0 or available >= n: */ - } + __pyx_v_offset = (__pyx_v_pos - __pyx_v_self->_buf_start); - /* "dataRead.pyx":84 - * return read_signed_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): - */ - switch (__pyx_v_signal_data_type) { - case 0: - case 1: - case 13: - case 14: - __pyx_t_5 = 1; - break; - default: - __pyx_t_5 = 0; - break; - } - __pyx_t_2 = __pyx_t_5; - if (__pyx_t_2) { + /* "dataRead.pyx":81 + * if self._buf_len > 0 and self._buf_start <= pos < buf_end: + * offset = pos - self._buf_start + * available = self._buf_len - offset # <<<<<<<<<<<<<< + * if n < 0 or available >= n: + * end = offset + (n if n >= 0 else available) + */ + __pyx_v_available = (__pyx_v_self->_buf_len - __pyx_v_offset); + + /* "dataRead.pyx":82 + * offset = pos - self._buf_start + * available = self._buf_len - offset + * if n < 0 or available >= n: # <<<<<<<<<<<<<< + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) + */ + __pyx_t_3 = (__pyx_v_n < 0); + if (!__pyx_t_3) { } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L33_bool_binop_done; + __pyx_t_2 = __pyx_t_3; + goto __pyx_L7_bool_binop_done; } - __pyx_t_2 = (__pyx_v_n_bytes <= 2); - __pyx_t_3 = __pyx_t_2; - __pyx_L33_bool_binop_done:; - if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_available >= __pyx_v_n); + __pyx_t_2 = __pyx_t_3; + __pyx_L7_bool_binop_done:; + if (__pyx_t_2) { - /* "dataRead.pyx":85 - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":83 + * available = self._buf_len - offset + * if n < 0 or available >= n: + * end = offset + (n if n >= 0 else available) # <<<<<<<<<<<<<< + * data = bytes(self._buf[offset:end]) + * self._pos += len(data) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_2) { - goto __pyx_L37_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_signal_data_type == 0); - if (!__pyx_t_2) { + __pyx_t_2 = (__pyx_v_n >= 0); + if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_n; } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L36_bool_binop_done; + __pyx_t_1 = __pyx_v_available; } - __pyx_L37_next_or:; + __pyx_v_end = (__pyx_v_offset + __pyx_t_1); - /* "dataRead.pyx":86 - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): # <<<<<<<<<<<<<< - * return read_unsigned_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) + /* "dataRead.pyx":84 + * if n < 0 or available >= n: + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) # <<<<<<<<<<<<<< + * self._pos += len(data) + * return data */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_self->_buf) + __pyx_v_offset, __pyx_v_end - __pyx_v_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L36_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_signal_data_type == 1); - __pyx_t_3 = __pyx_t_2; - __pyx_L36_bool_binop_done:; + __pyx_v_data = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; /* "dataRead.pyx":85 - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_short(bit_stream, record_format, number_of_records, + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) + * self._pos += len(data) # <<<<<<<<<<<<<< + * return data + * # Buffer miss: refill centred on pos, then serve */ - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_data); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_v_self->_pos = (__pyx_v_self->_pos + __pyx_t_1); - /* "dataRead.pyx":87 - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) - * else: # swap bytes + /* "dataRead.pyx":86 + * data = bytes(self._buf[offset:end]) + * self._pos += len(data) + * return data # <<<<<<<<<<<<<< + * # Buffer miss: refill centred on pos, then serve + * self._fill(pos) */ - __Pyx_XDECREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_data); + __pyx_r = __pyx_v_data; + goto __pyx_L0; - /* "dataRead.pyx":88 - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_unsigned_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":82 + * offset = pos - self._buf_start + * available = self._buf_len - offset + * if n < 0 or available >= n: # <<<<<<<<<<<<<< + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + } - /* "dataRead.pyx":85 - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":79 + * buf_end = self._buf_start + self._buf_len + * # Fast path: serve directly from buffer + * if self._buf_len > 0 and self._buf_start <= pos < buf_end: # <<<<<<<<<<<<<< + * offset = pos - self._buf_start + * available = self._buf_len - offset */ - } + } - /* "dataRead.pyx":90 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) - * else: # swap bytes - * return read_unsigned_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short + /* "dataRead.pyx":88 + * return data + * # Buffer miss: refill centred on pos, then serve + * self._fill(pos) # <<<<<<<<<<<<<< + * offset = pos - self._buf_start + * if offset >= self._buf_len: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = ((struct __pyx_vtabstruct_8dataRead_SymBufReader *)__pyx_v_self->__pyx_vtab)->_fill(__pyx_v_self, __pyx_v_pos); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 88, __pyx_L1_error) - /* "dataRead.pyx":91 - * else: # swap bytes - * return read_unsigned_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short - * if (byteorder == 'little' and signal_data_type == 2) or \ + /* "dataRead.pyx":89 + * # Buffer miss: refill centred on pos, then serve + * self._fill(pos) + * offset = pos - self._buf_start # <<<<<<<<<<<<<< + * if offset >= self._buf_len: + * return b'' */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_v_offset = (__pyx_v_pos - __pyx_v_self->_buf_start); - /* "dataRead.pyx":84 - * return read_signed_char(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset) - * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): + /* "dataRead.pyx":90 + * self._fill(pos) + * offset = pos - self._buf_start + * if offset >= self._buf_len: # <<<<<<<<<<<<<< + * return b'' + * available = self._buf_len - offset */ - } + __pyx_t_2 = (__pyx_v_offset >= __pyx_v_self->_buf_len); + if (__pyx_t_2) { - /* "dataRead.pyx":92 - * return read_unsigned_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): + /* "dataRead.pyx":91 + * offset = pos - self._buf_start + * if offset >= self._buf_len: + * return b'' # <<<<<<<<<<<<<< + * available = self._buf_len - offset + * end = offset + (n if n >= 0 else available) */ - switch (__pyx_v_signal_data_type) { - case 2: - case 3: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; - } - __pyx_t_5 = __pyx_t_2; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L40_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_n_bytes <= 2); - __pyx_t_3 = __pyx_t_5; - __pyx_L40_bool_binop_done:; - if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_b__12); + __pyx_r = __pyx_kp_b__12; + goto __pyx_L0; - /* "dataRead.pyx":93 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":90 + * self._fill(pos) + * offset = pos - self._buf_start + * if offset >= self._buf_len: # <<<<<<<<<<<<<< + * return b'' + * available = self._buf_len - offset */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - goto __pyx_L44_next_or; - } else { - } - __pyx_t_5 = (__pyx_v_signal_data_type == 2); - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L43_bool_binop_done; - } - __pyx_L44_next_or:; + } - /* "dataRead.pyx":94 - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): # <<<<<<<<<<<<<< - * return read_signed_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) + /* "dataRead.pyx":92 + * if offset >= self._buf_len: + * return b'' + * available = self._buf_len - offset # <<<<<<<<<<<<<< + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L43_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_signal_data_type == 3); - __pyx_t_3 = __pyx_t_5; - __pyx_L43_bool_binop_done:; + __pyx_v_available = (__pyx_v_self->_buf_len - __pyx_v_offset); - /* "dataRead.pyx":93 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":93 + * return b'' + * available = self._buf_len - offset + * end = offset + (n if n >= 0 else available) # <<<<<<<<<<<<<< + * data = bytes(self._buf[offset:end]) + * self._pos += len(data) */ - if (__pyx_t_3) { + __pyx_t_2 = (__pyx_v_n >= 0); + if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_n; + } else { + __pyx_t_1 = __pyx_v_available; + } + __pyx_v_end = (__pyx_v_offset + __pyx_t_1); - /* "dataRead.pyx":95 - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) - * else: # swap bytes + /* "dataRead.pyx":94 + * available = self._buf_len - offset + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) # <<<<<<<<<<<<<< + * self._pos += len(data) + * return data */ - __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_self->_buf) + __pyx_v_offset, __pyx_v_end - __pyx_v_offset); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_data = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":96 - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_signed_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":95 + * end = offset + (n if n >= 0 else available) + * data = bytes(self._buf[offset:end]) + * self._pos += len(data) # <<<<<<<<<<<<<< + * return data + * */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyBytes_GET_SIZE(__pyx_v_data); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_v_self->_pos = (__pyx_v_self->_pos + __pyx_t_1); - /* "dataRead.pyx":93 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_short(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":96 + * data = bytes(self._buf[offset:end]) + * self._pos += len(data) + * return data # <<<<<<<<<<<<<< + * + * def fileno(self): */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_data); + __pyx_r = __pyx_v_data; + goto __pyx_L0; - /* "dataRead.pyx":98 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) - * else: # swap bytes - * return read_signed_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int + /* "dataRead.pyx":73 + * return self._pos + * + * def read(self, Py_ssize_t n=-1): # <<<<<<<<<<<<<< + * """Return up to n bytes from the current position (or all if n<0).""" + * cdef Py_ssize_t pos = self._pos */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":99 - * else: # swap bytes - * return read_signed_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int - * if (byteorder == 'little' and signal_data_type == 0) or \ - */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dataRead.SymBufReader.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":92 - * return read_unsigned_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): +/* "dataRead.pyx":98 + * return data + * + * def fileno(self): # <<<<<<<<<<<<<< + * return self._fid.fileno() + * */ - } - /* "dataRead.pyx":100 - * return read_signed_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_12SymBufReader_9fileno(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_8dataRead_12SymBufReader_9fileno = {"fileno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_9fileno, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8dataRead_12SymBufReader_9fileno(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fileno (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("fileno", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "fileno", 0))) return NULL; + __pyx_r = __pyx_pf_8dataRead_12SymBufReader_8fileno(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8dataRead_12SymBufReader_8fileno(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fileno", 1); + + /* "dataRead.pyx":99 + * + * def fileno(self): + * return self._fid.fileno() # <<<<<<<<<<<<<< + * + * */ - switch (__pyx_v_signal_data_type) { - case 0: - case 1: - case 14: - __pyx_t_5 = 1; - break; - default: - __pyx_t_5 = 0; - break; - } - __pyx_t_2 = __pyx_t_5; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L47_bool_binop_done; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_fid, __pyx_n_s_fileno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } - __pyx_t_2 = (__pyx_v_n_bytes <= 4); - __pyx_t_3 = __pyx_t_2; - __pyx_L47_bool_binop_done:; - if (__pyx_t_3) { + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "dataRead.pyx":101 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_int(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":98 + * return data + * + * def fileno(self): # <<<<<<<<<<<<<< + * return self._fid.fileno() + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_2) { - goto __pyx_L51_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_signal_data_type == 0); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L50_bool_binop_done; - } - __pyx_L51_next_or:; - /* "dataRead.pyx":102 - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): # <<<<<<<<<<<<<< - * return read_unsigned_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L50_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_signal_data_type == 1); - __pyx_t_3 = __pyx_t_2; - __pyx_L50_bool_binop_done:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dataRead.SymBufReader.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":101 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_int(bit_stream, record_format, number_of_records, +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - if (__pyx_t_3) { - /* "dataRead.pyx":103 - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes - */ - __Pyx_XDECREF(__pyx_r); +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_12SymBufReader_11__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_8dataRead_12SymBufReader_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8dataRead_12SymBufReader_11__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_8dataRead_12SymBufReader_10__reduce_cython__(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self)); - /* "dataRead.pyx":104 - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_unsigned_int(bit_stream, record_format, number_of_records, - */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":101 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_int(bit_stream, record_format, number_of_records, - */ - } +static PyObject *__pyx_pf_8dataRead_12SymBufReader_10__reduce_cython__(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + 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_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 1); - /* "dataRead.pyx":106 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes - * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self._buf, self._buf_len, self._buf_start, self._fid, self._pos) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_FromCString(__pyx_v_self->_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->_buf_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->_buf_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_self->_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->_fid); + __Pyx_GIVEREF(__pyx_v_self->_fid); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_self->_fid)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "dataRead.pyx":107 - * else: # swap bytes - * return read_unsigned_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int - * if (byteorder == 'little' and signal_data_type == 2) or \ + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self._buf, self._buf_len, self._buf_start, self._fid, self._pos) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v__dict = __pyx_t_5; + __pyx_t_5 = 0; - /* "dataRead.pyx":100 - * return read_signed_short(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) - * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): + /* "(tree fragment)":7 + * state = (self._buf, self._buf_len, self._buf_start, self._fid, self._pos) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - } + __pyx_t_6 = (__pyx_v__dict != Py_None); + if (__pyx_t_6) { - /* "dataRead.pyx":108 - * return read_unsigned_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - switch (__pyx_v_signal_data_type) { - case 2: - case 3: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; - } - __pyx_t_5 = __pyx_t_2; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L54_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_n_bytes <= 4); - __pyx_t_3 = __pyx_t_5; - __pyx_L54_bool_binop_done:; - if (__pyx_t_3) { + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; - /* "dataRead.pyx":109 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_int(bit_stream, record_format, number_of_records, + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self._fid is not None */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - goto __pyx_L58_next_or; - } else { - } - __pyx_t_5 = (__pyx_v_signal_data_type == 2); - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L57_bool_binop_done; - } - __pyx_L58_next_or:; + __pyx_v_use_setstate = 1; - /* "dataRead.pyx":110 - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): # <<<<<<<<<<<<<< - * return read_signed_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + /* "(tree fragment)":7 + * state = (self._buf, self._buf_len, self._buf_start, self._fid, self._pos) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L57_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_signal_data_type == 3); - __pyx_t_3 = __pyx_t_5; - __pyx_L57_bool_binop_done:; + goto __pyx_L3; + } - /* "dataRead.pyx":109 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_int(bit_stream, record_format, number_of_records, + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self._fid is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, None), state */ - if (__pyx_t_3) { + /*else*/ { + __pyx_t_6 = (__pyx_v_self->_fid != Py_None); + __pyx_v_use_setstate = __pyx_t_6; + } + __pyx_L3:; - /* "dataRead.pyx":111 - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes + /* "(tree fragment)":12 + * else: + * use_setstate = self._fid is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, None), state + * else: */ - __Pyx_XDECREF(__pyx_r); + if (__pyx_v_use_setstate) { - /* "dataRead.pyx":112 - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_signed_int(bit_stream, record_format, number_of_records, + /* "(tree fragment)":13 + * use_setstate = self._fid is not None + * if use_setstate: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_SymBufReader); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_55633519); + __Pyx_GIVEREF(__pyx_int_55633519); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_55633519)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "dataRead.pyx":109 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_int(bit_stream, record_format, number_of_records, + /* "(tree fragment)":12 + * else: + * use_setstate = self._fid is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, None), state + * else: */ - } + } - /* "dataRead.pyx":114 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes - * return read_signed_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long + /* "(tree fragment)":15 + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, None), state + * else: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_SymBufReader__set_state(self, __pyx_state) */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_SymBufReader); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_55633519); + __Pyx_GIVEREF(__pyx_int_55633519); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_55633519)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":115 - * else: # swap bytes - * return read_signed_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long - * if (byteorder == 'little' and signal_data_type == 0) or \ + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /* "dataRead.pyx":108 - * return read_unsigned_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): + /* function exit code */ + __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("dataRead.SymBufReader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_SymBufReader__set_state(self, __pyx_state) */ - } - /* "dataRead.pyx":116 - * return read_signed_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): - */ - switch (__pyx_v_signal_data_type) { - case 0: - case 1: - __pyx_t_5 = 1; - break; - default: - __pyx_t_5 = 0; - break; - } - __pyx_t_2 = __pyx_t_5; - if (__pyx_t_2) { +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_12SymBufReader_13__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_8dataRead_12SymBufReader_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8dataRead_12SymBufReader_13__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L61_bool_binop_done; + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_t_2 = (__pyx_v_n_bytes <= 8); - __pyx_t_3 = __pyx_t_2; - __pyx_L61_bool_binop_done:; - if (__pyx_t_3) { + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.SymBufReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8dataRead_12SymBufReader_12__setstate_cython__(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v_self), __pyx_v___pyx_state); - /* "dataRead.pyx":117 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8dataRead_12SymBufReader_12__setstate_cython__(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + 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("__setstate_cython__", 1); + + /* "(tree fragment)":17 + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_SymBufReader__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_2) { - goto __pyx_L65_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_signal_data_type == 0); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L64_bool_binop_done; - } - __pyx_L65_next_or:; + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_f_8dataRead___pyx_unpickle_SymBufReader__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dataRead.pyx":118 - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): # <<<<<<<<<<<<<< - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_SymBufReader__set_state(self, __pyx_state) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L64_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_signal_data_type == 1); - __pyx_t_3 = __pyx_t_2; - __pyx_L64_bool_binop_done:; - /* "dataRead.pyx":117 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dataRead.SymBufReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":232 + * + * + * cdef str _fast_read_tx(int fd, uint64_t pointer): # <<<<<<<<<<<<<< + * """Read TX block text via pread. Returns '' if pointer is 0 or read fails.""" + * cdef _TXHdr hdr */ - if (__pyx_t_3) { - /* "dataRead.pyx":119 - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes +static PyObject *__pyx_f_8dataRead__fast_read_tx(int __pyx_v_fd, uint64_t __pyx_v_pointer) { + struct __pyx_t_8dataRead__TXHdr __pyx_v_hdr; + Py_ssize_t __pyx_v_content_len; + Py_ssize_t __pyx_v_end; + Py_ssize_t __pyx_v_nread; + unsigned char *__pyx_v_buf; + PyObject *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + char const *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_fast_read_tx", 1); + + /* "dataRead.pyx":239 + * cdef str result + * + * if pointer == 0: # <<<<<<<<<<<<<< + * return '' + * with nogil: */ - __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = (__pyx_v_pointer == 0); + if (__pyx_t_1) { - /* "dataRead.pyx":120 - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":240 + * + * if pointer == 0: + * return '' # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":117 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long - * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 1): - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":239 + * cdef str result + * + * if pointer == 0: # <<<<<<<<<<<<<< + * return '' + * with nogil: */ - } + } - /* "dataRead.pyx":122 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + /* "dataRead.pyx":241 + * if pointer == 0: + * return '' + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":123 - * else: # swap bytes - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long - * if (byteorder == 'little' and signal_data_type == 2) or \ + /* "dataRead.pyx":242 + * return '' + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) # <<<<<<<<<<<<<< + * if nread < 24 or hdr.length <= 24: + * return '' */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_hdr), 24, __pyx_v_pointer); } - /* "dataRead.pyx":116 - * return read_signed_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 0) or \ - * (byteorder == 'big' and signal_data_type == 1): + /* "dataRead.pyx":241 + * if pointer == 0: + * return '' + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "dataRead.pyx":243 + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: # <<<<<<<<<<<<<< + * return '' + * content_len = (hdr.length - 24) */ - } + __pyx_t_2 = (__pyx_v_nread < 24); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_hdr.length <= 24); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { - /* "dataRead.pyx":124 - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): + /* "dataRead.pyx":244 + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: + * return '' # <<<<<<<<<<<<<< + * content_len = (hdr.length - 24) + * if content_len <= 0: */ - switch (__pyx_v_signal_data_type) { - case 2: - case 3: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; - } - __pyx_t_5 = __pyx_t_2; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L68_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_n_bytes <= 8); - __pyx_t_3 = __pyx_t_5; - __pyx_L68_bool_binop_done:; - if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":125 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":243 + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: # <<<<<<<<<<<<<< + * return '' + * content_len = (hdr.length - 24) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_5) { - goto __pyx_L72_next_or; - } else { - } - __pyx_t_5 = (__pyx_v_signal_data_type == 2); - if (!__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L71_bool_binop_done; - } - __pyx_L72_next_or:; + } - /* "dataRead.pyx":126 - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): # <<<<<<<<<<<<<< - * return read_signed_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + /* "dataRead.pyx":245 + * if nread < 24 or hdr.length <= 24: + * return '' + * content_len = (hdr.length - 24) # <<<<<<<<<<<<<< + * if content_len <= 0: + * return '' */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - } else { - __pyx_t_3 = __pyx_t_5; - goto __pyx_L71_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_signal_data_type == 3); - __pyx_t_3 = __pyx_t_5; - __pyx_L71_bool_binop_done:; + __pyx_v_content_len = ((Py_ssize_t)(__pyx_v_hdr.length - 24)); - /* "dataRead.pyx":125 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":246 + * return '' + * content_len = (hdr.length - 24) + * if content_len <= 0: # <<<<<<<<<<<<<< + * return '' + * buf = PyMem_Malloc(content_len + 1) */ - if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_content_len <= 0); + if (__pyx_t_1) { - /* "dataRead.pyx":127 - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes + /* "dataRead.pyx":247 + * content_len = (hdr.length - 24) + * if content_len <= 0: + * return '' # <<<<<<<<<<<<<< + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: */ - __Pyx_XDECREF(__pyx_r); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":128 - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_signed_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":246 + * return '' + * content_len = (hdr.length - 24) + * if content_len <= 0: # <<<<<<<<<<<<<< + * return '' + * buf = PyMem_Malloc(content_len + 1) */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + } - /* "dataRead.pyx":125 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long - * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 3): - * return read_signed_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":248 + * if content_len <= 0: + * return '' + * buf = PyMem_Malloc(content_len + 1) # <<<<<<<<<<<<<< + * if buf == NULL: + * return '' */ - } + __pyx_v_buf = ((unsigned char *)PyMem_Malloc((__pyx_v_content_len + 1))); - /* "dataRead.pyx":130 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) - * else: # swap bytes - * return read_signed_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (15, 16): # complex + /* "dataRead.pyx":249 + * return '' + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: # <<<<<<<<<<<<<< + * return '' + * try: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = (__pyx_v_buf == NULL); + if (__pyx_t_1) { - /* "dataRead.pyx":131 - * else: # swap bytes - * return read_signed_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< - * elif signal_data_type in (15, 16): # complex - * if (byteorder == 'little' and signal_data_type == 15) or \ + /* "dataRead.pyx":250 + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: + * return '' # <<<<<<<<<<<<<< + * try: + * with nogil: */ - __pyx_t_4 = __pyx_f_8dataRead_read_signed_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":124 - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 2) or \ - * (byteorder == 'big' and signal_data_type == 3): + /* "dataRead.pyx":249 + * return '' + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: # <<<<<<<<<<<<<< + * return '' + * try: */ - } + } - /* "dataRead.pyx":132 - * return read_signed_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (15, 16): # complex # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 15) or \ - * (byteorder == 'big' and signal_data_type == 16): + /* "dataRead.pyx":251 + * if buf == NULL: + * return '' + * try: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) */ - switch (__pyx_v_signal_data_type) { - case 15: - case 16: - __pyx_t_3 = 1; - break; - default: - __pyx_t_3 = 0; - break; - } - __pyx_t_5 = __pyx_t_3; - if (__pyx_t_5) { + /*try:*/ { - /* "dataRead.pyx":133 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (15, 16): # complex - * if (byteorder == 'little' and signal_data_type == 15) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 16): - * swap_flag = 0 + /* "dataRead.pyx":252 + * return '' + * try: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_3) { - goto __pyx_L77_next_or; - } else { - } - __pyx_t_3 = (__pyx_v_signal_data_type == 15); - if (!__pyx_t_3) { - } else { - __pyx_t_5 = __pyx_t_3; - goto __pyx_L76_bool_binop_done; - } - __pyx_L77_next_or:; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":134 - * elif signal_data_type in (15, 16): # complex - * if (byteorder == 'little' and signal_data_type == 15) or \ - * (byteorder == 'big' and signal_data_type == 16): # <<<<<<<<<<<<<< - * swap_flag = 0 - * else: # swap bytes + /* "dataRead.pyx":253 + * try: + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) # <<<<<<<<<<<<<< + * if nread < 1: + * return '' */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_3) { - } else { - __pyx_t_5 = __pyx_t_3; - goto __pyx_L76_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_signal_data_type == 16); - __pyx_t_5 = __pyx_t_3; - __pyx_L76_bool_binop_done:; + __pyx_v_nread = pread(__pyx_v_fd, __pyx_v_buf, __pyx_v_content_len, (__pyx_v_pointer + 24)); + } - /* "dataRead.pyx":133 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (15, 16): # complex - * if (byteorder == 'little' and signal_data_type == 15) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 16): - * swap_flag = 0 + /* "dataRead.pyx":252 + * return '' + * try: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L17; + } + __pyx_L17:; + } + } + + /* "dataRead.pyx":254 + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: # <<<<<<<<<<<<<< + * return '' + * end = nread */ - if (__pyx_t_5) { + __pyx_t_1 = (__pyx_v_nread < 1); + if (__pyx_t_1) { - /* "dataRead.pyx":135 - * if (byteorder == 'little' and signal_data_type == 15) or \ - * (byteorder == 'big' and signal_data_type == 16): - * swap_flag = 0 # <<<<<<<<<<<<<< - * else: # swap bytes - * swap_flag = 1 + /* "dataRead.pyx":255 + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: + * return '' # <<<<<<<<<<<<<< + * end = nread + * while end > 0 and buf[end - 1] == 0: */ - __pyx_v_swap_flag = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L12_return; - /* "dataRead.pyx":133 - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (15, 16): # complex - * if (byteorder == 'little' and signal_data_type == 15) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type == 16): - * swap_flag = 0 + /* "dataRead.pyx":254 + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: # <<<<<<<<<<<<<< + * return '' + * end = nread */ - goto __pyx_L75; - } + } - /* "dataRead.pyx":137 - * swap_flag = 0 - * else: # swap bytes - * swap_flag = 1 # <<<<<<<<<<<<<< - * if n_bytes == 16: - * return read_cdouble(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":256 + * if nread < 1: + * return '' + * end = nread # <<<<<<<<<<<<<< + * while end > 0 and buf[end - 1] == 0: + * end -= 1 */ - /*else*/ { - __pyx_v_swap_flag = 1; - } - __pyx_L75:; + __pyx_v_end = __pyx_v_nread; - /* "dataRead.pyx":138 - * else: # swap bytes - * swap_flag = 1 - * if n_bytes == 16: # <<<<<<<<<<<<<< - * return read_cdouble(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) + /* "dataRead.pyx":257 + * return '' + * end = nread + * while end > 0 and buf[end - 1] == 0: # <<<<<<<<<<<<<< + * end -= 1 + * buf[end] = 0 */ - switch (__pyx_v_n_bytes) { - case 16: + while (1) { + __pyx_t_2 = (__pyx_v_end > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L21_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_buf[(__pyx_v_end - 1)]) == 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L21_bool_binop_done:; + if (!__pyx_t_1) break; - /* "dataRead.pyx":139 - * swap_flag = 1 - * if n_bytes == 16: - * return read_cdouble(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes == 8: + /* "dataRead.pyx":258 + * end = nread + * while end > 0 and buf[end - 1] == 0: + * end -= 1 # <<<<<<<<<<<<<< + * buf[end] = 0 + * result = (buf[:end]).decode('UTF-8', 'ignore') */ - __Pyx_XDECREF(__pyx_r); + __pyx_v_end = (__pyx_v_end - 1); + } - /* "dataRead.pyx":140 - * if n_bytes == 16: - * return read_cdouble(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< - * elif n_bytes == 8: - * return read_cfloat(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":259 + * while end > 0 and buf[end - 1] == 0: + * end -= 1 + * buf[end] = 0 # <<<<<<<<<<<<<< + * result = (buf[:end]).decode('UTF-8', 'ignore') + * finally: */ - __pyx_t_4 = __pyx_f_8dataRead_read_cdouble(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + (__pyx_v_buf[__pyx_v_end]) = 0; - /* "dataRead.pyx":138 - * else: # swap bytes - * swap_flag = 1 - * if n_bytes == 16: # <<<<<<<<<<<<<< - * return read_cdouble(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) + /* "dataRead.pyx":260 + * end -= 1 + * buf[end] = 0 + * result = (buf[:end]).decode('UTF-8', 'ignore') # <<<<<<<<<<<<<< + * finally: + * PyMem_Free(buf) */ - break; - case 8: + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_buf) + 0, __pyx_v_end - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode"); + __PYX_ERR(0, 260, __pyx_L13_error) + } + __pyx_t_4 = __Pyx_decode_bytes(((PyObject*)__pyx_t_3), 0, PY_SSIZE_T_MAX, NULL, ((char const *)"ignore"), PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } - /* "dataRead.pyx":142 - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes == 8: - * return read_cfloat(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes == 4: + /* "dataRead.pyx":262 + * result = (buf[:end]).decode('UTF-8', 'ignore') + * finally: + * PyMem_Free(buf) # <<<<<<<<<<<<<< + * return result + * */ - __Pyx_XDECREF(__pyx_r); + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_buf); + goto __pyx_L14; + } + __pyx_L13_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename; + { + PyMem_Free(__pyx_v_buf); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + } + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; + __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7; + goto __pyx_L1_error; + } + __pyx_L12_return: { + __pyx_t_14 = __pyx_r; + __pyx_r = 0; + PyMem_Free(__pyx_v_buf); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + } + __pyx_L14:; + } - /* "dataRead.pyx":143 - * elif n_bytes == 8: - * return read_cfloat(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< - * elif n_bytes == 4: - * return read_chalf(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":263 + * finally: + * PyMem_Free(buf) + * return result # <<<<<<<<<<<<<< + * + * */ - __pyx_t_4 = __pyx_f_8dataRead_read_cfloat(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_v_result)) { __Pyx_RaiseUnboundLocalError("result"); __PYX_ERR(0, 263, __pyx_L1_error) } + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "dataRead.pyx":141 - * return read_cdouble(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes == 8: # <<<<<<<<<<<<<< - * return read_cfloat(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) + /* "dataRead.pyx":232 + * + * + * cdef str _fast_read_tx(int fd, uint64_t pointer): # <<<<<<<<<<<<<< + * """Read TX block text via pread. Returns '' if pointer is 0 or read fails.""" + * cdef _TXHdr hdr */ - break; - case 4: - /* "dataRead.pyx":145 - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes == 4: - * return read_chalf(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes <= 4: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("dataRead._fast_read_tx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":266 + * + * + * cdef str _fast_read_tx_or_md(int fd, uint64_t pointer): # <<<<<<<<<<<<<< + * """Read a TX or MD block and return its text content. + * */ - __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":146 - * elif n_bytes == 4: - * return read_chalf(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< - * elif n_bytes <= 4: - * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) +static PyObject *__pyx_f_8dataRead__fast_read_tx_or_md(int __pyx_v_fd, uint64_t __pyx_v_pointer) { + struct __pyx_t_8dataRead__TXHdr __pyx_v_hdr; + Py_ssize_t __pyx_v_content_len; + Py_ssize_t __pyx_v_nread; + Py_ssize_t __pyx_v_tx_start; + Py_ssize_t __pyx_v_tx_end; + Py_ssize_t __pyx_v_end; + unsigned char *__pyx_v_buf; + PyObject *__pyx_v_payload = 0; + PyObject *__pyx_v_result = 0; + PyObject *__pyx_v__obj = NULL; + PyObject *__pyx_v_xml_tree = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + unsigned int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + char const *__pyx_t_16; + PyObject *__pyx_t_17 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_fast_read_tx_or_md", 1); + + /* "dataRead.pyx":289 + * cdef str result + * + * if pointer == 0: # <<<<<<<<<<<<<< + * return '' + * with nogil: */ - __pyx_t_4 = __pyx_f_8dataRead_read_chalf(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_pointer == 0); + if (__pyx_t_1) { - /* "dataRead.pyx":144 - * return read_cfloat(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes == 4: # <<<<<<<<<<<<<< - * return read_chalf(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) + /* "dataRead.pyx":290 + * + * if pointer == 0: + * return '' # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) */ - break; - default: break; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; + + /* "dataRead.pyx":289 + * cdef str result + * + * if pointer == 0: # <<<<<<<<<<<<<< + * return '' + * with nogil: + */ + } + + /* "dataRead.pyx":291 + * if pointer == 0: + * return '' + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "dataRead.pyx":292 + * return '' + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) # <<<<<<<<<<<<<< + * if nread < 24 or hdr.length <= 24: + * return '' + */ + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_hdr), 24, __pyx_v_pointer); } - /* "dataRead.pyx":132 - * return read_signed_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) - * elif signal_data_type in (15, 16): # complex # <<<<<<<<<<<<<< - * if (byteorder == 'little' and signal_data_type == 15) or \ - * (byteorder == 'big' and signal_data_type == 16): + /* "dataRead.pyx":291 + * if pointer == 0: + * return '' + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "dataRead.pyx":293 + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: # <<<<<<<<<<<<<< + * return '' + * content_len = (hdr.length - 24) */ - goto __pyx_L4; - } + __pyx_t_2 = (__pyx_v_nread < 24); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_hdr.length <= 24); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { - /* "dataRead.pyx":147 - * return read_chalf(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes <= 4: # <<<<<<<<<<<<<< - * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) - * return read_unsigned_int(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":294 + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: + * return '' # <<<<<<<<<<<<<< + * content_len = (hdr.length - 24) + * if content_len <= 0: */ - __pyx_t_5 = (__pyx_v_n_bytes <= 4); - if (__pyx_t_5) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":149 - * elif n_bytes <= 4: - * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) - * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) + /* "dataRead.pyx":293 + * with nogil: + * nread = c_pread(fd, &hdr, 24, pointer) + * if nread < 24 or hdr.length <= 24: # <<<<<<<<<<<<<< + * return '' + * content_len = (hdr.length - 24) */ - __Pyx_XDECREF(__pyx_r); + } - /* "dataRead.pyx":151 - * return read_unsigned_int(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) # <<<<<<<<<<<<<< - * elif n_bytes <= 8: - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":295 + * if nread < 24 or hdr.length <= 24: + * return '' + * content_len = (hdr.length - 24) # <<<<<<<<<<<<<< + * if content_len <= 0: + * return '' */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - __pyx_t_6 = 0; - } else { - __pyx_t_6 = 1; - } + __pyx_v_content_len = ((Py_ssize_t)(__pyx_v_hdr.length - 24)); - /* "dataRead.pyx":149 - * elif n_bytes <= 4: - * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) - * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) + /* "dataRead.pyx":296 + * return '' + * content_len = (hdr.length - 24) + * if content_len <= 0: # <<<<<<<<<<<<<< + * return '' + * buf = PyMem_Malloc(content_len + 1) */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, (__pyx_v_n_bytes * 8), __pyx_v_bit_offset, __pyx_v_n_bytes, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_content_len <= 0); + if (__pyx_t_1) { - /* "dataRead.pyx":147 - * return read_chalf(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, 0) - * elif n_bytes <= 4: # <<<<<<<<<<<<<< - * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) - * return read_unsigned_int(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":297 + * content_len = (hdr.length - 24) + * if content_len <= 0: + * return '' # <<<<<<<<<<<<<< + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":152 - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) - * elif n_bytes <= 8: # <<<<<<<<<<<<<< - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + /* "dataRead.pyx":296 + * return '' + * content_len = (hdr.length - 24) + * if content_len <= 0: # <<<<<<<<<<<<<< + * return '' + * buf = PyMem_Malloc(content_len + 1) */ - __pyx_t_5 = (__pyx_v_n_bytes <= 8); - if (__pyx_t_5) { + } - /* "dataRead.pyx":153 - * 0 if byteorder == 'little' else 1) - * elif n_bytes <= 8: - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) + /* "dataRead.pyx":298 + * if content_len <= 0: + * return '' + * buf = PyMem_Malloc(content_len + 1) # <<<<<<<<<<<<<< + * if buf == NULL: + * return '' */ - __Pyx_XDECREF(__pyx_r); + __pyx_v_buf = ((unsigned char *)PyMem_Malloc((__pyx_v_content_len + 1))); - /* "dataRead.pyx":155 - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) # <<<<<<<<<<<<<< - * else: - * return read_byte(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":299 + * return '' + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: # <<<<<<<<<<<<<< + * return '' + * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - __pyx_t_6 = 0; - } else { - __pyx_t_6 = 1; - } + __pyx_t_1 = (__pyx_v_buf == NULL); + if (__pyx_t_1) { - /* "dataRead.pyx":153 - * 0 if byteorder == 'little' else 1) - * elif n_bytes <= 8: - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) + /* "dataRead.pyx":300 + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: + * return '' # <<<<<<<<<<<<<< + * try: + * with nogil: */ - __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, (__pyx_v_n_bytes * 8), __pyx_v_bit_offset, __pyx_v_n_bytes, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L0; - /* "dataRead.pyx":152 - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, - * 0 if byteorder == 'little' else 1) - * elif n_bytes <= 8: # <<<<<<<<<<<<<< - * return read_unsigned_longlong(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + /* "dataRead.pyx":299 + * return '' + * buf = PyMem_Malloc(content_len + 1) + * if buf == NULL: # <<<<<<<<<<<<<< + * return '' + * try: + */ + } + + /* "dataRead.pyx":301 + * if buf == NULL: + * return '' + * try: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) + */ + /*try:*/ { + + /* "dataRead.pyx":302 + * return '' + * try: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "dataRead.pyx":303 + * try: + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) # <<<<<<<<<<<<<< + * if nread < 1: + * return '' */ + __pyx_v_nread = pread(__pyx_v_fd, __pyx_v_buf, __pyx_v_content_len, (__pyx_v_pointer + 24)); + } + + /* "dataRead.pyx":302 + * return '' + * try: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L17; + } + __pyx_L17:; + } } - /* "dataRead.pyx":157 - * 0 if byteorder == 'little' else 1) - * else: - * return read_byte(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * else: # array + /* "dataRead.pyx":304 + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: # <<<<<<<<<<<<<< + * return '' + * end = nread + */ + __pyx_t_1 = (__pyx_v_nread < 1); + if (__pyx_t_1) { + + /* "dataRead.pyx":305 + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: + * return '' # <<<<<<<<<<<<<< + * end = nread + * while end > 0 and buf[end - 1] == 0: */ - /*else*/ { __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L12_return; - /* "dataRead.pyx":158 - * else: - * return read_byte(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) # <<<<<<<<<<<<<< - * else: # array - * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ + /* "dataRead.pyx":304 + * with nogil: + * nread = c_pread(fd, buf, content_len, pointer + 24) + * if nread < 1: # <<<<<<<<<<<<<< + * return '' + * end = nread */ - __pyx_t_4 = __pyx_f_8dataRead_read_byte(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; } - __pyx_L4:; - /* "dataRead.pyx":50 - * """ - * cdef const char* bit_stream = PyBytes_AsString(tmp) - * if not array: # <<<<<<<<<<<<<< - * if 'V' in record_format or 'S' in record_format or record_format is None: - * return read_byte(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":306 + * if nread < 1: + * return '' + * end = nread # <<<<<<<<<<<<<< + * while end > 0 and buf[end - 1] == 0: + * end -= 1 */ - goto __pyx_L3; - } + __pyx_v_end = __pyx_v_nread; - /* "dataRead.pyx":160 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * else: # array - * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type in (1, 3, 5)): - * return read_array(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":307 + * return '' + * end = nread + * while end > 0 and buf[end - 1] == 0: # <<<<<<<<<<<<<< + * end -= 1 + * # TX block (id[2]=='T', id[3]=='X') */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_3) { - goto __pyx_L82_next_or; - } else { - } - switch (__pyx_v_signal_data_type) { - case 0: - case 2: - case 4: - __pyx_t_3 = 1; - break; - default: - __pyx_t_3 = 0; - break; - } - __pyx_t_2 = __pyx_t_3; - if (!__pyx_t_2) { - } else { - __pyx_t_5 = __pyx_t_2; - goto __pyx_L81_bool_binop_done; + while (1) { + __pyx_t_2 = (__pyx_v_end > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L21_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_buf[(__pyx_v_end - 1)]) == 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L21_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "dataRead.pyx":308 + * end = nread + * while end > 0 and buf[end - 1] == 0: + * end -= 1 # <<<<<<<<<<<<<< + * # TX block (id[2]=='T', id[3]=='X') + * if hdr.id[2] == b'T' and hdr.id[3] == b'X': + */ + __pyx_v_end = (__pyx_v_end - 1); } - __pyx_L82_next_or:; - /* "dataRead.pyx":161 - * else: # array - * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ - * (byteorder == 'big' and signal_data_type in (1, 3, 5)): # <<<<<<<<<<<<<< - * return read_array(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) + /* "dataRead.pyx":310 + * end -= 1 + * # TX block (id[2]=='T', id[3]=='X') + * if hdr.id[2] == b'T' and hdr.id[3] == b'X': # <<<<<<<<<<<<<< + * buf[end] = 0 + * result = (buf[:end]).decode('UTF-8', 'ignore') */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 161, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = ((__pyx_v_hdr.id[2]) == 'T'); if (__pyx_t_2) { } else { - __pyx_t_5 = __pyx_t_2; - goto __pyx_L81_bool_binop_done; - } - switch (__pyx_v_signal_data_type) { - case 1: - case 3: - case 5: - __pyx_t_2 = 1; - break; - default: - __pyx_t_2 = 0; - break; + __pyx_t_1 = __pyx_t_2; + goto __pyx_L24_bool_binop_done; } - __pyx_t_3 = __pyx_t_2; - __pyx_t_5 = __pyx_t_3; - __pyx_L81_bool_binop_done:; - - /* "dataRead.pyx":160 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * else: # array - * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type in (1, 3, 5)): - * return read_array(bit_stream, record_format, number_of_records, - */ - if (__pyx_t_5) { + __pyx_t_2 = ((__pyx_v_hdr.id[3]) == 'X'); + __pyx_t_1 = __pyx_t_2; + __pyx_L24_bool_binop_done:; + if (__pyx_t_1) { - /* "dataRead.pyx":162 - * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ - * (byteorder == 'big' and signal_data_type in (1, 3, 5)): - * return read_array(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) - * else: # swap bytes + /* "dataRead.pyx":311 + * # TX block (id[2]=='T', id[3]=='X') + * if hdr.id[2] == b'T' and hdr.id[3] == b'X': + * buf[end] = 0 # <<<<<<<<<<<<<< + * result = (buf[:end]).decode('UTF-8', 'ignore') + * return result */ - __Pyx_XDECREF(__pyx_r); + (__pyx_v_buf[__pyx_v_end]) = 0; - /* "dataRead.pyx":163 - * (byteorder == 'big' and signal_data_type in (1, 3, 5)): - * return read_array(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) # <<<<<<<<<<<<<< - * else: # swap bytes - * return read_array(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":312 + * if hdr.id[2] == b'T' and hdr.id[3] == b'X': + * buf[end] = 0 + * result = (buf[:end]).decode('UTF-8', 'ignore') # <<<<<<<<<<<<<< + * return result + * # MD block: fast ... scan */ - __pyx_t_4 = __pyx_f_8dataRead_read_array(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_buf) + 0, __pyx_v_end - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode"); + __PYX_ERR(0, 312, __pyx_L13_error) + } + __pyx_t_4 = __Pyx_decode_bytes(((PyObject*)__pyx_t_3), 0, PY_SSIZE_T_MAX, NULL, ((char const *)"ignore"), PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L0; - /* "dataRead.pyx":160 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) - * else: # array - * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ # <<<<<<<<<<<<<< - * (byteorder == 'big' and signal_data_type in (1, 3, 5)): - * return read_array(bit_stream, record_format, number_of_records, + /* "dataRead.pyx":313 + * buf[end] = 0 + * result = (buf[:end]).decode('UTF-8', 'ignore') + * return result # <<<<<<<<<<<<<< + * # MD block: fast ... scan + * payload = bytes(buf[:end]) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L12_return; + + /* "dataRead.pyx":310 + * end -= 1 + * # TX block (id[2]=='T', id[3]=='X') + * if hdr.id[2] == b'T' and hdr.id[3] == b'X': # <<<<<<<<<<<<<< + * buf[end] = 0 + * result = (buf[:end]).decode('UTF-8', 'ignore') */ } - /* "dataRead.pyx":165 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) - * else: # swap bytes - * return read_array(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) - * + /* "dataRead.pyx":315 + * return result + * # MD block: fast ... scan + * payload = bytes(buf[:end]) # <<<<<<<<<<<<<< + * tx_start = payload.find(b'') + * if tx_start >= 0: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_buf) + 0, __pyx_v_end - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_payload = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "dataRead.pyx":166 - * else: # swap bytes - * return read_array(bit_stream, record_format, number_of_records, - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) # <<<<<<<<<<<<<< - * - * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, + /* "dataRead.pyx":316 + * # MD block: fast ... scan + * payload = bytes(buf[:end]) + * tx_start = payload.find(b'') # <<<<<<<<<<<<<< + * if tx_start >= 0: + * tx_start += 4 + */ + __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyBytes_Type_find, __pyx_v_payload, __pyx_kp_b_TX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_tx_start = __pyx_t_5; + + /* "dataRead.pyx":317 + * payload = bytes(buf[:end]) + * tx_start = payload.find(b'') + * if tx_start >= 0: # <<<<<<<<<<<<<< + * tx_start += 4 + * tx_end = payload.find(b'', tx_start) + */ + __pyx_t_1 = (__pyx_v_tx_start >= 0); + if (__pyx_t_1) { + + /* "dataRead.pyx":318 + * tx_start = payload.find(b'') + * if tx_start >= 0: + * tx_start += 4 # <<<<<<<<<<<<<< + * tx_end = payload.find(b'', tx_start) + * if tx_end >= 0: + */ + __pyx_v_tx_start = (__pyx_v_tx_start + 4); + + /* "dataRead.pyx":319 + * if tx_start >= 0: + * tx_start += 4 + * tx_end = payload.find(b'', tx_start) # <<<<<<<<<<<<<< + * if tx_end >= 0: + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') */ - __pyx_t_4 = __pyx_f_8dataRead_read_array(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_tx_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyBytes_Type_find, __pyx_v_payload, __pyx_kp_b_TX_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - } - __pyx_L3:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_tx_end = __pyx_t_5; - /* "dataRead.pyx":12 - * cimport cython - * - * @cython.boundscheck(False) # <<<<<<<<<<<<<< - * @cython.wraparound(False) - * def sorted_data_read(bytes tmp, unsigned short bit_count, + /* "dataRead.pyx":320 + * tx_start += 4 + * tx_end = payload.find(b'', tx_start) + * if tx_end >= 0: # <<<<<<<<<<<<<< + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') + * # CDATA or namespaced XML: attempt lxml parse */ + __pyx_t_1 = (__pyx_v_tx_end >= 0); + if (__pyx_t_1) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dataRead.sorted_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":321 + * tx_end = payload.find(b'', tx_start) + * if tx_end >= 0: + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') # <<<<<<<<<<<<<< + * # CDATA or namespaced XML: attempt lxml parse + * try: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_decode_bytes(__pyx_v_payload, __pyx_v_tx_start, __pyx_v_tx_end, NULL, ((char const *)"ignore"), PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L12_return; -/* "dataRead.pyx":168 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) - * - * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) + /* "dataRead.pyx":320 + * tx_start += 4 + * tx_end = payload.find(b'', tx_start) + * if tx_end >= 0: # <<<<<<<<<<<<<< + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') + * # CDATA or namespaced XML: attempt lxml parse */ + } -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_half(char const *__pyx_v_bit_stream, CYTHON_UNUSED PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { - __Pyx_memviewslice __pyx_v_buf = { 0, 0, { 0 }, { 0 }, { 0 } }; - unsigned PY_LONG_LONG __pyx_v_i; - uint16_t __pyx_v_temp_uint16; - 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; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - int __pyx_t_11; - unsigned int __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_half", 1); + /* "dataRead.pyx":317 + * payload = bytes(buf[:end]) + * tx_start = payload.find(b'') + * if tx_start >= 0: # <<<<<<<<<<<<<< + * tx_start += 4 + * tx_end = payload.find(b'', tx_start) + */ + } - /* "dataRead.pyx":170 - * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing + /* "dataRead.pyx":323 + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') + * # CDATA or namespaced XML: attempt lxml parse + * try: # <<<<<<<<<<<<<< + * from lxml import objectify as _obj + * xml_tree = _obj.fromstring(payload) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint16_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_buf = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { - /* "dataRead.pyx":172 - * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) - * cdef unsigned long long i - * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":324 + * # CDATA or namespaced XML: attempt lxml parse + * try: + * from lxml import objectify as _obj # <<<<<<<<<<<<<< + * xml_tree = _obj.fromstring(payload) + * # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. */ - __pyx_v_temp_uint16 = 0; + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_n_s_objectify); + __Pyx_GIVEREF(__pyx_n_s_objectify); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_objectify)) __PYX_ERR(0, 324, __pyx_L28_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_4, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_objectify); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_4); + __pyx_v__obj = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":173 - * cdef unsigned long long i - * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp_uint16 + /* "dataRead.pyx":325 + * try: + * from lxml import objectify as _obj + * xml_tree = _obj.fromstring(payload) # <<<<<<<<<<<<<< + * # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. + * try: */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v__obj, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_payload}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_v_xml_tree = __pyx_t_3; + __pyx_t_3 = 0; + + /* "dataRead.pyx":327 + * xml_tree = _obj.fromstring(payload) + * # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.TX) + * except AttributeError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { + + /* "dataRead.pyx":328 + * # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. + * try: + * return str(xml_tree.TX) # <<<<<<<<<<<<<< + * except AttributeError: + * pass + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_xml_tree, __pyx_n_s_TX_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L34_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L34_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L38_try_return; + + /* "dataRead.pyx":327 + * xml_tree = _obj.fromstring(payload) + * # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.TX) + * except AttributeError: + */ + } + __pyx_L34_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dataRead.pyx":174 - * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing - * for i in range(number_of_records): - * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * buf[i] = temp_uint16 - * if swap == 0: + /* "dataRead.pyx":329 + * try: + * return str(xml_tree.TX) + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * try: */ - (void)(memcpy((&__pyx_v_temp_uint16), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_14) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L35_exception_handled; + } + goto __pyx_L36_except_error; - /* "dataRead.pyx":175 - * for i in range(number_of_records): - * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp_uint16 # <<<<<<<<<<<<<< - * if swap == 0: - * return np.asarray(buf).view(dtype=np.float16) + /* "dataRead.pyx":327 + * xml_tree = _obj.fromstring(payload) + * # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.TX) + * except AttributeError: + */ + __pyx_L36_except_error:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L28_error; + __pyx_L38_try_return:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L32_try_return; + __pyx_L35_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + } + + /* "dataRead.pyx":331 + * except AttributeError: + * pass + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.CNcomment.TX) + * except AttributeError: */ - __pyx_t_10 = __pyx_v_i; - *((uint16_t *) ( /* dim=0 */ (__pyx_v_buf.data + __pyx_t_10 * __pyx_v_buf.strides[0]) )) = __pyx_v_temp_uint16; - } + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + /*try:*/ { + + /* "dataRead.pyx":332 + * pass + * try: + * return str(xml_tree.CNcomment.TX) # <<<<<<<<<<<<<< + * except AttributeError: + * pass + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_xml_tree, __pyx_n_s_CNcomment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L40_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_TX_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L40_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L40_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L44_try_return; + + /* "dataRead.pyx":331 + * except AttributeError: + * pass + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.CNcomment.TX) + * except AttributeError: + */ + } + __pyx_L40_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "dataRead.pyx":176 - * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp_uint16 - * if swap == 0: # <<<<<<<<<<<<<< - * return np.asarray(buf).view(dtype=np.float16) - * else: + /* "dataRead.pyx":333 + * try: + * return str(xml_tree.CNcomment.TX) + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * try: */ - __pyx_t_11 = (__pyx_v_swap == 0); - if (__pyx_t_11) { + __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_14) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L41_exception_handled; + } + goto __pyx_L42_except_error; - /* "dataRead.pyx":177 - * buf[i] = temp_uint16 - * if swap == 0: - * return np.asarray(buf).view(dtype=np.float16) # <<<<<<<<<<<<<< - * else: - * return np.asarray(buf).view(dtype=np.float16).byteswap() + /* "dataRead.pyx":331 + * except AttributeError: + * pass + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.CNcomment.TX) + * except AttributeError: + */ + __pyx_L42_except_error:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11); + goto __pyx_L28_error; + __pyx_L44_try_return:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11); + goto __pyx_L32_try_return; + __pyx_L41_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11); + } + + /* "dataRead.pyx":335 + * except AttributeError: + * pass + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.CNunit.TX) + * except AttributeError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { + + /* "dataRead.pyx":336 + * pass + * try: + * return str(xml_tree.CNunit.TX) # <<<<<<<<<<<<<< + * except AttributeError: + * pass + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_xml_tree, __pyx_n_s_CNunit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L46_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_TX_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L46_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L46_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L50_try_return; + + /* "dataRead.pyx":335 + * except AttributeError: + * pass + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.CNunit.TX) + * except AttributeError: + */ + } + __pyx_L46_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "dataRead.pyx":337 + * try: + * return str(xml_tree.CNunit.TX) + * except AttributeError: # <<<<<<<<<<<<<< + * pass + * except Exception: + */ + __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_14) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L47_exception_handled; + } + goto __pyx_L48_except_error; + + /* "dataRead.pyx":335 + * except AttributeError: + * pass + * try: # <<<<<<<<<<<<<< + * return str(xml_tree.CNunit.TX) + * except AttributeError: + */ + __pyx_L48_except_error:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L28_error; + __pyx_L50_try_return:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L32_try_return; + __pyx_L47_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + } + + /* "dataRead.pyx":323 + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') + * # CDATA or namespaced XML: attempt lxml parse + * try: # <<<<<<<<<<<<<< + * from lxml import objectify as _obj + * xml_tree = _obj.fromstring(payload) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_buf, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint16_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint16_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - __pyx_t_12 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_12 = 1; } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L33_try_end; + __pyx_L28_error:; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "dataRead.pyx":339 + * except AttributeError: + * pass + * except Exception: # <<<<<<<<<<<<<< + * pass + * return '' + */ + __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_14) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L29_exception_handled; + } + goto __pyx_L30_except_error; + + /* "dataRead.pyx":323 + * return payload[tx_start:tx_end].decode('UTF-8', 'ignore') + * # CDATA or namespaced XML: attempt lxml parse + * try: # <<<<<<<<<<<<<< + * from lxml import objectify as _obj + * xml_tree = _obj.fromstring(payload) + */ + __pyx_L30_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L13_error; + __pyx_L32_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L12_return; + __pyx_L29_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __pyx_L33_try_end:; } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "dataRead.pyx":176 - * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp_uint16 - * if swap == 0: # <<<<<<<<<<<<<< - * return np.asarray(buf).view(dtype=np.float16) - * else: + /* "dataRead.pyx":341 + * except Exception: + * pass + * return '' # <<<<<<<<<<<<<< + * finally: + * PyMem_Free(buf) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_r = __pyx_kp_u__12; + goto __pyx_L12_return; } - /* "dataRead.pyx":179 - * return np.asarray(buf).view(dtype=np.float16) - * else: - * return np.asarray(buf).view(dtype=np.float16).byteswap() # <<<<<<<<<<<<<< + /* "dataRead.pyx":343 + * return '' + * finally: + * PyMem_Free(buf) # <<<<<<<<<<<<<< + * * - * cdef inline read_chalf(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_buf, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint16_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint16_t, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_12 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_12 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + /*finally:*/ { + __pyx_L13_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_view); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_byteswap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_12 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_12 = 1; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; + { + PyMem_Free(__pyx_v_buf); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11); } + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_ErrRestore(__pyx_t_8, __pyx_t_7, __pyx_t_6); + __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; + __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; + goto __pyx_L1_error; } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_12, 0+__pyx_t_12); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_L12_return: { + __pyx_t_17 = __pyx_r; + __pyx_r = 0; + PyMem_Free(__pyx_v_buf); + __pyx_r = __pyx_t_17; + __pyx_t_17 = 0; + goto __pyx_L0; } - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; } - /* "dataRead.pyx":168 - * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) + /* "dataRead.pyx":266 + * + * + * cdef str _fast_read_tx_or_md(int fd, uint64_t pointer): # <<<<<<<<<<<<<< + * """Read a TX or MD block and return its text content. * - * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) */ /* function exit code */ __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_XCLEAR_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("dataRead.read_half", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("dataRead._fast_read_tx_or_md", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __PYX_XCLEAR_MEMVIEW(&__pyx_v_buf, 1); + __Pyx_XDECREF(__pyx_v_payload); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v__obj); + __Pyx_XDECREF(__pyx_v_xml_tree); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":181 - * return np.asarray(buf).view(dtype=np.float16).byteswap() +/* "dataRead.pyx":346 + * + * + * cdef dict _fast_read_si(int fd, uint64_t pointer): # <<<<<<<<<<<<<< + * """Read an SI block and return a dict matching the ``SIBlock`` Python format. * - * cdef inline read_chalf(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * # complex32 = real(f16) + imag(f16): return as (n_records, 2) float16 array */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_chalf(char const *__pyx_v_bit_stream, CYTHON_UNUSED PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; +static PyObject *__pyx_f_8dataRead__fast_read_si(int __pyx_v_fd, uint64_t __pyx_v_pointer) { + struct __pyx_t_8dataRead__SIBlock __pyx_v_si; + Py_ssize_t __pyx_v_nread; + PyObject *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - Py_ssize_t __pyx_t_11; - int __pyx_t_12; - unsigned int __pyx_t_13; + PyObject *__pyx_t_6 = NULL; + unsigned int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_chalf", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + __Pyx_RefNannySetupContext("_fast_read_si", 1); - /* "dataRead.pyx":184 - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * # complex32 = real(f16) + imag(f16): return as (n_records, 2) float16 array - * cdef np.ndarray[np.uint16_t, ndim=2] buf = np.empty((number_of_records, 2), dtype=np.uint16) # <<<<<<<<<<<<<< - * cdef unsigned long long i - * for i in range(number_of_records): + /* "dataRead.pyx":362 + * cdef dict result + * + * if pointer == 0: # <<<<<<<<<<<<<< + * return None + * with nogil: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2)) __PYX_ERR(0, 184, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 184, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 184, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_buf.diminfo[1].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_buf.diminfo[1].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_6 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_1 = (__pyx_v_pointer == 0); + if (__pyx_t_1) { - /* "dataRead.pyx":186 - * cdef np.ndarray[np.uint16_t, ndim=2] buf = np.empty((number_of_records, 2), dtype=np.uint16) - * cdef unsigned long long i - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) + /* "dataRead.pyx":363 + * + * if pointer == 0: + * return None # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &si, 56, pointer) */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __Pyx_XDECREF(__pyx_r); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "dataRead.pyx":187 - * cdef unsigned long long i - * for i in range(number_of_records): - * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) - * if swap == 0: + /* "dataRead.pyx":362 + * cdef dict result + * + * if pointer == 0: # <<<<<<<<<<<<<< + * return None + * with nogil: */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_buf.diminfo[1].shape; - (void)(memcpy((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_buf.diminfo[1].strides))), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + } - /* "dataRead.pyx":188 - * for i in range(number_of_records): - * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) # <<<<<<<<<<<<<< - * if swap == 0: - * return buf.view(dtype=np.float16) + /* "dataRead.pyx":364 + * if pointer == 0: + * return None + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &si, 56, pointer) + * if nread < 56: */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_buf.diminfo[1].shape; - (void)(memcpy((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_buf.diminfo[1].strides))), (&(__pyx_v_bit_stream[((__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i)) + 2)])), 2)); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "dataRead.pyx":365 + * return None + * with nogil: + * nread = c_pread(fd, &si, 56, pointer) # <<<<<<<<<<<<<< + * if nread < 56: + * return None + */ + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_si), 56, __pyx_v_pointer); + } + + /* "dataRead.pyx":364 + * if pointer == 0: + * return None + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &si, 56, pointer) + * if nread < 56: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - /* "dataRead.pyx":189 - * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) - * if swap == 0: # <<<<<<<<<<<<<< - * return buf.view(dtype=np.float16) - * else: + /* "dataRead.pyx":366 + * with nogil: + * nread = c_pread(fd, &si, 56, pointer) + * if nread < 56: # <<<<<<<<<<<<<< + * return None + * result = { */ - __pyx_t_12 = (__pyx_v_swap == 0); - if (__pyx_t_12) { + __pyx_t_1 = (__pyx_v_nread < 56); + if (__pyx_t_1) { - /* "dataRead.pyx":190 - * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) - * if swap == 0: - * return buf.view(dtype=np.float16) # <<<<<<<<<<<<<< - * else: - * return buf.view(dtype=np.float16).byteswap() + /* "dataRead.pyx":367 + * nread = c_pread(fd, &si, 56, pointer) + * if nread < 56: + * return None # <<<<<<<<<<<<<< + * result = { + * 'id': b'##SI', */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_view); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "dataRead.pyx":189 - * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) - * if swap == 0: # <<<<<<<<<<<<<< - * return buf.view(dtype=np.float16) - * else: + /* "dataRead.pyx":366 + * with nogil: + * nread = c_pread(fd, &si, 56, pointer) + * if nread < 56: # <<<<<<<<<<<<<< + * return None + * result = { */ } - /* "dataRead.pyx":192 - * return buf.view(dtype=np.float16) - * else: - * return buf.view(dtype=np.float16).byteswap() # <<<<<<<<<<<<<< - * - * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, + /* "dataRead.pyx":369 + * return None + * result = { + * 'id': b'##SI', # <<<<<<<<<<<<<< + * 'length': si.length, + * 'link_count': si.link_count, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_byteswap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_13 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_13 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_13, 0+__pyx_t_13); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + __pyx_t_2 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_id, __pyx_kp_b_SI) < 0) __PYX_ERR(0, 369, __pyx_L1_error) - /* "dataRead.pyx":181 - * return np.asarray(buf).view(dtype=np.float16).byteswap() - * - * cdef inline read_chalf(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * # complex32 = real(f16) + imag(f16): return as (n_records, 2) float16 array + /* "dataRead.pyx":370 + * result = { + * 'id': b'##SI', + * 'length': si.length, # <<<<<<<<<<<<<< + * 'link_count': si.link_count, + * 'si_tx_name': si.si_tx_name, */ + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_si.length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_length, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __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); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_chalf", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":371 + * 'id': b'##SI', + * 'length': si.length, + * 'link_count': si.link_count, # <<<<<<<<<<<<<< + * 'si_tx_name': si.si_tx_name, + * 'si_tx_path': si.si_tx_path, + */ + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_si.link_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_link_count, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; -/* "dataRead.pyx":194 - * return buf.view(dtype=np.float16).byteswap() - * - * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - */ - -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_float(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - float __pyx_v_temp_float; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - unsigned PY_LONG_LONG __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - int __pyx_t_10; - unsigned int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_float", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - - /* "dataRead.pyx":196 - * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef float temp_float = 0 + /* "dataRead.pyx":372 + * 'length': si.length, + * 'link_count': si.link_count, + * 'si_tx_name': si.si_tx_name, # <<<<<<<<<<<<<< + * 'si_tx_path': si.si_tx_path, + * 'si_md_comment': si.si_md_comment, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_si.si_tx_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_si_tx_name, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 196, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 196, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - /* "dataRead.pyx":198 - * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef float temp_float = 0 # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + /* "dataRead.pyx":373 + * 'link_count': si.link_count, + * 'si_tx_name': si.si_tx_name, + * 'si_tx_path': si.si_tx_path, # <<<<<<<<<<<<<< + * 'si_md_comment': si.si_md_comment, + * 'si_type': _SI_TYPE_MAP.get(si.si_type, 'OTHER'), */ - __pyx_v_temp_float = 0.0; + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_si.si_tx_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_si_tx_path, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":199 - * cdef unsigned long long i - * cdef float temp_float = 0 - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp_float + /* "dataRead.pyx":374 + * 'si_tx_name': si.si_tx_name, + * 'si_tx_path': si.si_tx_path, + * 'si_md_comment': si.si_md_comment, # <<<<<<<<<<<<<< + * 'si_type': _SI_TYPE_MAP.get(si.si_type, 'OTHER'), + * 'si_bus_type': _SI_BUS_MAP.get(si.si_bus_type, 'NONE'), */ - __pyx_t_6 = __pyx_v_number_of_records; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_si.si_md_comment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_si_md_comment, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":200 - * cdef float temp_float = 0 - * for i in range(number_of_records): - * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) # <<<<<<<<<<<<<< - * buf[i] = temp_float - * if swap == 0: + /* "dataRead.pyx":375 + * 'si_tx_path': si.si_tx_path, + * 'si_md_comment': si.si_md_comment, + * 'si_type': _SI_TYPE_MAP.get(si.si_type, 'OTHER'), # <<<<<<<<<<<<<< + * 'si_bus_type': _SI_BUS_MAP.get(si.si_bus_type, 'NONE'), + * 'si_flags': si.si_flags, */ - (void)(memcpy((&__pyx_v_temp_float), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 4)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SI_TYPE_MAP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_uint8_t(__pyx_v_si.si_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_u_OTHER}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_si_type, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":201 - * for i in range(number_of_records): - * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp_float # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":376 + * 'si_md_comment': si.si_md_comment, + * 'si_type': _SI_TYPE_MAP.get(si.si_type, 'OTHER'), + * 'si_bus_type': _SI_BUS_MAP.get(si.si_bus_type, 'NONE'), # <<<<<<<<<<<<<< + * 'si_flags': si.si_flags, + * 'source_name': {'Comment': _fast_read_tx(fd, si.si_tx_name)}, */ - __pyx_t_9 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_float; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_SI_BUS_MAP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_uint8_t(__pyx_v_si.si_bus_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_5, __pyx_n_u_NONE}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_si_bus_type, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":202 - * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp_float - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":377 + * 'si_type': _SI_TYPE_MAP.get(si.si_type, 'OTHER'), + * 'si_bus_type': _SI_BUS_MAP.get(si.si_bus_type, 'NONE'), + * 'si_flags': si.si_flags, # <<<<<<<<<<<<<< + * 'source_name': {'Comment': _fast_read_tx(fd, si.si_tx_name)}, + * 'source_path': {'Comment': _fast_read_tx(fd, si.si_tx_path)}, */ - __pyx_t_10 = (__pyx_v_swap == 0); - if (__pyx_t_10) { + __pyx_t_3 = __Pyx_PyInt_From_uint8_t(__pyx_v_si.si_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_si_flags, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":203 - * buf[i] = temp_float - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":378 + * 'si_bus_type': _SI_BUS_MAP.get(si.si_bus_type, 'NONE'), + * 'si_flags': si.si_flags, + * 'source_name': {'Comment': _fast_read_tx(fd, si.si_tx_name)}, # <<<<<<<<<<<<<< + * 'source_path': {'Comment': _fast_read_tx(fd, si.si_tx_path)}, + * } */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_f_8dataRead__fast_read_tx(__pyx_v_fd, __pyx_v_si.si_tx_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_Comment, __pyx_t_4) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_source_name, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":202 - * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp_float - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":379 + * 'si_flags': si.si_flags, + * 'source_name': {'Comment': _fast_read_tx(fd, si.si_tx_name)}, + * 'source_path': {'Comment': _fast_read_tx(fd, si.si_tx_path)}, # <<<<<<<<<<<<<< + * } + * return result */ - } + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_f_8dataRead__fast_read_tx(__pyx_v_fd, __pyx_v_si.si_tx_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_Comment, __pyx_t_4) < 0) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_source_path, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "dataRead.pyx":205 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< + /* "dataRead.pyx":381 + * 'source_path': {'Comment': _fast_read_tx(fd, si.si_tx_path)}, + * } + * return result # <<<<<<<<<<<<<< + * * - * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "dataRead.pyx":194 - * return buf.view(dtype=np.float16).byteswap() + /* "dataRead.pyx":346 + * + * + * cdef dict _fast_read_si(int fd, uint64_t pointer): # <<<<<<<<<<<<<< + * """Read an SI block and return a dict matching the ``SIBlock`` Python format. * - * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dataRead._fast_read_si", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":207 - * return buf.byteswap() +/* "dataRead.pyx":384 * - * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * + * def read_cn_chain_fast(object fid, uint64_t first_pointer, # <<<<<<<<<<<<<< + * dict si_cache, int minimal, bint channel_name_list): + * """Read the CN linked list starting at first_pointer using pread(). */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_cfloat(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - __pyx_t_float_complex __pyx_v_temp_cfloat; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_1read_cn_chain_fast(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_8dataRead_read_cn_chain_fast, "Read the CN linked list starting at first_pointer using pread().\n\n Parameters\n ----------\n fid : file object (must support fileno())\n first_pointer : uint64_t\n File offset of the first CN block in the chain\n si_cache : dict\n Shared SI block cache keyed by file offset; updated in-place\n minimal : int\n 0 = load all metadata; non-zero = skip SI and XML comment\n channel_name_list : bool\n True = read only channel names (skip CC/SI/unit/comment)\n\n Returns\n -------\n list of (cn_key, cn_dict, cc_dict) tuples\n cn_key is positive (byte_offset*8 + bit_offset) or negative (DS mode)\n cn_dict and cc_dict match the structure produced by read_cn_block()\n cc_dict has '_needs_completion'=True for cc_type 3/7-11\n "); +static PyMethodDef __pyx_mdef_8dataRead_1read_cn_chain_fast = {"read_cn_chain_fast", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_1read_cn_chain_fast, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_read_cn_chain_fast}; +static PyObject *__pyx_pw_8dataRead_1read_cn_chain_fast(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_fid = 0; + uint64_t __pyx_v_first_pointer; + PyObject *__pyx_v_si_cache = 0; + int __pyx_v_minimal; + int __pyx_v_channel_name_list; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_cn_chain_fast (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fid,&__pyx_n_s_first_pointer,&__pyx_n_s_si_cache,&__pyx_n_s_minimal,&__pyx_n_s_channel_name_list,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fid)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_first_pointer)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("read_cn_chain_fast", 1, 5, 5, 1); __PYX_ERR(0, 384, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_si_cache)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("read_cn_chain_fast", 1, 5, 5, 2); __PYX_ERR(0, 384, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_minimal)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("read_cn_chain_fast", 1, 5, 5, 3); __PYX_ERR(0, 384, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_channel_name_list)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("read_cn_chain_fast", 1, 5, 5, 4); __PYX_ERR(0, 384, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_cn_chain_fast") < 0)) __PYX_ERR(0, 384, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_fid = values[0]; + __pyx_v_first_pointer = __Pyx_PyInt_As_uint64_t(values[1]); if (unlikely((__pyx_v_first_pointer == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error) + __pyx_v_si_cache = ((PyObject*)values[2]); + __pyx_v_minimal = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_minimal == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + __pyx_v_channel_name_list = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_channel_name_list == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_cn_chain_fast", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 384, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.read_cn_chain_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_si_cache), (&PyDict_Type), 1, "si_cache", 1))) __PYX_ERR(0, 385, __pyx_L1_error) + __pyx_r = __pyx_pf_8dataRead_read_cn_chain_fast(__pyx_self, __pyx_v_fid, __pyx_v_first_pointer, __pyx_v_si_cache, __pyx_v_minimal, __pyx_v_channel_name_list); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8dataRead_read_cn_chain_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fid, uint64_t __pyx_v_first_pointer, PyObject *__pyx_v_si_cache, int __pyx_v_minimal, int __pyx_v_channel_name_list) { + int __pyx_v_fd; + uint64_t __pyx_v_pointer; + struct __pyx_t_8dataRead__CNFixedHdr __pyx_v_cn_hdr; + struct __pyx_t_8dataRead__CNData __pyx_v_cn_dat; + struct __pyx_t_8dataRead__CCFixedHdr __pyx_v_cc_hdr; + struct __pyx_t_8dataRead__CCData __pyx_v_cc_dat; + Py_ssize_t __pyx_v_nread; + Py_ssize_t __pyx_v_data_offset; + Py_ssize_t __pyx_v_cc_data_offset; + Py_ssize_t __pyx_v_n_extra; + Py_ssize_t __pyx_v_n_bytes; + uint64_t __pyx_v_cn_key_uint; + uint64_t __pyx_v_si_ptr; + uint64_t __pyx_v_cc_ptr; + int64_t __pyx_v_cn_key_neg; + PyObject *__pyx_v_cn_key = 0; + PyObject *__pyx_v_results = 0; + PyObject *__pyx_v_cn_dict = 0; + PyObject *__pyx_v_cc_dict = 0; + PyObject *__pyx_v_si_dict = 0; + PyObject *__pyx_v_cn_name = 0; + PyObject *__pyx_v_unit_str = 0; + PyObject *__pyx_v_desc_str = 0; + unsigned char __pyx_v_extra_buf[0x200]; + double *__pyx_v_dbl_ptr; + unsigned char *__pyx_v_cc_val_buf; + PyObject *__pyx_v_cc_val_list = 0; + uint32_t __pyx_v_i; + PyObject *__pyx_v_extra_links = NULL; + long __pyx_v_lnk; 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; - PyArrayObject *__pyx_t_5 = NULL; - unsigned PY_LONG_LONG __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; + unsigned int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + uint32_t __pyx_t_9; int __pyx_t_10; - unsigned int __pyx_t_11; + uint64_t __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + uint16_t __pyx_t_14; + uint16_t __pyx_t_15; + int __pyx_t_16; + char const *__pyx_t_17; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_cfloat", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + __Pyx_RefNannySetupContext("read_cn_chain_fast", 1); - /* "dataRead.pyx":209 - * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef float complex temp_cfloat = 0 + /* "dataRead.pyx":407 + * cc_dict has '_needs_completion'=True for cc_type 3/7-11 + * """ + * cdef int fd = fid.fileno() # <<<<<<<<<<<<<< + * cdef uint64_t pointer = first_pointer + * cdef _CNFixedHdr cn_hdr */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fid, __pyx_n_s_fileno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 209, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 209, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo___pyx_t_float_complex, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 209, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_fd = __pyx_t_5; - /* "dataRead.pyx":211 - * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef float complex temp_cfloat = 0 # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + /* "dataRead.pyx":408 + * """ + * cdef int fd = fid.fileno() + * cdef uint64_t pointer = first_pointer # <<<<<<<<<<<<<< + * cdef _CNFixedHdr cn_hdr + * cdef _CNData cn_dat */ - __pyx_v_temp_cfloat = __pyx_t_float_complex_from_parts(0, 0); + __pyx_v_pointer = __pyx_v_first_pointer; - /* "dataRead.pyx":212 - * cdef unsigned long long i - * cdef float complex temp_cfloat = 0 - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_cfloat + /* "dataRead.pyx":417 + * cdef int64_t cn_key_neg + * cdef object cn_key + * cdef list results = [] # <<<<<<<<<<<<<< + * cdef dict cn_dict, cc_dict, si_dict + * cdef str cn_name, unit_str, desc_str */ - __pyx_t_6 = __pyx_v_number_of_records; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_results = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "dataRead.pyx":213 - * cdef float complex temp_cfloat = 0 - * for i in range(number_of_records): - * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) # <<<<<<<<<<<<<< - * buf[i] = temp_cfloat - * if swap == 0: + /* "dataRead.pyx":426 + * cdef uint32_t i + * + * while pointer != 0: # <<<<<<<<<<<<<< + * # Read CN fixed header + 8 standard links (88 bytes) + * with nogil: */ - (void)(memcpy((&__pyx_v_temp_cfloat), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 8)); + while (1) { + __pyx_t_6 = (__pyx_v_pointer != 0); + if (!__pyx_t_6) break; - /* "dataRead.pyx":214 - * for i in range(number_of_records): - * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_cfloat # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":428 + * while pointer != 0: + * # Read CN fixed header + 8 standard links (88 bytes) + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cn_hdr, 88, pointer) + * if nread < 88: */ - __pyx_t_9 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_cfloat; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":215 - * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_cfloat - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":429 + * # Read CN fixed header + 8 standard links (88 bytes) + * with nogil: + * nread = c_pread(fd, &cn_hdr, 88, pointer) # <<<<<<<<<<<<<< + * if nread < 88: + * break */ - __pyx_t_10 = (__pyx_v_swap == 0); - if (__pyx_t_10) { + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_cn_hdr), 88, __pyx_v_pointer); + } - /* "dataRead.pyx":216 - * buf[i] = temp_cfloat - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":428 + * while pointer != 0: + * # Read CN fixed header + 8 standard links (88 bytes) + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cn_hdr, 88, pointer) + * if nread < 88: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } + } + + /* "dataRead.pyx":430 + * with nogil: + * nread = c_pread(fd, &cn_hdr, 88, pointer) + * if nread < 88: # <<<<<<<<<<<<<< + * break + * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_t_6 = (__pyx_v_nread < 88); + if (__pyx_t_6) { - /* "dataRead.pyx":215 - * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_cfloat - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":431 + * nread = c_pread(fd, &cn_hdr, 88, pointer) + * if nread < 88: + * break # <<<<<<<<<<<<<< + * + * # Read CN data section (72 bytes at variable offset) */ - } + goto __pyx_L4_break; - /* "dataRead.pyx":218 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< + /* "dataRead.pyx":430 + * with nogil: + * nread = c_pread(fd, &cn_hdr, 88, pointer) + * if nread < 88: # <<<<<<<<<<<<<< + * break * - * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } } - #endif + + /* "dataRead.pyx":434 + * + * # Read CN data section (72 bytes at variable offset) + * data_offset = 24 + (cn_hdr.link_count) * 8 # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + */ + __pyx_v_data_offset = (24 + (((Py_ssize_t)__pyx_v_cn_hdr.link_count) * 8)); + + /* "dataRead.pyx":435 + * # Read CN data section (72 bytes at variable offset) + * data_offset = 24 + (cn_hdr.link_count) * 8 + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + * if nread < 72: + */ { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "dataRead.pyx":436 + * data_offset = 24 + (cn_hdr.link_count) * 8 + * with nogil: + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) # <<<<<<<<<<<<<< + * if nread < 72: + * break + */ + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_cn_dat), 72, (__pyx_v_pointer + __pyx_v_data_offset)); + } + + /* "dataRead.pyx":435 + * # Read CN data section (72 bytes at variable offset) + * data_offset = 24 + (cn_hdr.link_count) * 8 + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + * if nread < 72: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L15; + } + __pyx_L15:; + } } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /* "dataRead.pyx":207 - * return buf.byteswap() + /* "dataRead.pyx":437 + * with nogil: + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + * if nread < 72: # <<<<<<<<<<<<<< + * break * - * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ + __pyx_t_6 = (__pyx_v_nread < 72); + if (__pyx_t_6) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_cfloat", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":438 + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + * if nread < 72: + * break # <<<<<<<<<<<<<< + * + * # Compute dict key + */ + goto __pyx_L4_break; -/* "dataRead.pyx":220 - * return buf.byteswap() + /* "dataRead.pyx":437 + * with nogil: + * nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + * if nread < 72: # <<<<<<<<<<<<<< + * break * - * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ + } -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_double(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - double __pyx_v_temp_double; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - unsigned PY_LONG_LONG __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - int __pyx_t_10; - unsigned int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_double", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + /* "dataRead.pyx":441 + * + * # Compute dict key + * if cn_dat.cn_flags & 0x20000: # CN_F_DATA_STREAM_MODE # <<<<<<<<<<<<<< + * cn_key_neg = -pointer + * cn_key = cn_key_neg + */ + __pyx_t_6 = ((__pyx_v_cn_dat.cn_flags & 0x20000) != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":222 - * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef double temp_double = 0 + /* "dataRead.pyx":442 + * # Compute dict key + * if cn_dat.cn_flags & 0x20000: # CN_F_DATA_STREAM_MODE + * cn_key_neg = -pointer # <<<<<<<<<<<<<< + * cn_key = cn_key_neg + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 222, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 222, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 222, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + __pyx_v_cn_key_neg = (-((int64_t)__pyx_v_pointer)); + + /* "dataRead.pyx":443 + * if cn_dat.cn_flags & 0x20000: # CN_F_DATA_STREAM_MODE + * cn_key_neg = -pointer + * cn_key = cn_key_neg # <<<<<<<<<<<<<< + * else: + * cn_key_uint = (cn_dat.cn_byte_offset) * 8 + cn_dat.cn_bit_offset + */ + __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_cn_key_neg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_cn_key, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dataRead.pyx":441 + * + * # Compute dict key + * if cn_dat.cn_flags & 0x20000: # CN_F_DATA_STREAM_MODE # <<<<<<<<<<<<<< + * cn_key_neg = -pointer + * cn_key = cn_key_neg + */ + goto __pyx_L17; } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - /* "dataRead.pyx":224 - * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef double temp_double = 0 # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + /* "dataRead.pyx":445 + * cn_key = cn_key_neg + * else: + * cn_key_uint = (cn_dat.cn_byte_offset) * 8 + cn_dat.cn_bit_offset # <<<<<<<<<<<<<< + * cn_key = cn_key_uint + * */ - __pyx_v_temp_double = 0.0; + /*else*/ { + __pyx_v_cn_key_uint = ((((uint64_t)__pyx_v_cn_dat.cn_byte_offset) * 8) + __pyx_v_cn_dat.cn_bit_offset); - /* "dataRead.pyx":225 - * cdef unsigned long long i - * cdef double temp_double = 0 - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_double + /* "dataRead.pyx":446 + * else: + * cn_key_uint = (cn_dat.cn_byte_offset) * 8 + cn_dat.cn_bit_offset + * cn_key = cn_key_uint # <<<<<<<<<<<<<< + * + * # Read channel name (TX block) */ - __pyx_t_6 = __pyx_v_number_of_records; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_key_uint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_cn_key, __pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L17:; - /* "dataRead.pyx":226 - * cdef double temp_double = 0 - * for i in range(number_of_records): - * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) # <<<<<<<<<<<<<< - * buf[i] = temp_double - * if swap == 0: + /* "dataRead.pyx":449 + * + * # Read channel name (TX block) + * cn_name = _fast_read_tx(fd, cn_hdr.cn_tx_name) if cn_hdr.cn_tx_name else '' # <<<<<<<<<<<<<< + * + * # Build CN dict */ - (void)(memcpy((&__pyx_v_temp_double), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 8)); + __pyx_t_6 = (__pyx_v_cn_hdr.cn_tx_name != 0); + if (__pyx_t_6) { + __pyx_t_2 = __pyx_f_8dataRead__fast_read_tx(__pyx_v_fd, __pyx_v_cn_hdr.cn_tx_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + } else { + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_t_1 = __pyx_kp_u__12; + } + __Pyx_XDECREF_SET(__pyx_v_cn_name, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "dataRead.pyx":227 - * for i in range(number_of_records): - * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_double # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":453 + * # Build CN dict + * cn_dict = { + * 'pointer': pointer, # <<<<<<<<<<<<<< + * 'id': b'##CN', + * 'length': cn_hdr.length, */ - __pyx_t_9 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_double; - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(27); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_pointer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_pointer, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_id, __pyx_kp_b_CN) < 0) __PYX_ERR(0, 453, __pyx_L1_error) - /* "dataRead.pyx":228 - * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_double - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":455 + * 'pointer': pointer, + * 'id': b'##CN', + * 'length': cn_hdr.length, # <<<<<<<<<<<<<< + * 'link_count': cn_hdr.link_count, + * 'cn_cn_next': cn_hdr.cn_cn_next, */ - __pyx_t_10 = (__pyx_v_swap == 0); - if (__pyx_t_10) { + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_length, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":229 - * buf[i] = temp_double - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":456 + * 'id': b'##CN', + * 'length': cn_hdr.length, + * 'link_count': cn_hdr.link_count, # <<<<<<<<<<<<<< + * 'cn_cn_next': cn_hdr.cn_cn_next, + * 'cn_composition': cn_hdr.cn_composition, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.link_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_link_count, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":228 - * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) - * buf[i] = temp_double - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":457 + * 'length': cn_hdr.length, + * 'link_count': cn_hdr.link_count, + * 'cn_cn_next': cn_hdr.cn_cn_next, # <<<<<<<<<<<<<< + * 'cn_composition': cn_hdr.cn_composition, + * 'cn_tx_name': cn_hdr.cn_tx_name, */ - } + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_cn_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_cn_next, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":231 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * - * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, + /* "dataRead.pyx":458 + * 'link_count': cn_hdr.link_count, + * 'cn_cn_next': cn_hdr.cn_cn_next, + * 'cn_composition': cn_hdr.cn_composition, # <<<<<<<<<<<<<< + * 'cn_tx_name': cn_hdr.cn_tx_name, + * 'cn_si_source': cn_hdr.cn_si_source, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_composition); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_composition, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":220 - * return buf.byteswap() - * - * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + /* "dataRead.pyx":459 + * 'cn_cn_next': cn_hdr.cn_cn_next, + * 'cn_composition': cn_hdr.cn_composition, + * 'cn_tx_name': cn_hdr.cn_tx_name, # <<<<<<<<<<<<<< + * 'cn_si_source': cn_hdr.cn_si_source, + * 'cn_cc_conversion': cn_hdr.cn_cc_conversion, */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_tx_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_tx_name, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_double", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":460 + * 'cn_composition': cn_hdr.cn_composition, + * 'cn_tx_name': cn_hdr.cn_tx_name, + * 'cn_si_source': cn_hdr.cn_si_source, # <<<<<<<<<<<<<< + * 'cn_cc_conversion': cn_hdr.cn_cc_conversion, + * 'cn_data': cn_hdr.cn_data, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_si_source); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_si_source, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -/* "dataRead.pyx":233 - * return buf.byteswap() - * - * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + /* "dataRead.pyx":461 + * 'cn_tx_name': cn_hdr.cn_tx_name, + * 'cn_si_source': cn_hdr.cn_si_source, + * 'cn_cc_conversion': cn_hdr.cn_cc_conversion, # <<<<<<<<<<<<<< + * 'cn_data': cn_hdr.cn_data, + * 'cn_md_unit': cn_hdr.cn_md_unit, */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_cc_conversion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_cc_conversion, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_cdouble(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - __pyx_t_double_complex __pyx_v_temp_cdouble; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - unsigned PY_LONG_LONG __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - int __pyx_t_10; - unsigned int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_cdouble", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + /* "dataRead.pyx":462 + * 'cn_si_source': cn_hdr.cn_si_source, + * 'cn_cc_conversion': cn_hdr.cn_cc_conversion, + * 'cn_data': cn_hdr.cn_data, # <<<<<<<<<<<<<< + * 'cn_md_unit': cn_hdr.cn_md_unit, + * 'cn_md_comment': cn_hdr.cn_md_comment, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_data, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":235 - * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef double complex temp_cdouble = 0 + /* "dataRead.pyx":463 + * 'cn_cc_conversion': cn_hdr.cn_cc_conversion, + * 'cn_data': cn_hdr.cn_data, + * 'cn_md_unit': cn_hdr.cn_md_unit, # <<<<<<<<<<<<<< + * 'cn_md_comment': cn_hdr.cn_md_comment, + * 'cn_type': cn_dat.cn_type, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 235, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 235, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 235, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_md_unit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_md_unit, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":237 - * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef double complex temp_cdouble = 0 # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) + /* "dataRead.pyx":464 + * 'cn_data': cn_hdr.cn_data, + * 'cn_md_unit': cn_hdr.cn_md_unit, + * 'cn_md_comment': cn_hdr.cn_md_comment, # <<<<<<<<<<<<<< + * 'cn_type': cn_dat.cn_type, + * 'cn_sync_type': cn_dat.cn_sync_type, */ - __pyx_v_temp_cdouble = __pyx_t_double_complex_from_parts(0, 0); + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cn_hdr.cn_md_comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_md_comment, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":238 - * cdef unsigned long long i - * cdef double complex temp_cdouble = 0 - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) - * buf[i] = temp_cdouble + /* "dataRead.pyx":465 + * 'cn_md_unit': cn_hdr.cn_md_unit, + * 'cn_md_comment': cn_hdr.cn_md_comment, + * 'cn_type': cn_dat.cn_type, # <<<<<<<<<<<<<< + * 'cn_sync_type': cn_dat.cn_sync_type, + * 'cn_data_type': cn_dat.cn_data_type, */ - __pyx_t_6 = __pyx_v_number_of_records; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cn_dat.cn_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_type, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":239 - * cdef double complex temp_cdouble = 0 - * for i in range(number_of_records): - * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) # <<<<<<<<<<<<<< - * buf[i] = temp_cdouble - * if swap == 0: + /* "dataRead.pyx":466 + * 'cn_md_comment': cn_hdr.cn_md_comment, + * 'cn_type': cn_dat.cn_type, + * 'cn_sync_type': cn_dat.cn_sync_type, # <<<<<<<<<<<<<< + * 'cn_data_type': cn_dat.cn_data_type, + * 'cn_bit_offset': cn_dat.cn_bit_offset, */ - (void)(memcpy((&__pyx_v_temp_cdouble), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 16)); + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cn_dat.cn_sync_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_sync_type, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":240 - * for i in range(number_of_records): - * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) - * buf[i] = temp_cdouble # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":467 + * 'cn_type': cn_dat.cn_type, + * 'cn_sync_type': cn_dat.cn_sync_type, + * 'cn_data_type': cn_dat.cn_data_type, # <<<<<<<<<<<<<< + * 'cn_bit_offset': cn_dat.cn_bit_offset, + * 'cn_byte_offset': cn_dat.cn_byte_offset, */ - __pyx_t_9 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_cdouble; - } + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cn_dat.cn_data_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_data_type, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":241 - * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) - * buf[i] = temp_cdouble - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":468 + * 'cn_sync_type': cn_dat.cn_sync_type, + * 'cn_data_type': cn_dat.cn_data_type, + * 'cn_bit_offset': cn_dat.cn_bit_offset, # <<<<<<<<<<<<<< + * 'cn_byte_offset': cn_dat.cn_byte_offset, + * 'cn_bit_count': cn_dat.cn_bit_count, */ - __pyx_t_10 = (__pyx_v_swap == 0); - if (__pyx_t_10) { + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cn_dat.cn_bit_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_bit_offset, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":242 - * buf[i] = temp_cdouble - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":469 + * 'cn_data_type': cn_dat.cn_data_type, + * 'cn_bit_offset': cn_dat.cn_bit_offset, + * 'cn_byte_offset': cn_dat.cn_byte_offset, # <<<<<<<<<<<<<< + * 'cn_bit_count': cn_dat.cn_bit_count, + * 'cn_flags': cn_dat.cn_flags, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_cn_dat.cn_byte_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_byte_offset, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":241 - * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) - * buf[i] = temp_cdouble - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":470 + * 'cn_bit_offset': cn_dat.cn_bit_offset, + * 'cn_byte_offset': cn_dat.cn_byte_offset, + * 'cn_bit_count': cn_dat.cn_bit_count, # <<<<<<<<<<<<<< + * 'cn_flags': cn_dat.cn_flags, + * 'cn_invalid_bit_pos': cn_dat.cn_invalid_bit_pos, */ - } + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_cn_dat.cn_bit_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_bit_count, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":244 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< + /* "dataRead.pyx":471 + * 'cn_byte_offset': cn_dat.cn_byte_offset, + * 'cn_bit_count': cn_dat.cn_bit_count, + * 'cn_flags': cn_dat.cn_flags, # <<<<<<<<<<<<<< + * 'cn_invalid_bit_pos': cn_dat.cn_invalid_bit_pos, + * 'cn_precision': cn_dat.cn_precision, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_cn_dat.cn_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_flags, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":472 + * 'cn_bit_count': cn_dat.cn_bit_count, + * 'cn_flags': cn_dat.cn_flags, + * 'cn_invalid_bit_pos': cn_dat.cn_invalid_bit_pos, # <<<<<<<<<<<<<< + * 'cn_precision': cn_dat.cn_precision, + * 'cn_reserved': 0, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_cn_dat.cn_invalid_bit_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_invalid_bit_pos, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":473 + * 'cn_flags': cn_dat.cn_flags, + * 'cn_invalid_bit_pos': cn_dat.cn_invalid_bit_pos, + * 'cn_precision': cn_dat.cn_precision, # <<<<<<<<<<<<<< + * 'cn_reserved': 0, + * 'cn_attachment_count': cn_dat.cn_attachment_count, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cn_dat.cn_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_precision, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_reserved, __pyx_int_0) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + + /* "dataRead.pyx":475 + * 'cn_precision': cn_dat.cn_precision, + * 'cn_reserved': 0, + * 'cn_attachment_count': cn_dat.cn_attachment_count, # <<<<<<<<<<<<<< + * 'cn_val_range_min': cn_dat.cn_val_range_min, + * 'cn_val_range_max': cn_dat.cn_val_range_max, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(__pyx_v_cn_dat.cn_attachment_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_attachment_count, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":476 + * 'cn_reserved': 0, + * 'cn_attachment_count': cn_dat.cn_attachment_count, + * 'cn_val_range_min': cn_dat.cn_val_range_min, # <<<<<<<<<<<<<< + * 'cn_val_range_max': cn_dat.cn_val_range_max, + * 'cn_default_x': None, + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cn_dat.cn_val_range_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_val_range_min, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":477 + * 'cn_attachment_count': cn_dat.cn_attachment_count, + * 'cn_val_range_min': cn_dat.cn_val_range_min, + * 'cn_val_range_max': cn_dat.cn_val_range_max, # <<<<<<<<<<<<<< + * 'cn_default_x': None, + * 'name': cn_name, + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cn_dat.cn_val_range_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_val_range_max, __pyx_t_2) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":478 + * 'cn_val_range_min': cn_dat.cn_val_range_min, + * 'cn_val_range_max': cn_dat.cn_val_range_max, + * 'cn_default_x': None, # <<<<<<<<<<<<<< + * 'name': cn_name, + * } + */ + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cn_default_x, Py_None) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + + /* "dataRead.pyx":479 + * 'cn_val_range_max': cn_dat.cn_val_range_max, + * 'cn_default_x': None, + * 'name': cn_name, # <<<<<<<<<<<<<< + * } * - * cdef inline read_unsigned_char(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_name, __pyx_v_cn_name) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_cn_dict, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "dataRead.pyx":233 - * return buf.byteswap() + /* "dataRead.pyx":483 * - * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): - * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * # Handle extra links (attachments, default_x) + * if cn_hdr.link_count > 8: # <<<<<<<<<<<<<< + * n_extra = ((cn_hdr.link_count) - 8) * 8 + * if n_extra <= 512: */ + __pyx_t_6 = (__pyx_v_cn_hdr.link_count > 8); + if (__pyx_t_6) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_cdouble", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":484 + * # Handle extra links (attachments, default_x) + * if cn_hdr.link_count > 8: + * n_extra = ((cn_hdr.link_count) - 8) * 8 # <<<<<<<<<<<<<< + * if n_extra <= 512: + * with nogil: + */ + __pyx_v_n_extra = ((((Py_ssize_t)__pyx_v_cn_hdr.link_count) - 8) * 8); -/* "dataRead.pyx":246 - * return buf.byteswap() - * - * cdef inline read_unsigned_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset): + /* "dataRead.pyx":485 + * if cn_hdr.link_count > 8: + * n_extra = ((cn_hdr.link_count) - 8) * 8 + * if n_extra <= 512: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) */ + __pyx_t_6 = (__pyx_v_n_extra <= 0x200); + if (__pyx_t_6) { -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_char(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned char __pyx_v_mask; - unsigned char __pyx_v_temp1byte; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_unsigned_char", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - - /* "dataRead.pyx":249 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset): - * cdef np.ndarray[np.uint8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned char mask = ((1 << bit_count) - 1) - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 249, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 249, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 249, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "dataRead.pyx":251 - * cdef np.ndarray[np.uint8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned char mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef unsigned char temp1byte = 0 - * if bit_count == 8: + /* "dataRead.pyx":486 + * n_extra = ((cn_hdr.link_count) - 8) * 8 + * if n_extra <= 512: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) + * if nread == n_extra: */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":252 - * cdef unsigned long long i - * cdef unsigned char mask = ((1 << bit_count) - 1) - * cdef unsigned char temp1byte = 0 # <<<<<<<<<<<<<< - * if bit_count == 8: - * for i in range(number_of_records): + /* "dataRead.pyx":487 + * if n_extra <= 512: + * with nogil: + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) # <<<<<<<<<<<<<< + * if nread == n_extra: + * extra_links = [] */ - __pyx_v_temp1byte = 0; + __pyx_v_nread = pread(__pyx_v_fd, __pyx_v_extra_buf, __pyx_v_n_extra, (__pyx_v_pointer + 88)); + } - /* "dataRead.pyx":253 - * cdef unsigned char mask = ((1 << bit_count) - 1) - * cdef unsigned char temp1byte = 0 - * if bit_count == 8: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - */ - __pyx_t_6 = (__pyx_v_bit_count == 8); - if (__pyx_t_6) { + /* "dataRead.pyx":486 + * n_extra = ((cn_hdr.link_count) - 8) * 8 + * if n_extra <= 512: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) + * if nread == n_extra: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L24; + } + __pyx_L24:; + } + } - /* "dataRead.pyx":254 - * cdef unsigned char temp1byte = 0 - * if bit_count == 8: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * buf[i] = temp1byte + /* "dataRead.pyx":488 + * with nogil: + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) + * if nread == n_extra: # <<<<<<<<<<<<<< + * extra_links = [] + * for i in range(0, n_extra, 8): */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_6 = (__pyx_v_nread == __pyx_v_n_extra); + if (__pyx_t_6) { - /* "dataRead.pyx":255 - * if bit_count == 8: - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< - * buf[i] = temp1byte - * else: + /* "dataRead.pyx":489 + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) + * if nread == n_extra: + * extra_links = [] # <<<<<<<<<<<<<< + * for i in range(0, n_extra, 8): + * lnk = 0 */ - (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_extra_links, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "dataRead.pyx":256 - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * buf[i] = temp1byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): - */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; - } + /* "dataRead.pyx":490 + * if nread == n_extra: + * extra_links = [] + * for i in range(0, n_extra, 8): # <<<<<<<<<<<<<< + * lnk = 0 + * memcpy(&lnk, extra_buf + i, 8) + */ + __pyx_t_7 = __pyx_v_n_extra; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=8) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":491 + * extra_links = [] + * for i in range(0, n_extra, 8): + * lnk = 0 # <<<<<<<<<<<<<< + * memcpy(&lnk, extra_buf + i, 8) + * extra_links.append(lnk) + */ + __pyx_v_lnk = 0; + + /* "dataRead.pyx":492 + * for i in range(0, n_extra, 8): + * lnk = 0 + * memcpy(&lnk, extra_buf + i, 8) # <<<<<<<<<<<<<< + * extra_links.append(lnk) + * if cn_dat.cn_attachment_count > 0: + */ + (void)(memcpy((&__pyx_v_lnk), (__pyx_v_extra_buf + __pyx_v_i), 8)); + + /* "dataRead.pyx":493 + * lnk = 0 + * memcpy(&lnk, extra_buf + i, 8) + * extra_links.append(lnk) # <<<<<<<<<<<<<< + * if cn_dat.cn_attachment_count > 0: + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_lnk); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_extra_links, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "dataRead.pyx":253 - * cdef unsigned char mask = ((1 << bit_count) - 1) - * cdef unsigned char temp1byte = 0 - * if bit_count == 8: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + /* "dataRead.pyx":494 + * memcpy(&lnk, extra_buf + i, 8) + * extra_links.append(lnk) + * if cn_dat.cn_attachment_count > 0: # <<<<<<<<<<<<<< + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + * if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: + */ + __pyx_t_6 = (__pyx_v_cn_dat.cn_attachment_count > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":495 + * extra_links.append(lnk) + * if cn_dat.cn_attachment_count > 0: + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] # <<<<<<<<<<<<<< + * if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: + * cn_dict['cn_default_x'] = extra_links[cn_dat.cn_attachment_count:] + */ + __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_extra_links, 0, __pyx_v_cn_dat.cn_attachment_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_cn_at_reference, __pyx_t_1) < 0))) __PYX_ERR(0, 495, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dataRead.pyx":494 + * memcpy(&lnk, extra_buf + i, 8) + * extra_links.append(lnk) + * if cn_dat.cn_attachment_count > 0: # <<<<<<<<<<<<<< + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + * if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: */ - goto __pyx_L3; - } + } - /* "dataRead.pyx":258 - * buf[i] = temp1byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * # right shift + /* "dataRead.pyx":496 + * if cn_dat.cn_attachment_count > 0: + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + * if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: # <<<<<<<<<<<<<< + * cn_dict['cn_default_x'] = extra_links[cn_dat.cn_attachment_count:] + * */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_6 = (__pyx_v_cn_hdr.link_count > (8 + __pyx_v_cn_dat.cn_attachment_count)); + if (__pyx_t_6) { - /* "dataRead.pyx":259 - * else: - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":497 + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + * if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: + * cn_dict['cn_default_x'] = extra_links[cn_dat.cn_attachment_count:] # <<<<<<<<<<<<<< + * + * # Read unit (TX or MD block) */ - (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); + __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_extra_links, __pyx_v_cn_dat.cn_attachment_count, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_cn_default_x, __pyx_t_1) < 0))) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dataRead.pyx":261 - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp1byte = temp1byte >> bit_offset - * # mask left part + /* "dataRead.pyx":496 + * if cn_dat.cn_attachment_count > 0: + * cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + * if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: # <<<<<<<<<<<<<< + * cn_dict['cn_default_x'] = extra_links[cn_dat.cn_attachment_count:] + * */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + } - /* "dataRead.pyx":262 - * # right shift - * if bit_offset > 0: - * temp1byte = temp1byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * temp1byte &= mask + /* "dataRead.pyx":488 + * with nogil: + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) + * if nread == n_extra: # <<<<<<<<<<<<<< + * extra_links = [] + * for i in range(0, n_extra, 8): */ - __pyx_v_temp1byte = (__pyx_v_temp1byte >> __pyx_v_bit_offset); + } - /* "dataRead.pyx":261 - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp1byte = temp1byte >> bit_offset - * # mask left part + /* "dataRead.pyx":485 + * if cn_hdr.link_count > 8: + * n_extra = ((cn_hdr.link_count) - 8) * 8 + * if n_extra <= 512: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, extra_buf, n_extra, pointer + 88) */ } - /* "dataRead.pyx":264 - * temp1byte = temp1byte >> bit_offset - * # mask left part - * temp1byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp1byte - * return buf - */ - __pyx_v_temp1byte = (__pyx_v_temp1byte & __pyx_v_mask); - - /* "dataRead.pyx":265 - * # mask left part - * temp1byte &= mask - * buf[i] = temp1byte # <<<<<<<<<<<<<< - * return buf + /* "dataRead.pyx":483 * + * # Handle extra links (attachments, default_x) + * if cn_hdr.link_count > 8: # <<<<<<<<<<<<<< + * n_extra = ((cn_hdr.link_count) - 8) * 8 + * if n_extra <= 512: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; } - } - __pyx_L3:; - /* "dataRead.pyx":266 - * temp1byte &= mask - * buf[i] = temp1byte - * return buf # <<<<<<<<<<<<<< + /* "dataRead.pyx":500 * - * cdef inline read_signed_char(const char* bit_stream, str record_format, unsigned long long number_of_records, + * # Read unit (TX or MD block) + * if not channel_name_list: # <<<<<<<<<<<<<< + * if cn_hdr.cn_md_unit: + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_t_6 = (!__pyx_v_channel_name_list); + if (__pyx_t_6) { - /* "dataRead.pyx":246 - * return buf.byteswap() - * - * cdef inline read_unsigned_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset): + /* "dataRead.pyx":501 + * # Read unit (TX or MD block) + * if not channel_name_list: + * if cn_hdr.cn_md_unit: # <<<<<<<<<<<<<< + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + * if unit_str: */ + __pyx_t_6 = (__pyx_v_cn_hdr.cn_md_unit != 0); + if (__pyx_t_6) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":502 + * if not channel_name_list: + * if cn_hdr.cn_md_unit: + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) # <<<<<<<<<<<<<< + * if unit_str: + * cn_dict['unit'] = unit_str + */ + __pyx_t_1 = __pyx_f_8dataRead__fast_read_tx_or_md(__pyx_v_fd, __pyx_v_cn_hdr.cn_md_unit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_unit_str, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; -/* "dataRead.pyx":268 - * return buf - * - * cdef inline read_signed_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset): + /* "dataRead.pyx":503 + * if cn_hdr.cn_md_unit: + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + * if unit_str: # <<<<<<<<<<<<<< + * cn_dict['unit'] = unit_str + * elif cn_dat.cn_sync_type == 1: */ + __pyx_t_6 = (__pyx_v_unit_str != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_unit_str) != 0); + if (__pyx_t_6) { -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_char(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned char __pyx_v_mask; - char __pyx_v_temp1byte; - unsigned char __pyx_v_sign_bit; - unsigned char __pyx_v_sign_bit_mask; - unsigned char __pyx_v_sign_extend; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_signed_char", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + /* "dataRead.pyx":504 + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + * if unit_str: + * cn_dict['unit'] = unit_str # <<<<<<<<<<<<<< + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' + */ + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_v_unit_str) < 0))) __PYX_ERR(0, 504, __pyx_L1_error) - /* "dataRead.pyx":271 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset): - * cdef np.ndarray[np.int8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned char mask = ((1 << bit_count) - 1) + /* "dataRead.pyx":503 + * if cn_hdr.cn_md_unit: + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + * if unit_str: # <<<<<<<<<<<<<< + * cn_dict['unit'] = unit_str + * elif cn_dat.cn_sync_type == 1: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 271, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 271, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 271, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + goto __pyx_L32; + } - /* "dataRead.pyx":273 - * cdef np.ndarray[np.int8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned char mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef char temp1byte = 0 - * cdef unsigned char sign_bit = 0 + /* "dataRead.pyx":505 + * if unit_str: + * cn_dict['unit'] = unit_str + * elif cn_dat.cn_sync_type == 1: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + __pyx_t_6 = (__pyx_v_cn_dat.cn_sync_type == 1); + if (__pyx_t_6) { - /* "dataRead.pyx":274 - * cdef unsigned long long i - * cdef unsigned char mask = ((1 << bit_count) - 1) - * cdef char temp1byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned char sign_bit = 0 - * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) + /* "dataRead.pyx":506 + * cn_dict['unit'] = unit_str + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' # <<<<<<<<<<<<<< + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' */ - __pyx_v_temp1byte = 0; + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_n_u_s) < 0))) __PYX_ERR(0, 506, __pyx_L1_error) - /* "dataRead.pyx":275 - * cdef unsigned char mask = ((1 << bit_count) - 1) - * cdef char temp1byte = 0 - * cdef unsigned char sign_bit = 0 # <<<<<<<<<<<<<< - * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count + /* "dataRead.pyx":505 + * if unit_str: + * cn_dict['unit'] = unit_str + * elif cn_dat.cn_sync_type == 1: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: */ - __pyx_v_sign_bit = 0; + goto __pyx_L32; + } - /* "dataRead.pyx":276 - * cdef char temp1byte = 0 - * cdef unsigned char sign_bit = 0 - * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< - * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count - * if bit_count == 8: + /* "dataRead.pyx":507 + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: */ - __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); + __pyx_t_6 = (__pyx_v_cn_dat.cn_sync_type == 2); + if (__pyx_t_6) { - /* "dataRead.pyx":277 - * cdef unsigned char sign_bit = 0 - * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< - * if bit_count == 8: - * for i in range(number_of_records): + /* "dataRead.pyx":508 + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' # <<<<<<<<<<<<<< + * elif cn_dat.cn_sync_type == 3: + * cn_dict['unit'] = 'm' */ - __pyx_v_sign_extend = (((1 << (8 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_n_u_rad) < 0))) __PYX_ERR(0, 508, __pyx_L1_error) - /* "dataRead.pyx":278 - * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count - * if bit_count == 8: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + /* "dataRead.pyx":507 + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: */ - __pyx_t_6 = (__pyx_v_bit_count == 8); - if (__pyx_t_6) { + goto __pyx_L32; + } - /* "dataRead.pyx":279 - * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count - * if bit_count == 8: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * buf[i] = temp1byte + /* "dataRead.pyx":509 + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'm' + * elif cn_dat.cn_sync_type == 1: */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_6 = (__pyx_v_cn_dat.cn_sync_type == 3); + if (__pyx_t_6) { - /* "dataRead.pyx":280 - * if bit_count == 8: - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< - * buf[i] = temp1byte - * else: + /* "dataRead.pyx":510 + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: + * cn_dict['unit'] = 'm' # <<<<<<<<<<<<<< + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' */ - (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_n_u_m) < 0))) __PYX_ERR(0, 510, __pyx_L1_error) - /* "dataRead.pyx":281 - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * buf[i] = temp1byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":509 + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'm' + * elif cn_dat.cn_sync_type == 1: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; - } + } + __pyx_L32:; - /* "dataRead.pyx":278 - * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count - * if bit_count == 8: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + /* "dataRead.pyx":501 + * # Read unit (TX or MD block) + * if not channel_name_list: + * if cn_hdr.cn_md_unit: # <<<<<<<<<<<<<< + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + * if unit_str: */ - goto __pyx_L3; - } + goto __pyx_L31; + } - /* "dataRead.pyx":283 - * buf[i] = temp1byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * # right shift + /* "dataRead.pyx":511 + * elif cn_dat.cn_sync_type == 3: + * cn_dict['unit'] = 'm' + * elif cn_dat.cn_sync_type == 1: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_6 = (__pyx_v_cn_dat.cn_sync_type == 1); + if (__pyx_t_6) { - /* "dataRead.pyx":284 - * else: - * for i in range(number_of_records): - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":512 + * cn_dict['unit'] = 'm' + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' # <<<<<<<<<<<<<< + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' */ - (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_n_u_s) < 0))) __PYX_ERR(0, 512, __pyx_L1_error) - /* "dataRead.pyx":286 - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp1byte = temp1byte >> bit_offset - * # mask left part + /* "dataRead.pyx":511 + * elif cn_dat.cn_sync_type == 3: + * cn_dict['unit'] = 'm' + * elif cn_dat.cn_sync_type == 1: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); + goto __pyx_L31; + } + + /* "dataRead.pyx":513 + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: + */ + __pyx_t_6 = (__pyx_v_cn_dat.cn_sync_type == 2); if (__pyx_t_6) { - /* "dataRead.pyx":287 - * # right shift - * if bit_offset > 0: - * temp1byte = temp1byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * temp1byte &= mask + /* "dataRead.pyx":514 + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' # <<<<<<<<<<<<<< + * elif cn_dat.cn_sync_type == 3: + * cn_dict['unit'] = 'm' */ - __pyx_v_temp1byte = (__pyx_v_temp1byte >> __pyx_v_bit_offset); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_n_u_rad) < 0))) __PYX_ERR(0, 514, __pyx_L1_error) - /* "dataRead.pyx":286 - * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp1byte = temp1byte >> bit_offset - * # mask left part + /* "dataRead.pyx":513 + * elif cn_dat.cn_sync_type == 1: + * cn_dict['unit'] = 's' + * elif cn_dat.cn_sync_type == 2: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: */ + goto __pyx_L31; } - /* "dataRead.pyx":289 - * temp1byte = temp1byte >> bit_offset - * # mask left part - * temp1byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp1byte & sign_bit_mask - * if sign_bit: # negative value, sign extend + /* "dataRead.pyx":515 + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'm' + * */ - __pyx_v_temp1byte = (__pyx_v_temp1byte & __pyx_v_mask); + __pyx_t_6 = (__pyx_v_cn_dat.cn_sync_type == 3); + if (__pyx_t_6) { - /* "dataRead.pyx":290 - * # mask left part - * temp1byte &= mask - * sign_bit = temp1byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp1byte |= sign_extend + /* "dataRead.pyx":516 + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: + * cn_dict['unit'] = 'm' # <<<<<<<<<<<<<< + * + * # Read description (MD/TX block) */ - __pyx_v_sign_bit = (__pyx_v_temp1byte & __pyx_v_sign_bit_mask); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_unit, __pyx_n_u_m) < 0))) __PYX_ERR(0, 516, __pyx_L1_error) - /* "dataRead.pyx":291 - * temp1byte &= mask - * sign_bit = temp1byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp1byte |= sign_extend - * buf[i] = temp1byte + /* "dataRead.pyx":515 + * elif cn_dat.cn_sync_type == 2: + * cn_dict['unit'] = 'rad' + * elif cn_dat.cn_sync_type == 3: # <<<<<<<<<<<<<< + * cn_dict['unit'] = 'm' + * */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); + } + __pyx_L31:; + + /* "dataRead.pyx":519 + * + * # Read description (MD/TX block) + * if cn_hdr.cn_md_comment: # <<<<<<<<<<<<<< + * desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) + * if desc_str: + */ + __pyx_t_6 = (__pyx_v_cn_hdr.cn_md_comment != 0); if (__pyx_t_6) { - /* "dataRead.pyx":292 - * sign_bit = temp1byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp1byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp1byte - * return buf + /* "dataRead.pyx":520 + * # Read description (MD/TX block) + * if cn_hdr.cn_md_comment: + * desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) # <<<<<<<<<<<<<< + * if desc_str: + * cn_dict['Comment'] = {'description': desc_str} */ - __pyx_v_temp1byte = (__pyx_v_temp1byte | __pyx_v_sign_extend); + __pyx_t_1 = __pyx_f_8dataRead__fast_read_tx_or_md(__pyx_v_fd, __pyx_v_cn_hdr.cn_md_comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_desc_str, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "dataRead.pyx":291 - * temp1byte &= mask - * sign_bit = temp1byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp1byte |= sign_extend - * buf[i] = temp1byte + /* "dataRead.pyx":521 + * if cn_hdr.cn_md_comment: + * desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) + * if desc_str: # <<<<<<<<<<<<<< + * cn_dict['Comment'] = {'description': desc_str} + * */ - } + __pyx_t_6 = (__pyx_v_desc_str != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_desc_str) != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":293 - * if sign_bit: # negative value, sign extend - * temp1byte |= sign_extend - * buf[i] = temp1byte # <<<<<<<<<<<<<< - * return buf + /* "dataRead.pyx":522 + * desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) + * if desc_str: + * cn_dict['Comment'] = {'description': desc_str} # <<<<<<<<<<<<<< * + * # Read CC block */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; - } - } - __pyx_L3:; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_description, __pyx_v_desc_str) < 0) __PYX_ERR(0, 522, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_Comment, __pyx_t_1) < 0))) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dataRead.pyx":294 - * temp1byte |= sign_extend - * buf[i] = temp1byte - * return buf # <<<<<<<<<<<<<< + /* "dataRead.pyx":521 + * if cn_hdr.cn_md_comment: + * desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) + * if desc_str: # <<<<<<<<<<<<<< + * cn_dict['Comment'] = {'description': desc_str} * - * cdef inline read_unsigned_short(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + } - /* "dataRead.pyx":268 - * return buf + /* "dataRead.pyx":519 * - * cdef inline read_signed_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset): + * # Read description (MD/TX block) + * if cn_hdr.cn_md_comment: # <<<<<<<<<<<<<< + * desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) + * if desc_str: */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_signed_char", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":500 + * + * # Read unit (TX or MD block) + * if not channel_name_list: # <<<<<<<<<<<<<< + * if cn_hdr.cn_md_unit: + * unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + */ + } -/* "dataRead.pyx":296 - * return buf + /* "dataRead.pyx":525 * - * cdef inline read_unsigned_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + * # Read CC block + * cc_ptr = cn_hdr.cn_cc_conversion # <<<<<<<<<<<<<< + * cc_dict = {'cc_type': 0} + * if cc_ptr != 0: */ + __pyx_t_11 = __pyx_v_cn_hdr.cn_cc_conversion; + __pyx_v_cc_ptr = __pyx_t_11; -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_short(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned short __pyx_v_mask; - unsigned short __pyx_v_temp2byte; - unsigned char __pyx_v_temp[2]; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - unsigned int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_unsigned_short", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - - /* "dataRead.pyx":299 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): - * cdef np.ndarray[np.uint16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned short mask = ((1 << bit_count) - 1) + /* "dataRead.pyx":526 + * # Read CC block + * cc_ptr = cn_hdr.cn_cc_conversion + * cc_dict = {'cc_type': 0} # <<<<<<<<<<<<<< + * if cc_ptr != 0: + * with nogil: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 299, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 299, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 299, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "dataRead.pyx":301 - * cdef np.ndarray[np.uint16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned short mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef unsigned short temp2byte = 0 - * cdef unsigned char temp[2] - */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_type, __pyx_int_0) < 0) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_cc_dict, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* "dataRead.pyx":302 - * cdef unsigned long long i - * cdef unsigned short mask = ((1 << bit_count) - 1) - * cdef unsigned short temp2byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned char temp[2] - * if bit_count == 16: + /* "dataRead.pyx":527 + * cc_ptr = cn_hdr.cn_cc_conversion + * cc_dict = {'cc_type': 0} + * if cc_ptr != 0: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) */ - __pyx_v_temp2byte = 0; + __pyx_t_6 = (__pyx_v_cc_ptr != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":304 - * cdef unsigned short temp2byte = 0 - * cdef unsigned char temp[2] - * if bit_count == 16: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":528 + * cc_dict = {'cc_type': 0} + * if cc_ptr != 0: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) + * if nread == 56: */ - __pyx_t_6 = (__pyx_v_bit_count == 16); - if (__pyx_t_6) { + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":305 - * cdef unsigned char temp[2] - * if bit_count == 16: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte + /* "dataRead.pyx":529 + * if cc_ptr != 0: + * with nogil: + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) # <<<<<<<<<<<<<< + * if nread == 56: + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_cc_hdr), 56, __pyx_v_cc_ptr); + } - /* "dataRead.pyx":306 - * if bit_count == 16: - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * buf[i] = temp2byte - * if swap == 0: - */ - (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + /* "dataRead.pyx":528 + * cc_dict = {'cc_type': 0} + * if cc_ptr != 0: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) + * if nread == 56: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L40; + } + __pyx_L40:; + } + } - /* "dataRead.pyx":307 - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":530 + * with nogil: + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) + * if nread == 56: # <<<<<<<<<<<<<< + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 + * with nogil: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; - } + __pyx_t_6 = (__pyx_v_nread == 56); + if (__pyx_t_6) { - /* "dataRead.pyx":308 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":531 + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) + * if nread == 56: + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __pyx_v_cc_data_offset = (24 + (((Py_ssize_t)__pyx_v_cc_hdr.link_count) * 8)); - /* "dataRead.pyx":309 - * buf[i] = temp2byte - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":532 + * if nread == 56: + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) + * if nread == 24: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":308 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":533 + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 + * with nogil: + * nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) # <<<<<<<<<<<<<< + * if nread == 24: + * cc_dict = { */ - } + __pyx_v_nread = pread(__pyx_v_fd, (&__pyx_v_cc_dat), 24, (__pyx_v_cc_ptr + __pyx_v_cc_data_offset)); + } - /* "dataRead.pyx":311 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * else: - * if swap == 0: - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; + /* "dataRead.pyx":532 + * if nread == 56: + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) + * if nread == 24: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L46; + } + __pyx_L46:; + } } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /* "dataRead.pyx":304 - * cdef unsigned short temp2byte = 0 - * cdef unsigned char temp[2] - * if bit_count == 16: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":534 + * with nogil: + * nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) + * if nread == 24: # <<<<<<<<<<<<<< + * cc_dict = { + * 'pointer': cc_ptr, */ - } + __pyx_t_6 = (__pyx_v_nread == 24); + if (__pyx_t_6) { - /* "dataRead.pyx":313 - * return buf.byteswap() - * else: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":536 + * if nread == 24: + * cc_dict = { + * 'pointer': cc_ptr, # <<<<<<<<<<<<<< + * 'id': b'##CC', + * 'length': cc_hdr.length, */ - /*else*/ { - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __pyx_t_1 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_ptr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_pointer, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_id, __pyx_kp_b_CC) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + + /* "dataRead.pyx":538 + * 'pointer': cc_ptr, + * 'id': b'##CC', + * 'length': cc_hdr.length, # <<<<<<<<<<<<<< + * 'link_count': cc_hdr.link_count, + * 'cc_tx_name': cc_hdr.cc_tx_name, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_hdr.length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_length, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":539 + * 'id': b'##CC', + * 'length': cc_hdr.length, + * 'link_count': cc_hdr.link_count, # <<<<<<<<<<<<<< + * 'cc_tx_name': cc_hdr.cc_tx_name, + * 'cc_md_unit': cc_hdr.cc_md_unit, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_hdr.link_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_link_count, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":540 + * 'length': cc_hdr.length, + * 'link_count': cc_hdr.link_count, + * 'cc_tx_name': cc_hdr.cc_tx_name, # <<<<<<<<<<<<<< + * 'cc_md_unit': cc_hdr.cc_md_unit, + * 'cc_md_comment': cc_hdr.cc_md_comment, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_hdr.cc_tx_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_tx_name, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":541 + * 'link_count': cc_hdr.link_count, + * 'cc_tx_name': cc_hdr.cc_tx_name, + * 'cc_md_unit': cc_hdr.cc_md_unit, # <<<<<<<<<<<<<< + * 'cc_md_comment': cc_hdr.cc_md_comment, + * 'cc_cc_inverse': cc_hdr.cc_cc_inverse, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_hdr.cc_md_unit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_md_unit, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":542 + * 'cc_tx_name': cc_hdr.cc_tx_name, + * 'cc_md_unit': cc_hdr.cc_md_unit, + * 'cc_md_comment': cc_hdr.cc_md_comment, # <<<<<<<<<<<<<< + * 'cc_cc_inverse': cc_hdr.cc_cc_inverse, + * 'cc_type': cc_dat.cc_type, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_hdr.cc_md_comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_md_comment, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":543 + * 'cc_md_unit': cc_hdr.cc_md_unit, + * 'cc_md_comment': cc_hdr.cc_md_comment, + * 'cc_cc_inverse': cc_hdr.cc_cc_inverse, # <<<<<<<<<<<<<< + * 'cc_type': cc_dat.cc_type, + * 'cc_precision': cc_dat.cc_precision, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_cc_hdr.cc_cc_inverse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_cc_inverse, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":544 + * 'cc_md_comment': cc_hdr.cc_md_comment, + * 'cc_cc_inverse': cc_hdr.cc_cc_inverse, + * 'cc_type': cc_dat.cc_type, # <<<<<<<<<<<<<< + * 'cc_precision': cc_dat.cc_precision, + * 'cc_flags': cc_dat.cc_flags, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cc_dat.cc_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_type, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":545 + * 'cc_cc_inverse': cc_hdr.cc_cc_inverse, + * 'cc_type': cc_dat.cc_type, + * 'cc_precision': cc_dat.cc_precision, # <<<<<<<<<<<<<< + * 'cc_flags': cc_dat.cc_flags, + * 'cc_ref_count': cc_dat.cc_ref_count, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_cc_dat.cc_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_precision, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":546 + * 'cc_type': cc_dat.cc_type, + * 'cc_precision': cc_dat.cc_precision, + * 'cc_flags': cc_dat.cc_flags, # <<<<<<<<<<<<<< + * 'cc_ref_count': cc_dat.cc_ref_count, + * 'cc_val_count': cc_dat.cc_val_count, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(__pyx_v_cc_dat.cc_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_flags, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":547 + * 'cc_precision': cc_dat.cc_precision, + * 'cc_flags': cc_dat.cc_flags, + * 'cc_ref_count': cc_dat.cc_ref_count, # <<<<<<<<<<<<<< + * 'cc_val_count': cc_dat.cc_val_count, + * 'cc_phy_range_min': cc_dat.cc_phy_range_min, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(__pyx_v_cc_dat.cc_ref_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_ref_count, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":548 + * 'cc_flags': cc_dat.cc_flags, + * 'cc_ref_count': cc_dat.cc_ref_count, + * 'cc_val_count': cc_dat.cc_val_count, # <<<<<<<<<<<<<< + * 'cc_phy_range_min': cc_dat.cc_phy_range_min, + * 'cc_phy_range_max': cc_dat.cc_phy_range_max, + */ + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(__pyx_v_cc_dat.cc_val_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_val_count, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":549 + * 'cc_ref_count': cc_dat.cc_ref_count, + * 'cc_val_count': cc_dat.cc_val_count, + * 'cc_phy_range_min': cc_dat.cc_phy_range_min, # <<<<<<<<<<<<<< + * 'cc_phy_range_max': cc_dat.cc_phy_range_max, + * } + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cc_dat.cc_phy_range_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_phy_range_min, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":550 + * 'cc_val_count': cc_dat.cc_val_count, + * 'cc_phy_range_min': cc_dat.cc_phy_range_min, + * 'cc_phy_range_max': cc_dat.cc_phy_range_max, # <<<<<<<<<<<<<< + * } + * # Read cc_val (doubles) for common conversion types + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cc_dat.cc_phy_range_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_cc_phy_range_max, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_cc_dict, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dataRead.pyx":553 + * } + * # Read cc_val (doubles) for common conversion types + * if cc_dat.cc_val_count > 0 and cc_dat.cc_type not in (3, 7, 8, 9, 10, 11): # <<<<<<<<<<<<<< + * n_bytes = cc_dat.cc_val_count * 8 + * cc_val_buf = PyMem_Malloc(n_bytes) + */ + __pyx_t_12 = (__pyx_v_cc_dat.cc_val_count > 0); + if (__pyx_t_12) { + } else { + __pyx_t_6 = __pyx_t_12; + goto __pyx_L49_bool_binop_done; + } + switch (__pyx_v_cc_dat.cc_type) { + case 3: + case 7: + case 8: + case 9: + case 10: + case 11: + __pyx_t_12 = 0; + break; + default: + __pyx_t_12 = 1; + break; + } + __pyx_t_13 = __pyx_t_12; + __pyx_t_6 = __pyx_t_13; + __pyx_L49_bool_binop_done:; + if (__pyx_t_6) { + + /* "dataRead.pyx":554 + * # Read cc_val (doubles) for common conversion types + * if cc_dat.cc_val_count > 0 and cc_dat.cc_type not in (3, 7, 8, 9, 10, 11): + * n_bytes = cc_dat.cc_val_count * 8 # <<<<<<<<<<<<<< + * cc_val_buf = PyMem_Malloc(n_bytes) + * if cc_val_buf != NULL: + */ + __pyx_v_n_bytes = (__pyx_v_cc_dat.cc_val_count * 8); + + /* "dataRead.pyx":555 + * if cc_dat.cc_val_count > 0 and cc_dat.cc_type not in (3, 7, 8, 9, 10, 11): + * n_bytes = cc_dat.cc_val_count * 8 + * cc_val_buf = PyMem_Malloc(n_bytes) # <<<<<<<<<<<<<< + * if cc_val_buf != NULL: + * try: + */ + __pyx_v_cc_val_buf = ((unsigned char *)PyMem_Malloc(__pyx_v_n_bytes)); + + /* "dataRead.pyx":556 + * n_bytes = cc_dat.cc_val_count * 8 + * cc_val_buf = PyMem_Malloc(n_bytes) + * if cc_val_buf != NULL: # <<<<<<<<<<<<<< + * try: + * with nogil: + */ + __pyx_t_6 = (__pyx_v_cc_val_buf != NULL); + if (__pyx_t_6) { + + /* "dataRead.pyx":557 + * cc_val_buf = PyMem_Malloc(n_bytes) + * if cc_val_buf != NULL: + * try: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, cc_val_buf, + */ + /*try:*/ { + + /* "dataRead.pyx":558 + * if cc_val_buf != NULL: + * try: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, cc_val_buf, + * n_bytes, + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "dataRead.pyx":314 - * else: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * # right shift + /* "dataRead.pyx":559 + * try: + * with nogil: + * nread = c_pread(fd, cc_val_buf, # <<<<<<<<<<<<<< + * n_bytes, + * cc_ptr + cc_data_offset + 24) */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_v_nread = pread(__pyx_v_fd, __pyx_v_cc_val_buf, __pyx_v_n_bytes, ((__pyx_v_cc_ptr + __pyx_v_cc_data_offset) + 24)); + } - /* "dataRead.pyx":315 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":558 + * if cc_val_buf != NULL: + * try: + * with nogil: # <<<<<<<<<<<<<< + * nread = c_pread(fd, cc_val_buf, + * n_bytes, + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L61; + } + __pyx_L61:; + } + } + + /* "dataRead.pyx":562 + * n_bytes, + * cc_ptr + cc_data_offset + 24) + * if nread == n_bytes: # <<<<<<<<<<<<<< + * dbl_ptr = cc_val_buf + * cc_val_list = [] + */ + __pyx_t_6 = (__pyx_v_nread == __pyx_v_n_bytes); + if (__pyx_t_6) { + + /* "dataRead.pyx":563 + * cc_ptr + cc_data_offset + 24) + * if nread == n_bytes: + * dbl_ptr = cc_val_buf # <<<<<<<<<<<<<< + * cc_val_list = [] + * for i in range(cc_dat.cc_val_count): + */ + __pyx_v_dbl_ptr = ((double *)__pyx_v_cc_val_buf); + + /* "dataRead.pyx":564 + * if nread == n_bytes: + * dbl_ptr = cc_val_buf + * cc_val_list = [] # <<<<<<<<<<<<<< + * for i in range(cc_dat.cc_val_count): + * cc_val_list.append(dbl_ptr[i]) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_cc_val_list, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dataRead.pyx":565 + * dbl_ptr = cc_val_buf + * cc_val_list = [] + * for i in range(cc_dat.cc_val_count): # <<<<<<<<<<<<<< + * cc_val_list.append(dbl_ptr[i]) + * cc_dict['cc_val'] = cc_val_list + */ + __pyx_t_14 = __pyx_v_cc_dat.cc_val_count; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":566 + * cc_val_list = [] + * for i in range(cc_dat.cc_val_count): + * cc_val_list.append(dbl_ptr[i]) # <<<<<<<<<<<<<< + * cc_dict['cc_val'] = cc_val_list + * finally: + */ + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_dbl_ptr[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_cc_val_list, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 566, __pyx_L55_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dataRead.pyx":567 + * for i in range(cc_dat.cc_val_count): + * cc_val_list.append(dbl_ptr[i]) + * cc_dict['cc_val'] = cc_val_list # <<<<<<<<<<<<<< + * finally: + * PyMem_Free(cc_val_buf) + */ + if (unlikely((PyDict_SetItem(__pyx_v_cc_dict, __pyx_n_u_cc_val, __pyx_v_cc_val_list) < 0))) __PYX_ERR(0, 567, __pyx_L55_error) + + /* "dataRead.pyx":562 + * n_bytes, + * cc_ptr + cc_data_offset + 24) + * if nread == n_bytes: # <<<<<<<<<<<<<< + * dbl_ptr = cc_val_buf + * cc_val_list = [] */ - (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + } + } + + /* "dataRead.pyx":569 + * cc_dict['cc_val'] = cc_val_list + * finally: + * PyMem_Free(cc_val_buf) # <<<<<<<<<<<<<< + * # Mark complex CC types for Python re-read + * if cc_dat.cc_type in (3, 7, 8, 9, 10, 11): + */ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_cc_val_buf); + goto __pyx_L56; + } + __pyx_L55_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); + __Pyx_XGOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_t_19); + __Pyx_XGOTREF(__pyx_t_20); + __Pyx_XGOTREF(__pyx_t_21); + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_5 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename; + { + PyMem_Free(__pyx_v_cc_val_buf); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); + } + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17; + goto __pyx_L1_error; + } + __pyx_L56:; + } - /* "dataRead.pyx":317 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":556 + * n_bytes = cc_dat.cc_val_count * 8 + * cc_val_buf = PyMem_Malloc(n_bytes) + * if cc_val_buf != NULL: # <<<<<<<<<<<<<< + * try: + * with nogil: */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + } - /* "dataRead.pyx":318 - * # right shift - * if bit_offset > 0: - * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 16: + /* "dataRead.pyx":553 + * } + * # Read cc_val (doubles) for common conversion types + * if cc_dat.cc_val_count > 0 and cc_dat.cc_type not in (3, 7, 8, 9, 10, 11): # <<<<<<<<<<<<<< + * n_bytes = cc_dat.cc_val_count * 8 + * cc_val_buf = PyMem_Malloc(n_bytes) */ - __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); + } - /* "dataRead.pyx":317 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":571 + * PyMem_Free(cc_val_buf) + * # Mark complex CC types for Python re-read + * if cc_dat.cc_type in (3, 7, 8, 9, 10, 11): # <<<<<<<<<<<<<< + * cc_dict['_needs_completion'] = True + * */ - } + switch (__pyx_v_cc_dat.cc_type) { + case 3: + case 7: + case 8: + case 9: + case 10: + case 11: - /* "dataRead.pyx":320 - * temp2byte = temp2byte >> bit_offset - * # mask left part - * if bit_count < 16: # <<<<<<<<<<<<<< - * temp2byte &= mask - * buf[i] = temp2byte + /* "dataRead.pyx":572 + * # Mark complex CC types for Python re-read + * if cc_dat.cc_type in (3, 7, 8, 9, 10, 11): + * cc_dict['_needs_completion'] = True # <<<<<<<<<<<<<< + * + * # Read SI block (cached) */ - __pyx_t_6 = (__pyx_v_bit_count < 16); - if (__pyx_t_6) { + if (unlikely((PyDict_SetItem(__pyx_v_cc_dict, __pyx_n_u_needs_completion, Py_True) < 0))) __PYX_ERR(0, 572, __pyx_L1_error) - /* "dataRead.pyx":321 - * # mask left part - * if bit_count < 16: - * temp2byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp2byte - * else: + /* "dataRead.pyx":571 + * PyMem_Free(cc_val_buf) + * # Mark complex CC types for Python re-read + * if cc_dat.cc_type in (3, 7, 8, 9, 10, 11): # <<<<<<<<<<<<<< + * cc_dict['_needs_completion'] = True + * */ - __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); + break; + default: break; + } - /* "dataRead.pyx":320 - * temp2byte = temp2byte >> bit_offset - * # mask left part - * if bit_count < 16: # <<<<<<<<<<<<<< - * temp2byte &= mask - * buf[i] = temp2byte + /* "dataRead.pyx":534 + * with nogil: + * nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) + * if nread == 24: # <<<<<<<<<<<<<< + * cc_dict = { + * 'pointer': cc_ptr, */ } - /* "dataRead.pyx":322 - * if bit_count < 16: - * temp2byte &= mask - * buf[i] = temp2byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":530 + * with nogil: + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) + * if nread == 56: # <<<<<<<<<<<<<< + * cc_data_offset = 24 + (cc_hdr.link_count) * 8 + * with nogil: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - /* "dataRead.pyx":313 - * return buf.byteswap() - * else: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":527 + * cc_ptr = cn_hdr.cn_cc_conversion + * cc_dict = {'cc_type': 0} + * if cc_ptr != 0: # <<<<<<<<<<<<<< + * with nogil: + * nread = c_pread(fd, &cc_hdr, 56, cc_ptr) */ - goto __pyx_L7; } - /* "dataRead.pyx":324 - * buf[i] = temp2byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * temp2byte = temp[0]<<8 | temp[1] # swap bytes + /* "dataRead.pyx":575 + * + * # Read SI block (cached) + * if not minimal and not channel_name_list and cn_hdr.cn_si_source != 0: # <<<<<<<<<<<<<< + * si_ptr = cn_hdr.cn_si_source + * if si_ptr not in si_cache: */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_13 = (!(__pyx_v_minimal != 0)); + if (__pyx_t_13) { + } else { + __pyx_t_6 = __pyx_t_13; + goto __pyx_L70_bool_binop_done; + } + __pyx_t_13 = (!__pyx_v_channel_name_list); + if (__pyx_t_13) { + } else { + __pyx_t_6 = __pyx_t_13; + goto __pyx_L70_bool_binop_done; + } + __pyx_t_13 = (__pyx_v_cn_hdr.cn_si_source != 0); + __pyx_t_6 = __pyx_t_13; + __pyx_L70_bool_binop_done:; + if (__pyx_t_6) { - /* "dataRead.pyx":325 - * else: - * for i in range(number_of_records): - * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * temp2byte = temp[0]<<8 | temp[1] # swap bytes - * # right shift + /* "dataRead.pyx":576 + * # Read SI block (cached) + * if not minimal and not channel_name_list and cn_hdr.cn_si_source != 0: + * si_ptr = cn_hdr.cn_si_source # <<<<<<<<<<<<<< + * if si_ptr not in si_cache: + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) */ - (void)(memcpy((&__pyx_v_temp), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + __pyx_t_11 = __pyx_v_cn_hdr.cn_si_source; + __pyx_v_si_ptr = __pyx_t_11; - /* "dataRead.pyx":326 - * for i in range(number_of_records): - * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * temp2byte = temp[0]<<8 | temp[1] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":577 + * if not minimal and not channel_name_list and cn_hdr.cn_si_source != 0: + * si_ptr = cn_hdr.cn_si_source + * if si_ptr not in si_cache: # <<<<<<<<<<<<<< + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) + * si_dict = si_cache.get(si_ptr) */ - __pyx_v_temp2byte = (((__pyx_v_temp[0]) << 8) | (__pyx_v_temp[1])); + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_si_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__pyx_v_si_cache == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 577, __pyx_L1_error) + } + __pyx_t_6 = (__Pyx_PyDict_ContainsTF(__pyx_t_1, __pyx_v_si_cache, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { - /* "dataRead.pyx":328 - * temp2byte = temp[0]<<8 | temp[1] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":578 + * si_ptr = cn_hdr.cn_si_source + * if si_ptr not in si_cache: + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) # <<<<<<<<<<<<<< + * si_dict = si_cache.get(si_ptr) + * if si_dict is not None: */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_t_1 = __pyx_f_8dataRead__fast_read_si(__pyx_v_fd, __pyx_v_si_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__pyx_v_si_cache == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 578, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_si_ptr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((PyDict_SetItem(__pyx_v_si_cache, __pyx_t_2, __pyx_t_1) < 0))) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dataRead.pyx":329 - * # right shift - * if bit_offset > 0: - * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 16: + /* "dataRead.pyx":577 + * if not minimal and not channel_name_list and cn_hdr.cn_si_source != 0: + * si_ptr = cn_hdr.cn_si_source + * if si_ptr not in si_cache: # <<<<<<<<<<<<<< + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) + * si_dict = si_cache.get(si_ptr) */ - __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); + } - /* "dataRead.pyx":328 - * temp2byte = temp[0]<<8 | temp[1] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":579 + * if si_ptr not in si_cache: + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) + * si_dict = si_cache.get(si_ptr) # <<<<<<<<<<<<<< + * if si_dict is not None: + * cn_dict['SI'] = si_dict */ - } + if (unlikely(__pyx_v_si_cache == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 579, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_si_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_si_cache, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_2))) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_si_dict, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "dataRead.pyx":331 - * temp2byte = temp2byte >> bit_offset - * # mask left part - * if bit_count < 16: # <<<<<<<<<<<<<< - * temp2byte &= mask - * buf[i] = temp2byte + /* "dataRead.pyx":580 + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) + * si_dict = si_cache.get(si_ptr) + * if si_dict is not None: # <<<<<<<<<<<<<< + * cn_dict['SI'] = si_dict + * */ - __pyx_t_6 = (__pyx_v_bit_count < 16); - if (__pyx_t_6) { + __pyx_t_6 = (__pyx_v_si_dict != ((PyObject*)Py_None)); + if (__pyx_t_6) { - /* "dataRead.pyx":332 - * # mask left part - * if bit_count < 16: - * temp2byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp2byte - * return buf + /* "dataRead.pyx":581 + * si_dict = si_cache.get(si_ptr) + * if si_dict is not None: + * cn_dict['SI'] = si_dict # <<<<<<<<<<<<<< + * + * results.append((cn_key, cn_dict, cc_dict)) */ - __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); + if (unlikely((PyDict_SetItem(__pyx_v_cn_dict, __pyx_n_u_SI_2, __pyx_v_si_dict) < 0))) __PYX_ERR(0, 581, __pyx_L1_error) - /* "dataRead.pyx":331 - * temp2byte = temp2byte >> bit_offset - * # mask left part - * if bit_count < 16: # <<<<<<<<<<<<<< - * temp2byte &= mask - * buf[i] = temp2byte + /* "dataRead.pyx":580 + * si_cache[si_ptr] = _fast_read_si(fd, si_ptr) + * si_dict = si_cache.get(si_ptr) + * if si_dict is not None: # <<<<<<<<<<<<<< + * cn_dict['SI'] = si_dict + * */ - } + } - /* "dataRead.pyx":333 - * if bit_count < 16: - * temp2byte &= mask - * buf[i] = temp2byte # <<<<<<<<<<<<<< - * return buf + /* "dataRead.pyx":575 * + * # Read SI block (cached) + * if not minimal and not channel_name_list and cn_hdr.cn_si_source != 0: # <<<<<<<<<<<<<< + * si_ptr = cn_hdr.cn_si_source + * if si_ptr not in si_cache: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; - } } - __pyx_L7:; - /* "dataRead.pyx":334 - * temp2byte &= mask - * buf[i] = temp2byte - * return buf # <<<<<<<<<<<<<< + /* "dataRead.pyx":583 + * cn_dict['SI'] = si_dict + * + * results.append((cn_key, cn_dict, cc_dict)) # <<<<<<<<<<<<<< + * pointer = cn_hdr.cn_cn_next * - * cdef inline read_signed_short(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_cn_key); + __Pyx_GIVEREF(__pyx_v_cn_key); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_cn_key)) __PYX_ERR(0, 583, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_cn_dict); + __Pyx_GIVEREF(__pyx_v_cn_dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_cn_dict)) __PYX_ERR(0, 583, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_cc_dict); + __Pyx_GIVEREF(__pyx_v_cc_dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_cc_dict)) __PYX_ERR(0, 583, __pyx_L1_error); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":584 + * + * results.append((cn_key, cn_dict, cc_dict)) + * pointer = cn_hdr.cn_cn_next # <<<<<<<<<<<<<< + * + * return results + */ + __pyx_t_11 = __pyx_v_cn_hdr.cn_cn_next; + __pyx_v_pointer = __pyx_t_11; } + __pyx_L4_break:; - /* "dataRead.pyx":296 - * return buf + /* "dataRead.pyx":586 + * pointer = cn_hdr.cn_cn_next * - * cdef inline read_unsigned_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + * return results # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_results); + __pyx_r = __pyx_v_results; + goto __pyx_L0; + + /* "dataRead.pyx":384 + * + * + * def read_cn_chain_fast(object fid, uint64_t first_pointer, # <<<<<<<<<<<<<< + * dict si_cache, int minimal, bint channel_name_list): + * """Read the CN linked list starting at first_pointer using pread(). */ /* function exit code */ @@ -25040,2136 +27621,2577 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_short(char const __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_unsigned_short", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; + __Pyx_AddTraceback("dataRead.read_cn_chain_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XDECREF(__pyx_v_cn_key); + __Pyx_XDECREF(__pyx_v_results); + __Pyx_XDECREF(__pyx_v_cn_dict); + __Pyx_XDECREF(__pyx_v_cc_dict); + __Pyx_XDECREF(__pyx_v_si_dict); + __Pyx_XDECREF(__pyx_v_cn_name); + __Pyx_XDECREF(__pyx_v_unit_str); + __Pyx_XDECREF(__pyx_v_desc_str); + __Pyx_XDECREF(__pyx_v_cc_val_list); + __Pyx_XDECREF(__pyx_v_extra_links); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":336 - * return buf +/* "dataRead.pyx":589 * - * cdef inline read_signed_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * @cython.wraparound(False) + * def sorted_data_read(bytes tmp, unsigned short bit_count, */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_short(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned short __pyx_v_mask; - short __pyx_v_temp2byte; - unsigned short __pyx_v_sign_bit; - unsigned short __pyx_v_sign_bit_mask; - unsigned short __pyx_v_sign_extend; - unsigned char __pyx_v_temp[2]; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - unsigned int __pyx_t_11; +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_3sorted_data_read(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_8dataRead_2sorted_data_read, "dataRead function to read in cython a channel from a byte stream\n\n Parameters\n ------------\n tmp : bytes\n byte stream\n bit_count : unsigned short\n number of bit taken by the channel in the record\n signal_data_type : unsigned short\n int to describe data type\n record_format : string\n basic numpy dtype description of data type, used to create\n returned numpy ndarray\n number_of_records : unsigned long long\n number of records in byte stream\n record_byte_size : unsigned long\n number of bytes taken by one record repeated in byte stream\n bit_offset : unsigned char\n bit offset of data in C aligned bytes\n pos_byte_beg : unsigned long\n beginning byte position of channel in record\n n_bytes : unsigned long\n bytes length of channel in record\n array : boolean\n reads an array, not a vector\n\n Returns\n -------\n ndarray of type record_format with number_of_records records.\n Byte order is swapped if necessary to match machine byte order before bits offset and masking\n "); +static PyMethodDef __pyx_mdef_8dataRead_3sorted_data_read = {"sorted_data_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_3sorted_data_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_2sorted_data_read}; +static PyObject *__pyx_pw_8dataRead_3sorted_data_read(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_tmp = 0; + unsigned short __pyx_v_bit_count; + unsigned short __pyx_v_signal_data_type; + PyObject *__pyx_v_record_format = 0; + unsigned PY_LONG_LONG __pyx_v_number_of_records; + unsigned long __pyx_v_record_byte_size; + unsigned char __pyx_v_bit_offset; + unsigned long __pyx_v_pos_byte_beg; + unsigned long __pyx_v_n_bytes; + PyObject *__pyx_v_array = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_signed_short", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - - /* "dataRead.pyx":339 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): - * cdef np.ndarray[np.int16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned short mask = ((1 << bit_count) - 1) - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 339, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 339, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int16_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 339, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "dataRead.pyx":341 - * cdef np.ndarray[np.int16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned short mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef short temp2byte = 0 - * cdef unsigned short sign_bit = 0 - */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sorted_data_read (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tmp,&__pyx_n_s_bit_count,&__pyx_n_s_signal_data_type,&__pyx_n_s_record_format,&__pyx_n_s_number_of_records,&__pyx_n_s_record_byte_size,&__pyx_n_s_bit_offset,&__pyx_n_s_pos_byte_beg,&__pyx_n_s_n_bytes,&__pyx_n_s_array,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tmp)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bit_count)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 1); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_signal_data_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 2); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record_format)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 3); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number_of_records)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 4); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record_byte_size)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 5); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bit_offset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 6); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pos_byte_beg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 7); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_bytes)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 8); __PYX_ERR(0, 589, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_array)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, 9); __PYX_ERR(0, 589, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sorted_data_read") < 0)) __PYX_ERR(0, 589, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 10)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + } + __pyx_v_tmp = ((PyObject*)values[0]); + __pyx_v_bit_count = __Pyx_PyInt_As_unsigned_short(values[1]); if (unlikely((__pyx_v_bit_count == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 591, __pyx_L3_error) + __pyx_v_signal_data_type = __Pyx_PyInt_As_unsigned_short(values[2]); if (unlikely((__pyx_v_signal_data_type == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 592, __pyx_L3_error) + __pyx_v_record_format = ((PyObject*)values[3]); + __pyx_v_number_of_records = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[4]); if (unlikely((__pyx_v_number_of_records == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 592, __pyx_L3_error) + __pyx_v_record_byte_size = __Pyx_PyInt_As_unsigned_long(values[5]); if (unlikely((__pyx_v_record_byte_size == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 593, __pyx_L3_error) + __pyx_v_bit_offset = __Pyx_PyInt_As_unsigned_char(values[6]); if (unlikely((__pyx_v_bit_offset == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 593, __pyx_L3_error) + __pyx_v_pos_byte_beg = __Pyx_PyInt_As_unsigned_long(values[7]); if (unlikely((__pyx_v_pos_byte_beg == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error) + __pyx_v_n_bytes = __Pyx_PyInt_As_unsigned_long(values[8]); if (unlikely((__pyx_v_n_bytes == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error) + __pyx_v_array = values[9]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sorted_data_read", 1, 10, 10, __pyx_nargs); __PYX_ERR(0, 589, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.sorted_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tmp), (&PyBytes_Type), 1, "tmp", 1))) __PYX_ERR(0, 591, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record_format), (&PyUnicode_Type), 1, "record_format", 1))) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_r = __pyx_pf_8dataRead_2sorted_data_read(__pyx_self, __pyx_v_tmp, __pyx_v_bit_count, __pyx_v_signal_data_type, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_bit_offset, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_array); - /* "dataRead.pyx":342 - * cdef unsigned long long i - * cdef unsigned short mask = ((1 << bit_count) - 1) - * cdef short temp2byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned short sign_bit = 0 - * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) - */ - __pyx_v_temp2byte = 0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":343 - * cdef unsigned short mask = ((1 << bit_count) - 1) - * cdef short temp2byte = 0 - * cdef unsigned short sign_bit = 0 # <<<<<<<<<<<<<< - * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count - */ - __pyx_v_sign_bit = 0; +static PyObject *__pyx_pf_8dataRead_2sorted_data_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tmp, unsigned short __pyx_v_bit_count, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, PyObject *__pyx_v_array) { + char const *__pyx_v_bit_stream; + CYTHON_UNUSED long __pyx_v_swap_flag; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + unsigned char __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sorted_data_read", 1); - /* "dataRead.pyx":344 - * cdef short temp2byte = 0 - * cdef unsigned short sign_bit = 0 - * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< - * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count - * cdef unsigned char temp[2] + /* "dataRead.pyx":626 + * Byte order is swapped if necessary to match machine byte order before bits offset and masking + * """ + * cdef const char* bit_stream = PyBytes_AsString(tmp) # <<<<<<<<<<<<<< + * if not array: + * if 'V' in record_format or 'S' in record_format or record_format is None: */ - __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); + __pyx_t_1 = PyBytes_AsString(__pyx_v_tmp); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 626, __pyx_L1_error) + __pyx_v_bit_stream = __pyx_t_1; - /* "dataRead.pyx":345 - * cdef unsigned short sign_bit = 0 - * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< - * cdef unsigned char temp[2] - * if bit_count == 16: + /* "dataRead.pyx":627 + * """ + * cdef const char* bit_stream = PyBytes_AsString(tmp) + * if not array: # <<<<<<<<<<<<<< + * if 'V' in record_format or 'S' in record_format or record_format is None: + * return read_byte(bit_stream, record_format, number_of_records, */ - __pyx_v_sign_extend = (((1 << (16 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_array); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 627, __pyx_L1_error) + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "dataRead.pyx":347 - * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count - * cdef unsigned char temp[2] - * if bit_count == 16: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":628 + * cdef const char* bit_stream = PyBytes_AsString(tmp) + * if not array: + * if 'V' in record_format or 'S' in record_format or record_format is None: # <<<<<<<<<<<<<< + * return read_byte(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) */ - __pyx_t_6 = (__pyx_v_bit_count == 16); - if (__pyx_t_6) { + if (unlikely(__pyx_v_record_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 628, __pyx_L1_error) + } + __pyx_t_2 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_V, __pyx_v_record_format, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 628, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + if (unlikely(__pyx_v_record_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 628, __pyx_L1_error) + } + __pyx_t_2 = (__Pyx_PyUnicode_ContainsTF(__pyx_n_u_S, __pyx_v_record_format, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 628, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_record_format == ((PyObject*)Py_None)); + __pyx_t_3 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":348 - * cdef unsigned char temp[2] - * if bit_count == 16: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte + /* "dataRead.pyx":629 + * if not array: + * if 'V' in record_format or 'S' in record_format or record_format is None: + * return read_byte(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * elif signal_data_type in (4, 5) and n_bytes == 4: # float */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":349 - * if bit_count == 16: - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * buf[i] = temp2byte - * if swap == 0: + /* "dataRead.pyx":630 + * if 'V' in record_format or 'S' in record_format or record_format is None: + * return read_byte(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) # <<<<<<<<<<<<<< + * elif signal_data_type in (4, 5) and n_bytes == 4: # float + * if (byteorder == 'little' and signal_data_type == 4) or \ */ - (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + __pyx_t_4 = __pyx_f_8dataRead_read_byte(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":350 - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":628 + * cdef const char* bit_stream = PyBytes_AsString(tmp) + * if not array: + * if 'V' in record_format or 'S' in record_format or record_format is None: # <<<<<<<<<<<<<< + * return read_byte(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - /* "dataRead.pyx":351 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: - */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":352 - * buf[i] = temp2byte - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; - - /* "dataRead.pyx":351 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * buf[i] = temp2byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":631 + * return read_byte(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * elif signal_data_type in (4, 5) and n_bytes == 4: # float # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): */ + switch (__pyx_v_signal_data_type) { + case 4: + case 5: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_5 = __pyx_t_2; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L8_bool_binop_done; } + __pyx_t_5 = (__pyx_v_n_bytes == 4); + __pyx_t_3 = __pyx_t_5; + __pyx_L8_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":354 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * else: - * if swap == 0: + /* "dataRead.pyx":632 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * elif signal_data_type in (4, 5) and n_bytes == 4: # float + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_float(bit_stream, record_format, number_of_records, */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + goto __pyx_L12_next_or; + } else { } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = (__pyx_v_signal_data_type == 4); + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L11_bool_binop_done; } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_L12_next_or:; - /* "dataRead.pyx":347 - * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count - * cdef unsigned char temp[2] - * if bit_count == 16: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":633 + * elif signal_data_type in (4, 5) and n_bytes == 4: # float + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): # <<<<<<<<<<<<<< + * return read_float(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_signal_data_type == 5); + __pyx_t_3 = __pyx_t_5; + __pyx_L11_bool_binop_done:; - /* "dataRead.pyx":356 - * return buf.byteswap() - * else: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":632 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * elif signal_data_type in (4, 5) and n_bytes == 4: # float + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_float(bit_stream, record_format, number_of_records, */ - /*else*/ { - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + if (__pyx_t_3) { - /* "dataRead.pyx":357 - * else: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * # right shift + /* "dataRead.pyx":634 + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): + * return read_float(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 0) + * else: # swap bytes */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":358 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":635 + * (byteorder == 'big' and signal_data_type == 5): + * return read_float(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_float(bit_stream, record_format, number_of_records, */ - (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + __pyx_t_4 = __pyx_f_8dataRead_read_float(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":360 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":632 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * elif signal_data_type in (4, 5) and n_bytes == 4: # float + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_float(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + } - /* "dataRead.pyx":361 - * # right shift - * if bit_offset > 0: - * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * temp2byte &= mask + /* "dataRead.pyx":637 + * record_byte_size, pos_byte_beg, 0) + * else: # swap bytes + * return read_float(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 8: # double */ - __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":360 - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":638 + * else: # swap bytes + * return read_float(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (4, 5) and n_bytes == 8: # double + * if (byteorder == 'little' and signal_data_type == 4) or \ */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_float(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":363 - * temp2byte = temp2byte >> bit_offset - * # mask left part - * temp2byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - */ - __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); - - /* "dataRead.pyx":364 - * # mask left part - * temp2byte &= mask - * sign_bit = temp2byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp2byte |= sign_extend + /* "dataRead.pyx":631 + * return read_byte(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * elif signal_data_type in (4, 5) and n_bytes == 4: # float # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): */ - __pyx_v_sign_bit = (__pyx_v_temp2byte & __pyx_v_sign_bit_mask); + } - /* "dataRead.pyx":365 - * temp2byte &= mask - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp2byte |= sign_extend - * buf[i] = temp2byte + /* "dataRead.pyx":639 + * return read_float(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 8: # double # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { + switch (__pyx_v_signal_data_type) { + case 4: + case 5: + __pyx_t_5 = 1; + break; + default: + __pyx_t_5 = 0; + break; + } + __pyx_t_2 = __pyx_t_5; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_n_bytes == 8); + __pyx_t_3 = __pyx_t_2; + __pyx_L15_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":366 - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp2byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp2byte - * else: + /* "dataRead.pyx":640 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 8: # double + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_double(bit_stream, record_format, number_of_records, */ - __pyx_v_temp2byte = (__pyx_v_temp2byte | __pyx_v_sign_extend); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_2) { + goto __pyx_L19_next_or; + } else { + } + __pyx_t_2 = (__pyx_v_signal_data_type == 4); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L18_bool_binop_done; + } + __pyx_L19_next_or:; - /* "dataRead.pyx":365 - * temp2byte &= mask - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp2byte |= sign_extend - * buf[i] = temp2byte + /* "dataRead.pyx":641 + * elif signal_data_type in (4, 5) and n_bytes == 8: # double + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): # <<<<<<<<<<<<<< + * return read_double(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L18_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_signal_data_type == 5); + __pyx_t_3 = __pyx_t_2; + __pyx_L18_bool_binop_done:; - /* "dataRead.pyx":367 - * if sign_bit: # negative value, sign extend - * temp2byte |= sign_extend - * buf[i] = temp2byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":640 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 8: # double + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_double(bit_stream, record_format, number_of_records, */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; - } + if (__pyx_t_3) { - /* "dataRead.pyx":356 - * return buf.byteswap() - * else: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + /* "dataRead.pyx":642 + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): + * return read_double(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 0) + * else: # swap bytes */ - goto __pyx_L7; - } + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":369 - * buf[i] = temp2byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * temp2byte = temp[0]<<8 | temp[1] # swap bytes + /* "dataRead.pyx":643 + * (byteorder == 'big' and signal_data_type == 5): + * return read_double(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_double(bit_stream, record_format, number_of_records, */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_4 = __pyx_f_8dataRead_read_double(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":370 - * else: - * for i in range(number_of_records): - * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< - * temp2byte = temp[0]<<8 | temp[1] # swap bytes - * # right shift + /* "dataRead.pyx":640 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 8: # double + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_double(bit_stream, record_format, number_of_records, */ - (void)(memcpy((&__pyx_v_temp), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + } - /* "dataRead.pyx":371 - * for i in range(number_of_records): - * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) - * temp2byte = temp[0]<<8 | temp[1] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":645 + * record_byte_size, pos_byte_beg, 0) + * else: # swap bytes + * return read_double(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision */ - __pyx_v_temp2byte = (((__pyx_v_temp[0]) << 8) | (__pyx_v_temp[1])); + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":373 - * temp2byte = temp[0]<<8 | temp[1] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":646 + * else: # swap bytes + * return read_double(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision + * if (byteorder == 'little' and signal_data_type == 4) or \ */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_double(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":374 - * # right shift - * if bit_offset > 0: - * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * temp2byte &= mask + /* "dataRead.pyx":639 + * return read_float(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 8: # double # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): */ - __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); + } - /* "dataRead.pyx":373 - * temp2byte = temp[0]<<8 | temp[1] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp2byte = temp2byte >> bit_offset - * # mask left part + /* "dataRead.pyx":647 + * return read_double(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): */ - } + switch (__pyx_v_signal_data_type) { + case 4: + case 5: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_5 = __pyx_t_2; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_n_bytes == 2); + __pyx_t_3 = __pyx_t_5; + __pyx_L22_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":376 - * temp2byte = temp2byte >> bit_offset - * # mask left part - * temp2byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend + /* "dataRead.pyx":648 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_half(bit_stream, record_format, number_of_records, */ - __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + goto __pyx_L26_next_or; + } else { + } + __pyx_t_5 = (__pyx_v_signal_data_type == 4); + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L25_bool_binop_done; + } + __pyx_L26_next_or:; - /* "dataRead.pyx":377 - * # mask left part - * temp2byte &= mask - * sign_bit = temp2byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp2byte |= sign_extend + /* "dataRead.pyx":649 + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): # <<<<<<<<<<<<<< + * return read_half(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - __pyx_v_sign_bit = (__pyx_v_temp2byte & __pyx_v_sign_bit_mask); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 649, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 649, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L25_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_signal_data_type == 5); + __pyx_t_3 = __pyx_t_5; + __pyx_L25_bool_binop_done:; - /* "dataRead.pyx":378 - * temp2byte &= mask - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp2byte |= sign_extend - * buf[i] = temp2byte + /* "dataRead.pyx":648 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_half(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { + if (__pyx_t_3) { - /* "dataRead.pyx":379 - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp2byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp2byte - * return buf + /* "dataRead.pyx":650 + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): + * return read_half(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 0) + * else: # swap bytes */ - __pyx_v_temp2byte = (__pyx_v_temp2byte | __pyx_v_sign_extend); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":378 - * temp2byte &= mask - * sign_bit = temp2byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp2byte |= sign_extend - * buf[i] = temp2byte + /* "dataRead.pyx":651 + * (byteorder == 'big' and signal_data_type == 5): + * return read_half(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_half(bit_stream, record_format, number_of_records, */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_half(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":380 - * if sign_bit: # negative value, sign extend - * temp2byte |= sign_extend - * buf[i] = temp2byte # <<<<<<<<<<<<<< - * return buf - * + /* "dataRead.pyx":648 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision + * if (byteorder == 'little' and signal_data_type == 4) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 5): + * return read_half(bit_stream, record_format, number_of_records, */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - } - __pyx_L7:; - /* "dataRead.pyx":381 - * temp2byte |= sign_extend - * buf[i] = temp2byte - * return buf # <<<<<<<<<<<<<< - * - * cdef inline read_unsigned_int(const char* bit_stream, str record_format, unsigned long long number_of_records, + /* "dataRead.pyx":653 + * record_byte_size, pos_byte_beg, 0) + * else: # swap bytes + * return read_half(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":336 - * return buf - * - * cdef inline read_signed_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + /* "dataRead.pyx":654 + * else: # swap bytes + * return read_half(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char + * return read_unsigned_char(bit_stream, record_format, number_of_records, */ + __pyx_t_4 = __pyx_f_8dataRead_read_half(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_signed_short", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dataRead.pyx":383 - * return buf - * - * cdef inline read_unsigned_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + /* "dataRead.pyx":647 + * return read_double(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (4, 5) and n_bytes == 2: # half precision # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 4) or \ + * (byteorder == 'big' and signal_data_type == 5): */ + } -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_int(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned int __pyx_v_mask; - unsigned int __pyx_v_temp4byte; - unsigned char __pyx_v_temp4[4]; - unsigned char __pyx_v_temp3[3]; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - unsigned int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_unsigned_int", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - - /* "dataRead.pyx":386 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): - * cdef np.ndarray[np.uint32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned int mask = ((1 << bit_count) - 1) + /* "dataRead.pyx":655 + * return read_half(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char # <<<<<<<<<<<<<< + * return read_unsigned_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 386, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 386, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 386, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + switch (__pyx_v_signal_data_type) { + case 0: + case 1: + case 13: + __pyx_t_5 = 1; + break; + default: + __pyx_t_5 = 0; + break; } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_5; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L29_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_n_bytes == 1); + __pyx_t_3 = __pyx_t_2; + __pyx_L29_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":388 - * cdef np.ndarray[np.uint32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned int mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef unsigned int temp4byte = 0 - * cdef unsigned char temp4[4] + /* "dataRead.pyx":656 + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char + * return read_unsigned_char(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":389 - * cdef unsigned long long i - * cdef unsigned int mask = ((1 << bit_count) - 1) - * cdef unsigned int temp4byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned char temp4[4] - * cdef unsigned char temp3[3] + /* "dataRead.pyx":657 + * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char + * return read_unsigned_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) # <<<<<<<<<<<<<< + * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char + * return read_signed_char(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = 0; + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_char(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":392 - * cdef unsigned char temp4[4] - * cdef unsigned char temp3[3] - * if bit_count == 32: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - */ - __pyx_t_6 = (__pyx_v_bit_count == 32); - if (__pyx_t_6) { - - /* "dataRead.pyx":393 - * cdef unsigned char temp3[3] - * if bit_count == 32: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte - */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "dataRead.pyx":394 - * if bit_count == 32: - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * if swap == 0: - */ - (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 4)); - - /* "dataRead.pyx":395 - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":655 + * return read_half(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 1) + * elif signal_data_type in (0, 1, 13) and n_bytes == 1: # unsigned char # <<<<<<<<<<<<<< + * return read_unsigned_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; } - /* "dataRead.pyx":396 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":658 + * return read_unsigned_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char # <<<<<<<<<<<<<< + * return read_signed_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + switch (__pyx_v_signal_data_type) { + case 2: + case 3: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_5 = __pyx_t_2; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L31_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_n_bytes == 1); + __pyx_t_3 = __pyx_t_5; + __pyx_L31_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":397 - * buf[i] = temp4byte - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":659 + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char + * return read_signed_char(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; - - /* "dataRead.pyx":396 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: - */ - } - /* "dataRead.pyx":399 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * elif n_bytes == 4: - * if swap == 0: + /* "dataRead.pyx":660 + * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char + * return read_signed_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) # <<<<<<<<<<<<<< + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short + * if (byteorder == 'little' and signal_data_type == 0) or \ */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __pyx_t_4 = __pyx_f_8dataRead_read_signed_char(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - } - - /* "dataRead.pyx":392 - * cdef unsigned char temp4[4] - * cdef unsigned char temp3[3] - * if bit_count == 32: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - */ - } - - /* "dataRead.pyx":400 - * else: - * return buf.byteswap() - * elif n_bytes == 4: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): - */ - __pyx_t_6 = (__pyx_v_n_bytes == 4); - if (__pyx_t_6) { - /* "dataRead.pyx":401 - * return buf.byteswap() - * elif n_bytes == 4: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":658 + * return read_unsigned_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (2, 3) and n_bytes == 1: # signed char # <<<<<<<<<<<<<< + * return read_signed_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + } - /* "dataRead.pyx":402 - * elif n_bytes == 4: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift + /* "dataRead.pyx":661 + * return read_signed_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + switch (__pyx_v_signal_data_type) { + case 0: + case 1: + case 13: + case 14: + __pyx_t_5 = 1; + break; + default: + __pyx_t_5 = 0; + break; + } + __pyx_t_2 = __pyx_t_5; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L33_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_n_bytes <= 2); + __pyx_t_3 = __pyx_t_2; + __pyx_L33_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":403 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":662 + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_short(bit_stream, record_format, number_of_records, */ - (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_2) { + goto __pyx_L37_next_or; + } else { + } + __pyx_t_2 = (__pyx_v_signal_data_type == 0); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L36_bool_binop_done; + } + __pyx_L37_next_or:; - /* "dataRead.pyx":405 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":663 + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): # <<<<<<<<<<<<<< + * return read_unsigned_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L36_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_signal_data_type == 1); + __pyx_t_3 = __pyx_t_2; + __pyx_L36_bool_binop_done:; - /* "dataRead.pyx":406 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 32: + /* "dataRead.pyx":662 + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_short(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + if (__pyx_t_3) { - /* "dataRead.pyx":405 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":664 + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) + * else: # swap bytes */ - } + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":408 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":665 + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_unsigned_short(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_count < 32); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":409 - * # mask left part - * if bit_count < 32: - * temp4byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * else: + /* "dataRead.pyx":662 + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_short(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + } - /* "dataRead.pyx":408 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":667 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) + * else: # swap bytes + * return read_unsigned_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short */ - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":410 - * if bit_count < 32: - * temp4byte &= mask - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":668 + * else: # swap bytes + * return read_unsigned_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short + * if (byteorder == 'little' and signal_data_type == 2) or \ */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; } - /* "dataRead.pyx":401 - * return buf.byteswap() - * elif n_bytes == 4: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":661 + * return read_signed_char(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset) + * elif signal_data_type in (0, 1, 13, 14) and n_bytes <= 2: # unsigned short # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): */ - goto __pyx_L7; } - /* "dataRead.pyx":412 - * buf[i] = temp4byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes + /* "dataRead.pyx":669 + * return read_unsigned_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + switch (__pyx_v_signal_data_type) { + case 2: + case 3: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_5 = __pyx_t_2; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L40_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_n_bytes <= 2); + __pyx_t_3 = __pyx_t_5; + __pyx_L40_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":413 - * else: - * for i in range(number_of_records): - * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - * # right shift + /* "dataRead.pyx":670 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_short(bit_stream, record_format, number_of_records, */ - (void)(memcpy((&__pyx_v_temp4), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + goto __pyx_L44_next_or; + } else { + } + __pyx_t_5 = (__pyx_v_signal_data_type == 2); + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L43_bool_binop_done; + } + __pyx_L44_next_or:; - /* "dataRead.pyx":414 - * for i in range(number_of_records): - * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":671 + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): # <<<<<<<<<<<<<< + * return read_signed_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) */ - __pyx_v_temp4byte = (((((__pyx_v_temp4[0]) << 24) | ((__pyx_v_temp4[1]) << 16)) | ((__pyx_v_temp4[2]) << 8)) | (__pyx_v_temp4[3])); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L43_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_signal_data_type == 3); + __pyx_t_3 = __pyx_t_5; + __pyx_L43_bool_binop_done:; - /* "dataRead.pyx":416 - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":670 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_short(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + if (__pyx_t_3) { - /* "dataRead.pyx":417 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 32: + /* "dataRead.pyx":672 + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) + * else: # swap bytes */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":416 - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":673 + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_signed_short(bit_stream, record_format, number_of_records, */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_signed_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":419 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":670 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_short(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_count < 32); - if (__pyx_t_6) { + } - /* "dataRead.pyx":420 - * # mask left part - * if bit_count < 32: - * temp4byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * return buf + /* "dataRead.pyx":675 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 0) + * else: # swap bytes + * return read_signed_short(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":419 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":676 + * else: # swap bytes + * return read_signed_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int + * if (byteorder == 'little' and signal_data_type == 0) or \ */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_signed_short(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":421 - * if bit_count < 32: - * temp4byte &= mask - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * return buf - * else: # on 3 bytes + /* "dataRead.pyx":669 + * return read_unsigned_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 2: # signed short # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; - } } - __pyx_L7:; - /* "dataRead.pyx":422 - * temp4byte &= mask - * buf[i] = temp4byte - * return buf # <<<<<<<<<<<<<< - * else: # on 3 bytes - * if swap == 0: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + /* "dataRead.pyx":677 + * return read_signed_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): + */ + switch (__pyx_v_signal_data_type) { + case 0: + case 1: + case 14: + __pyx_t_5 = 1; + break; + default: + __pyx_t_5 = 0; + break; + } + __pyx_t_2 = __pyx_t_5; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L47_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_n_bytes <= 4); + __pyx_t_3 = __pyx_t_2; + __pyx_L47_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":400 - * else: - * return buf.byteswap() - * elif n_bytes == 4: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":678 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_int(bit_stream, record_format, number_of_records, */ - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_2) { + goto __pyx_L51_next_or; + } else { + } + __pyx_t_2 = (__pyx_v_signal_data_type == 0); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L50_bool_binop_done; + } + __pyx_L51_next_or:; - /* "dataRead.pyx":424 - * return buf - * else: # on 3 bytes - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":679 + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): # <<<<<<<<<<<<<< + * return read_unsigned_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) */ - /*else*/ { - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 679, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L50_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_signal_data_type == 1); + __pyx_t_3 = __pyx_t_2; + __pyx_L50_bool_binop_done:; - /* "dataRead.pyx":425 - * else: # on 3 bytes - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift + /* "dataRead.pyx":678 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_int(bit_stream, record_format, number_of_records, */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + if (__pyx_t_3) { - /* "dataRead.pyx":426 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":680 + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes */ - (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":428 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":681 + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_unsigned_int(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":429 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 24: + /* "dataRead.pyx":678 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_int(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + } - /* "dataRead.pyx":428 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":683 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes + * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int */ - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":431 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":684 + * else: # swap bytes + * return read_unsigned_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int + * if (byteorder == 'little' and signal_data_type == 2) or \ */ - __pyx_t_6 = (__pyx_v_bit_count < 24); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":432 - * # mask left part - * if bit_count < 24: - * temp4byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * else: + /* "dataRead.pyx":677 + * return read_signed_short(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, 1) + * elif signal_data_type in (0, 1, 14) and n_bytes <= 4: # unsigned int # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + } - /* "dataRead.pyx":431 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":685 + * return read_unsigned_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): */ - } + switch (__pyx_v_signal_data_type) { + case 2: + case 3: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_5 = __pyx_t_2; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L54_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_n_bytes <= 4); + __pyx_t_3 = __pyx_t_5; + __pyx_L54_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":433 - * if bit_count < 24: - * temp4byte &= mask - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":686 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_int(bit_stream, record_format, number_of_records, */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 686, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 686, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + goto __pyx_L58_next_or; + } else { + } + __pyx_t_5 = (__pyx_v_signal_data_type == 2); + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L57_bool_binop_done; } + __pyx_L58_next_or:; - /* "dataRead.pyx":424 - * return buf - * else: # on 3 bytes - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":687 + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): # <<<<<<<<<<<<<< + * return read_signed_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) */ - goto __pyx_L16; - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L57_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_signal_data_type == 3); + __pyx_t_3 = __pyx_t_5; + __pyx_L57_bool_binop_done:; - /* "dataRead.pyx":435 - * buf[i] = temp4byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes + /* "dataRead.pyx":686 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_int(bit_stream, record_format, number_of_records, */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + if (__pyx_t_3) { - /* "dataRead.pyx":436 - * else: - * for i in range(number_of_records): - * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - * # right shift + /* "dataRead.pyx":688 + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes */ - (void)(memcpy((&__pyx_v_temp3), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":437 - * for i in range(number_of_records): - * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":689 + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_signed_int(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = ((((__pyx_v_temp3[0]) << 16) | ((__pyx_v_temp3[1]) << 8)) | (__pyx_v_temp3[2])); + __pyx_t_4 = __pyx_f_8dataRead_read_signed_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":439 - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":686 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_int(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + } - /* "dataRead.pyx":440 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 24: + /* "dataRead.pyx":691 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes + * return read_signed_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":439 - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":692 + * else: # swap bytes + * return read_signed_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long + * if (byteorder == 'little' and signal_data_type == 0) or \ */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_signed_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":442 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":685 + * return read_unsigned_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 4: # signed int # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): */ - __pyx_t_6 = (__pyx_v_bit_count < 24); - if (__pyx_t_6) { + } - /* "dataRead.pyx":443 - * # mask left part - * if bit_count < 24: - * temp4byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * return buf + /* "dataRead.pyx":693 + * return read_signed_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + switch (__pyx_v_signal_data_type) { + case 0: + case 1: + __pyx_t_5 = 1; + break; + default: + __pyx_t_5 = 0; + break; + } + __pyx_t_2 = __pyx_t_5; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L61_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_n_bytes <= 8); + __pyx_t_3 = __pyx_t_2; + __pyx_L61_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":442 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * buf[i] = temp4byte + /* "dataRead.pyx":694 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, */ - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 694, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_2) { + goto __pyx_L65_next_or; + } else { + } + __pyx_t_2 = (__pyx_v_signal_data_type == 0); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L64_bool_binop_done; + } + __pyx_L65_next_or:; - /* "dataRead.pyx":444 - * if bit_count < 24: - * temp4byte &= mask - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * return buf - * + /* "dataRead.pyx":695 + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): # <<<<<<<<<<<<<< + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L64_bool_binop_done; } - } - __pyx_L16:; + __pyx_t_2 = (__pyx_v_signal_data_type == 1); + __pyx_t_3 = __pyx_t_2; + __pyx_L64_bool_binop_done:; - /* "dataRead.pyx":445 - * temp4byte &= mask - * buf[i] = temp4byte - * return buf # <<<<<<<<<<<<<< - * - * + /* "dataRead.pyx":694 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; - } + if (__pyx_t_3) { - /* "dataRead.pyx":383 - * return buf - * - * cdef inline read_unsigned_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + /* "dataRead.pyx":696 + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes */ + __Pyx_XDECREF(__pyx_r); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":697 + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + */ + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; -/* "dataRead.pyx":448 - * - * - * cdef inline read_signed_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + /* "dataRead.pyx":694 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long + * if (byteorder == 'little' and signal_data_type == 0) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 1): + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, */ + } -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_int(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned int __pyx_v_mask; - int __pyx_v_temp4byte; - unsigned int __pyx_v_sign_bit; - unsigned int __pyx_v_sign_bit_mask; - unsigned int __pyx_v_sign_extend; - unsigned char __pyx_v_temp4[4]; - unsigned char __pyx_v_temp3[3]; - __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; - __Pyx_Buffer __pyx_pybuffer_buf; - 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; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - unsigned PY_LONG_LONG __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; - unsigned PY_LONG_LONG __pyx_t_10; - unsigned int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_signed_int", 1); - __pyx_pybuffer_buf.pybuffer.buf = NULL; - __pyx_pybuffer_buf.refcount = 0; - __pyx_pybuffernd_buf.data = NULL; - __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + /* "dataRead.pyx":699 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":451 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): - * cdef np.ndarray[np.int32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned int mask = ((1 << bit_count) - 1) + /* "dataRead.pyx":700 + * else: # swap bytes + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + * if (byteorder == 'little' and signal_data_type == 2) or \ */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 451, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 451, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 451, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":453 - * cdef np.ndarray[np.int32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned int mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef int temp4byte = 0 - * cdef unsigned int sign_bit = 0 + /* "dataRead.pyx":693 + * return read_signed_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (0, 1) and n_bytes <= 8: # unsigned long long # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 0) or \ + * (byteorder == 'big' and signal_data_type == 1): */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + } - /* "dataRead.pyx":454 - * cdef unsigned long long i - * cdef unsigned int mask = ((1 << bit_count) - 1) - * cdef int temp4byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned int sign_bit = 0 - * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) + /* "dataRead.pyx":701 + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): */ - __pyx_v_temp4byte = 0; + switch (__pyx_v_signal_data_type) { + case 2: + case 3: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_5 = __pyx_t_2; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L68_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_n_bytes <= 8); + __pyx_t_3 = __pyx_t_5; + __pyx_L68_bool_binop_done:; + if (__pyx_t_3) { - /* "dataRead.pyx":455 - * cdef unsigned int mask = ((1 << bit_count) - 1) - * cdef int temp4byte = 0 - * cdef unsigned int sign_bit = 0 # <<<<<<<<<<<<<< - * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned int sign_extend = ((1 << (32 - bit_count)) - 1) << bit_count + /* "dataRead.pyx":702 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_longlong(bit_stream, record_format, number_of_records, */ - __pyx_v_sign_bit = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_5) { + goto __pyx_L72_next_or; + } else { + } + __pyx_t_5 = (__pyx_v_signal_data_type == 2); + if (!__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L71_bool_binop_done; + } + __pyx_L72_next_or:; - /* "dataRead.pyx":456 - * cdef int temp4byte = 0 - * cdef unsigned int sign_bit = 0 - * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< - * cdef unsigned int sign_extend = ((1 << (32 - bit_count)) - 1) << bit_count - * cdef unsigned char temp4[4] + /* "dataRead.pyx":703 + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): # <<<<<<<<<<<<<< + * return read_signed_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) */ - __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_3 = __pyx_t_5; + goto __pyx_L71_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_signal_data_type == 3); + __pyx_t_3 = __pyx_t_5; + __pyx_L71_bool_binop_done:; - /* "dataRead.pyx":457 - * cdef unsigned int sign_bit = 0 - * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned int sign_extend = ((1 << (32 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< - * cdef unsigned char temp4[4] - * cdef unsigned char temp3[3] + /* "dataRead.pyx":702 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_longlong(bit_stream, record_format, number_of_records, */ - __pyx_v_sign_extend = (((1 << (32 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); + if (__pyx_t_3) { - /* "dataRead.pyx":460 - * cdef unsigned char temp4[4] - * cdef unsigned char temp3[3] - * if bit_count == 32: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + /* "dataRead.pyx":704 + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes */ - __pyx_t_6 = (__pyx_v_bit_count == 32); - if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":461 - * cdef unsigned char temp3[3] - * if bit_count == 32: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte + /* "dataRead.pyx":705 + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_signed_longlong(bit_stream, record_format, number_of_records, */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_4 = __pyx_f_8dataRead_read_signed_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":462 - * if bit_count == 32: - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * if swap == 0: + /* "dataRead.pyx":702 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long + * if (byteorder == 'little' and signal_data_type == 2) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 3): + * return read_signed_longlong(bit_stream, record_format, number_of_records, */ - (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 4)); + } - /* "dataRead.pyx":463 - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":707 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 0) + * else: # swap bytes + * return read_signed_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (15, 16): # complex */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":464 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":708 + * else: # swap bytes + * return read_signed_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) # <<<<<<<<<<<<<< + * elif signal_data_type in (15, 16): # complex + * if (byteorder == 'little' and signal_data_type == 15) or \ */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_signed_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_bit_count, __pyx_v_bit_offset, __pyx_v_n_bytes, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":465 - * buf[i] = temp4byte - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":701 + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (2, 3) and n_bytes <= 8: # signed long long # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 2) or \ + * (byteorder == 'big' and signal_data_type == 3): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + } - /* "dataRead.pyx":464 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) - * buf[i] = temp4byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":709 + * return read_signed_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (15, 16): # complex # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 15) or \ + * (byteorder == 'big' and signal_data_type == 16): */ + switch (__pyx_v_signal_data_type) { + case 15: + case 16: + __pyx_t_3 = 1; + break; + default: + __pyx_t_3 = 0; + break; } + __pyx_t_5 = __pyx_t_3; + if (__pyx_t_5) { - /* "dataRead.pyx":467 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * elif n_bytes == 4: - * if swap == 0: + /* "dataRead.pyx":710 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (15, 16): # complex + * if (byteorder == 'little' and signal_data_type == 15) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 16): + * swap_flag = 0 */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 710, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_3) { + goto __pyx_L77_next_or; + } else { } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 467, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_v_signal_data_type == 15); + if (!__pyx_t_3) { + } else { + __pyx_t_5 = __pyx_t_3; + goto __pyx_L76_bool_binop_done; } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __pyx_L77_next_or:; - /* "dataRead.pyx":460 - * cdef unsigned char temp4[4] - * cdef unsigned char temp3[3] - * if bit_count == 32: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + /* "dataRead.pyx":711 + * elif signal_data_type in (15, 16): # complex + * if (byteorder == 'little' and signal_data_type == 15) or \ + * (byteorder == 'big' and signal_data_type == 16): # <<<<<<<<<<<<<< + * swap_flag = 0 + * else: # swap bytes */ - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + } else { + __pyx_t_5 = __pyx_t_3; + goto __pyx_L76_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_signal_data_type == 16); + __pyx_t_5 = __pyx_t_3; + __pyx_L76_bool_binop_done:; - /* "dataRead.pyx":468 - * else: - * return buf.byteswap() - * elif n_bytes == 4: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":710 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (15, 16): # complex + * if (byteorder == 'little' and signal_data_type == 15) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 16): + * swap_flag = 0 */ - __pyx_t_6 = (__pyx_v_n_bytes == 4); - if (__pyx_t_6) { + if (__pyx_t_5) { - /* "dataRead.pyx":469 - * return buf.byteswap() - * elif n_bytes == 4: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":712 + * if (byteorder == 'little' and signal_data_type == 15) or \ + * (byteorder == 'big' and signal_data_type == 16): + * swap_flag = 0 # <<<<<<<<<<<<<< + * else: # swap bytes + * swap_flag = 1 */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __pyx_v_swap_flag = 0; - /* "dataRead.pyx":470 - * elif n_bytes == 4: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift + /* "dataRead.pyx":710 + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (15, 16): # complex + * if (byteorder == 'little' and signal_data_type == 15) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type == 16): + * swap_flag = 0 */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + goto __pyx_L75; + } - /* "dataRead.pyx":471 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":714 + * swap_flag = 0 + * else: # swap bytes + * swap_flag = 1 # <<<<<<<<<<<<<< + * if n_bytes == 16: + * return read_cdouble(bit_stream, record_format, number_of_records, */ - (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + /*else*/ { + __pyx_v_swap_flag = 1; + } + __pyx_L75:; - /* "dataRead.pyx":473 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":715 + * else: # swap bytes + * swap_flag = 1 + * if n_bytes == 16: # <<<<<<<<<<<<<< + * return read_cdouble(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + switch (__pyx_v_n_bytes) { + case 16: - /* "dataRead.pyx":474 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 32: + /* "dataRead.pyx":716 + * swap_flag = 1 + * if n_bytes == 16: + * return read_cdouble(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes == 8: */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":473 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":717 + * if n_bytes == 16: + * return read_cdouble(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< + * elif n_bytes == 8: + * return read_cfloat(bit_stream, record_format, number_of_records, */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_cdouble(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":476 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":715 + * else: # swap bytes + * swap_flag = 1 + * if n_bytes == 16: # <<<<<<<<<<<<<< + * return read_cdouble(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - __pyx_t_6 = (__pyx_v_bit_count < 32); - if (__pyx_t_6) { + break; + case 8: - /* "dataRead.pyx":477 - * # mask left part - * if bit_count < 32: - * temp4byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend + /* "dataRead.pyx":719 + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes == 8: + * return read_cfloat(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes == 4: */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":476 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":720 + * elif n_bytes == 8: + * return read_cfloat(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< + * elif n_bytes == 4: + * return read_chalf(bit_stream, record_format, number_of_records, */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_cfloat(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":478 - * if bit_count < 32: - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend + /* "dataRead.pyx":718 + * return read_cdouble(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes == 8: # <<<<<<<<<<<<<< + * return read_cfloat(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); + break; + case 4: - /* "dataRead.pyx":479 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte - */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":480 - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * else: + /* "dataRead.pyx":722 + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes == 4: + * return read_chalf(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes <= 4: */ - __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":479 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte + /* "dataRead.pyx":723 + * elif n_bytes == 4: + * return read_chalf(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) # <<<<<<<<<<<<<< + * elif n_bytes <= 4: + * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_chalf(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":481 - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":721 + * return read_cfloat(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes == 4: # <<<<<<<<<<<<<< + * return read_chalf(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + break; + default: break; } - /* "dataRead.pyx":469 - * return buf.byteswap() - * elif n_bytes == 4: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":709 + * return read_signed_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, bit_count, bit_offset, n_bytes, 1) + * elif signal_data_type in (15, 16): # complex # <<<<<<<<<<<<<< + * if (byteorder == 'little' and signal_data_type == 15) or \ + * (byteorder == 'big' and signal_data_type == 16): */ - goto __pyx_L7; + goto __pyx_L4; } - /* "dataRead.pyx":483 - * buf[i] = temp4byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "dataRead.pyx":484 - * else: - * for i in range(number_of_records): - * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - * # right shift - */ - (void)(memcpy((&__pyx_v_temp4), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - - /* "dataRead.pyx":485 - * for i in range(number_of_records): - * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":724 + * return read_chalf(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes <= 4: # <<<<<<<<<<<<<< + * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) + * return read_unsigned_int(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (((((__pyx_v_temp4[0]) << 24) | ((__pyx_v_temp4[1]) << 16)) | ((__pyx_v_temp4[2]) << 8)) | (__pyx_v_temp4[3])); + __pyx_t_5 = (__pyx_v_n_bytes <= 4); + if (__pyx_t_5) { - /* "dataRead.pyx":487 - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":726 + * elif n_bytes <= 4: + * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) + * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":488 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 32: + /* "dataRead.pyx":728 + * return read_unsigned_int(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) # <<<<<<<<<<<<<< + * elif n_bytes <= 8: + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + __pyx_t_6 = 0; + } else { + __pyx_t_6 = 1; + } - /* "dataRead.pyx":487 - * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":726 + * elif n_bytes <= 4: + * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) + * return read_unsigned_int(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) */ - } + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_int(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, (__pyx_v_n_bytes * 8), __pyx_v_bit_offset, __pyx_v_n_bytes, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":490 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":724 + * return read_chalf(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, 0) + * elif n_bytes <= 4: # <<<<<<<<<<<<<< + * # VLSD/VLSC channels: record stores a uint pointer/size (signal_data_type 6-12) + * return read_unsigned_int(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_count < 32); - if (__pyx_t_6) { + } - /* "dataRead.pyx":491 - * # mask left part - * if bit_count < 32: - * temp4byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend + /* "dataRead.pyx":729 + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) + * elif n_bytes <= 8: # <<<<<<<<<<<<<< + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + __pyx_t_5 = (__pyx_v_n_bytes <= 8); + if (__pyx_t_5) { - /* "dataRead.pyx":490 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":730 + * 0 if byteorder == 'little' else 1) + * elif n_bytes <= 8: + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) */ - } + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":492 - * if bit_count < 32: - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend + /* "dataRead.pyx":732 + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) # <<<<<<<<<<<<<< + * else: + * return read_byte(bit_stream, record_format, number_of_records, */ - __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + __pyx_t_6 = 0; + } else { + __pyx_t_6 = 1; + } - /* "dataRead.pyx":493 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte + /* "dataRead.pyx":730 + * 0 if byteorder == 'little' else 1) + * elif n_bytes <= 8: + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_unsigned_longlong(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, (__pyx_v_n_bytes * 8), __pyx_v_bit_offset, __pyx_v_n_bytes, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":494 - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * return buf + /* "dataRead.pyx":729 + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, + * 0 if byteorder == 'little' else 1) + * elif n_bytes <= 8: # <<<<<<<<<<<<<< + * return read_unsigned_longlong(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes * 8, bit_offset, n_bytes, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); + } - /* "dataRead.pyx":493 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte + /* "dataRead.pyx":734 + * 0 if byteorder == 'little' else 1) + * else: + * return read_byte(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * else: # array */ - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":495 - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * return buf - * else: # on 3 bytes + /* "dataRead.pyx":735 + * else: + * return read_byte(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) # <<<<<<<<<<<<<< + * else: # array + * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; - } + __pyx_t_4 = __pyx_f_8dataRead_read_byte(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; } - __pyx_L7:; - - /* "dataRead.pyx":496 - * temp4byte |= sign_extend - * buf[i] = temp4byte - * return buf # <<<<<<<<<<<<<< - * else: # on 3 bytes - * if swap == 0: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_L4:; - /* "dataRead.pyx":468 - * else: - * return buf.byteswap() - * elif n_bytes == 4: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":627 + * """ + * cdef const char* bit_stream = PyBytes_AsString(tmp) + * if not array: # <<<<<<<<<<<<<< + * if 'V' in record_format or 'S' in record_format or record_format is None: + * return read_byte(bit_stream, record_format, number_of_records, */ + goto __pyx_L3; } - /* "dataRead.pyx":498 - * return buf - * else: # on 3 bytes - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":737 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * else: # array + * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type in (1, 3, 5)): + * return read_array(bit_stream, record_format, number_of_records, */ /*else*/ { - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":499 - * else: # on 3 bytes - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "dataRead.pyx":500 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: - */ - (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_little, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 737, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_3) { + goto __pyx_L82_next_or; + } else { + } + switch (__pyx_v_signal_data_type) { + case 0: + case 2: + case 4: + __pyx_t_3 = 1; + break; + default: + __pyx_t_3 = 0; + break; + } + __pyx_t_2 = __pyx_t_3; + if (!__pyx_t_2) { + } else { + __pyx_t_5 = __pyx_t_2; + goto __pyx_L81_bool_binop_done; + } + __pyx_L82_next_or:; - /* "dataRead.pyx":502 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":738 + * else: # array + * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ + * (byteorder == 'big' and signal_data_type in (1, 3, 5)): # <<<<<<<<<<<<<< + * return read_array(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_big, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_5 = __pyx_t_2; + goto __pyx_L81_bool_binop_done; + } + switch (__pyx_v_signal_data_type) { + case 1: + case 3: + case 5: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_3 = __pyx_t_2; + __pyx_t_5 = __pyx_t_3; + __pyx_L81_bool_binop_done:; - /* "dataRead.pyx":503 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 24: + /* "dataRead.pyx":737 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * else: # array + * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type in (1, 3, 5)): + * return read_array(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + if (__pyx_t_5) { - /* "dataRead.pyx":502 - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":739 + * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ + * (byteorder == 'big' and signal_data_type in (1, 3, 5)): + * return read_array(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) + * else: # swap bytes */ - } + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":505 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":740 + * (byteorder == 'big' and signal_data_type in (1, 3, 5)): + * return read_array(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) # <<<<<<<<<<<<<< + * else: # swap bytes + * return read_array(bit_stream, record_format, number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_count < 24); - if (__pyx_t_6) { + __pyx_t_4 = __pyx_f_8dataRead_read_array(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "dataRead.pyx":506 - * # mask left part - * if bit_count < 24: - * temp4byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend + /* "dataRead.pyx":737 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset) + * else: # array + * if (byteorder == 'little' and signal_data_type in (0, 2, 4)) or \ # <<<<<<<<<<<<<< + * (byteorder == 'big' and signal_data_type in (1, 3, 5)): + * return read_array(bit_stream, record_format, number_of_records, */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + } - /* "dataRead.pyx":505 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":742 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 0) + * else: # swap bytes + * return read_array(bit_stream, record_format, number_of_records, # <<<<<<<<<<<<<< + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) + * */ - } + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":507 - * if bit_count < 24: - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend + /* "dataRead.pyx":743 + * else: # swap bytes + * return read_array(bit_stream, record_format, number_of_records, + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) # <<<<<<<<<<<<<< + * + * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); + __pyx_t_4 = __pyx_f_8dataRead_read_array(__pyx_v_bit_stream, __pyx_v_record_format, __pyx_v_number_of_records, __pyx_v_record_byte_size, __pyx_v_pos_byte_beg, __pyx_v_n_bytes, __pyx_v_bit_count, __pyx_v_bit_offset, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + } + __pyx_L3:; - /* "dataRead.pyx":508 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte + /* "dataRead.pyx":589 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * @cython.wraparound(False) + * def sorted_data_read(bytes tmp, unsigned short bit_count, */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { - /* "dataRead.pyx":509 - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * else: - */ - __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("dataRead.sorted_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":508 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte +/* "dataRead.pyx":745 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) + * + * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) */ - } - /* "dataRead.pyx":510 - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): - */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; - } - - /* "dataRead.pyx":498 - * return buf - * else: # on 3 bytes - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - */ - goto __pyx_L18; - } - - /* "dataRead.pyx":512 - * buf[i] = temp4byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "dataRead.pyx":513 - * else: - * for i in range(number_of_records): - * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - * # right shift - */ - (void)(memcpy((&__pyx_v_temp3), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - - /* "dataRead.pyx":514 - * for i in range(number_of_records): - * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: - */ - __pyx_v_temp4byte = ((((__pyx_v_temp3[0]) << 16) | ((__pyx_v_temp3[1]) << 8)) | (__pyx_v_temp3[2])); - - /* "dataRead.pyx":516 - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part - */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":517 - * # right shift - * if bit_offset > 0: - * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 24: - */ - __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_half(char const *__pyx_v_bit_stream, CYTHON_UNUSED PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { + __Pyx_memviewslice __pyx_v_buf = { 0, 0, { 0 }, { 0 }, { 0 } }; + unsigned PY_LONG_LONG __pyx_v_i; + uint16_t __pyx_v_temp_uint16; + 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; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + int __pyx_t_11; + unsigned int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_half", 1); - /* "dataRead.pyx":516 - * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp4byte = temp4byte >> bit_offset - * # mask left part + /* "dataRead.pyx":747 + * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing */ - } + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint16_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_buf = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "dataRead.pyx":519 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":749 + * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) + * cdef unsigned long long i + * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ - __pyx_t_6 = (__pyx_v_bit_count < 24); - if (__pyx_t_6) { + __pyx_v_temp_uint16 = 0; - /* "dataRead.pyx":520 - * # mask left part - * if bit_count < 24: - * temp4byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend + /* "dataRead.pyx":750 + * cdef unsigned long long i + * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp_uint16 */ - __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":519 - * temp4byte = temp4byte >> bit_offset - * # mask left part - * if bit_count < 24: # <<<<<<<<<<<<<< - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + /* "dataRead.pyx":751 + * cdef uint16_t temp_uint16 = 0 # using uint16 because float16_t is not existing + * for i in range(number_of_records): + * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< + * buf[i] = temp_uint16 + * if swap == 0: */ - } + (void)(memcpy((&__pyx_v_temp_uint16), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":521 - * if bit_count < 24: - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend + /* "dataRead.pyx":752 + * for i in range(number_of_records): + * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp_uint16 # <<<<<<<<<<<<<< + * if swap == 0: + * return np.asarray(buf).view(dtype=np.float16) */ - __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); + __pyx_t_10 = __pyx_v_i; + *((uint16_t *) ( /* dim=0 */ (__pyx_v_buf.data + __pyx_t_10 * __pyx_v_buf.strides[0]) )) = __pyx_v_temp_uint16; + } - /* "dataRead.pyx":522 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte + /* "dataRead.pyx":753 + * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp_uint16 + * if swap == 0: # <<<<<<<<<<<<<< + * return np.asarray(buf).view(dtype=np.float16) + * else: */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { + __pyx_t_11 = (__pyx_v_swap == 0); + if (__pyx_t_11) { - /* "dataRead.pyx":523 - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp4byte - * return buf + /* "dataRead.pyx":754 + * buf[i] = temp_uint16 + * if swap == 0: + * return np.asarray(buf).view(dtype=np.float16) # <<<<<<<<<<<<<< + * else: + * return np.asarray(buf).view(dtype=np.float16).byteswap() */ - __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_buf, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint16_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint16_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_12 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_12 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "dataRead.pyx":522 - * temp4byte &= mask - * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp4byte |= sign_extend - * buf[i] = temp4byte + /* "dataRead.pyx":753 + * memcpy(&temp_uint16, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp_uint16 + * if swap == 0: # <<<<<<<<<<<<<< + * return np.asarray(buf).view(dtype=np.float16) + * else: */ - } + } - /* "dataRead.pyx":524 - * if sign_bit: # negative value, sign extend - * temp4byte |= sign_extend - * buf[i] = temp4byte # <<<<<<<<<<<<<< - * return buf + /* "dataRead.pyx":756 + * return np.asarray(buf).view(dtype=np.float16) + * else: + * return np.asarray(buf).view(dtype=np.float16).byteswap() # <<<<<<<<<<<<<< * + * cdef inline read_chalf(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_buf, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint16_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint16_t, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_12 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_12 = 1; } } - __pyx_L18:; - - /* "dataRead.pyx":525 - * temp4byte |= sign_extend - * buf[i] = temp4byte - * return buf # <<<<<<<<<<<<<< - * - * cdef inline read_unsigned_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_view); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_byteswap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_12 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_12 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_12, 0+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; } - /* "dataRead.pyx":448 - * + /* "dataRead.pyx":745 + * record_byte_size, pos_byte_beg, n_bytes, bit_count, bit_offset, 1) * - * cdef inline read_signed_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * cdef inline read_half(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef uint16_t[:] buf = np.empty(number_of_records, dtype=np.uint16) */ /* function exit code */ @@ -27178,41 +30200,28 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_int(char const *__p __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_signed_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("dataRead.read_half", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_buf, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":527 - * return buf +/* "dataRead.pyx":758 + * return np.asarray(buf).view(dtype=np.float16).byteswap() * - * cdef inline read_unsigned_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * cdef inline read_chalf(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * # complex32 = real(f16) + imag(f16): return as (n_records, 2) float16 array */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_longlong(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_chalf(char const *__pyx_v_bit_stream, CYTHON_UNUSED PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { PyArrayObject *__pyx_v_buf = 0; unsigned PY_LONG_LONG __pyx_v_i; - unsigned PY_LONG_LONG __pyx_v_mask; - unsigned PY_LONG_LONG __pyx_v_temp8byte; - unsigned char __pyx_v_temp8[8]; - unsigned char __pyx_v_temp7[7]; - unsigned char __pyx_v_temp6[6]; - unsigned char __pyx_v_temp5[5]; __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; __Pyx_Buffer __pyx_pybuffer_buf; PyObject *__pyx_r = NULL; @@ -27221,1131 +30230,1692 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_longlong(char con PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; unsigned PY_LONG_LONG __pyx_t_7; unsigned PY_LONG_LONG __pyx_t_8; unsigned PY_LONG_LONG __pyx_t_9; unsigned PY_LONG_LONG __pyx_t_10; - unsigned int __pyx_t_11; + Py_ssize_t __pyx_t_11; + int __pyx_t_12; + unsigned int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_unsigned_longlong", 1); + __Pyx_RefNannySetupContext("read_chalf", 1); __pyx_pybuffer_buf.pybuffer.buf = NULL; __pyx_pybuffer_buf.refcount = 0; __pyx_pybuffernd_buf.data = NULL; __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":530 - * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): - * cdef np.ndarray[np.uint64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + /* "dataRead.pyx":761 + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * # complex32 = real(f16) + imag(f16): return as (n_records, 2) float16 array + * cdef np.ndarray[np.uint16_t, ndim=2] buf = np.empty((number_of_records, 2), dtype=np.uint16) # <<<<<<<<<<<<<< * cdef unsigned long long i - * cdef unsigned long long mask = ((1 << bit_count) - 1) + * for i in range(number_of_records): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2)) __PYX_ERR(0, 761, __pyx_L1_error); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 530, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 530, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 761, __pyx_L1_error) + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 530, __pyx_L1_error) - } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + __PYX_ERR(0, 761, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_buf.diminfo[1].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_buf.diminfo[1].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[1]; } } + __pyx_t_6 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - /* "dataRead.pyx":532 - * cdef np.ndarray[np.uint64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + /* "dataRead.pyx":763 + * cdef np.ndarray[np.uint16_t, ndim=2] buf = np.empty((number_of_records, 2), dtype=np.uint16) * cdef unsigned long long i - * cdef unsigned long long mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef unsigned long long temp8byte = 0 - * cdef unsigned char temp8[8] + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) */ - __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":533 + /* "dataRead.pyx":764 * cdef unsigned long long i - * cdef unsigned long long mask = ((1 << bit_count) - 1) - * cdef unsigned long long temp8byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned char temp8[8] - * cdef unsigned char temp7[7] + * for i in range(number_of_records): + * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< + * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) + * if swap == 0: */ - __pyx_v_temp8byte = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_buf.diminfo[1].shape; + (void)(memcpy((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_buf.diminfo[1].strides))), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":538 - * cdef unsigned char temp6[6] - * cdef unsigned char temp5[5] - * if bit_count == 64: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":765 + * for i in range(number_of_records): + * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) # <<<<<<<<<<<<<< + * if swap == 0: + * return buf.view(dtype=np.float16) */ - __pyx_t_6 = (__pyx_v_bit_count == 64); - if (__pyx_t_6) { + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_buf.diminfo[1].shape; + (void)(memcpy((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_buf.diminfo[1].strides))), (&(__pyx_v_bit_stream[((__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i)) + 2)])), 2)); + } - /* "dataRead.pyx":539 - * cdef unsigned char temp5[5] - * if bit_count == 64: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte + /* "dataRead.pyx":766 + * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) + * if swap == 0: # <<<<<<<<<<<<<< + * return buf.view(dtype=np.float16) + * else: */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_12 = (__pyx_v_swap == 0); + if (__pyx_t_12) { - /* "dataRead.pyx":540 - * if bit_count == 64: - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * if swap == 0: + /* "dataRead.pyx":767 + * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) + * if swap == 0: + * return buf.view(dtype=np.float16) # <<<<<<<<<<<<<< + * else: + * return buf.view(dtype=np.float16).byteswap() */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_view); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "dataRead.pyx":541 - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":766 + * memcpy(&buf[i, 0], &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * memcpy(&buf[i, 1], &bit_stream[pos_byte_beg + record_byte_size * i + 2], 2) + * if swap == 0: # <<<<<<<<<<<<<< + * return buf.view(dtype=np.float16) + * else: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } + } - /* "dataRead.pyx":542 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":769 + * return buf.view(dtype=np.float16) + * else: + * return buf.view(dtype=np.float16).byteswap() # <<<<<<<<<<<<<< + * + * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_byteswap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_13 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_13 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_13, 0+__pyx_t_13); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":543 - * buf[i] = temp8byte - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":758 + * return np.asarray(buf).view(dtype=np.float16).byteswap() + * + * cdef inline read_chalf(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * # complex32 = real(f16) + imag(f16): return as (n_records, 2) float16 array */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; - /* "dataRead.pyx":542 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: - */ - } + /* function exit code */ + __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); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_chalf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":545 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * elif n_bytes == 8: - * if swap == 0: +/* "dataRead.pyx":771 + * return buf.view(dtype=np.float16).byteswap() + * + * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_11 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - /* "dataRead.pyx":538 - * cdef unsigned char temp6[6] - * cdef unsigned char temp5[5] - * if bit_count == 64: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_float(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + float __pyx_v_temp_float; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + unsigned PY_LONG_LONG __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + int __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_float", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + + /* "dataRead.pyx":773 + * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef float temp_float = 0 */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 773, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 773, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 773, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":546 - * else: - * return buf.byteswap() - * elif n_bytes == 8: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":775 + * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef float temp_float = 0 # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) */ - __pyx_t_6 = (__pyx_v_n_bytes == 8); - if (__pyx_t_6) { + __pyx_v_temp_float = 0.0; - /* "dataRead.pyx":547 - * return buf.byteswap() - * elif n_bytes == 8: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":776 + * cdef unsigned long long i + * cdef float temp_float = 0 + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp_float */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __pyx_t_6 = __pyx_v_number_of_records; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "dataRead.pyx":548 - * elif n_bytes == 8: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift + /* "dataRead.pyx":777 + * cdef float temp_float = 0 + * for i in range(number_of_records): + * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) # <<<<<<<<<<<<<< + * buf[i] = temp_float + * if swap == 0: */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + (void)(memcpy((&__pyx_v_temp_float), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 4)); - /* "dataRead.pyx":549 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":778 + * for i in range(number_of_records): + * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp_float # <<<<<<<<<<<<<< + * if swap == 0: + * return buf */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __pyx_t_9 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_float; + } - /* "dataRead.pyx":551 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":779 + * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp_float + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_t_10 = (__pyx_v_swap == 0); + if (__pyx_t_10) { - /* "dataRead.pyx":552 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 64: + /* "dataRead.pyx":780 + * buf[i] = temp_float + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":551 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":779 + * memcpy(&temp_float, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp_float + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - } + } - /* "dataRead.pyx":554 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":782 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * + * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_t_6 = (__pyx_v_bit_count < 64); - if (__pyx_t_6) { + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":555 - * # mask left part - * if bit_count < 64: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * else: + /* "dataRead.pyx":771 + * return buf.view(dtype=np.float16).byteswap() + * + * cdef inline read_float(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.float32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); - /* "dataRead.pyx":554 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":556 - * if bit_count < 64: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): +/* "dataRead.pyx":784 + * return buf.byteswap() + * + * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } - /* "dataRead.pyx":547 - * return buf.byteswap() - * elif n_bytes == 8: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - */ - goto __pyx_L7; - } +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_cfloat(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + __pyx_t_float_complex __pyx_v_temp_cfloat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + unsigned PY_LONG_LONG __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + int __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_cfloat", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":558 - * buf[i] = temp8byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + /* "dataRead.pyx":786 + * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef float complex temp_cfloat = 0 */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 786, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 786, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo___pyx_t_float_complex, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 786, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":559 - * else: - * for i in range(number_of_records): - * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ - * temp8[2]<<40 | temp8[3]<<32 | \ + /* "dataRead.pyx":788 + * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef float complex temp_cfloat = 0 # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) */ - (void)(memcpy((&__pyx_v_temp8), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __pyx_v_temp_cfloat = __pyx_t_float_complex_from_parts(0, 0); - /* "dataRead.pyx":562 - * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ - * temp8[2]<<40 | temp8[3]<<32 | \ - * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":789 + * cdef unsigned long long i + * cdef float complex temp_cfloat = 0 + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_cfloat */ - __pyx_v_temp8byte = ((((((((((uint64_t)(__pyx_v_temp8[0])) << 56) | (((uint64_t)(__pyx_v_temp8[1])) << 48)) | (((uint64_t)(__pyx_v_temp8[2])) << 40)) | (((uint64_t)(__pyx_v_temp8[3])) << 32)) | ((__pyx_v_temp8[4]) << 24)) | ((__pyx_v_temp8[5]) << 16)) | ((__pyx_v_temp8[6]) << 8)) | (__pyx_v_temp8[7])); + __pyx_t_6 = __pyx_v_number_of_records; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "dataRead.pyx":564 - * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":790 + * cdef float complex temp_cfloat = 0 + * for i in range(number_of_records): + * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) # <<<<<<<<<<<<<< + * buf[i] = temp_cfloat + * if swap == 0: */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + (void)(memcpy((&__pyx_v_temp_cfloat), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 8)); - /* "dataRead.pyx":565 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 64: + /* "dataRead.pyx":791 + * for i in range(number_of_records): + * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_cfloat # <<<<<<<<<<<<<< + * if swap == 0: + * return buf */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_t_9 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_float_complex *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_cfloat; + } - /* "dataRead.pyx":564 - * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part - */ - } - - /* "dataRead.pyx":567 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":792 + * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_cfloat + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_t_6 = (__pyx_v_bit_count < 64); - if (__pyx_t_6) { + __pyx_t_10 = (__pyx_v_swap == 0); + if (__pyx_t_10) { - /* "dataRead.pyx":568 - * # mask left part - * if bit_count < 64: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * elif n_bytes == 7: + /* "dataRead.pyx":793 + * buf[i] = temp_cfloat + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":567 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":792 + * memcpy(&temp_cfloat, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_cfloat + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - } + } - /* "dataRead.pyx":569 - * if bit_count < 64: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * elif n_bytes == 7: - * if swap == 0: + /* "dataRead.pyx":795 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * + * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; } } - __pyx_L7:; - - /* "dataRead.pyx":546 - * else: - * return buf.byteswap() - * elif n_bytes == 8: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): - */ - goto __pyx_L3; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; } - /* "dataRead.pyx":570 - * temp8byte &= mask - * buf[i] = temp8byte - * elif n_bytes == 7: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":784 + * return buf.byteswap() + * + * cdef inline read_cfloat(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.complex64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - __pyx_t_6 = (__pyx_v_n_bytes == 7); - if (__pyx_t_6) { - /* "dataRead.pyx":571 - * buf[i] = temp8byte - * elif n_bytes == 7: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_cfloat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":572 - * elif n_bytes == 7: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift +/* "dataRead.pyx":797 + * return buf.byteswap() + * + * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":573 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_double(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + double __pyx_v_temp_double; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + unsigned PY_LONG_LONG __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + int __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_double", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + + /* "dataRead.pyx":799 + * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef double temp_double = 0 */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 799, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":575 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":801 + * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef double temp_double = 0 # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_v_temp_double = 0.0; - /* "dataRead.pyx":576 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 56: + /* "dataRead.pyx":802 + * cdef unsigned long long i + * cdef double temp_double = 0 + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_double */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_t_6 = __pyx_v_number_of_records; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "dataRead.pyx":575 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":803 + * cdef double temp_double = 0 + * for i in range(number_of_records): + * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) # <<<<<<<<<<<<<< + * buf[i] = temp_double + * if swap == 0: */ - } + (void)(memcpy((&__pyx_v_temp_double), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 8)); - /* "dataRead.pyx":578 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":804 + * for i in range(number_of_records): + * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_double # <<<<<<<<<<<<<< + * if swap == 0: + * return buf */ - __pyx_t_6 = (__pyx_v_bit_count < 56); - if (__pyx_t_6) { + __pyx_t_9 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_double; + } - /* "dataRead.pyx":579 - * # mask left part - * if bit_count < 56: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * else: + /* "dataRead.pyx":805 + * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_double + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_t_10 = (__pyx_v_swap == 0); + if (__pyx_t_10) { - /* "dataRead.pyx":578 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":806 + * buf[i] = temp_double + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":580 - * if bit_count < 56: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":805 + * memcpy(&temp_double, &bit_stream[pos_byte_beg + record_byte_size * i], 8) + * buf[i] = temp_double + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } + } - /* "dataRead.pyx":571 - * buf[i] = temp8byte - * elif n_bytes == 7: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":808 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * + * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - goto __pyx_L16; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":582 - * buf[i] = temp8byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + /* "dataRead.pyx":797 + * return buf.byteswap() + * + * cdef inline read_double(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.float64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":583 - * else: - * for i in range(number_of_records): - * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes - */ - (void)(memcpy((&__pyx_v_temp7), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":585 - * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: +/* "dataRead.pyx":810 + * return buf.byteswap() + * + * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - __pyx_v_temp8byte = (((((((((uint64_t)(__pyx_v_temp7[0])) << 48) | (((uint64_t)(__pyx_v_temp7[1])) << 40)) | (((uint64_t)(__pyx_v_temp7[2])) << 32)) | ((__pyx_v_temp7[3]) << 24)) | ((__pyx_v_temp7[4]) << 16)) | ((__pyx_v_temp7[5]) << 8)) | (__pyx_v_temp7[6])); - /* "dataRead.pyx":587 - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part - */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_cdouble(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + __pyx_t_double_complex __pyx_v_temp_cdouble; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + unsigned PY_LONG_LONG __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + int __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_cdouble", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":588 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 56: + /* "dataRead.pyx":812 + * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef double complex temp_cdouble = 0 */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 812, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":587 - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":814 + * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef double complex temp_cdouble = 0 # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) */ - } + __pyx_v_temp_cdouble = __pyx_t_double_complex_from_parts(0, 0); - /* "dataRead.pyx":590 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":815 + * cdef unsigned long long i + * cdef double complex temp_cdouble = 0 + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) + * buf[i] = temp_cdouble */ - __pyx_t_6 = (__pyx_v_bit_count < 56); - if (__pyx_t_6) { + __pyx_t_6 = __pyx_v_number_of_records; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "dataRead.pyx":591 - * # mask left part - * if bit_count < 56: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * elif n_bytes == 6: - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); - - /* "dataRead.pyx":590 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte - */ - } - - /* "dataRead.pyx":592 - * if bit_count < 56: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * elif n_bytes == 6: - * if swap == 0: + /* "dataRead.pyx":816 + * cdef double complex temp_cdouble = 0 + * for i in range(number_of_records): + * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) # <<<<<<<<<<<<<< + * buf[i] = temp_cdouble + * if swap == 0: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } - } - __pyx_L16:; + (void)(memcpy((&__pyx_v_temp_cdouble), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 16)); - /* "dataRead.pyx":570 - * temp8byte &= mask - * buf[i] = temp8byte - * elif n_bytes == 7: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":817 + * for i in range(number_of_records): + * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) + * buf[i] = temp_cdouble # <<<<<<<<<<<<<< + * if swap == 0: + * return buf */ - goto __pyx_L3; + __pyx_t_9 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp_cdouble; } - /* "dataRead.pyx":593 - * temp8byte &= mask - * buf[i] = temp8byte - * elif n_bytes == 6: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":818 + * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) + * buf[i] = temp_cdouble + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_t_6 = (__pyx_v_n_bytes == 6); - if (__pyx_t_6) { + __pyx_t_10 = (__pyx_v_swap == 0); + if (__pyx_t_10) { - /* "dataRead.pyx":594 - * buf[i] = temp8byte - * elif n_bytes == 6: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":819 + * buf[i] = temp_cdouble + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":595 - * elif n_bytes == 6: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift + /* "dataRead.pyx":818 + * memcpy(&temp_cdouble, &bit_stream[pos_byte_beg + record_byte_size * i], 16) + * buf[i] = temp_cdouble + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + } - /* "dataRead.pyx":596 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":821 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * + * cdef inline read_unsigned_char(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":598 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":810 + * return buf.byteswap() + * + * cdef inline read_cdouble(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned char swap): + * cdef np.ndarray[np.complex128_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { - /* "dataRead.pyx":599 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 48: - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_cdouble", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":598 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part +/* "dataRead.pyx":823 + * return buf.byteswap() + * + * cdef inline read_unsigned_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset): */ - } - /* "dataRead.pyx":601 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte - */ - __pyx_t_6 = (__pyx_v_bit_count < 48); - if (__pyx_t_6) { +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_char(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned char __pyx_v_mask; + unsigned char __pyx_v_temp1byte; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_unsigned_char", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":602 - * # mask left part - * if bit_count < 48: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * else: + /* "dataRead.pyx":826 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset): + * cdef np.ndarray[np.uint8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned char mask = ((1 << bit_count) - 1) */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 826, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 826, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 826, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":601 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":828 + * cdef np.ndarray[np.uint8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned char mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef unsigned char temp1byte = 0 + * if bit_count == 8: */ - } + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); - /* "dataRead.pyx":603 - * if bit_count < 48: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":829 + * cdef unsigned long long i + * cdef unsigned char mask = ((1 << bit_count) - 1) + * cdef unsigned char temp1byte = 0 # <<<<<<<<<<<<<< + * if bit_count == 8: + * for i in range(number_of_records): */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } + __pyx_v_temp1byte = 0; - /* "dataRead.pyx":594 - * buf[i] = temp8byte - * elif n_bytes == 6: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":830 + * cdef unsigned char mask = ((1 << bit_count) - 1) + * cdef unsigned char temp1byte = 0 + * if bit_count == 8: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) */ - goto __pyx_L25; - } + __pyx_t_6 = (__pyx_v_bit_count == 8); + if (__pyx_t_6) { - /* "dataRead.pyx":605 - * buf[i] = temp8byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + /* "dataRead.pyx":831 + * cdef unsigned char temp1byte = 0 + * if bit_count == 8: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * buf[i] = temp1byte */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":606 - * else: - * for i in range(number_of_records): - * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + /* "dataRead.pyx":832 + * if bit_count == 8: + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< + * buf[i] = temp1byte + * else: */ - (void)(memcpy((&__pyx_v_temp6), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); - /* "dataRead.pyx":608 - * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":833 + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * buf[i] = temp1byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): */ - __pyx_v_temp8byte = ((((((((uint64_t)(__pyx_v_temp6[0])) << 40) | (((uint64_t)(__pyx_v_temp6[1])) << 32)) | ((__pyx_v_temp6[2]) << 24)) | ((__pyx_v_temp6[3]) << 16)) | ((__pyx_v_temp6[4]) << 8)) | (__pyx_v_temp6[5])); + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; + } - /* "dataRead.pyx":610 - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":830 + * cdef unsigned char mask = ((1 << bit_count) - 1) + * cdef unsigned char temp1byte = 0 + * if bit_count == 8: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + goto __pyx_L3; + } - /* "dataRead.pyx":611 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 48: + /* "dataRead.pyx":835 + * buf[i] = temp1byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * # right shift */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":610 - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":836 + * else: + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: */ - } + (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); - /* "dataRead.pyx":613 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":838 + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp1byte = temp1byte >> bit_offset + * # mask left part */ - __pyx_t_6 = (__pyx_v_bit_count < 48); - if (__pyx_t_6) { + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { - /* "dataRead.pyx":614 - * # mask left part - * if bit_count < 48: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * elif n_bytes == 5: + /* "dataRead.pyx":839 + * # right shift + * if bit_offset > 0: + * temp1byte = temp1byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * temp1byte &= mask */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_temp1byte = (__pyx_v_temp1byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":613 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":838 + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp1byte = temp1byte >> bit_offset + * # mask left part */ - } + } - /* "dataRead.pyx":615 - * if bit_count < 48: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * elif n_bytes == 5: - * if swap == 0: + /* "dataRead.pyx":841 + * temp1byte = temp1byte >> bit_offset + * # mask left part + * temp1byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp1byte + * return buf */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } - } - __pyx_L25:; + __pyx_v_temp1byte = (__pyx_v_temp1byte & __pyx_v_mask); - /* "dataRead.pyx":593 - * temp8byte &= mask - * buf[i] = temp8byte - * elif n_bytes == 6: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":842 + * # mask left part + * temp1byte &= mask + * buf[i] = temp1byte # <<<<<<<<<<<<<< + * return buf + * */ - goto __pyx_L3; + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; + } } + __pyx_L3:; - /* "dataRead.pyx":616 - * temp8byte &= mask - * buf[i] = temp8byte - * elif n_bytes == 5: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":843 + * temp1byte &= mask + * buf[i] = temp1byte + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_signed_char(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_t_6 = (__pyx_v_n_bytes == 5); - if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":617 - * buf[i] = temp8byte - * elif n_bytes == 5: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":823 + * return buf.byteswap() + * + * cdef inline read_unsigned_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset): */ - __pyx_t_6 = (__pyx_v_swap == 0); - if (__pyx_t_6) { - /* "dataRead.pyx":618 - * elif n_bytes == 5: - * if swap == 0: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":845 + * return buf + * + * cdef inline read_signed_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset): */ - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":619 - * if swap == 0: - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_char(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned char __pyx_v_mask; + char __pyx_v_temp1byte; + unsigned char __pyx_v_sign_bit; + unsigned char __pyx_v_sign_bit_mask; + unsigned char __pyx_v_sign_extend; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_signed_char", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + + /* "dataRead.pyx":848 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset): + * cdef np.ndarray[np.int8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned char mask = ((1 << bit_count) - 1) */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 848, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 848, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":621 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":850 + * cdef np.ndarray[np.int8_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned char mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef char temp1byte = 0 + * cdef unsigned char sign_bit = 0 */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); - /* "dataRead.pyx":622 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 32: + /* "dataRead.pyx":851 + * cdef unsigned long long i + * cdef unsigned char mask = ((1 << bit_count) - 1) + * cdef char temp1byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned char sign_bit = 0 + * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp1byte = 0; - /* "dataRead.pyx":621 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":852 + * cdef unsigned char mask = ((1 << bit_count) - 1) + * cdef char temp1byte = 0 + * cdef unsigned char sign_bit = 0 # <<<<<<<<<<<<<< + * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count */ - } + __pyx_v_sign_bit = 0; - /* "dataRead.pyx":624 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":853 + * cdef char temp1byte = 0 + * cdef unsigned char sign_bit = 0 + * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< + * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count + * if bit_count == 8: */ - __pyx_t_6 = (__pyx_v_bit_count < 32); - if (__pyx_t_6) { + __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); - /* "dataRead.pyx":625 - * # mask left part - * if bit_count < 32: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * else: + /* "dataRead.pyx":854 + * cdef unsigned char sign_bit = 0 + * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< + * if bit_count == 8: + * for i in range(number_of_records): */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_sign_extend = (((1 << (8 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); - /* "dataRead.pyx":624 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":855 + * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count + * if bit_count == 8: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) */ - } + __pyx_t_6 = (__pyx_v_bit_count == 8); + if (__pyx_t_6) { - /* "dataRead.pyx":626 - * if bit_count < 32: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): + /* "dataRead.pyx":856 + * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count + * if bit_count == 8: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * buf[i] = temp1byte */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":617 - * buf[i] = temp8byte - * elif n_bytes == 5: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":857 + * if bit_count == 8: + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< + * buf[i] = temp1byte + * else: */ - goto __pyx_L34; + (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); + + /* "dataRead.pyx":858 + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * buf[i] = temp1byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; } - /* "dataRead.pyx":628 - * buf[i] = temp8byte - * else: - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + /* "dataRead.pyx":855 + * cdef unsigned char sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned char sign_extend = ((1 << (8 - bit_count)) - 1) << bit_count + * if bit_count == 8: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) */ - /*else*/ { - __pyx_t_7 = __pyx_v_number_of_records; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + goto __pyx_L3; + } - /* "dataRead.pyx":629 - * else: - * for i in range(number_of_records): - * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + /* "dataRead.pyx":860 + * buf[i] = temp1byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * # right shift */ - (void)(memcpy((&__pyx_v_temp5), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":631 - * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes # <<<<<<<<<<<<<< - * # right shift - * if bit_offset > 0: + /* "dataRead.pyx":861 + * else: + * for i in range(number_of_records): + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: */ - __pyx_v_temp8byte = (((((((uint64_t)(__pyx_v_temp5[0])) << 32) | ((__pyx_v_temp5[1]) << 24)) | ((__pyx_v_temp5[2]) << 16)) | ((__pyx_v_temp5[3]) << 8)) | (__pyx_v_temp5[4])); + (void)(memcpy((&__pyx_v_temp1byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 1)); - /* "dataRead.pyx":633 - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":863 + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp1byte = temp1byte >> bit_offset + * # mask left part */ - __pyx_t_6 = (__pyx_v_bit_offset > 0); - if (__pyx_t_6) { + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { - /* "dataRead.pyx":634 - * # right shift - * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< - * # mask left part - * if bit_count < 32: + /* "dataRead.pyx":864 + * # right shift + * if bit_offset > 0: + * temp1byte = temp1byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * temp1byte &= mask */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp1byte = (__pyx_v_temp1byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":633 - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes - * # right shift - * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset - * # mask left part + /* "dataRead.pyx":863 + * memcpy(&temp1byte, &bit_stream[pos_byte_beg + record_byte_size * i], 1) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp1byte = temp1byte >> bit_offset + * # mask left part */ - } + } - /* "dataRead.pyx":636 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":866 + * temp1byte = temp1byte >> bit_offset + * # mask left part + * temp1byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp1byte & sign_bit_mask + * if sign_bit: # negative value, sign extend */ - __pyx_t_6 = (__pyx_v_bit_count < 32); - if (__pyx_t_6) { + __pyx_v_temp1byte = (__pyx_v_temp1byte & __pyx_v_mask); - /* "dataRead.pyx":637 - * # mask left part - * if bit_count < 32: - * temp8byte &= mask # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * return buf + /* "dataRead.pyx":867 + * # mask left part + * temp1byte &= mask + * sign_bit = temp1byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp1byte |= sign_extend */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_sign_bit = (__pyx_v_temp1byte & __pyx_v_sign_bit_mask); - /* "dataRead.pyx":636 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 32: # <<<<<<<<<<<<<< - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":868 + * temp1byte &= mask + * sign_bit = temp1byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp1byte |= sign_extend + * buf[i] = temp1byte */ - } + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":638 - * if bit_count < 32: - * temp8byte &= mask - * buf[i] = temp8byte # <<<<<<<<<<<<<< + /* "dataRead.pyx":869 + * sign_bit = temp1byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp1byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp1byte * return buf - * */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + __pyx_v_temp1byte = (__pyx_v_temp1byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":868 + * temp1byte &= mask + * sign_bit = temp1byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp1byte |= sign_extend + * buf[i] = temp1byte + */ } - } - __pyx_L34:; - /* "dataRead.pyx":616 - * temp8byte &= mask - * buf[i] = temp8byte - * elif n_bytes == 5: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): + /* "dataRead.pyx":870 + * if sign_bit: # negative value, sign extend + * temp1byte |= sign_extend + * buf[i] = temp1byte # <<<<<<<<<<<<<< + * return buf + * */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp1byte; + } } __pyx_L3:; - /* "dataRead.pyx":639 - * temp8byte &= mask - * buf[i] = temp8byte + /* "dataRead.pyx":871 + * temp1byte |= sign_extend + * buf[i] = temp1byte * return buf # <<<<<<<<<<<<<< * - * cdef inline read_signed_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, + * cdef inline read_unsigned_short(const char* bit_stream, str record_format, unsigned long long number_of_records, */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_buf); __pyx_r = ((PyObject *)__pyx_v_buf); goto __pyx_L0; - /* "dataRead.pyx":527 - * return buf + /* "dataRead.pyx":845 + * return buf * - * cdef inline read_unsigned_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * cdef inline read_signed_char(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * unsigned long bit_count, unsigned char bit_offset): */ /* function exit code */ @@ -28360,7 +31930,7 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_longlong(char con __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_unsigned_longlong", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.read_signed_char", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -28372,26 +31942,20 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_longlong(char con return __pyx_r; } -/* "dataRead.pyx":641 +/* "dataRead.pyx":873 * return buf * - * cdef inline read_signed_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * cdef inline read_unsigned_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_short(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned char __pyx_v_swap) { PyArrayObject *__pyx_v_buf = 0; unsigned PY_LONG_LONG __pyx_v_i; - unsigned PY_LONG_LONG __pyx_v_mask; - PY_LONG_LONG __pyx_v_temp8byte; - unsigned long __pyx_v_sign_bit; - unsigned PY_LONG_LONG __pyx_v_sign_bit_mask; - unsigned PY_LONG_LONG __pyx_v_sign_extend; - unsigned char __pyx_v_temp8[8]; - unsigned char __pyx_v_temp7[7]; - unsigned char __pyx_v_temp6[6]; - unsigned char __pyx_v_temp5[5]; + unsigned short __pyx_v_mask; + unsigned short __pyx_v_temp2byte; + unsigned char __pyx_v_temp[2]; __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; __Pyx_Buffer __pyx_pybuffer_buf; PyObject *__pyx_r = NULL; @@ -28410,46 +31974,46 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_signed_longlong", 1); + __Pyx_RefNannySetupContext("read_unsigned_short", 1); __pyx_pybuffer_buf.pybuffer.buf = NULL; __pyx_pybuffer_buf.refcount = 0; __pyx_pybuffernd_buf.data = NULL; __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":644 + /* "dataRead.pyx":876 * unsigned long record_byte_size, unsigned long pos_byte_beg, - * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): - * cdef np.ndarray[np.int64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + * cdef np.ndarray[np.uint16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< * cdef unsigned long long i - * cdef unsigned long long mask = ((1 << bit_count) - 1) + * cdef unsigned short mask = ((1 << bit_count) - 1) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 644, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 644, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 644, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 876, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 644, __pyx_L1_error) + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 876, __pyx_L1_error) __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 644, __pyx_L1_error) + __PYX_ERR(0, 876, __pyx_L1_error) } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; } } @@ -28457,96 +32021,69 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":646 - * cdef np.ndarray[np.int64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + /* "dataRead.pyx":878 + * cdef np.ndarray[np.uint16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array * cdef unsigned long long i - * cdef unsigned long long mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< - * cdef long long temp8byte = 0 - * cdef unsigned long sign_bit = 0 + * cdef unsigned short mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef unsigned short temp2byte = 0 + * cdef unsigned char temp[2] */ __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); - /* "dataRead.pyx":647 + /* "dataRead.pyx":879 * cdef unsigned long long i - * cdef unsigned long long mask = ((1 << bit_count) - 1) - * cdef long long temp8byte = 0 # <<<<<<<<<<<<<< - * cdef unsigned long sign_bit = 0 - * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) - */ - __pyx_v_temp8byte = 0; - - /* "dataRead.pyx":648 - * cdef unsigned long long mask = ((1 << bit_count) - 1) - * cdef long long temp8byte = 0 - * cdef unsigned long sign_bit = 0 # <<<<<<<<<<<<<< - * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned long long sign_extend = ((1 << (64 - bit_count)) - 1) << bit_count - */ - __pyx_v_sign_bit = 0; - - /* "dataRead.pyx":649 - * cdef long long temp8byte = 0 - * cdef unsigned long sign_bit = 0 - * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< - * cdef unsigned long long sign_extend = ((1 << (64 - bit_count)) - 1) << bit_count - * cdef unsigned char temp8[8] - */ - __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); - - /* "dataRead.pyx":650 - * cdef unsigned long sign_bit = 0 - * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) - * cdef unsigned long long sign_extend = ((1 << (64 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< - * cdef unsigned char temp8[8] - * cdef unsigned char temp7[7] + * cdef unsigned short mask = ((1 << bit_count) - 1) + * cdef unsigned short temp2byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned char temp[2] + * if bit_count == 16: */ - __pyx_v_sign_extend = (((1 << (64 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); + __pyx_v_temp2byte = 0; - /* "dataRead.pyx":655 - * cdef unsigned char temp6[6] - * cdef unsigned char temp5[5] - * if bit_count == 64: # <<<<<<<<<<<<<< + /* "dataRead.pyx":881 + * cdef unsigned short temp2byte = 0 + * cdef unsigned char temp[2] + * if bit_count == 16: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ - __pyx_t_6 = (__pyx_v_bit_count == 64); + __pyx_t_6 = (__pyx_v_bit_count == 16); if (__pyx_t_6) { - /* "dataRead.pyx":656 - * cdef unsigned char temp5[5] - * if bit_count == 64: + /* "dataRead.pyx":882 + * cdef unsigned char temp[2] + * if bit_count == 16: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte */ __pyx_t_7 = __pyx_v_number_of_records; __pyx_t_8 = __pyx_t_7; for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":657 - * if bit_count == 64: + /* "dataRead.pyx":883 + * if bit_count == 16: * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * buf[i] = temp8byte + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< + * buf[i] = temp2byte * if swap == 0: */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":658 + /* "dataRead.pyx":884 * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte # <<<<<<<<<<<<<< + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte # <<<<<<<<<<<<<< * if swap == 0: * return buf */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - /* "dataRead.pyx":659 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte + /* "dataRead.pyx":885 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte * if swap == 0: # <<<<<<<<<<<<<< * return buf * else: @@ -28554,8 +32091,8 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const __pyx_t_6 = (__pyx_v_swap == 0); if (__pyx_t_6) { - /* "dataRead.pyx":660 - * buf[i] = temp8byte + /* "dataRead.pyx":886 + * buf[i] = temp2byte * if swap == 0: * return buf # <<<<<<<<<<<<<< * else: @@ -28566,25 +32103,25 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const __pyx_r = ((PyObject *)__pyx_v_buf); goto __pyx_L0; - /* "dataRead.pyx":659 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * buf[i] = temp8byte + /* "dataRead.pyx":885 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte * if swap == 0: # <<<<<<<<<<<<<< * return buf * else: */ } - /* "dataRead.pyx":662 + /* "dataRead.pyx":888 * return buf * else: * return buf.byteswap() # <<<<<<<<<<<<<< - * elif n_bytes == 8: + * else: * if swap == 0: */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; __pyx_t_11 = 0; @@ -28604,7 +32141,7 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } @@ -28613,40 +32150,31 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const goto __pyx_L0; } - /* "dataRead.pyx":655 - * cdef unsigned char temp6[6] - * cdef unsigned char temp5[5] - * if bit_count == 64: # <<<<<<<<<<<<<< + /* "dataRead.pyx":881 + * cdef unsigned short temp2byte = 0 + * cdef unsigned char temp[2] + * if bit_count == 16: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ } - /* "dataRead.pyx":663 - * else: - * return buf.byteswap() - * elif n_bytes == 8: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): - */ - __pyx_t_6 = (__pyx_v_n_bytes == 8); - if (__pyx_t_6) { - - /* "dataRead.pyx":664 + /* "dataRead.pyx":890 * return buf.byteswap() - * elif n_bytes == 8: + * else: * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ + /*else*/ { __pyx_t_6 = (__pyx_v_swap == 0); if (__pyx_t_6) { - /* "dataRead.pyx":665 - * elif n_bytes == 8: + /* "dataRead.pyx":891 + * else: * if swap == 0: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) * # right shift */ __pyx_t_7 = __pyx_v_number_of_records; @@ -28654,135 +32182,98 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":666 + /* "dataRead.pyx":892 * if swap == 0: * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":668 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":894 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":669 + /* "dataRead.pyx":895 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 64: + * if bit_count < 16: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":668 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":894 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":671 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":897 + * temp2byte = temp2byte >> bit_offset * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 16: # <<<<<<<<<<<<<< + * temp2byte &= mask + * buf[i] = temp2byte */ - __pyx_t_6 = (__pyx_v_bit_count < 64); + __pyx_t_6 = (__pyx_v_bit_count < 16); if (__pyx_t_6) { - /* "dataRead.pyx":672 - * # mask left part - * if bit_count < 64: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); - - /* "dataRead.pyx":671 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":898 * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - } - - /* "dataRead.pyx":673 - * if bit_count < 64: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); - - /* "dataRead.pyx":674 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte - */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":675 - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte + * if bit_count < 16: + * temp2byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp2byte * else: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); - /* "dataRead.pyx":674 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + /* "dataRead.pyx":897 + * temp2byte = temp2byte >> bit_offset + * # mask left part + * if bit_count < 16: # <<<<<<<<<<<<<< + * temp2byte &= mask + * buf[i] = temp2byte */ } - /* "dataRead.pyx":676 - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< + /* "dataRead.pyx":899 + * if bit_count < 16: + * temp2byte &= mask + * buf[i] = temp2byte # <<<<<<<<<<<<<< * else: * for i in range(number_of_records): */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - /* "dataRead.pyx":664 + /* "dataRead.pyx":890 * return buf.byteswap() - * elif n_bytes == 8: + * else: * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ goto __pyx_L7; } - /* "dataRead.pyx":678 - * buf[i] = temp8byte + /* "dataRead.pyx":901 + * buf[i] = temp2byte * else: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * temp2byte = temp[0]<<8 | temp[1] # swap bytes */ /*else*/ { __pyx_t_7 = __pyx_v_number_of_records; @@ -28790,165 +32281,401 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":679 + /* "dataRead.pyx":902 * else: * for i in range(number_of_records): - * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ - * temp8[2]<<40 | temp8[3]<<32 | \ + * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< + * temp2byte = temp[0]<<8 | temp[1] # swap bytes + * # right shift */ - (void)(memcpy((&__pyx_v_temp8), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":682 - * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ - * temp8[2]<<40 | temp8[3]<<32 | \ - * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes # <<<<<<<<<<<<<< + /* "dataRead.pyx":903 + * for i in range(number_of_records): + * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * temp2byte = temp[0]<<8 | temp[1] # swap bytes # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - __pyx_v_temp8byte = ((((((((((uint64_t)(__pyx_v_temp8[0])) << 56) | (((uint64_t)(__pyx_v_temp8[1])) << 48)) | (((uint64_t)(__pyx_v_temp8[2])) << 40)) | (((uint64_t)(__pyx_v_temp8[3])) << 32)) | ((__pyx_v_temp8[4]) << 24)) | ((__pyx_v_temp8[5]) << 16)) | ((__pyx_v_temp8[6]) << 8)) | (__pyx_v_temp8[7])); + __pyx_v_temp2byte = (((__pyx_v_temp[0]) << 8) | (__pyx_v_temp[1])); - /* "dataRead.pyx":684 - * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes + /* "dataRead.pyx":905 + * temp2byte = temp[0]<<8 | temp[1] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":685 + /* "dataRead.pyx":906 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 64: + * if bit_count < 16: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":684 - * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes + /* "dataRead.pyx":905 + * temp2byte = temp[0]<<8 | temp[1] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":687 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":908 + * temp2byte = temp2byte >> bit_offset * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 16: # <<<<<<<<<<<<<< + * temp2byte &= mask + * buf[i] = temp2byte */ - __pyx_t_6 = (__pyx_v_bit_count < 64); + __pyx_t_6 = (__pyx_v_bit_count < 16); if (__pyx_t_6) { - /* "dataRead.pyx":688 + /* "dataRead.pyx":909 * # mask left part - * if bit_count < 64: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend + * if bit_count < 16: + * temp2byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp2byte + * return buf */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); - /* "dataRead.pyx":687 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":908 + * temp2byte = temp2byte >> bit_offset * # mask left part - * if bit_count < 64: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 16: # <<<<<<<<<<<<<< + * temp2byte &= mask + * buf[i] = temp2byte */ } - /* "dataRead.pyx":689 - * if bit_count < 64: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend + /* "dataRead.pyx":910 + * if bit_count < 16: + * temp2byte &= mask + * buf[i] = temp2byte # <<<<<<<<<<<<<< + * return buf + * */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; + } + } + __pyx_L7:; - /* "dataRead.pyx":690 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + /* "dataRead.pyx":911 + * temp2byte &= mask + * buf[i] = temp2byte + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_signed_short(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + } - /* "dataRead.pyx":691 - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * elif n_bytes == 7: + /* "dataRead.pyx":873 + * return buf + * + * cdef inline read_unsigned_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); - /* "dataRead.pyx":690 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_unsigned_short", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":913 + * return buf + * + * cdef inline read_signed_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): */ - } - /* "dataRead.pyx":692 - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * elif n_bytes == 7: +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_short(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned short __pyx_v_mask; + short __pyx_v_temp2byte; + unsigned short __pyx_v_sign_bit; + unsigned short __pyx_v_sign_bit_mask; + unsigned short __pyx_v_sign_extend; + unsigned char __pyx_v_temp[2]; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_signed_short", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + + /* "dataRead.pyx":916 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + * cdef np.ndarray[np.int16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned short mask = ((1 << bit_count) - 1) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 916, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 916, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 916, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int16_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 916, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dataRead.pyx":918 + * cdef np.ndarray[np.int16_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned short mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef short temp2byte = 0 + * cdef unsigned short sign_bit = 0 + */ + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + + /* "dataRead.pyx":919 + * cdef unsigned long long i + * cdef unsigned short mask = ((1 << bit_count) - 1) + * cdef short temp2byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned short sign_bit = 0 + * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) + */ + __pyx_v_temp2byte = 0; + + /* "dataRead.pyx":920 + * cdef unsigned short mask = ((1 << bit_count) - 1) + * cdef short temp2byte = 0 + * cdef unsigned short sign_bit = 0 # <<<<<<<<<<<<<< + * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count + */ + __pyx_v_sign_bit = 0; + + /* "dataRead.pyx":921 + * cdef short temp2byte = 0 + * cdef unsigned short sign_bit = 0 + * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< + * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count + * cdef unsigned char temp[2] + */ + __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); + + /* "dataRead.pyx":922 + * cdef unsigned short sign_bit = 0 + * cdef unsigned short sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< + * cdef unsigned char temp[2] + * if bit_count == 16: + */ + __pyx_v_sign_extend = (((1 << (16 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); + + /* "dataRead.pyx":924 + * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count + * cdef unsigned char temp[2] + * if bit_count == 16: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + */ + __pyx_t_6 = (__pyx_v_bit_count == 16); + if (__pyx_t_6) { + + /* "dataRead.pyx":925 + * cdef unsigned char temp[2] + * if bit_count == 16: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":926 + * if bit_count == 16: + * for i in range(number_of_records): + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< + * buf[i] = temp2byte * if swap == 0: */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } + (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); + + /* "dataRead.pyx":927 + * for i in range(number_of_records): + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte # <<<<<<<<<<<<<< + * if swap == 0: + * return buf + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - __pyx_L7:; - /* "dataRead.pyx":663 + /* "dataRead.pyx":928 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":929 + * buf[i] = temp2byte + * if swap == 0: + * return buf # <<<<<<<<<<<<<< * else: * return buf.byteswap() - * elif n_bytes == 8: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): */ - goto __pyx_L3; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":693 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * elif n_bytes == 7: # <<<<<<<<<<<<<< + /* "dataRead.pyx":928 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * buf[i] = temp2byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + } + + /* "dataRead.pyx":931 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * else: * if swap == 0: - * for i in range(number_of_records): */ - __pyx_t_6 = (__pyx_v_n_bytes == 7); - if (__pyx_t_6) { + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":694 - * buf[i] = temp8byte - * elif n_bytes == 7: + /* "dataRead.pyx":924 + * cdef unsigned short sign_extend = ((1 << (16 - bit_count)) - 1) << bit_count + * cdef unsigned char temp[2] + * if bit_count == 16: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + */ + } + + /* "dataRead.pyx":933 + * return buf.byteswap() + * else: * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ + /*else*/ { __pyx_t_6 = (__pyx_v_swap == 0); if (__pyx_t_6) { - /* "dataRead.pyx":695 - * elif n_bytes == 7: + /* "dataRead.pyx":934 + * else: * if swap == 0: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) * # right shift */ __pyx_t_7 = __pyx_v_number_of_records; @@ -28956,135 +32683,116 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":696 + /* "dataRead.pyx":935 * if swap == 0: * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp2byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":698 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":937 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":699 + /* "dataRead.pyx":938 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 56: + * temp2byte &= mask */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":698 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":937 + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":701 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":940 + * temp2byte = temp2byte >> bit_offset * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * temp2byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp2byte & sign_bit_mask + * if sign_bit: # negative value, sign extend */ - __pyx_t_6 = (__pyx_v_bit_count < 56); - if (__pyx_t_6) { + __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); - /* "dataRead.pyx":702 + /* "dataRead.pyx":941 * # mask left part - * if bit_count < 56: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask + * temp2byte &= mask + * sign_bit = temp2byte & sign_bit_mask # <<<<<<<<<<<<<< * if sign_bit: # negative value, sign extend + * temp2byte |= sign_extend */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_sign_bit = (__pyx_v_temp2byte & __pyx_v_sign_bit_mask); - /* "dataRead.pyx":701 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - } - - /* "dataRead.pyx":703 - * if bit_count < 56: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); - - /* "dataRead.pyx":704 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + /* "dataRead.pyx":942 + * temp2byte &= mask + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + * temp2byte |= sign_extend + * buf[i] = temp2byte */ __pyx_t_6 = (__pyx_v_sign_bit != 0); if (__pyx_t_6) { - /* "dataRead.pyx":705 - * sign_bit = temp8byte & sign_bit_mask + /* "dataRead.pyx":943 + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte + * temp2byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp2byte * else: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + __pyx_v_temp2byte = (__pyx_v_temp2byte | __pyx_v_sign_extend); - /* "dataRead.pyx":704 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + /* "dataRead.pyx":942 + * temp2byte &= mask + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + * temp2byte |= sign_extend + * buf[i] = temp2byte */ } - /* "dataRead.pyx":706 + /* "dataRead.pyx":944 * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< + * temp2byte |= sign_extend + * buf[i] = temp2byte # <<<<<<<<<<<<<< * else: * for i in range(number_of_records): */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } - /* "dataRead.pyx":694 - * buf[i] = temp8byte - * elif n_bytes == 7: + /* "dataRead.pyx":933 + * return buf.byteswap() + * else: * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp2byte, &bit_stream[pos_byte_beg + record_byte_size * i], 2) */ - goto __pyx_L18; + goto __pyx_L7; } - /* "dataRead.pyx":708 - * buf[i] = temp8byte + /* "dataRead.pyx":946 + * buf[i] = temp2byte * else: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * temp2byte = temp[0]<<8 | temp[1] # swap bytes */ /*else*/ { __pyx_t_7 = __pyx_v_number_of_records; @@ -29092,165 +32800,399 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":709 + /* "dataRead.pyx":947 * else: * for i in range(number_of_records): - * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) # <<<<<<<<<<<<<< + * temp2byte = temp[0]<<8 | temp[1] # swap bytes + * # right shift */ - (void)(memcpy((&__pyx_v_temp7), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 2)); - /* "dataRead.pyx":711 - * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes # <<<<<<<<<<<<<< + /* "dataRead.pyx":948 + * for i in range(number_of_records): + * memcpy(&temp, &bit_stream[pos_byte_beg + record_byte_size * i], 2) + * temp2byte = temp[0]<<8 | temp[1] # swap bytes # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - __pyx_v_temp8byte = (((((((((uint64_t)(__pyx_v_temp7[0])) << 48) | (((uint64_t)(__pyx_v_temp7[1])) << 40)) | (((uint64_t)(__pyx_v_temp7[2])) << 32)) | ((__pyx_v_temp7[3]) << 24)) | ((__pyx_v_temp7[4]) << 16)) | ((__pyx_v_temp7[5]) << 8)) | (__pyx_v_temp7[6])); + __pyx_v_temp2byte = (((__pyx_v_temp[0]) << 8) | (__pyx_v_temp[1])); - /* "dataRead.pyx":713 - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + /* "dataRead.pyx":950 + * temp2byte = temp[0]<<8 | temp[1] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":714 + /* "dataRead.pyx":951 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp2byte = temp2byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 56: + * temp2byte &= mask */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp2byte = (__pyx_v_temp2byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":713 - * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + /* "dataRead.pyx":950 + * temp2byte = temp[0]<<8 | temp[1] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp2byte = temp2byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":716 - * temp8byte = temp8byte >> bit_offset - * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - __pyx_t_6 = (__pyx_v_bit_count < 56); - if (__pyx_t_6) { - - /* "dataRead.pyx":717 + /* "dataRead.pyx":953 + * temp2byte = temp2byte >> bit_offset * # mask left part - * if bit_count < 56: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask + * temp2byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_temp2byte = (__pyx_v_temp2byte & __pyx_v_mask); - /* "dataRead.pyx":716 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":954 * # mask left part - * if bit_count < 56: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - } - - /* "dataRead.pyx":718 - * if bit_count < 56: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * temp2byte &= mask + * sign_bit = temp2byte & sign_bit_mask # <<<<<<<<<<<<<< * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend + * temp2byte |= sign_extend */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + __pyx_v_sign_bit = (__pyx_v_temp2byte & __pyx_v_sign_bit_mask); - /* "dataRead.pyx":719 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + /* "dataRead.pyx":955 + * temp2byte &= mask + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + * temp2byte |= sign_extend + * buf[i] = temp2byte */ __pyx_t_6 = (__pyx_v_sign_bit != 0); if (__pyx_t_6) { - /* "dataRead.pyx":720 - * sign_bit = temp8byte & sign_bit_mask + /* "dataRead.pyx":956 + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * elif n_bytes == 6: + * temp2byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp2byte + * return buf */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + __pyx_v_temp2byte = (__pyx_v_temp2byte | __pyx_v_sign_extend); - /* "dataRead.pyx":719 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + /* "dataRead.pyx":955 + * temp2byte &= mask + * sign_bit = temp2byte & sign_bit_mask * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + * temp2byte |= sign_extend + * buf[i] = temp2byte */ } - /* "dataRead.pyx":721 + /* "dataRead.pyx":957 * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * elif n_bytes == 6: - * if swap == 0: + * temp2byte |= sign_extend + * buf[i] = temp2byte # <<<<<<<<<<<<<< + * return buf + * */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp2byte; } } - __pyx_L18:; + __pyx_L7:; - /* "dataRead.pyx":693 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * elif n_bytes == 7: # <<<<<<<<<<<<<< + /* "dataRead.pyx":958 + * temp2byte |= sign_extend + * buf[i] = temp2byte + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_unsigned_int(const char* bit_stream, str record_format, unsigned long long number_of_records, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + } + + /* "dataRead.pyx":913 + * return buf + * + * cdef inline read_signed_short(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_signed_short", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":960 + * return buf + * + * cdef inline read_unsigned_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + */ + +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_int(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned int __pyx_v_mask; + unsigned int __pyx_v_temp4byte; + unsigned char __pyx_v_temp4[4]; + unsigned char __pyx_v_temp3[3]; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_unsigned_int", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + + /* "dataRead.pyx":963 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * cdef np.ndarray[np.uint32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned int mask = ((1 << bit_count) - 1) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 963, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 963, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 963, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dataRead.pyx":965 + * cdef np.ndarray[np.uint32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned int mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef unsigned int temp4byte = 0 + * cdef unsigned char temp4[4] + */ + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + + /* "dataRead.pyx":966 + * cdef unsigned long long i + * cdef unsigned int mask = ((1 << bit_count) - 1) + * cdef unsigned int temp4byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned char temp4[4] + * cdef unsigned char temp3[3] + */ + __pyx_v_temp4byte = 0; + + /* "dataRead.pyx":969 + * cdef unsigned char temp4[4] + * cdef unsigned char temp3[3] + * if bit_count == 32: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + */ + __pyx_t_6 = (__pyx_v_bit_count == 32); + if (__pyx_t_6) { + + /* "dataRead.pyx":970 + * cdef unsigned char temp3[3] + * if bit_count == 32: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":971 + * if bit_count == 32: + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) # <<<<<<<<<<<<<< + * buf[i] = temp4byte * if swap == 0: - * for i in range(number_of_records): */ - goto __pyx_L3; + (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 4)); + + /* "dataRead.pyx":972 + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * if swap == 0: + * return buf + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + } + + /* "dataRead.pyx":973 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":974 + * buf[i] = temp4byte + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":973 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + } + + /* "dataRead.pyx":976 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * elif n_bytes == 4: + * if swap == 0: + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "dataRead.pyx":969 + * cdef unsigned char temp4[4] + * cdef unsigned char temp3[3] + * if bit_count == 32: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + */ } - /* "dataRead.pyx":722 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * elif n_bytes == 6: # <<<<<<<<<<<<<< + /* "dataRead.pyx":977 + * else: + * return buf.byteswap() + * elif n_bytes == 4: # <<<<<<<<<<<<<< * if swap == 0: * for i in range(number_of_records): */ - __pyx_t_6 = (__pyx_v_n_bytes == 6); + __pyx_t_6 = (__pyx_v_n_bytes == 4); if (__pyx_t_6) { - /* "dataRead.pyx":723 - * buf[i] = temp8byte - * elif n_bytes == 6: + /* "dataRead.pyx":978 + * return buf.byteswap() + * elif n_bytes == 4: * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ __pyx_t_6 = (__pyx_v_swap == 0); if (__pyx_t_6) { - /* "dataRead.pyx":724 - * elif n_bytes == 6: + /* "dataRead.pyx":979 + * elif n_bytes == 4: * if swap == 0: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) * # right shift */ __pyx_t_7 = __pyx_v_number_of_records; @@ -29258,135 +33200,98 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":725 + /* "dataRead.pyx":980 * if swap == 0: * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":727 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":982 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":728 + /* "dataRead.pyx":983 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 48: + * if bit_count < 32: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":727 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":982 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":730 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":985 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ - __pyx_t_6 = (__pyx_v_bit_count < 48); + __pyx_t_6 = (__pyx_v_bit_count < 32); if (__pyx_t_6) { - /* "dataRead.pyx":731 + /* "dataRead.pyx":986 * # mask left part - * if bit_count < 48: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend + * if bit_count < 32: + * temp4byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * else: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); - /* "dataRead.pyx":730 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":985 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ } - /* "dataRead.pyx":732 - * if bit_count < 48: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend + /* "dataRead.pyx":987 + * if bit_count < 32: + * temp4byte &= mask + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + } - /* "dataRead.pyx":733 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + /* "dataRead.pyx":978 + * return buf.byteswap() + * elif n_bytes == 4: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { + goto __pyx_L7; + } - /* "dataRead.pyx":734 - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * else: - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); - - /* "dataRead.pyx":733 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte - */ - } - - /* "dataRead.pyx":735 - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * else: - * for i in range(number_of_records): - */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; - } - - /* "dataRead.pyx":723 - * buf[i] = temp8byte - * elif n_bytes == 6: - * if swap == 0: # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - */ - goto __pyx_L29; - } - - /* "dataRead.pyx":737 - * buf[i] = temp8byte + /* "dataRead.pyx":989 + * buf[i] = temp4byte * else: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes */ /*else*/ { __pyx_t_7 = __pyx_v_number_of_records; @@ -29394,165 +33299,130 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":738 + /* "dataRead.pyx":990 * else: * for i in range(number_of_records): - * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes + * # right shift */ - (void)(memcpy((&__pyx_v_temp6), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp4), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":740 - * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes # <<<<<<<<<<<<<< + /* "dataRead.pyx":991 + * for i in range(number_of_records): + * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - __pyx_v_temp8byte = ((((((((uint64_t)(__pyx_v_temp6[0])) << 40) | (((uint64_t)(__pyx_v_temp6[1])) << 32)) | ((__pyx_v_temp6[2]) << 24)) | ((__pyx_v_temp6[3]) << 16)) | ((__pyx_v_temp6[4]) << 8)) | (__pyx_v_temp6[5])); + __pyx_v_temp4byte = (((((__pyx_v_temp4[0]) << 24) | ((__pyx_v_temp4[1]) << 16)) | ((__pyx_v_temp4[2]) << 8)) | (__pyx_v_temp4[3])); - /* "dataRead.pyx":742 - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + /* "dataRead.pyx":993 + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":743 + /* "dataRead.pyx":994 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 48: + * if bit_count < 32: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":742 - * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + /* "dataRead.pyx":993 + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":745 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":996 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ - __pyx_t_6 = (__pyx_v_bit_count < 48); + __pyx_t_6 = (__pyx_v_bit_count < 32); if (__pyx_t_6) { - /* "dataRead.pyx":746 + /* "dataRead.pyx":997 * # mask left part - * if bit_count < 48: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend + * if bit_count < 32: + * temp4byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * return buf */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); - /* "dataRead.pyx":745 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":996 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 48: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - } - - /* "dataRead.pyx":747 - * if bit_count < 48: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); - - /* "dataRead.pyx":748 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte - */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":749 - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * elif n_bytes == 5: - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); - - /* "dataRead.pyx":748 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ } - /* "dataRead.pyx":750 - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * elif n_bytes == 5: - * if swap == 0: + /* "dataRead.pyx":998 + * if bit_count < 32: + * temp4byte &= mask + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * return buf + * else: # on 3 bytes */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; } } - __pyx_L29:; + __pyx_L7:; - /* "dataRead.pyx":722 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * elif n_bytes == 6: # <<<<<<<<<<<<<< + /* "dataRead.pyx":999 + * temp4byte &= mask + * buf[i] = temp4byte + * return buf # <<<<<<<<<<<<<< + * else: # on 3 bytes * if swap == 0: - * for i in range(number_of_records): */ - goto __pyx_L3; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":751 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * elif n_bytes == 5: # <<<<<<<<<<<<<< + /* "dataRead.pyx":977 + * else: + * return buf.byteswap() + * elif n_bytes == 4: # <<<<<<<<<<<<<< * if swap == 0: * for i in range(number_of_records): */ - __pyx_t_6 = (__pyx_v_n_bytes == 5); - if (__pyx_t_6) { + } - /* "dataRead.pyx":752 - * buf[i] = temp8byte - * elif n_bytes == 5: + /* "dataRead.pyx":1001 + * return buf + * else: # on 3 bytes * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ + /*else*/ { __pyx_t_6 = (__pyx_v_swap == 0); if (__pyx_t_6) { - /* "dataRead.pyx":753 - * elif n_bytes == 5: + /* "dataRead.pyx":1002 + * else: # on 3 bytes * if swap == 0: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) * # right shift */ __pyx_t_7 = __pyx_v_number_of_records; @@ -29560,135 +33430,98 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":754 + /* "dataRead.pyx":1003 * if swap == 0: * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":756 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":1005 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":757 + /* "dataRead.pyx":1006 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 40: + * if bit_count < 24: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":756 - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + /* "dataRead.pyx":1005 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":759 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":1008 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 40: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ - __pyx_t_6 = (__pyx_v_bit_count < 40); + __pyx_t_6 = (__pyx_v_bit_count < 24); if (__pyx_t_6) { - /* "dataRead.pyx":760 - * # mask left part - * if bit_count < 40: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); - - /* "dataRead.pyx":759 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":1009 * # mask left part - * if bit_count < 40: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - } - - /* "dataRead.pyx":761 - * if bit_count < 40: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); - - /* "dataRead.pyx":762 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte - */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":763 - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte + * if bit_count < 24: + * temp4byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp4byte * else: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); - /* "dataRead.pyx":762 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + /* "dataRead.pyx":1008 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ } - /* "dataRead.pyx":764 - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< + /* "dataRead.pyx":1010 + * if bit_count < 24: + * temp4byte &= mask + * buf[i] = temp4byte # <<<<<<<<<<<<<< * else: * for i in range(number_of_records): */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; } - /* "dataRead.pyx":752 - * buf[i] = temp8byte - * elif n_bytes == 5: + /* "dataRead.pyx":1001 + * return buf + * else: # on 3 bytes * if swap == 0: # <<<<<<<<<<<<<< * for i in range(number_of_records): - * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ - goto __pyx_L40; + goto __pyx_L16; } - /* "dataRead.pyx":766 - * buf[i] = temp8byte + /* "dataRead.pyx":1012 + * buf[i] = temp4byte * else: * for i in range(number_of_records): # <<<<<<<<<<<<<< - * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes */ /*else*/ { __pyx_t_7 = __pyx_v_number_of_records; @@ -29696,156 +33529,110 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":767 + /* "dataRead.pyx":1013 * else: * for i in range(number_of_records): - * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< - * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes + * # right shift */ - (void)(memcpy((&__pyx_v_temp5), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + (void)(memcpy((&__pyx_v_temp3), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":769 - * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) - * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes # <<<<<<<<<<<<<< + /* "dataRead.pyx":1014 + * for i in range(number_of_records): + * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes # <<<<<<<<<<<<<< * # right shift * if bit_offset > 0: */ - __pyx_v_temp8byte = (((((((uint64_t)(__pyx_v_temp5[0])) << 32) | ((__pyx_v_temp5[1]) << 24)) | ((__pyx_v_temp5[2]) << 16)) | ((__pyx_v_temp5[3]) << 8)) | (__pyx_v_temp5[4])); + __pyx_v_temp4byte = ((((__pyx_v_temp3[0]) << 16) | ((__pyx_v_temp3[1]) << 8)) | (__pyx_v_temp3[2])); - /* "dataRead.pyx":771 - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + /* "dataRead.pyx":1016 + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ __pyx_t_6 = (__pyx_v_bit_offset > 0); if (__pyx_t_6) { - /* "dataRead.pyx":772 + /* "dataRead.pyx":1017 * # right shift * if bit_offset > 0: - * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< * # mask left part - * if bit_count < 40: + * if bit_count < 24: */ - __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":771 - * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + /* "dataRead.pyx":1016 + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes * # right shift * if bit_offset > 0: # <<<<<<<<<<<<<< - * temp8byte = temp8byte >> bit_offset + * temp4byte = temp4byte >> bit_offset * # mask left part */ } - /* "dataRead.pyx":774 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":1019 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 40: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ - __pyx_t_6 = (__pyx_v_bit_count < 40); + __pyx_t_6 = (__pyx_v_bit_count < 24); if (__pyx_t_6) { - /* "dataRead.pyx":775 + /* "dataRead.pyx":1020 * # mask left part - * if bit_count < 40: - * temp8byte &= mask # <<<<<<<<<<<<<< - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend + * if bit_count < 24: + * temp4byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * return buf */ - __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); - /* "dataRead.pyx":774 - * temp8byte = temp8byte >> bit_offset + /* "dataRead.pyx":1019 + * temp4byte = temp4byte >> bit_offset * # mask left part - * if bit_count < 40: # <<<<<<<<<<<<<< - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - */ - } - - /* "dataRead.pyx":776 - * if bit_count < 40: - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - */ - __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); - - /* "dataRead.pyx":777 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte - */ - __pyx_t_6 = (__pyx_v_sign_bit != 0); - if (__pyx_t_6) { - - /* "dataRead.pyx":778 - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend # <<<<<<<<<<<<<< - * buf[i] = temp8byte - * return buf - */ - __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); - - /* "dataRead.pyx":777 - * temp8byte &= mask - * sign_bit = temp8byte & sign_bit_mask - * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< - * temp8byte |= sign_extend - * buf[i] = temp8byte + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * buf[i] = temp4byte */ } - /* "dataRead.pyx":779 - * if sign_bit: # negative value, sign extend - * temp8byte |= sign_extend - * buf[i] = temp8byte # <<<<<<<<<<<<<< - * return buf + /* "dataRead.pyx":1021 + * if bit_count < 24: + * temp4byte &= mask + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * return buf * */ __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; } } - __pyx_L40:; - - /* "dataRead.pyx":751 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * elif n_bytes == 5: # <<<<<<<<<<<<<< - * if swap == 0: - * for i in range(number_of_records): - */ - } - __pyx_L3:; + __pyx_L16:; - /* "dataRead.pyx":780 - * temp8byte |= sign_extend - * buf[i] = temp8byte - * return buf # <<<<<<<<<<<<<< + /* "dataRead.pyx":1022 + * temp4byte &= mask + * buf[i] = temp4byte + * return buf # <<<<<<<<<<<<<< + * * - * cdef inline read_byte(const char* bit_stream, str record_format, unsigned long long number_of_records, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + } - /* "dataRead.pyx":641 - * return buf + /* "dataRead.pyx":960 + * return buf * - * cdef inline read_signed_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * cdef inline read_unsigned_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< * unsigned long record_byte_size, unsigned long pos_byte_beg, * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): */ @@ -29862,7 +33649,7 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("dataRead.read_signed_longlong", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.read_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -29874,2572 +33661,7683 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const return __pyx_r; } -/* "dataRead.pyx":782 - * return buf +/* "dataRead.pyx":1025 * - * cdef inline read_byte(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, - * unsigned long bit_count, unsigned char bit_offset): + * + * cdef inline read_signed_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_byte(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, CYTHON_UNUSED unsigned long __pyx_v_bit_count, CYTHON_UNUSED unsigned char __pyx_v_bit_offset) { +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_int(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { PyArrayObject *__pyx_v_buf = 0; unsigned PY_LONG_LONG __pyx_v_i; - unsigned long __pyx_v_pos_byte_end; + unsigned int __pyx_v_mask; + int __pyx_v_temp4byte; + unsigned int __pyx_v_sign_bit; + unsigned int __pyx_v_sign_bit_mask; + unsigned int __pyx_v_sign_extend; + unsigned char __pyx_v_temp4[4]; + unsigned char __pyx_v_temp3[3]; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; 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; - unsigned PY_LONG_LONG __pyx_t_5; - unsigned PY_LONG_LONG __pyx_t_6; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_byte", 1); + __Pyx_RefNannySetupContext("read_signed_int", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":785 - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, - * unsigned long bit_count, unsigned char bit_offset): - * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + /* "dataRead.pyx":1028 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * cdef np.ndarray[np.int32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< * cdef unsigned long long i - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * cdef unsigned int mask = ((1 << bit_count) - 1) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 785, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 1028, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 785, __pyx_L1_error) + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1028, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1028, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":787 - * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array + /* "dataRead.pyx":1030 + * cdef np.ndarray[np.int32_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array * cdef unsigned long long i - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ + * cdef unsigned int mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef int temp4byte = 0 + * cdef unsigned int sign_bit = 0 */ - __pyx_v_pos_byte_end = (__pyx_v_pos_byte_beg + __pyx_v_n_bytes); + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); - /* "dataRead.pyx":788 + /* "dataRead.pyx":1031 * cdef unsigned long long i - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i]) + * cdef unsigned int mask = ((1 << bit_count) - 1) + * cdef int temp4byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned int sign_bit = 0 + * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) */ - __pyx_t_5 = __pyx_v_number_of_records; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_v_temp4byte = 0; - /* "dataRead.pyx":789 - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes - * for i in range(number_of_records): - * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< - * pos_byte_end + record_byte_size * i]) - * return buf + /* "dataRead.pyx":1032 + * cdef unsigned int mask = ((1 << bit_count) - 1) + * cdef int temp4byte = 0 + * cdef unsigned int sign_bit = 0 # <<<<<<<<<<<<<< + * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned int sign_extend = ((1 << (32 - bit_count)) - 1) << bit_count */ - __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i)), (__pyx_v_pos_byte_end + (__pyx_v_record_byte_size * __pyx_v_i)) - (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_buf), __pyx_v_i, __pyx_t_1, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __pyx_v_sign_bit = 0; - /* "dataRead.pyx":791 - * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i]) - * return buf # <<<<<<<<<<<<<< - * - * cdef inline read_array(const char* bit_stream, str record_format, unsigned long long number_of_records, + /* "dataRead.pyx":1033 + * cdef int temp4byte = 0 + * cdef unsigned int sign_bit = 0 + * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< + * cdef unsigned int sign_extend = ((1 << (32 - bit_count)) - 1) << bit_count + * cdef unsigned char temp4[4] */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); - /* "dataRead.pyx":782 - * return buf - * - * cdef inline read_byte(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, - * unsigned long bit_count, unsigned char bit_offset): + /* "dataRead.pyx":1034 + * cdef unsigned int sign_bit = 0 + * cdef unsigned int sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned int sign_extend = ((1 << (32 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< + * cdef unsigned char temp4[4] + * cdef unsigned char temp3[3] */ + __pyx_v_sign_extend = (((1 << (32 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); - /* function exit code */ - __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("dataRead.read_byte", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":1037 + * cdef unsigned char temp4[4] + * cdef unsigned char temp3[3] + * if bit_count == 32: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + */ + __pyx_t_6 = (__pyx_v_bit_count == 32); + if (__pyx_t_6) { -/* "dataRead.pyx":793 - * return buf - * - * cdef inline read_array(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + /* "dataRead.pyx":1038 + * cdef unsigned char temp3[3] + * if bit_count == 32: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_array(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, CYTHON_UNUSED unsigned long __pyx_v_bit_count, CYTHON_UNUSED unsigned char __pyx_v_bit_offset, unsigned char __pyx_v_swap) { - PyArrayObject *__pyx_v_buf = 0; - unsigned PY_LONG_LONG __pyx_v_i; - unsigned long __pyx_v_pos_byte_end; - 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; - unsigned PY_LONG_LONG __pyx_t_5; - unsigned PY_LONG_LONG __pyx_t_6; - unsigned PY_LONG_LONG __pyx_t_7; - int __pyx_t_8; - unsigned int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_array", 1); + /* "dataRead.pyx":1039 + * if bit_count == 32: + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * if swap == 0: + */ + (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), 4)); - /* "dataRead.pyx":796 - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): - * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< - * cdef unsigned long long i - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + /* "dataRead.pyx":1040 + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * if swap == 0: + * return buf */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 796, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 796, __pyx_L1_error) - __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + } - /* "dataRead.pyx":798 - * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array - * cdef unsigned long long i - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes # <<<<<<<<<<<<<< - * for i in range(number_of_records): - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + /* "dataRead.pyx":1041 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __pyx_v_pos_byte_end = (__pyx_v_pos_byte_beg + __pyx_v_n_bytes); + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { - /* "dataRead.pyx":799 - * cdef unsigned long long i - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes - * for i in range(number_of_records): # <<<<<<<<<<<<<< - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i], dtype=record_format) + /* "dataRead.pyx":1042 + * buf[i] = temp4byte + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() */ - __pyx_t_5 = __pyx_v_number_of_records; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":800 - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes - * for i in range(number_of_records): - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< - * pos_byte_end + record_byte_size * i], dtype=record_format) - * if swap == 0: + /* "dataRead.pyx":1041 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) + * buf[i] = temp4byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } - /* "dataRead.pyx":801 - * for i in range(number_of_records): - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i], dtype=record_format) # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":1044 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * elif n_bytes == 4: + * if swap == 0: */ - __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i)), (__pyx_v_pos_byte_end + (__pyx_v_record_byte_size * __pyx_v_i)) - (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":800 - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes - * for i in range(number_of_records): - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< - * pos_byte_end + record_byte_size * i], dtype=record_format) - * if swap == 0: + /* "dataRead.pyx":1037 + * cdef unsigned char temp4[4] + * cdef unsigned char temp3[3] + * if bit_count == 32: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], 4) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error); - __pyx_t_4 = 0; + } - /* "dataRead.pyx":801 - * for i in range(number_of_records): - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i], dtype=record_format) # <<<<<<<<<<<<<< - * if swap == 0: - * return buf + /* "dataRead.pyx":1045 + * else: + * return buf.byteswap() + * elif n_bytes == 4: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 801, __pyx_L1_error) + __pyx_t_6 = (__pyx_v_n_bytes == 4); + if (__pyx_t_6) { - /* "dataRead.pyx":800 - * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes - * for i in range(number_of_records): - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< - * pos_byte_end + record_byte_size * i], dtype=record_format) - * if swap == 0: + /* "dataRead.pyx":1046 + * return buf.byteswap() + * elif n_bytes == 4: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_buf), __pyx_v_i, __pyx_t_2, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 800, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { - /* "dataRead.pyx":802 - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i], dtype=record_format) - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":1047 + * elif n_bytes == 4: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift */ - __pyx_t_8 = (__pyx_v_swap == 0); - if (__pyx_t_8) { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":803 - * pos_byte_end + record_byte_size * i], dtype=record_format) - * if swap == 0: - * return buf # <<<<<<<<<<<<<< - * else: - * return buf.byteswap() + /* "dataRead.pyx":1048 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_buf); - __pyx_r = ((PyObject *)__pyx_v_buf); - goto __pyx_L0; + (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":802 - * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ - * pos_byte_end + record_byte_size * i], dtype=record_format) - * if swap == 0: # <<<<<<<<<<<<<< - * return buf - * else: + /* "dataRead.pyx":1050 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ - } + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { - /* "dataRead.pyx":805 - * return buf - * else: - * return buf.byteswap() # <<<<<<<<<<<<<< - * - * def unsorted_data_read4(record, info, bytes tmp, + /* "dataRead.pyx":1051 + * # right shift + * if bit_offset > 0: + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 32: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = NULL; - __pyx_t_9 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_9 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; - __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":793 - * return buf - * - * cdef inline read_array(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< - * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, - * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + /* "dataRead.pyx":1050 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ + } - /* function exit code */ - __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("dataRead.read_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_buf); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":1053 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + */ + __pyx_t_6 = (__pyx_v_bit_count < 32); + if (__pyx_t_6) { -/* "dataRead.pyx":807 - * return buf.byteswap() - * - * def unsorted_data_read4(record, info, bytes tmp, # <<<<<<<<<<<<<< - * const unsigned short record_id_size, - * const unsigned long long data_block_length): + /* "dataRead.pyx":1054 + * # mask left part + * if bit_count < 32: + * temp4byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend */ + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); -/* Python wrapper */ -static PyObject *__pyx_pw_8dataRead_3unsorted_data_read4(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -); /*proto*/ -PyDoc_STRVAR(__pyx_doc_8dataRead_2unsorted_data_read4, " reads only the channels using offset functions, channel by channel within unsorted data\n\n Parameters\n ------------\n record : class\n record class\n info: class\n info class\n tmp : bytes\n byte stream\n record_id_size : unsigned short\n record id length\n data_block_length : unsigned long long\n length of data block minus header\n\n Returns\n --------\n buf : array\n data array\n\n "); -static PyMethodDef __pyx_mdef_8dataRead_3unsorted_data_read4 = {"unsorted_data_read4", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_3unsorted_data_read4, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_2unsorted_data_read4}; -static PyObject *__pyx_pw_8dataRead_3unsorted_data_read4(PyObject *__pyx_self, -#if CYTHON_METH_FASTCALL -PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds -#else -PyObject *__pyx_args, PyObject *__pyx_kwds -#endif -) { - PyObject *__pyx_v_record = 0; - PyObject *__pyx_v_info = 0; - PyObject *__pyx_v_tmp = 0; - unsigned short __pyx_v_record_id_size; - unsigned PY_LONG_LONG __pyx_v_data_block_length; - #if !CYTHON_METH_FASTCALL - CYTHON_UNUSED Py_ssize_t __pyx_nargs; - #endif - CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[5] = {0,0,0,0,0}; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unsorted_data_read4 (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; - #endif - #endif - __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); - { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_record,&__pyx_n_s_info,&__pyx_n_s_tmp,&__pyx_n_s_record_id_size,&__pyx_n_s_data_block_length,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_info)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 1); __PYX_ERR(0, 807, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tmp)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 2); __PYX_ERR(0, 807, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record_id_size)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 3); __PYX_ERR(0, 807, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data_block_length)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) - else { - __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 4); __PYX_ERR(0, 807, __pyx_L3_error) + /* "dataRead.pyx":1053 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + */ } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unsorted_data_read4") < 0)) __PYX_ERR(0, 807, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 5)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); - values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); - values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); - values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); - } - __pyx_v_record = values[0]; - __pyx_v_info = values[1]; - __pyx_v_tmp = ((PyObject*)values[2]); - __pyx_v_record_id_size = __Pyx_PyInt_As_unsigned_short(values[3]); if (unlikely((__pyx_v_record_id_size == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L3_error) - __pyx_v_data_block_length = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[4]); if (unlikely((__pyx_v_data_block_length == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 809, __pyx_L3_error) - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 807, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("dataRead.unsorted_data_read4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tmp), (&PyBytes_Type), 1, "tmp", 1))) __PYX_ERR(0, 807, __pyx_L1_error) - __pyx_r = __pyx_pf_8dataRead_2unsorted_data_read4(__pyx_self, __pyx_v_record, __pyx_v_info, __pyx_v_tmp, __pyx_v_record_id_size, __pyx_v_data_block_length); - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "dataRead.pyx":1055 + * if bit_count < 32: + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); -static PyObject *__pyx_pf_8dataRead_2unsorted_data_read4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_record, PyObject *__pyx_v_info, PyObject *__pyx_v_tmp, unsigned short __pyx_v_record_id_size, unsigned PY_LONG_LONG __pyx_v_data_block_length) { - char const *__pyx_v_bit_stream; - unsigned PY_LONG_LONG __pyx_v_position; - unsigned char __pyx_v_record_id_char; - unsigned short __pyx_v_record_id_short; - unsigned long __pyx_v_record_id_long; - unsigned PY_LONG_LONG __pyx_v_record_id_long_long; - PyObject *__pyx_v_buf = 0; - PyObject *__pyx_v_VLSD = 0; - PyObject *__pyx_v_pos_byte_beg = 0; - PyObject *__pyx_v_pos_byte_end = 0; - PyObject *__pyx_v_c_format_structure = 0; - CYTHON_UNUSED PyObject *__pyx_v_byte_length = 0; - PyObject *__pyx_v_numpy_format = 0; - PyObject *__pyx_v_index = 0; - PyObject *__pyx_v_CGrecordLength = 0; - PyObject *__pyx_v_VLSD_flag = 0; - PyObject *__pyx_v_VLSD_CG_name = 0; - PyObject *__pyx_v_VLSD_CG_signal_data_type = 0; - PyObject *__pyx_v_channel_name_set = 0; - PyObject *__pyx_v_record_id = NULL; - PyObject *__pyx_v_Channel = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_channel_name = NULL; - PyObject *__pyx_r = NULL; - __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; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - unsigned int __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *(*__pyx_t_19)(PyObject *); - unsigned PY_LONG_LONG __pyx_t_20; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unsorted_data_read4", 1); + /* "dataRead.pyx":1056 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":831 - * - * """ - * cdef const char* bit_stream = PyBytes_AsString(tmp) # <<<<<<<<<<<<<< - * cdef unsigned long long position = 0 - * cdef unsigned char record_id_char = 0 + /* "dataRead.pyx":1057 + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * else: */ - __pyx_t_1 = PyBytes_AsString(__pyx_v_tmp); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 831, __pyx_L1_error) - __pyx_v_bit_stream = __pyx_t_1; + __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); - /* "dataRead.pyx":832 - * """ - * cdef const char* bit_stream = PyBytes_AsString(tmp) - * cdef unsigned long long position = 0 # <<<<<<<<<<<<<< - * cdef unsigned char record_id_char = 0 - * cdef unsigned short record_id_short = 0 + /* "dataRead.pyx":1056 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte */ - __pyx_v_position = 0; + } - /* "dataRead.pyx":833 - * cdef const char* bit_stream = PyBytes_AsString(tmp) - * cdef unsigned long long position = 0 - * cdef unsigned char record_id_char = 0 # <<<<<<<<<<<<<< - * cdef unsigned short record_id_short = 0 - * cdef unsigned long record_id_long = 0 + /* "dataRead.pyx":1058 + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): */ - __pyx_v_record_id_char = 0; + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + } - /* "dataRead.pyx":834 - * cdef unsigned long long position = 0 - * cdef unsigned char record_id_char = 0 - * cdef unsigned short record_id_short = 0 # <<<<<<<<<<<<<< - * cdef unsigned long record_id_long = 0 - * cdef unsigned long long record_id_long_long = 0 + /* "dataRead.pyx":1046 + * return buf.byteswap() + * elif n_bytes == 4: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ - __pyx_v_record_id_short = 0; + goto __pyx_L7; + } - /* "dataRead.pyx":835 - * cdef unsigned char record_id_char = 0 - * cdef unsigned short record_id_short = 0 - * cdef unsigned long record_id_long = 0 # <<<<<<<<<<<<<< - * cdef unsigned long long record_id_long_long = 0 - * # initialise data structure + /* "dataRead.pyx":1060 + * buf[i] = temp4byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes */ - __pyx_v_record_id_long = 0; + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":836 - * cdef unsigned short record_id_short = 0 - * cdef unsigned long record_id_long = 0 - * cdef unsigned long long record_id_long_long = 0 # <<<<<<<<<<<<<< - * # initialise data structure - * # key is channel name + /* "dataRead.pyx":1061 + * else: + * for i in range(number_of_records): + * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes + * # right shift */ - __pyx_v_record_id_long_long = 0; + (void)(memcpy((&__pyx_v_temp4), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":839 - * # initialise data structure - * # key is channel name - * cdef dict buf = {} # <<<<<<<<<<<<<< - * cdef dict VLSD = {} - * cdef dict pos_byte_beg = {} + /* "dataRead.pyx":1062 + * for i in range(number_of_records): + * memcpy(&temp4, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_buf = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_temp4byte = (((((__pyx_v_temp4[0]) << 24) | ((__pyx_v_temp4[1]) << 16)) | ((__pyx_v_temp4[2]) << 8)) | (__pyx_v_temp4[3])); - /* "dataRead.pyx":840 - * # key is channel name - * cdef dict buf = {} - * cdef dict VLSD = {} # <<<<<<<<<<<<<< - * cdef dict pos_byte_beg = {} - * cdef dict pos_byte_end = {} + /* "dataRead.pyx":1064 + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_VLSD = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { - /* "dataRead.pyx":841 - * cdef dict buf = {} - * cdef dict VLSD = {} - * cdef dict pos_byte_beg = {} # <<<<<<<<<<<<<< - * cdef dict pos_byte_end = {} - * cdef dict c_format_structure = {} + /* "dataRead.pyx":1065 + * # right shift + * if bit_offset > 0: + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 32: */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_pos_byte_beg = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":842 - * cdef dict VLSD = {} - * cdef dict pos_byte_beg = {} - * cdef dict pos_byte_end = {} # <<<<<<<<<<<<<< - * cdef dict c_format_structure = {} - * cdef dict byte_length = {} + /* "dataRead.pyx":1064 + * temp4byte = temp4[0]<<24 | temp4[1]<<16 | temp4[2]<<8 | temp4[3] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_pos_byte_end = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + } - /* "dataRead.pyx":843 - * cdef dict pos_byte_beg = {} - * cdef dict pos_byte_end = {} - * cdef dict c_format_structure = {} # <<<<<<<<<<<<<< - * cdef dict byte_length = {} - * cdef dict numpy_format = {} + /* "dataRead.pyx":1067 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_c_format_structure = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_6 = (__pyx_v_bit_count < 32); + if (__pyx_t_6) { - /* "dataRead.pyx":844 - * cdef dict pos_byte_end = {} - * cdef dict c_format_structure = {} - * cdef dict byte_length = {} # <<<<<<<<<<<<<< - * cdef dict numpy_format = {} - * # key is record id + /* "dataRead.pyx":1068 + * # mask left part + * if bit_count < 32: + * temp4byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_byte_length = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); - /* "dataRead.pyx":845 - * cdef dict c_format_structure = {} - * cdef dict byte_length = {} - * cdef dict numpy_format = {} # <<<<<<<<<<<<<< - * # key is record id - * cdef dict index = {} + /* "dataRead.pyx":1067 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_numpy_format = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + } - /* "dataRead.pyx":847 - * cdef dict numpy_format = {} - * # key is record id - * cdef dict index = {} # <<<<<<<<<<<<<< - * cdef dict CGrecordLength = {} - * cdef dict VLSD_flag = {} + /* "dataRead.pyx":1069 + * if bit_count < 32: + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_index = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); - /* "dataRead.pyx":848 - * # key is record id - * cdef dict index = {} - * cdef dict CGrecordLength = {} # <<<<<<<<<<<<<< - * cdef dict VLSD_flag = {} - * cdef dict VLSD_CG_name = {} + /* "dataRead.pyx":1070 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_CGrecordLength = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":849 - * cdef dict index = {} - * cdef dict CGrecordLength = {} - * cdef dict VLSD_flag = {} # <<<<<<<<<<<<<< - * cdef dict VLSD_CG_name = {} - * cdef dict VLSD_CG_signal_data_type = {} + /* "dataRead.pyx":1071 + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * return buf */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_VLSD_flag = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); - /* "dataRead.pyx":850 - * cdef dict CGrecordLength = {} - * cdef dict VLSD_flag = {} - * cdef dict VLSD_CG_name = {} # <<<<<<<<<<<<<< - * cdef dict VLSD_CG_signal_data_type = {} - * cdef dict channel_name_set = {} + /* "dataRead.pyx":1070 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_VLSD_CG_name = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + } - /* "dataRead.pyx":851 - * cdef dict VLSD_flag = {} - * cdef dict VLSD_CG_name = {} - * cdef dict VLSD_CG_signal_data_type = {} # <<<<<<<<<<<<<< - * cdef dict channel_name_set = {} - * for record_id in record: + /* "dataRead.pyx":1072 + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * return buf + * else: # on 3 bytes */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_VLSD_CG_signal_data_type = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + } + } + __pyx_L7:; - /* "dataRead.pyx":852 - * cdef dict VLSD_CG_name = {} - * cdef dict VLSD_CG_signal_data_type = {} - * cdef dict channel_name_set = {} # <<<<<<<<<<<<<< - * for record_id in record: - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) + /* "dataRead.pyx":1073 + * temp4byte |= sign_extend + * buf[i] = temp4byte + * return buf # <<<<<<<<<<<<<< + * else: # on 3 bytes + * if swap == 0: */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_channel_name_set = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; - /* "dataRead.pyx":853 - * cdef dict VLSD_CG_signal_data_type = {} - * cdef dict channel_name_set = {} - * for record_id in record: # <<<<<<<<<<<<<< - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) - * VLSD_flag[record_id] = True + /* "dataRead.pyx":1045 + * else: + * return buf.byteswap() + * elif n_bytes == 4: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): */ - if (likely(PyList_CheckExact(__pyx_v_record)) || PyTuple_CheckExact(__pyx_v_record)) { - __pyx_t_2 = __pyx_v_record; __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_record); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 853, __pyx_L1_error) } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - { - Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); - #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 853, __pyx_L1_error) - #endif - if (__pyx_t_3 >= __pyx_temp) break; - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 853, __pyx_L1_error) - #else - __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - { - Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); - #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 853, __pyx_L1_error) - #endif - if (__pyx_t_3 >= __pyx_temp) break; - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 853, __pyx_L1_error) - #else - __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 853, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_record_id, __pyx_t_5); - __pyx_t_5 = 0; - /* "dataRead.pyx":854 - * cdef dict channel_name_set = {} - * for record_id in record: - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) # <<<<<<<<<<<<<< - * VLSD_flag[record_id] = True - * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + /* "dataRead.pyx":1075 + * return buf + * else: # on 3 bytes + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * temp4byte = 0 # must zero high byte: memcpy only writes n_bytes=3, and sign_extend may have set it to 0xFF */ - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_record); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_33, 33, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_7) { + /*else*/ { + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { - /* "dataRead.pyx":855 - * for record_id in record: - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) - * VLSD_flag[record_id] = True # <<<<<<<<<<<<<< - * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] - * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] + /* "dataRead.pyx":1076 + * else: # on 3 bytes + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * temp4byte = 0 # must zero high byte: memcpy only writes n_bytes=3, and sign_extend may have set it to 0xFF + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) */ - if (unlikely((PyDict_SetItem(__pyx_v_VLSD_flag, __pyx_v_record_id, Py_True) < 0))) __PYX_ERR(0, 855, __pyx_L1_error) + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":856 - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) - * VLSD_flag[record_id] = True - * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] # <<<<<<<<<<<<<< - * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] - * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) + /* "dataRead.pyx":1077 + * if swap == 0: + * for i in range(number_of_records): + * temp4byte = 0 # must zero high byte: memcpy only writes n_bytes=3, and sign_extend may have set it to 0xFF # <<<<<<<<<<<<<< + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_record); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_VLSD_CG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_channelName); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely((PyDict_SetItem(__pyx_v_VLSD, __pyx_t_5, __pyx_t_6) < 0))) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_temp4byte = 0; - /* "dataRead.pyx":857 - * VLSD_flag[record_id] = True - * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] - * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] # <<<<<<<<<<<<<< - * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) - * else: + /* "dataRead.pyx":1078 + * for i in range(number_of_records): + * temp4byte = 0 # must zero high byte: memcpy only writes n_bytes=3, and sign_extend may have set it to 0xFF + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: */ - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_record); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_VLSD_CG); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_channelName); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely((PyDict_SetItem(__pyx_v_VLSD_CG_name, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + (void)(memcpy((&__pyx_v_temp4byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":858 - * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] - * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] - * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) # <<<<<<<<<<<<<< - * else: - * VLSD_flag[record_id] = False + /* "dataRead.pyx":1080 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1081 + * # right shift + * if bit_offset > 0: + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 24: + */ + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1080 + * memcpy(&temp4byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_record); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_VLSD_CG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_channel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_signal_data_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_9 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_9 = 1; } + + /* "dataRead.pyx":1083 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + */ + __pyx_t_6 = (__pyx_v_bit_count < 24); + if (__pyx_t_6) { + + /* "dataRead.pyx":1084 + * # mask left part + * if bit_count < 24: + * temp4byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + + /* "dataRead.pyx":1083 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + */ + } + + /* "dataRead.pyx":1085 + * if bit_count < 24: + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1086 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1087 + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * else: + */ + __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1086 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte + */ + } + + /* "dataRead.pyx":1088 + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_info}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - if (unlikely((PyDict_SetItem(__pyx_v_VLSD_CG_signal_data_type, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 858, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "dataRead.pyx":854 - * cdef dict channel_name_set = {} - * for record_id in record: - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) # <<<<<<<<<<<<<< - * VLSD_flag[record_id] = True - * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + /* "dataRead.pyx":1075 + * return buf + * else: # on 3 bytes + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * temp4byte = 0 # must zero high byte: memcpy only writes n_bytes=3, and sign_extend may have set it to 0xFF */ - goto __pyx_L5; + goto __pyx_L18; } - /* "dataRead.pyx":860 - * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) + /* "dataRead.pyx":1090 + * buf[i] = temp4byte * else: - * VLSD_flag[record_id] = False # <<<<<<<<<<<<<< - * for Channel in record[record_id]['record'].values(): - * #if not Channel.VLSD_CG_Flag: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes */ /*else*/ { - if (unlikely((PyDict_SetItem(__pyx_v_VLSD_flag, __pyx_v_record_id, Py_False) < 0))) __PYX_ERR(0, 860, __pyx_L1_error) + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "dataRead.pyx":861 + /* "dataRead.pyx":1091 * else: - * VLSD_flag[record_id] = False - * for Channel in record[record_id]['record'].values(): # <<<<<<<<<<<<<< - * #if not Channel.VLSD_CG_Flag: - * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), + * for i in range(number_of_records): + * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes + * # right shift */ - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 861, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_record); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 861, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__pyx_t_5 == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values"); - __PYX_ERR(0, 861, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_n_s_values, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 861, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); - __pyx_t_6 = __pyx_t_8; - __pyx_t_8 = 0; - while (1) { - __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_11, &__pyx_t_10, NULL, &__pyx_t_8, NULL, __pyx_t_12); - if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 861, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF_SET(__pyx_v_Channel, __pyx_t_8); - __pyx_t_8 = 0; + (void)(memcpy((&__pyx_v_temp3), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); - /* "dataRead.pyx":863 - * for Channel in record[record_id]['record'].values(): - * #if not Channel.VLSD_CG_Flag: - * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), # <<<<<<<<<<<<<< - * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') - * numpy_format[Channel.name] = Channel.data_format(info) + /* "dataRead.pyx":1092 + * for i in range(number_of_records): + * memcpy(&temp3, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_record); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_numberOfRecords); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_GIVEREF(__pyx_t_8); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error); - __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_14); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14)) __PYX_ERR(0, 863, __pyx_L1_error); - __pyx_t_14 = 0; + __pyx_v_temp4byte = ((((__pyx_v_temp3[0]) << 16) | ((__pyx_v_temp3[1]) << 8)) | (__pyx_v_temp3[2])); - /* "dataRead.pyx":864 - * #if not Channel.VLSD_CG_Flag: - * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), - * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') # <<<<<<<<<<<<<< - * numpy_format[Channel.name] = Channel.data_format(info) - * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset + /* "dataRead.pyx":1094 + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ - __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_V_2, __pyx_n_s_format); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_nBytes_aligned); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = NULL; - __pyx_t_9 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_16))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_16); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_16, function); - __pyx_t_9 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_17}; - __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_dtype, __pyx_t_15) < 0) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 864, __pyx_L1_error) + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { - /* "dataRead.pyx":863 - * for Channel in record[record_id]['record'].values(): - * #if not Channel.VLSD_CG_Flag: - * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), # <<<<<<<<<<<<<< - * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') - * numpy_format[Channel.name] = Channel.data_format(info) + /* "dataRead.pyx":1095 + * # right shift + * if bit_offset > 0: + * temp4byte = temp4byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 24: */ - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (unlikely((PyDict_SetItem(__pyx_v_buf, __pyx_t_14, __pyx_t_15) < 0))) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_v_temp4byte = (__pyx_v_temp4byte >> __pyx_v_bit_offset); - /* "dataRead.pyx":865 - * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), - * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') - * numpy_format[Channel.name] = Channel.data_format(info) # <<<<<<<<<<<<<< - * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset - * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned + /* "dataRead.pyx":1094 + * temp4byte = temp3[0]<<16 | temp3[1]<<8 | temp3[2] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp4byte = temp4byte >> bit_offset + * # mask left part */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_data_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_8 = NULL; - __pyx_t_9 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - __pyx_t_9 = 1; - } } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_info}; - __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "dataRead.pyx":1097 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + */ + __pyx_t_6 = (__pyx_v_bit_count < 24); + if (__pyx_t_6) { + + /* "dataRead.pyx":1098 + * # mask left part + * if bit_count < 24: + * temp4byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp4byte = (__pyx_v_temp4byte & __pyx_v_mask); + + /* "dataRead.pyx":1097 + * temp4byte = temp4byte >> bit_offset + * # mask left part + * if bit_count < 24: # <<<<<<<<<<<<<< + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + */ } - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (unlikely((PyDict_SetItem(__pyx_v_numpy_format, __pyx_t_14, __pyx_t_15) < 0))) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "dataRead.pyx":866 - * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') - * numpy_format[Channel.name] = Channel.data_format(info) - * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset # <<<<<<<<<<<<<< - * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned - * index[record_id] = 0 + /* "dataRead.pyx":1099 + * if bit_count < 24: + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend */ - __pyx_t_15 = __Pyx_PyInt_From_unsigned_short(__pyx_v_record_id_size); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_byteOffset); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_8 = PyNumber_Add(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (unlikely((PyDict_SetItem(__pyx_v_pos_byte_beg, __pyx_t_14, __pyx_t_8) < 0))) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_sign_bit = (__pyx_v_temp4byte & __pyx_v_sign_bit_mask); - /* "dataRead.pyx":867 - * numpy_format[Channel.name] = Channel.data_format(info) - * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset - * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned # <<<<<<<<<<<<<< - * index[record_id] = 0 - * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength + /* "dataRead.pyx":1100 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_pos_byte_beg, __pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_nBytes_aligned); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PyNumber_Add(__pyx_t_14, __pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely((PyDict_SetItem(__pyx_v_pos_byte_end, __pyx_t_8, __pyx_t_15) < 0))) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { - /* "dataRead.pyx":868 - * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset - * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned - * index[record_id] = 0 # <<<<<<<<<<<<<< - * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength - * channel_name_set[record_id] = record[record_id]['record'].channelNames + /* "dataRead.pyx":1101 + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp4byte + * return buf */ - if (unlikely((PyDict_SetItem(__pyx_v_index, __pyx_v_record_id, __pyx_int_0) < 0))) __PYX_ERR(0, 868, __pyx_L1_error) + __pyx_v_temp4byte = (__pyx_v_temp4byte | __pyx_v_sign_extend); - /* "dataRead.pyx":869 - * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned - * index[record_id] = 0 - * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength # <<<<<<<<<<<<<< - * channel_name_set[record_id] = record[record_id]['record'].channelNames - * # read data + /* "dataRead.pyx":1100 + * temp4byte &= mask + * sign_bit = temp4byte & sign_bit_mask # assumes return in little endian, to be reviewed + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp4byte |= sign_extend + * buf[i] = temp4byte */ - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_record); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_CGrecordLength); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely((PyDict_SetItem(__pyx_v_CGrecordLength, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } - /* "dataRead.pyx":870 - * index[record_id] = 0 - * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength - * channel_name_set[record_id] = record[record_id]['record'].channelNames # <<<<<<<<<<<<<< - * # read data - * if record_id_size == 1: + /* "dataRead.pyx":1102 + * if sign_bit: # negative value, sign extend + * temp4byte |= sign_extend + * buf[i] = temp4byte # <<<<<<<<<<<<<< + * return buf + * */ - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_record); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_channelNames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely((PyDict_SetItem(__pyx_v_channel_name_set, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp4byte; + } } - __pyx_L5:; + __pyx_L18:; - /* "dataRead.pyx":853 - * cdef dict VLSD_CG_signal_data_type = {} - * cdef dict channel_name_set = {} - * for record_id in record: # <<<<<<<<<<<<<< - * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) - * VLSD_flag[record_id] = True + /* "dataRead.pyx":1103 + * temp4byte |= sign_extend + * buf[i] = temp4byte + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_unsigned_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dataRead.pyx":872 - * channel_name_set[record_id] = record[record_id]['record'].channelNames - * # read data - * if record_id_size == 1: # <<<<<<<<<<<<<< - * while position < data_block_length: - * memcpy(&record_id_char, &bit_stream[position], 1) + /* "dataRead.pyx":1025 + * + * + * cdef inline read_signed_int(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): */ - switch (__pyx_v_record_id_size) { - case 1: - /* "dataRead.pyx":873 - * # read data - * if record_id_size == 1: - * while position < data_block_length: # <<<<<<<<<<<<<< - * memcpy(&record_id_char, &bit_stream[position], 1) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, - */ - while (1) { - __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); - if (!__pyx_t_7) break; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_signed_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":874 - * if record_id_size == 1: - * while position < data_block_length: - * memcpy(&record_id_char, &bit_stream[position], 1) # <<<<<<<<<<<<<< - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, - * position, buf, VLSD, pos_byte_beg, pos_byte_end, +/* "dataRead.pyx":1105 + * return buf + * + * cdef inline read_unsigned_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): */ - (void)(memcpy((&__pyx_v_record_id_char), (&(__pyx_v_bit_stream[__pyx_v_position])), 1)); - /* "dataRead.pyx":875 - * while position < data_block_length: - * memcpy(&record_id_char, &bit_stream[position], 1) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, - */ - __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_v_record_id_char); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_unsigned_longlong(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned PY_LONG_LONG __pyx_v_mask; + unsigned PY_LONG_LONG __pyx_v_temp8byte; + unsigned char __pyx_v_temp8[8]; + unsigned char __pyx_v_temp7[7]; + unsigned char __pyx_v_temp6[6]; + unsigned char __pyx_v_temp5[5]; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_unsigned_longlong", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; - /* "dataRead.pyx":878 - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< - * elif record_id_size == 2: - * while position < data_block_length: + /* "dataRead.pyx":1108 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * cdef np.ndarray[np.uint64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long long mask = ((1 << bit_count) - 1) */ - __pyx_t_6 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_2, 1, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { - PyObject* sequence = __pyx_t_6; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 875, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 1108, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1108, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1108, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dataRead.pyx":1110 + * cdef np.ndarray[np.uint64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned long long mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef unsigned long long temp8byte = 0 + * cdef unsigned char temp8[8] + */ + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + + /* "dataRead.pyx":1111 + * cdef unsigned long long i + * cdef unsigned long long mask = ((1 << bit_count) - 1) + * cdef unsigned long long temp8byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned char temp8[8] + * cdef unsigned char temp7[7] + */ + __pyx_v_temp8byte = 0; + + /* "dataRead.pyx":1116 + * cdef unsigned char temp6[6] + * cdef unsigned char temp5[5] + * if bit_count == 64: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_bit_count == 64); + if (__pyx_t_6) { + + /* "dataRead.pyx":1117 + * cdef unsigned char temp5[5] + * if bit_count == 64: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1118 + * if bit_count == 64: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * if swap == 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1119 + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * if swap == 0: + * return buf + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1120 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1121 + * buf[i] = temp8byte + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":1120 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + } + + /* "dataRead.pyx":1123 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * elif n_bytes == 8: + * if swap == 0: + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "dataRead.pyx":1116 + * cdef unsigned char temp6[6] + * cdef unsigned char temp5[5] + * if bit_count == 64: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + } + + /* "dataRead.pyx":1124 + * else: + * return buf.byteswap() + * elif n_bytes == 8: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 8); + if (__pyx_t_6) { + + /* "dataRead.pyx":1125 + * return buf.byteswap() + * elif n_bytes == 8: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1126 + * elif n_bytes == 8: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1127 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1129 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1130 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 64: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1129 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1132 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 64); + if (__pyx_t_6) { + + /* "dataRead.pyx":1133 + * # mask left part + * if bit_count < 64: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1132 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1134 + * if bit_count < 64: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1125 + * return buf.byteswap() + * elif n_bytes == 8: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L7; + } + + /* "dataRead.pyx":1136 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1137 + * else: + * for i in range(number_of_records): + * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + * temp8[2]<<40 | temp8[3]<<32 | \ + */ + (void)(memcpy((&__pyx_v_temp8), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1140 + * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + * temp8[2]<<40 | temp8[3]<<32 | \ + * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = ((((((((((uint64_t)(__pyx_v_temp8[0])) << 56) | (((uint64_t)(__pyx_v_temp8[1])) << 48)) | (((uint64_t)(__pyx_v_temp8[2])) << 40)) | (((uint64_t)(__pyx_v_temp8[3])) << 32)) | ((__pyx_v_temp8[4]) << 24)) | ((__pyx_v_temp8[5]) << 16)) | ((__pyx_v_temp8[6]) << 8)) | (__pyx_v_temp8[7])); + + /* "dataRead.pyx":1142 + * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1143 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 64: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1142 + * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1145 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 64); + if (__pyx_t_6) { + + /* "dataRead.pyx":1146 + * # mask left part + * if bit_count < 64: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * elif n_bytes == 7: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1145 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1147 + * if bit_count < 64: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * elif n_bytes == 7: + * if swap == 0: + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L7:; + + /* "dataRead.pyx":1124 + * else: + * return buf.byteswap() + * elif n_bytes == 8: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1148 + * temp8byte &= mask + * buf[i] = temp8byte + * elif n_bytes == 7: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 7); + if (__pyx_t_6) { + + /* "dataRead.pyx":1149 + * buf[i] = temp8byte + * elif n_bytes == 7: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1150 + * elif n_bytes == 7: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1151 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1153 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1154 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 56: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1153 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1156 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 56); + if (__pyx_t_6) { + + /* "dataRead.pyx":1157 + * # mask left part + * if bit_count < 56: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1156 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1158 + * if bit_count < 56: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1149 + * buf[i] = temp8byte + * elif n_bytes == 7: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L16; + } + + /* "dataRead.pyx":1160 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1161 + * else: + * for i in range(number_of_records): + * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + */ + (void)(memcpy((&__pyx_v_temp7), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1163 + * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = (((((((((uint64_t)(__pyx_v_temp7[0])) << 48) | (((uint64_t)(__pyx_v_temp7[1])) << 40)) | (((uint64_t)(__pyx_v_temp7[2])) << 32)) | ((__pyx_v_temp7[3]) << 24)) | ((__pyx_v_temp7[4]) << 16)) | ((__pyx_v_temp7[5]) << 8)) | (__pyx_v_temp7[6])); + + /* "dataRead.pyx":1165 + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1166 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 56: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1165 + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1168 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 56); + if (__pyx_t_6) { + + /* "dataRead.pyx":1169 + * # mask left part + * if bit_count < 56: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * elif n_bytes == 6: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1168 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1170 + * if bit_count < 56: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * elif n_bytes == 6: + * if swap == 0: + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L16:; + + /* "dataRead.pyx":1148 + * temp8byte &= mask + * buf[i] = temp8byte + * elif n_bytes == 7: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1171 + * temp8byte &= mask + * buf[i] = temp8byte + * elif n_bytes == 6: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 6); + if (__pyx_t_6) { + + /* "dataRead.pyx":1172 + * buf[i] = temp8byte + * elif n_bytes == 6: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1173 + * elif n_bytes == 6: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1174 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1176 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1177 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 48: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1176 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1179 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 48); + if (__pyx_t_6) { + + /* "dataRead.pyx":1180 + * # mask left part + * if bit_count < 48: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1179 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1181 + * if bit_count < 48: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1172 + * buf[i] = temp8byte + * elif n_bytes == 6: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L25; + } + + /* "dataRead.pyx":1183 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1184 + * else: + * for i in range(number_of_records): + * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + */ + (void)(memcpy((&__pyx_v_temp6), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1186 + * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = ((((((((uint64_t)(__pyx_v_temp6[0])) << 40) | (((uint64_t)(__pyx_v_temp6[1])) << 32)) | ((__pyx_v_temp6[2]) << 24)) | ((__pyx_v_temp6[3]) << 16)) | ((__pyx_v_temp6[4]) << 8)) | (__pyx_v_temp6[5])); + + /* "dataRead.pyx":1188 + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1189 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 48: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1188 + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1191 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 48); + if (__pyx_t_6) { + + /* "dataRead.pyx":1192 + * # mask left part + * if bit_count < 48: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * elif n_bytes == 5: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1191 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1193 + * if bit_count < 48: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * elif n_bytes == 5: + * if swap == 0: + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L25:; + + /* "dataRead.pyx":1171 + * temp8byte &= mask + * buf[i] = temp8byte + * elif n_bytes == 6: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1194 + * temp8byte &= mask + * buf[i] = temp8byte + * elif n_bytes == 5: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 5); + if (__pyx_t_6) { + + /* "dataRead.pyx":1195 + * buf[i] = temp8byte + * elif n_bytes == 5: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1196 + * elif n_bytes == 5: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1197 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1199 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1200 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 32: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1199 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1202 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 32); + if (__pyx_t_6) { + + /* "dataRead.pyx":1203 + * # mask left part + * if bit_count < 32: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1202 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1204 + * if bit_count < 32: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1195 + * buf[i] = temp8byte + * elif n_bytes == 5: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L34; + } + + /* "dataRead.pyx":1206 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1207 + * else: + * for i in range(number_of_records): + * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + */ + (void)(memcpy((&__pyx_v_temp5), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1209 + * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = (((((((uint64_t)(__pyx_v_temp5[0])) << 32) | ((__pyx_v_temp5[1]) << 24)) | ((__pyx_v_temp5[2]) << 16)) | ((__pyx_v_temp5[3]) << 8)) | (__pyx_v_temp5[4])); + + /* "dataRead.pyx":1211 + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1212 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 32: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1211 + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1214 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_bit_count < 32); + if (__pyx_t_6) { + + /* "dataRead.pyx":1215 + * # mask left part + * if bit_count < 32: + * temp8byte &= mask # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * return buf + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1214 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 32: # <<<<<<<<<<<<<< + * temp8byte &= mask + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1216 + * if bit_count < 32: + * temp8byte &= mask + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * return buf + * + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L34:; + + /* "dataRead.pyx":1194 + * temp8byte &= mask + * buf[i] = temp8byte + * elif n_bytes == 5: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + } + __pyx_L3:; + + /* "dataRead.pyx":1217 + * temp8byte &= mask + * buf[i] = temp8byte + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_signed_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":1105 + * return buf + * + * cdef inline read_unsigned_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_unsigned_longlong", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":1219 + * return buf + * + * cdef inline read_signed_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + */ + +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_signed_longlong(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_bit_count, unsigned char __pyx_v_bit_offset, unsigned long __pyx_v_n_bytes, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned PY_LONG_LONG __pyx_v_mask; + PY_LONG_LONG __pyx_v_temp8byte; + unsigned long __pyx_v_sign_bit; + unsigned PY_LONG_LONG __pyx_v_sign_bit_mask; + unsigned PY_LONG_LONG __pyx_v_sign_extend; + unsigned char __pyx_v_temp8[8]; + unsigned char __pyx_v_temp7[7]; + unsigned char __pyx_v_temp6[6]; + unsigned char __pyx_v_temp5[5]; + __Pyx_LocalBuf_ND __pyx_pybuffernd_buf; + __Pyx_Buffer __pyx_pybuffer_buf; + 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; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + unsigned PY_LONG_LONG __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_signed_longlong", 1); + __pyx_pybuffer_buf.pybuffer.buf = NULL; + __pyx_pybuffer_buf.refcount = 0; + __pyx_pybuffernd_buf.data = NULL; + __pyx_pybuffernd_buf.rcbuffer = &__pyx_pybuffer_buf; + + /* "dataRead.pyx":1222 + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + * cdef np.ndarray[np.int64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long long mask = ((1 << bit_count) - 1) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 1222, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1222, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1222, __pyx_L1_error) + } else {__pyx_pybuffernd_buf.diminfo[0].strides = __pyx_pybuffernd_buf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf.diminfo[0].shape = __pyx_pybuffernd_buf.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dataRead.pyx":1224 + * cdef np.ndarray[np.int64_t] buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned long long mask = ((1 << bit_count) - 1) # <<<<<<<<<<<<<< + * cdef long long temp8byte = 0 + * cdef unsigned long sign_bit = 0 + */ + __pyx_v_mask = ((1 << __pyx_v_bit_count) - 1); + + /* "dataRead.pyx":1225 + * cdef unsigned long long i + * cdef unsigned long long mask = ((1 << bit_count) - 1) + * cdef long long temp8byte = 0 # <<<<<<<<<<<<<< + * cdef unsigned long sign_bit = 0 + * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) + */ + __pyx_v_temp8byte = 0; + + /* "dataRead.pyx":1226 + * cdef unsigned long long mask = ((1 << bit_count) - 1) + * cdef long long temp8byte = 0 + * cdef unsigned long sign_bit = 0 # <<<<<<<<<<<<<< + * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned long long sign_extend = ((1 << (64 - bit_count)) - 1) << bit_count + */ + __pyx_v_sign_bit = 0; + + /* "dataRead.pyx":1227 + * cdef long long temp8byte = 0 + * cdef unsigned long sign_bit = 0 + * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) # <<<<<<<<<<<<<< + * cdef unsigned long long sign_extend = ((1 << (64 - bit_count)) - 1) << bit_count + * cdef unsigned char temp8[8] + */ + __pyx_v_sign_bit_mask = (1 << (__pyx_v_bit_count - 1)); + + /* "dataRead.pyx":1228 + * cdef unsigned long sign_bit = 0 + * cdef unsigned long long sign_bit_mask = (1 << (bit_count-1)) + * cdef unsigned long long sign_extend = ((1 << (64 - bit_count)) - 1) << bit_count # <<<<<<<<<<<<<< + * cdef unsigned char temp8[8] + * cdef unsigned char temp7[7] + */ + __pyx_v_sign_extend = (((1 << (64 - __pyx_v_bit_count)) - 1) << __pyx_v_bit_count); + + /* "dataRead.pyx":1233 + * cdef unsigned char temp6[6] + * cdef unsigned char temp5[5] + * if bit_count == 64: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_bit_count == 64); + if (__pyx_t_6) { + + /* "dataRead.pyx":1234 + * cdef unsigned char temp5[5] + * if bit_count == 64: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1235 + * if bit_count == 64: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * if swap == 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1236 + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * if swap == 0: + * return buf + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1237 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1238 + * buf[i] = temp8byte + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":1237 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * buf[i] = temp8byte + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + } + + /* "dataRead.pyx":1240 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * elif n_bytes == 8: + * if swap == 0: + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "dataRead.pyx":1233 + * cdef unsigned char temp6[6] + * cdef unsigned char temp5[5] + * if bit_count == 64: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + } + + /* "dataRead.pyx":1241 + * else: + * return buf.byteswap() + * elif n_bytes == 8: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 8); + if (__pyx_t_6) { + + /* "dataRead.pyx":1242 + * return buf.byteswap() + * elif n_bytes == 8: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1243 + * elif n_bytes == 8: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1244 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1246 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1247 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 64: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1246 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1249 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 64); + if (__pyx_t_6) { + + /* "dataRead.pyx":1250 + * # mask left part + * if bit_count < 64: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1249 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1251 + * if bit_count < 64: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1252 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1253 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1252 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1254 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1242 + * return buf.byteswap() + * elif n_bytes == 8: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L7; + } + + /* "dataRead.pyx":1256 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1257 + * else: + * for i in range(number_of_records): + * memcpy(&temp8, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + * temp8[2]<<40 | temp8[3]<<32 | \ + */ + (void)(memcpy((&__pyx_v_temp8), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1260 + * temp8byte = temp8[0]<<56 | temp8[1]<<48 | \ + * temp8[2]<<40 | temp8[3]<<32 | \ + * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = ((((((((((uint64_t)(__pyx_v_temp8[0])) << 56) | (((uint64_t)(__pyx_v_temp8[1])) << 48)) | (((uint64_t)(__pyx_v_temp8[2])) << 40)) | (((uint64_t)(__pyx_v_temp8[3])) << 32)) | ((__pyx_v_temp8[4]) << 24)) | ((__pyx_v_temp8[5]) << 16)) | ((__pyx_v_temp8[6]) << 8)) | (__pyx_v_temp8[7])); + + /* "dataRead.pyx":1262 + * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1263 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 64: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1262 + * temp8[4]<<24 | temp8[5]<<16 | temp8[6]<<8 | temp8[7] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1265 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 64); + if (__pyx_t_6) { + + /* "dataRead.pyx":1266 + * # mask left part + * if bit_count < 64: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1265 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 64: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1267 + * if bit_count < 64: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1268 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1269 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * elif n_bytes == 7: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1268 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1270 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * elif n_bytes == 7: + * if swap == 0: + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L7:; + + /* "dataRead.pyx":1241 + * else: + * return buf.byteswap() + * elif n_bytes == 8: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1271 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * elif n_bytes == 7: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 7); + if (__pyx_t_6) { + + /* "dataRead.pyx":1272 + * buf[i] = temp8byte + * elif n_bytes == 7: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1273 + * elif n_bytes == 7: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1274 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1276 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1277 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 56: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1276 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1279 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 56); + if (__pyx_t_6) { + + /* "dataRead.pyx":1280 + * # mask left part + * if bit_count < 56: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1279 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1281 + * if bit_count < 56: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1282 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1283 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1282 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1284 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1272 + * buf[i] = temp8byte + * elif n_bytes == 7: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L18; + } + + /* "dataRead.pyx":1286 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1287 + * else: + * for i in range(number_of_records): + * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + */ + (void)(memcpy((&__pyx_v_temp7), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1289 + * memcpy(&temp7, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp7[0]<<48 | temp7[1]<<40 | temp7[2]<<32 | \ + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = (((((((((uint64_t)(__pyx_v_temp7[0])) << 48) | (((uint64_t)(__pyx_v_temp7[1])) << 40)) | (((uint64_t)(__pyx_v_temp7[2])) << 32)) | ((__pyx_v_temp7[3]) << 24)) | ((__pyx_v_temp7[4]) << 16)) | ((__pyx_v_temp7[5]) << 8)) | (__pyx_v_temp7[6])); + + /* "dataRead.pyx":1291 + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1292 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 56: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1291 + * temp7[3]<<24 | temp7[4]<<16 | temp7[5]<<8 | temp7[6] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1294 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 56); + if (__pyx_t_6) { + + /* "dataRead.pyx":1295 + * # mask left part + * if bit_count < 56: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1294 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 56: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1296 + * if bit_count < 56: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1297 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1298 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * elif n_bytes == 6: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1297 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1299 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * elif n_bytes == 6: + * if swap == 0: + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L18:; + + /* "dataRead.pyx":1271 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * elif n_bytes == 7: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1300 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * elif n_bytes == 6: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 6); + if (__pyx_t_6) { + + /* "dataRead.pyx":1301 + * buf[i] = temp8byte + * elif n_bytes == 6: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1302 + * elif n_bytes == 6: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1303 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1305 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1306 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 48: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1305 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1308 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 48); + if (__pyx_t_6) { + + /* "dataRead.pyx":1309 + * # mask left part + * if bit_count < 48: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1308 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1310 + * if bit_count < 48: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1311 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1312 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1311 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1313 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1301 + * buf[i] = temp8byte + * elif n_bytes == 6: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L29; + } + + /* "dataRead.pyx":1315 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1316 + * else: + * for i in range(number_of_records): + * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + */ + (void)(memcpy((&__pyx_v_temp6), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1318 + * memcpy(&temp6, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp6[0]<<40 | temp6[1]<<32 | temp6[2]<<24 | \ + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = ((((((((uint64_t)(__pyx_v_temp6[0])) << 40) | (((uint64_t)(__pyx_v_temp6[1])) << 32)) | ((__pyx_v_temp6[2]) << 24)) | ((__pyx_v_temp6[3]) << 16)) | ((__pyx_v_temp6[4]) << 8)) | (__pyx_v_temp6[5])); + + /* "dataRead.pyx":1320 + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1321 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 48: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1320 + * temp6[3]<<16 | temp6[4]<<8 | temp6[5] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1323 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 48); + if (__pyx_t_6) { + + /* "dataRead.pyx":1324 + * # mask left part + * if bit_count < 48: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1323 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 48: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1325 + * if bit_count < 48: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1326 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1327 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * elif n_bytes == 5: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1326 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1328 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * elif n_bytes == 5: + * if swap == 0: + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L29:; + + /* "dataRead.pyx":1300 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * elif n_bytes == 6: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1329 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * elif n_bytes == 5: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + __pyx_t_6 = (__pyx_v_n_bytes == 5); + if (__pyx_t_6) { + + /* "dataRead.pyx":1330 + * buf[i] = temp8byte + * elif n_bytes == 5: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + __pyx_t_6 = (__pyx_v_swap == 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1331 + * elif n_bytes == 5: + * if swap == 0: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + */ + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1332 + * if swap == 0: + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + (void)(memcpy((&__pyx_v_temp8byte), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1334 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1335 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 40: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1334 + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1337 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 40: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 40); + if (__pyx_t_6) { + + /* "dataRead.pyx":1338 + * # mask left part + * if bit_count < 40: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1337 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 40: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1339 + * if bit_count < 40: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1340 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1341 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * else: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1340 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1342 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * else: + * for i in range(number_of_records): + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + + /* "dataRead.pyx":1330 + * buf[i] = temp8byte + * elif n_bytes == 5: + * if swap == 0: # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * memcpy(&temp8byte, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + */ + goto __pyx_L40; + } + + /* "dataRead.pyx":1344 + * buf[i] = temp8byte + * else: + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + */ + /*else*/ { + __pyx_t_7 = __pyx_v_number_of_records; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "dataRead.pyx":1345 + * else: + * for i in range(number_of_records): + * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) # <<<<<<<<<<<<<< + * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + */ + (void)(memcpy((&__pyx_v_temp5), (&(__pyx_v_bit_stream[(__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))])), __pyx_v_n_bytes)); + + /* "dataRead.pyx":1347 + * memcpy(&temp5, &bit_stream[pos_byte_beg + record_byte_size * i], n_bytes) + * temp8byte = temp5[0]<<32 | temp5[1]<<24 | \ + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes # <<<<<<<<<<<<<< + * # right shift + * if bit_offset > 0: + */ + __pyx_v_temp8byte = (((((((uint64_t)(__pyx_v_temp5[0])) << 32) | ((__pyx_v_temp5[1]) << 24)) | ((__pyx_v_temp5[2]) << 16)) | ((__pyx_v_temp5[3]) << 8)) | (__pyx_v_temp5[4])); + + /* "dataRead.pyx":1349 + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + __pyx_t_6 = (__pyx_v_bit_offset > 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1350 + * # right shift + * if bit_offset > 0: + * temp8byte = temp8byte >> bit_offset # <<<<<<<<<<<<<< + * # mask left part + * if bit_count < 40: + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte >> __pyx_v_bit_offset); + + /* "dataRead.pyx":1349 + * temp5[2]<<16 | temp5[3]<<8 | temp5[4] # swap bytes + * # right shift + * if bit_offset > 0: # <<<<<<<<<<<<<< + * temp8byte = temp8byte >> bit_offset + * # mask left part + */ + } + + /* "dataRead.pyx":1352 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 40: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + __pyx_t_6 = (__pyx_v_bit_count < 40); + if (__pyx_t_6) { + + /* "dataRead.pyx":1353 + * # mask left part + * if bit_count < 40: + * temp8byte &= mask # <<<<<<<<<<<<<< + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte & __pyx_v_mask); + + /* "dataRead.pyx":1352 + * temp8byte = temp8byte >> bit_offset + * # mask left part + * if bit_count < 40: # <<<<<<<<<<<<<< + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + */ + } + + /* "dataRead.pyx":1354 + * if bit_count < 40: + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask # <<<<<<<<<<<<<< + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + */ + __pyx_v_sign_bit = (__pyx_v_temp8byte & __pyx_v_sign_bit_mask); + + /* "dataRead.pyx":1355 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + __pyx_t_6 = (__pyx_v_sign_bit != 0); + if (__pyx_t_6) { + + /* "dataRead.pyx":1356 + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend # <<<<<<<<<<<<<< + * buf[i] = temp8byte + * return buf + */ + __pyx_v_temp8byte = (__pyx_v_temp8byte | __pyx_v_sign_extend); + + /* "dataRead.pyx":1355 + * temp8byte &= mask + * sign_bit = temp8byte & sign_bit_mask + * if sign_bit: # negative value, sign extend # <<<<<<<<<<<<<< + * temp8byte |= sign_extend + * buf[i] = temp8byte + */ + } + + /* "dataRead.pyx":1357 + * if sign_bit: # negative value, sign extend + * temp8byte |= sign_extend + * buf[i] = temp8byte # <<<<<<<<<<<<<< + * return buf + * + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_buf.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf.diminfo[0].strides) = __pyx_v_temp8byte; + } + } + __pyx_L40:; + + /* "dataRead.pyx":1329 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * elif n_bytes == 5: # <<<<<<<<<<<<<< + * if swap == 0: + * for i in range(number_of_records): + */ + } + __pyx_L3:; + + /* "dataRead.pyx":1358 + * temp8byte |= sign_extend + * buf[i] = temp8byte + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_byte(const char* bit_stream, str record_format, unsigned long long number_of_records, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":1219 + * return buf + * + * cdef inline read_signed_longlong(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, + * unsigned long bit_count, unsigned char bit_offset, unsigned long n_bytes, unsigned char swap): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("dataRead.read_signed_longlong", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":1360 + * return buf + * + * cdef inline read_byte(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, + * unsigned long bit_count, unsigned char bit_offset): + */ + +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_byte(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, CYTHON_UNUSED unsigned long __pyx_v_bit_count, CYTHON_UNUSED unsigned char __pyx_v_bit_offset) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned long __pyx_v_pos_byte_end; + 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; + unsigned PY_LONG_LONG __pyx_t_5; + unsigned PY_LONG_LONG __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_byte", 1); + + /* "dataRead.pyx":1363 + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, + * unsigned long bit_count, unsigned char bit_offset): + * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 1363, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1363, __pyx_L1_error) + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dataRead.pyx":1365 + * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ + */ + __pyx_v_pos_byte_end = (__pyx_v_pos_byte_beg + __pyx_v_n_bytes); + + /* "dataRead.pyx":1366 + * cdef unsigned long long i + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i]) + */ + __pyx_t_5 = __pyx_v_number_of_records; + __pyx_t_6 = __pyx_t_5; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "dataRead.pyx":1367 + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * for i in range(number_of_records): + * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< + * pos_byte_end + record_byte_size * i]) + * return buf + */ + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i)), (__pyx_v_pos_byte_end + (__pyx_v_record_byte_size * __pyx_v_i)) - (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_buf), __pyx_v_i, __pyx_t_1, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1367, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dataRead.pyx":1369 + * buf[i] = bytes(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i]) + * return buf # <<<<<<<<<<<<<< + * + * cdef inline read_array(const char* bit_stream, str record_format, unsigned long long number_of_records, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":1360 + * return buf + * + * cdef inline read_byte(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, + * unsigned long bit_count, unsigned char bit_offset): + */ + + /* function exit code */ + __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("dataRead.read_byte", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":1371 + * return buf + * + * cdef inline read_array(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + */ + +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_read_array(char const *__pyx_v_bit_stream, PyObject *__pyx_v_record_format, unsigned PY_LONG_LONG __pyx_v_number_of_records, unsigned long __pyx_v_record_byte_size, unsigned long __pyx_v_pos_byte_beg, unsigned long __pyx_v_n_bytes, CYTHON_UNUSED unsigned long __pyx_v_bit_count, CYTHON_UNUSED unsigned char __pyx_v_bit_offset, unsigned char __pyx_v_swap) { + PyArrayObject *__pyx_v_buf = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned long __pyx_v_pos_byte_end; + 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; + unsigned PY_LONG_LONG __pyx_t_5; + unsigned PY_LONG_LONG __pyx_t_6; + unsigned PY_LONG_LONG __pyx_t_7; + int __pyx_t_8; + unsigned int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_array", 1); + + /* "dataRead.pyx":1374 + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_number_of_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 1374, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1374, __pyx_L1_error) + __pyx_v_buf = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dataRead.pyx":1376 + * cdef np.ndarray buf = np.empty(number_of_records, dtype=record_format) # return numpy array + * cdef unsigned long long i + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes # <<<<<<<<<<<<<< + * for i in range(number_of_records): + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + */ + __pyx_v_pos_byte_end = (__pyx_v_pos_byte_beg + __pyx_v_n_bytes); + + /* "dataRead.pyx":1377 + * cdef unsigned long long i + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * for i in range(number_of_records): # <<<<<<<<<<<<<< + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i], dtype=record_format) + */ + __pyx_t_5 = __pyx_v_number_of_records; + __pyx_t_6 = __pyx_t_5; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "dataRead.pyx":1378 + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * for i in range(number_of_records): + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< + * pos_byte_end + record_byte_size * i], dtype=record_format) + * if swap == 0: + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":1379 + * for i in range(number_of_records): + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i], dtype=record_format) # <<<<<<<<<<<<<< + * if swap == 0: + * return buf + */ + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i)), (__pyx_v_pos_byte_end + (__pyx_v_record_byte_size * __pyx_v_i)) - (__pyx_v_pos_byte_beg + (__pyx_v_record_byte_size * __pyx_v_i))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "dataRead.pyx":1378 + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * for i in range(number_of_records): + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< + * pos_byte_end + record_byte_size * i], dtype=record_format) + * if swap == 0: + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 1378, __pyx_L1_error); + __pyx_t_4 = 0; + + /* "dataRead.pyx":1379 + * for i in range(number_of_records): + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i], dtype=record_format) # <<<<<<<<<<<<<< + * if swap == 0: + * return buf + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_v_record_format) < 0) __PYX_ERR(0, 1379, __pyx_L1_error) + + /* "dataRead.pyx":1378 + * cdef unsigned long pos_byte_end = pos_byte_beg + n_bytes + * for i in range(number_of_records): + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ # <<<<<<<<<<<<<< + * pos_byte_end + record_byte_size * i], dtype=record_format) + * if swap == 0: + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_buf), __pyx_v_i, __pyx_t_2, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1378, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "dataRead.pyx":1380 + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i], dtype=record_format) + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + __pyx_t_8 = (__pyx_v_swap == 0); + if (__pyx_t_8) { + + /* "dataRead.pyx":1381 + * pos_byte_end + record_byte_size * i], dtype=record_format) + * if swap == 0: + * return buf # <<<<<<<<<<<<<< + * else: + * return buf.byteswap() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_buf); + __pyx_r = ((PyObject *)__pyx_v_buf); + goto __pyx_L0; + + /* "dataRead.pyx":1380 + * buf[i] = np.frombuffer(bit_stream[pos_byte_beg + record_byte_size * i:\ + * pos_byte_end + record_byte_size * i], dtype=record_format) + * if swap == 0: # <<<<<<<<<<<<<< + * return buf + * else: + */ + } + + /* "dataRead.pyx":1383 + * return buf + * else: + * return buf.byteswap() # <<<<<<<<<<<<<< + * + * def unsorted_data_read4(record, info, bytes tmp, + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buf), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "dataRead.pyx":1371 + * return buf + * + * cdef inline read_array(const char* bit_stream, str record_format, unsigned long long number_of_records, # <<<<<<<<<<<<<< + * unsigned long record_byte_size, unsigned long pos_byte_beg, unsigned long n_bytes, + * unsigned long bit_count, unsigned char bit_offset, unsigned char swap): + */ + + /* function exit code */ + __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("dataRead.read_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":1385 + * return buf.byteswap() + * + * def unsorted_data_read4(record, info, bytes tmp, # <<<<<<<<<<<<<< + * const unsigned short record_id_size, + * const unsigned long long data_block_length): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_5unsorted_data_read4(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_8dataRead_4unsorted_data_read4, " reads only the channels using offset functions, channel by channel within unsorted data\n\n Parameters\n ------------\n record : class\n record class\n info: class\n info class\n tmp : bytes\n byte stream\n record_id_size : unsigned short\n record id length\n data_block_length : unsigned long long\n length of data block minus header\n\n Returns\n --------\n buf : array\n data array\n\n "); +static PyMethodDef __pyx_mdef_8dataRead_5unsorted_data_read4 = {"unsorted_data_read4", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_5unsorted_data_read4, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_4unsorted_data_read4}; +static PyObject *__pyx_pw_8dataRead_5unsorted_data_read4(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_record = 0; + PyObject *__pyx_v_info = 0; + PyObject *__pyx_v_tmp = 0; + unsigned short __pyx_v_record_id_size; + unsigned PY_LONG_LONG __pyx_v_data_block_length; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unsorted_data_read4 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_record,&__pyx_n_s_info,&__pyx_n_s_tmp,&__pyx_n_s_record_id_size,&__pyx_n_s_data_block_length,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_info)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 1); __PYX_ERR(0, 1385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tmp)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 2); __PYX_ERR(0, 1385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_record_id_size)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 3); __PYX_ERR(0, 1385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data_block_length)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, 4); __PYX_ERR(0, 1385, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unsorted_data_read4") < 0)) __PYX_ERR(0, 1385, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_record = values[0]; + __pyx_v_info = values[1]; + __pyx_v_tmp = ((PyObject*)values[2]); + __pyx_v_record_id_size = __Pyx_PyInt_As_unsigned_short(values[3]); if (unlikely((__pyx_v_record_id_size == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + __pyx_v_data_block_length = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[4]); if (unlikely((__pyx_v_data_block_length == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unsorted_data_read4", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1385, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.unsorted_data_read4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tmp), (&PyBytes_Type), 1, "tmp", 1))) __PYX_ERR(0, 1385, __pyx_L1_error) + __pyx_r = __pyx_pf_8dataRead_4unsorted_data_read4(__pyx_self, __pyx_v_record, __pyx_v_info, __pyx_v_tmp, __pyx_v_record_id_size, __pyx_v_data_block_length); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8dataRead_4unsorted_data_read4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_record, PyObject *__pyx_v_info, PyObject *__pyx_v_tmp, unsigned short __pyx_v_record_id_size, unsigned PY_LONG_LONG __pyx_v_data_block_length) { + char const *__pyx_v_bit_stream; + unsigned PY_LONG_LONG __pyx_v_position; + unsigned char __pyx_v_record_id_char; + unsigned short __pyx_v_record_id_short; + unsigned long __pyx_v_record_id_long; + unsigned PY_LONG_LONG __pyx_v_record_id_long_long; + PyObject *__pyx_v_buf = 0; + PyObject *__pyx_v_VLSD = 0; + PyObject *__pyx_v_pos_byte_beg = 0; + PyObject *__pyx_v_pos_byte_end = 0; + PyObject *__pyx_v_c_format_structure = 0; + CYTHON_UNUSED PyObject *__pyx_v_byte_length = 0; + PyObject *__pyx_v_numpy_format = 0; + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_CGrecordLength = 0; + PyObject *__pyx_v_VLSD_flag = 0; + PyObject *__pyx_v_VLSD_CG_name = 0; + PyObject *__pyx_v_VLSD_CG_signal_data_type = 0; + PyObject *__pyx_v_channel_name_set = 0; + PyObject *__pyx_v_record_id = NULL; + PyObject *__pyx_v_Channel = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_channel_name = NULL; + PyObject *__pyx_r = NULL; + __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; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + unsigned int __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *(*__pyx_t_19)(PyObject *); + unsigned PY_LONG_LONG __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unsorted_data_read4", 1); + + /* "dataRead.pyx":1409 + * + * """ + * cdef const char* bit_stream = PyBytes_AsString(tmp) # <<<<<<<<<<<<<< + * cdef unsigned long long position = 0 + * cdef unsigned char record_id_char = 0 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_tmp); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 1409, __pyx_L1_error) + __pyx_v_bit_stream = __pyx_t_1; + + /* "dataRead.pyx":1410 + * """ + * cdef const char* bit_stream = PyBytes_AsString(tmp) + * cdef unsigned long long position = 0 # <<<<<<<<<<<<<< + * cdef unsigned char record_id_char = 0 + * cdef unsigned short record_id_short = 0 + */ + __pyx_v_position = 0; + + /* "dataRead.pyx":1411 + * cdef const char* bit_stream = PyBytes_AsString(tmp) + * cdef unsigned long long position = 0 + * cdef unsigned char record_id_char = 0 # <<<<<<<<<<<<<< + * cdef unsigned short record_id_short = 0 + * cdef unsigned long record_id_long = 0 + */ + __pyx_v_record_id_char = 0; + + /* "dataRead.pyx":1412 + * cdef unsigned long long position = 0 + * cdef unsigned char record_id_char = 0 + * cdef unsigned short record_id_short = 0 # <<<<<<<<<<<<<< + * cdef unsigned long record_id_long = 0 + * cdef unsigned long long record_id_long_long = 0 + */ + __pyx_v_record_id_short = 0; + + /* "dataRead.pyx":1413 + * cdef unsigned char record_id_char = 0 + * cdef unsigned short record_id_short = 0 + * cdef unsigned long record_id_long = 0 # <<<<<<<<<<<<<< + * cdef unsigned long long record_id_long_long = 0 + * # initialise data structure + */ + __pyx_v_record_id_long = 0; + + /* "dataRead.pyx":1414 + * cdef unsigned short record_id_short = 0 + * cdef unsigned long record_id_long = 0 + * cdef unsigned long long record_id_long_long = 0 # <<<<<<<<<<<<<< + * # initialise data structure + * # key is channel name + */ + __pyx_v_record_id_long_long = 0; + + /* "dataRead.pyx":1417 + * # initialise data structure + * # key is channel name + * cdef dict buf = {} # <<<<<<<<<<<<<< + * cdef dict VLSD = {} + * cdef dict pos_byte_beg = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_buf = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1418 + * # key is channel name + * cdef dict buf = {} + * cdef dict VLSD = {} # <<<<<<<<<<<<<< + * cdef dict pos_byte_beg = {} + * cdef dict pos_byte_end = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_VLSD = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1419 + * cdef dict buf = {} + * cdef dict VLSD = {} + * cdef dict pos_byte_beg = {} # <<<<<<<<<<<<<< + * cdef dict pos_byte_end = {} + * cdef dict c_format_structure = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_pos_byte_beg = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1420 + * cdef dict VLSD = {} + * cdef dict pos_byte_beg = {} + * cdef dict pos_byte_end = {} # <<<<<<<<<<<<<< + * cdef dict c_format_structure = {} + * cdef dict byte_length = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_pos_byte_end = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1421 + * cdef dict pos_byte_beg = {} + * cdef dict pos_byte_end = {} + * cdef dict c_format_structure = {} # <<<<<<<<<<<<<< + * cdef dict byte_length = {} + * cdef dict numpy_format = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_c_format_structure = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1422 + * cdef dict pos_byte_end = {} + * cdef dict c_format_structure = {} + * cdef dict byte_length = {} # <<<<<<<<<<<<<< + * cdef dict numpy_format = {} + * # key is record id + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_byte_length = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1423 + * cdef dict c_format_structure = {} + * cdef dict byte_length = {} + * cdef dict numpy_format = {} # <<<<<<<<<<<<<< + * # key is record id + * cdef dict index = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_numpy_format = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1425 + * cdef dict numpy_format = {} + * # key is record id + * cdef dict index = {} # <<<<<<<<<<<<<< + * cdef dict CGrecordLength = {} + * cdef dict VLSD_flag = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_index = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1426 + * # key is record id + * cdef dict index = {} + * cdef dict CGrecordLength = {} # <<<<<<<<<<<<<< + * cdef dict VLSD_flag = {} + * cdef dict VLSD_CG_name = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_CGrecordLength = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1427 + * cdef dict index = {} + * cdef dict CGrecordLength = {} + * cdef dict VLSD_flag = {} # <<<<<<<<<<<<<< + * cdef dict VLSD_CG_name = {} + * cdef dict VLSD_CG_signal_data_type = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_VLSD_flag = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1428 + * cdef dict CGrecordLength = {} + * cdef dict VLSD_flag = {} + * cdef dict VLSD_CG_name = {} # <<<<<<<<<<<<<< + * cdef dict VLSD_CG_signal_data_type = {} + * cdef dict channel_name_set = {} + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_VLSD_CG_name = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1429 + * cdef dict VLSD_flag = {} + * cdef dict VLSD_CG_name = {} + * cdef dict VLSD_CG_signal_data_type = {} # <<<<<<<<<<<<<< + * cdef dict channel_name_set = {} + * for record_id in record: + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_VLSD_CG_signal_data_type = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1430 + * cdef dict VLSD_CG_name = {} + * cdef dict VLSD_CG_signal_data_type = {} + * cdef dict channel_name_set = {} # <<<<<<<<<<<<<< + * for record_id in record: + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_channel_name_set = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dataRead.pyx":1431 + * cdef dict VLSD_CG_signal_data_type = {} + * cdef dict channel_name_set = {} + * for record_id in record: # <<<<<<<<<<<<<< + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) + * VLSD_flag[record_id] = True + */ + if (likely(PyList_CheckExact(__pyx_v_record)) || PyTuple_CheckExact(__pyx_v_record)) { + __pyx_t_2 = __pyx_v_record; __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_record); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1431, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1431, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 1431, __pyx_L1_error) + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1431, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 1431, __pyx_L1_error) + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1431, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_record_id, __pyx_t_5); + __pyx_t_5 = 0; + + /* "dataRead.pyx":1432 + * cdef dict channel_name_set = {} + * for record_id in record: + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) # <<<<<<<<<<<<<< + * VLSD_flag[record_id] = True + * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + */ + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_record); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_33, 33, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1432, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_7) { + + /* "dataRead.pyx":1433 + * for record_id in record: + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) + * VLSD_flag[record_id] = True # <<<<<<<<<<<<<< + * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] + */ + if (unlikely((PyDict_SetItem(__pyx_v_VLSD_flag, __pyx_v_record_id, Py_True) < 0))) __PYX_ERR(0, 1433, __pyx_L1_error) + + /* "dataRead.pyx":1434 + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) + * VLSD_flag[record_id] = True + * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] # <<<<<<<<<<<<<< + * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] + * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) + */ + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_record); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_VLSD_CG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_channelName); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely((PyDict_SetItem(__pyx_v_VLSD, __pyx_t_5, __pyx_t_6) < 0))) __PYX_ERR(0, 1434, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1435 + * VLSD_flag[record_id] = True + * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] # <<<<<<<<<<<<<< + * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) + * else: + */ + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_record); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_VLSD_CG); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_channelName); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely((PyDict_SetItem(__pyx_v_VLSD_CG_name, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 1435, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1436 + * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + * VLSD_CG_name[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channelName'] + * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) # <<<<<<<<<<<<<< + * else: + * VLSD_flag[record_id] = False + */ + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_record); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_VLSD_CG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_channel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_signal_data_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_info}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + if (unlikely((PyDict_SetItem(__pyx_v_VLSD_CG_signal_data_type, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 1436, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1432 + * cdef dict channel_name_set = {} + * for record_id in record: + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) # <<<<<<<<<<<<<< + * VLSD_flag[record_id] = True + * VLSD[record[record_id]['record'].VLSD_CG[record_id]['channelName']] = [] + */ + goto __pyx_L5; + } + + /* "dataRead.pyx":1438 + * VLSD_CG_signal_data_type[record_id] = record[record_id]['record'].VLSD_CG[record_id]['channel'].signal_data_type(info) + * else: + * VLSD_flag[record_id] = False # <<<<<<<<<<<<<< + * for Channel in record[record_id]['record'].values(): + * #if not Channel.VLSD_CG_Flag: + */ + /*else*/ { + if (unlikely((PyDict_SetItem(__pyx_v_VLSD_flag, __pyx_v_record_id, Py_False) < 0))) __PYX_ERR(0, 1438, __pyx_L1_error) + + /* "dataRead.pyx":1439 + * else: + * VLSD_flag[record_id] = False + * for Channel in record[record_id]['record'].values(): # <<<<<<<<<<<<<< + * #if not Channel.VLSD_CG_Flag: + * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), + */ + __pyx_t_10 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_record); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(__pyx_t_5 == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values"); + __PYX_ERR(0, 1439, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_n_s_values, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_8; + __pyx_t_8 = 0; + while (1) { + __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_11, &__pyx_t_10, NULL, &__pyx_t_8, NULL, __pyx_t_12); + if (unlikely(__pyx_t_13 == 0)) break; + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_Channel, __pyx_t_8); + __pyx_t_8 = 0; + + /* "dataRead.pyx":1441 + * for Channel in record[record_id]['record'].values(): + * #if not Channel.VLSD_CG_Flag: + * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), # <<<<<<<<<<<<<< + * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') + * numpy_format[Channel.name] = Channel.data_format(info) + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_record); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_numberOfRecords); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_14); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14)) __PYX_ERR(0, 1441, __pyx_L1_error); + __pyx_t_14 = 0; + + /* "dataRead.pyx":1442 + * #if not Channel.VLSD_CG_Flag: + * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), + * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') # <<<<<<<<<<<<<< + * numpy_format[Channel.name] = Channel.data_format(info) + * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset + */ + __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_V_2, __pyx_n_s_format); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_nBytes_aligned); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_16, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_17}; + __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_dtype, __pyx_t_15) < 0) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 1442, __pyx_L1_error) + + /* "dataRead.pyx":1441 + * for Channel in record[record_id]['record'].values(): + * #if not Channel.VLSD_CG_Flag: + * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), # <<<<<<<<<<<<<< + * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') + * numpy_format[Channel.name] = Channel.data_format(info) + */ + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (unlikely((PyDict_SetItem(__pyx_v_buf, __pyx_t_14, __pyx_t_15) < 0))) __PYX_ERR(0, 1441, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "dataRead.pyx":1443 + * buf[Channel.name] = np.empty((record[record_id]['record'].numberOfRecords,), + * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') + * numpy_format[Channel.name] = Channel.data_format(info) # <<<<<<<<<<<<<< + * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset + * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_data_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_8 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_14, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_info}; + __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (unlikely((PyDict_SetItem(__pyx_v_numpy_format, __pyx_t_14, __pyx_t_15) < 0))) __PYX_ERR(0, 1443, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "dataRead.pyx":1444 + * dtype='V{}'.format(Channel.nBytes_aligned), order ='C') + * numpy_format[Channel.name] = Channel.data_format(info) + * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset # <<<<<<<<<<<<<< + * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned + * index[record_id] = 0 + */ + __pyx_t_15 = __Pyx_PyInt_From_unsigned_short(__pyx_v_record_id_size); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_byteOffset); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_8 = PyNumber_Add(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (unlikely((PyDict_SetItem(__pyx_v_pos_byte_beg, __pyx_t_14, __pyx_t_8) < 0))) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "dataRead.pyx":1445 + * numpy_format[Channel.name] = Channel.data_format(info) + * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset + * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned # <<<<<<<<<<<<<< + * index[record_id] = 0 + * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_pos_byte_beg, __pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_nBytes_aligned); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PyNumber_Add(__pyx_t_14, __pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_Channel, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (unlikely((PyDict_SetItem(__pyx_v_pos_byte_end, __pyx_t_8, __pyx_t_15) < 0))) __PYX_ERR(0, 1445, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1446 + * pos_byte_beg[Channel.name] = record_id_size + Channel.byteOffset + * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned + * index[record_id] = 0 # <<<<<<<<<<<<<< + * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength + * channel_name_set[record_id] = record[record_id]['record'].channelNames + */ + if (unlikely((PyDict_SetItem(__pyx_v_index, __pyx_v_record_id, __pyx_int_0) < 0))) __PYX_ERR(0, 1446, __pyx_L1_error) + + /* "dataRead.pyx":1447 + * pos_byte_end[Channel.name] = pos_byte_beg[Channel.name] + Channel.nBytes_aligned + * index[record_id] = 0 + * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength # <<<<<<<<<<<<<< + * channel_name_set[record_id] = record[record_id]['record'].channelNames + * # read data + */ + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_record); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_CGrecordLength); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely((PyDict_SetItem(__pyx_v_CGrecordLength, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 1447, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1448 + * index[record_id] = 0 + * CGrecordLength[record_id] = record[record_id]['record'].CGrecordLength + * channel_name_set[record_id] = record[record_id]['record'].channelNames # <<<<<<<<<<<<<< + * # read data + * if record_id_size == 1: + */ + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_record, __pyx_v_record_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_15 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_u_record); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_channelNames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely((PyDict_SetItem(__pyx_v_channel_name_set, __pyx_v_record_id, __pyx_t_6) < 0))) __PYX_ERR(0, 1448, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_L5:; + + /* "dataRead.pyx":1431 + * cdef dict VLSD_CG_signal_data_type = {} + * cdef dict channel_name_set = {} + * for record_id in record: # <<<<<<<<<<<<<< + * if record[record_id]['record'].Flags & 0b100001: # VLSD (bit 0) or VLSC compact (bit 5) + * VLSD_flag[record_id] = True + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dataRead.pyx":1450 + * channel_name_set[record_id] = record[record_id]['record'].channelNames + * # read data + * if record_id_size == 1: # <<<<<<<<<<<<<< + * while position < data_block_length: + * memcpy(&record_id_char, &bit_stream[position], 1) + */ + switch (__pyx_v_record_id_size) { + case 1: + + /* "dataRead.pyx":1451 + * # read data + * if record_id_size == 1: + * while position < data_block_length: # <<<<<<<<<<<<<< + * memcpy(&record_id_char, &bit_stream[position], 1) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, + */ + while (1) { + __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); + if (!__pyx_t_7) break; + + /* "dataRead.pyx":1452 + * if record_id_size == 1: + * while position < data_block_length: + * memcpy(&record_id_char, &bit_stream[position], 1) # <<<<<<<<<<<<<< + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + */ + (void)(memcpy((&__pyx_v_record_id_char), (&(__pyx_v_bit_stream[__pyx_v_position])), 1)); + + /* "dataRead.pyx":1453 + * while position < data_block_length: + * memcpy(&record_id_char, &bit_stream[position], 1) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_v_record_id_char); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "dataRead.pyx":1456 + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< + * elif record_id_size == 2: + * while position < data_block_length: + */ + __pyx_t_6 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_2, 1, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1453, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); + } else { + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_15 = PyList_GET_ITEM(sequence, 1); + __pyx_t_8 = PyList_GET_ITEM(sequence, 2); + __pyx_t_14 = PyList_GET_ITEM(sequence, 3); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_14); + #else + { + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_15,&__pyx_t_8,&__pyx_t_14}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1453, __pyx_L1_error) + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + } + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_15,&__pyx_t_8,&__pyx_t_14}; + __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 1453, __pyx_L1_error) + __pyx_t_19 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L12_unpacking_done; + __pyx_L11_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_19 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1453, __pyx_L1_error) + __pyx_L12_unpacking_done:; + } + + /* "dataRead.pyx":1453 + * while position < data_block_length: + * memcpy(&record_id_char, &bit_stream[position], 1) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 1453, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 1453, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_14))||((__pyx_t_14) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_14))) __PYX_ERR(0, 1453, __pyx_L1_error) + __pyx_v_position = __pyx_t_20; + __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; + __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_8)); + __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_14)); + __pyx_t_14 = 0; + } + + /* "dataRead.pyx":1450 + * channel_name_set[record_id] = record[record_id]['record'].channelNames + * # read data + * if record_id_size == 1: # <<<<<<<<<<<<<< + * while position < data_block_length: + * memcpy(&record_id_char, &bit_stream[position], 1) + */ + break; + case 2: + + /* "dataRead.pyx":1458 + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * elif record_id_size == 2: + * while position < data_block_length: # <<<<<<<<<<<<<< + * memcpy(&record_id_short, &bit_stream[position], 2) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, + */ + while (1) { + __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); + if (!__pyx_t_7) break; + + /* "dataRead.pyx":1459 + * elif record_id_size == 2: + * while position < data_block_length: + * memcpy(&record_id_short, &bit_stream[position], 2) # <<<<<<<<<<<<<< + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + */ + (void)(memcpy((&__pyx_v_record_id_short), (&(__pyx_v_bit_stream[__pyx_v_position])), 2)); + + /* "dataRead.pyx":1460 + * while position < data_block_length: + * memcpy(&record_id_short, &bit_stream[position], 2) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_6 = __Pyx_PyInt_From_unsigned_short(__pyx_v_record_id_short); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + + /* "dataRead.pyx":1463 + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< + * elif record_id_size == 3: + * while position < data_block_length: + */ + __pyx_t_14 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_6, 2, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) { + PyObject* sequence = __pyx_t_14; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1460, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_15 = PyList_GET_ITEM(sequence, 2); + __pyx_t_2 = PyList_GET_ITEM(sequence, 3); + } + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_2); + #else + { + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_8,&__pyx_t_15,&__pyx_t_2}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + } + #endif + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } else { + Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_8,&__pyx_t_15,&__pyx_t_2}; + __pyx_t_5 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L15_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 1460, __pyx_L1_error) + __pyx_t_19 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L16_unpacking_done; + __pyx_L15_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_19 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1460, __pyx_L1_error) + __pyx_L16_unpacking_done:; + } + + /* "dataRead.pyx":1460 + * while position < data_block_length: + * memcpy(&record_id_short, &bit_stream[position], 2) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_6); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 1460, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 1460, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_2))) __PYX_ERR(0, 1460, __pyx_L1_error) + __pyx_v_position = __pyx_t_20; + __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_8)); + __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; + __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + } + + /* "dataRead.pyx":1457 + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * elif record_id_size == 2: # <<<<<<<<<<<<<< + * while position < data_block_length: + * memcpy(&record_id_short, &bit_stream[position], 2) + */ + break; + case 3: + + /* "dataRead.pyx":1465 + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * elif record_id_size == 3: + * while position < data_block_length: # <<<<<<<<<<<<<< + * memcpy(&record_id_long, &bit_stream[position], 4) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, + */ + while (1) { + __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); + if (!__pyx_t_7) break; + + /* "dataRead.pyx":1466 + * elif record_id_size == 3: + * while position < data_block_length: + * memcpy(&record_id_long, &bit_stream[position], 4) # <<<<<<<<<<<<<< + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + */ + (void)(memcpy((&__pyx_v_record_id_long), (&(__pyx_v_bit_stream[__pyx_v_position])), 4)); + + /* "dataRead.pyx":1467 + * while position < data_block_length: + * memcpy(&record_id_long, &bit_stream[position], 4) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_14 = __Pyx_PyInt_From_unsigned_long(__pyx_v_record_id_long); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + + /* "dataRead.pyx":1470 + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< + * elif record_id_size == 4: + * while position < data_block_length: + */ + __pyx_t_2 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_14, 4, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1467, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); + } else { + __pyx_t_14 = PyList_GET_ITEM(sequence, 0); + __pyx_t_15 = PyList_GET_ITEM(sequence, 1); + __pyx_t_8 = PyList_GET_ITEM(sequence, 2); + __pyx_t_6 = PyList_GET_ITEM(sequence, 3); + } + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_6); + #else + { + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_8,&__pyx_t_6}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1467, __pyx_L1_error) + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + } + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_8,&__pyx_t_6}; + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L19_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 1467, __pyx_L1_error) + __pyx_t_19 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L20_unpacking_done; + __pyx_L19_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_19 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1467, __pyx_L1_error) + __pyx_L20_unpacking_done:; + } + + /* "dataRead.pyx":1467 + * while position < data_block_length: + * memcpy(&record_id_long, &bit_stream[position], 4) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_14); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1467, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 1467, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 1467, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_6))) __PYX_ERR(0, 1467, __pyx_L1_error) + __pyx_v_position = __pyx_t_20; + __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; + __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_8)); + __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_6)); + __pyx_t_6 = 0; + } + + /* "dataRead.pyx":1464 + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * elif record_id_size == 3: # <<<<<<<<<<<<<< + * while position < data_block_length: + * memcpy(&record_id_long, &bit_stream[position], 4) + */ + break; + case 4: + + /* "dataRead.pyx":1472 + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * elif record_id_size == 4: + * while position < data_block_length: # <<<<<<<<<<<<<< + * memcpy(&record_id_long_long, &bit_stream[position], 8) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, + */ + while (1) { + __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); + if (!__pyx_t_7) break; + + /* "dataRead.pyx":1473 + * elif record_id_size == 4: + * while position < data_block_length: + * memcpy(&record_id_long_long, &bit_stream[position], 8) # <<<<<<<<<<<<<< + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + */ + (void)(memcpy((&__pyx_v_record_id_long_long), (&(__pyx_v_bit_stream[__pyx_v_position])), 8)); + + /* "dataRead.pyx":1474 + * while position < data_block_length: + * memcpy(&record_id_long_long, &bit_stream[position], 8) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_2 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_record_id_long_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "dataRead.pyx":1477 + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< + * # changing from bytes type to desired type + * if buf: + */ + __pyx_t_6 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_2, 8, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1474, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_15 = PyList_GET_ITEM(sequence, 1); - __pyx_t_8 = PyList_GET_ITEM(sequence, 2); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_15 = PyList_GET_ITEM(sequence, 2); __pyx_t_14 = PyList_GET_ITEM(sequence, 3); } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_14); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_15,&__pyx_t_8,&__pyx_t_14}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_14); + #else + { + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_8,&__pyx_t_15,&__pyx_t_14}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1474, __pyx_L1_error) + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + } + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_8,&__pyx_t_15,&__pyx_t_14}; + __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L23_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 1474, __pyx_L1_error) + __pyx_t_19 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L24_unpacking_done; + __pyx_L23_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_19 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1474, __pyx_L1_error) + __pyx_L24_unpacking_done:; + } + + /* "dataRead.pyx":1474 + * while position < data_block_length: + * memcpy(&record_id_long_long, &bit_stream[position], 8) + * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, # <<<<<<<<<<<<<< + * position, buf, VLSD, pos_byte_beg, pos_byte_end, + * c_format_structure, index, CGrecordLength, + */ + __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1474, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 1474, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 1474, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_t_14))||((__pyx_t_14) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_14))) __PYX_ERR(0, 1474, __pyx_L1_error) + __pyx_v_position = __pyx_t_20; + __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_8)); + __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; + __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_14)); + __pyx_t_14 = 0; + } + + /* "dataRead.pyx":1471 + * c_format_structure, index, CGrecordLength, + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * elif record_id_size == 4: # <<<<<<<<<<<<<< + * while position < data_block_length: + * memcpy(&record_id_long_long, &bit_stream[position], 8) + */ + break; + default: break; + } + + /* "dataRead.pyx":1479 + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * # changing from bytes type to desired type + * if buf: # <<<<<<<<<<<<<< + * for name in buf.keys(): + * buf[name] = buf[name].view(dtype=numpy_format[name]) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_buf); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1479, __pyx_L1_error) + if (__pyx_t_7) { + + /* "dataRead.pyx":1480 + * # changing from bytes type to desired type + * if buf: + * for name in buf.keys(): # <<<<<<<<<<<<<< + * buf[name] = buf[name].view(dtype=numpy_format[name]) + * # convert list to array for VLSD only + */ + __pyx_t_3 = 0; + if (unlikely(__pyx_v_buf == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys"); + __PYX_ERR(0, 1480, __pyx_L1_error) + } + __pyx_t_14 = __Pyx_dict_iterator(__pyx_v_buf, 1, __pyx_n_s_keys, (&__pyx_t_11), (&__pyx_t_12)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_14; + __pyx_t_14 = 0; + while (1) { + __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_11, &__pyx_t_3, &__pyx_t_14, NULL, NULL, __pyx_t_12); + if (unlikely(__pyx_t_13 == 0)) break; + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_14); + __pyx_t_14 = 0; + + /* "dataRead.pyx":1481 + * if buf: + * for name in buf.keys(): + * buf[name] = buf[name].view(dtype=numpy_format[name]) # <<<<<<<<<<<<<< + * # convert list to array for VLSD only + * if VLSD: + */ + if (unlikely(__pyx_v_buf == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1481, __pyx_L1_error) + } + __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_buf, __pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_view); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_numpy_format, __pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__pyx_v_buf == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1481, __pyx_L1_error) + } + if (unlikely((PyDict_SetItem(__pyx_v_buf, __pyx_v_name, __pyx_t_8) < 0))) __PYX_ERR(0, 1481, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1479 + * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) + * # changing from bytes type to desired type + * if buf: # <<<<<<<<<<<<<< + * for name in buf.keys(): + * buf[name] = buf[name].view(dtype=numpy_format[name]) + */ + } + + /* "dataRead.pyx":1483 + * buf[name] = buf[name].view(dtype=numpy_format[name]) + * # convert list to array for VLSD only + * if VLSD: # <<<<<<<<<<<<<< + * for channel_name in VLSD: + * VLSD[channel_name] = np.array(VLSD[channel_name]) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_VLSD); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1483, __pyx_L1_error) + if (__pyx_t_7) { + + /* "dataRead.pyx":1484 + * # convert list to array for VLSD only + * if VLSD: + * for channel_name in VLSD: # <<<<<<<<<<<<<< + * VLSD[channel_name] = np.array(VLSD[channel_name]) + * buf.update(VLSD) + */ + __pyx_t_11 = 0; + if (unlikely(__pyx_v_VLSD == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 1484, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_VLSD, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_12)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_8; + __pyx_t_8 = 0; + while (1) { + __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_3, &__pyx_t_11, &__pyx_t_8, NULL, NULL, __pyx_t_12); + if (unlikely(__pyx_t_13 == 0)) break; + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_channel_name, __pyx_t_8); + __pyx_t_8 = 0; + + /* "dataRead.pyx":1485 + * if VLSD: + * for channel_name in VLSD: + * VLSD[channel_name] = np.array(VLSD[channel_name]) # <<<<<<<<<<<<<< + * buf.update(VLSD) + * return buf + */ + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_array); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__pyx_v_VLSD == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1485, __pyx_L1_error) + } + __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_VLSD, __pyx_v_channel_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_14}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + if (unlikely(__pyx_v_VLSD == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1485, __pyx_L1_error) + } + if (unlikely((PyDict_SetItem(__pyx_v_VLSD, __pyx_v_channel_name, __pyx_t_8) < 0))) __PYX_ERR(0, 1485, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1486 + * for channel_name in VLSD: + * VLSD[channel_name] = np.array(VLSD[channel_name]) + * buf.update(VLSD) # <<<<<<<<<<<<<< + * return buf + * + */ + __pyx_t_6 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_buf, __pyx_v_VLSD); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dataRead.pyx":1483 + * buf[name] = buf[name].view(dtype=numpy_format[name]) + * # convert list to array for VLSD only + * if VLSD: # <<<<<<<<<<<<<< + * for channel_name in VLSD: + * VLSD[channel_name] = np.array(VLSD[channel_name]) + */ + } + + /* "dataRead.pyx":1487 + * VLSD[channel_name] = np.array(VLSD[channel_name]) + * buf.update(VLSD) + * return buf # <<<<<<<<<<<<<< + * + * cdef inline unsorted_read4(const char* bit_stream, bytes tmp, record_id, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_buf); + __pyx_r = __pyx_v_buf; + goto __pyx_L0; + + /* "dataRead.pyx":1385 + * return buf.byteswap() + * + * def unsorted_data_read4(record, info, bytes tmp, # <<<<<<<<<<<<<< + * const unsigned short record_id_size, + * const unsigned long long data_block_length): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_AddTraceback("dataRead.unsorted_data_read4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); + __Pyx_XDECREF(__pyx_v_VLSD); + __Pyx_XDECREF(__pyx_v_pos_byte_beg); + __Pyx_XDECREF(__pyx_v_pos_byte_end); + __Pyx_XDECREF(__pyx_v_c_format_structure); + __Pyx_XDECREF(__pyx_v_byte_length); + __Pyx_XDECREF(__pyx_v_numpy_format); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XDECREF(__pyx_v_CGrecordLength); + __Pyx_XDECREF(__pyx_v_VLSD_flag); + __Pyx_XDECREF(__pyx_v_VLSD_CG_name); + __Pyx_XDECREF(__pyx_v_VLSD_CG_signal_data_type); + __Pyx_XDECREF(__pyx_v_channel_name_set); + __Pyx_XDECREF(__pyx_v_record_id); + __Pyx_XDECREF(__pyx_v_Channel); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_channel_name); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":1489 + * return buf + * + * cdef inline unsorted_read4(const char* bit_stream, bytes tmp, record_id, # <<<<<<<<<<<<<< + * unsigned short record_id_size, unsigned long long position, + * buf, VLSD, pos_byte_beg, pos_byte_end, c_format_structure, + */ + +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_unsorted_read4(char const *__pyx_v_bit_stream, PyObject *__pyx_v_tmp, PyObject *__pyx_v_record_id, unsigned short __pyx_v_record_id_size, unsigned PY_LONG_LONG __pyx_v_position, PyObject *__pyx_v_buf, PyObject *__pyx_v_VLSD, PyObject *__pyx_v_pos_byte_beg, PyObject *__pyx_v_pos_byte_end, CYTHON_UNUSED PyObject *__pyx_v_c_format_structure, PyObject *__pyx_v_index, PyObject *__pyx_v_CGrecordLength, PyObject *__pyx_v_VLSD_flag, PyObject *__pyx_v_VLSD_CG_name, PyObject *__pyx_v_VLSD_CG_signal_data_type, PyObject *__pyx_v_channel_name_set) { + unsigned long __pyx_v_VLSDLen; + PyObject *__pyx_v_channel_name = NULL; + PyObject *__pyx_v_signal_data_type = NULL; + PyObject *__pyx_v_temp = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + unsigned PY_LONG_LONG __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unsorted_read4", 1); + + /* "dataRead.pyx":1494 + * index, CGrecordLength, VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, + * channel_name_set): + * cdef unsigned long VLSDLen = 0 # <<<<<<<<<<<<<< + * if not VLSD_flag[record_id]: # not VLSD CG) + * for channel_name in channel_name_set[record_id]: # list of channel classes + */ + __pyx_v_VLSDLen = 0; + + /* "dataRead.pyx":1495 + * channel_name_set): + * cdef unsigned long VLSDLen = 0 + * if not VLSD_flag[record_id]: # not VLSD CG) # <<<<<<<<<<<<<< + * for channel_name in channel_name_set[record_id]: # list of channel classes + * buf[channel_name][index[record_id]] = \ + */ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_VLSD_flag, __pyx_v_record_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1495, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "dataRead.pyx":1496 + * cdef unsigned long VLSDLen = 0 + * if not VLSD_flag[record_id]: # not VLSD CG) + * for channel_name in channel_name_set[record_id]: # list of channel classes # <<<<<<<<<<<<<< + * buf[channel_name][index[record_id]] = \ + * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] + */ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_channel_name_set, __pyx_v_record_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1496, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 1496, __pyx_L1_error) + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1496, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 1496, __pyx_L1_error) + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1496, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_channel_name, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dataRead.pyx":1498 + * for channel_name in channel_name_set[record_id]: # list of channel classes + * buf[channel_name][index[record_id]] = \ + * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] # <<<<<<<<<<<<<< + * index[record_id] += 1 + * position += CGrecordLength[record_id] + */ + if (unlikely(__pyx_v_tmp == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1498, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_pos_byte_beg, __pyx_v_channel_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = (__pyx_t_8 == Py_None); + if (__pyx_t_3) { + __pyx_t_9 = 0; + } else { + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1498, __pyx_L1_error) + __pyx_t_9 = __pyx_t_10; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_pos_byte_end, __pyx_v_channel_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = (__pyx_t_1 == Py_None); + if (__pyx_t_3) { + __pyx_t_10 = PY_SSIZE_T_MAX; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1498, __pyx_L1_error) + __pyx_t_10 = __pyx_t_11; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySequence_GetSlice(__pyx_v_tmp, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "dataRead.pyx":1497 + * if not VLSD_flag[record_id]: # not VLSD CG) + * for channel_name in channel_name_set[record_id]: # list of channel classes + * buf[channel_name][index[record_id]] = \ # <<<<<<<<<<<<<< + * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] + * index[record_id] += 1 + */ + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_buf, __pyx_v_channel_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_index, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (unlikely((PyObject_SetItem(__pyx_t_7, __pyx_t_8, __pyx_t_1) < 0))) __PYX_ERR(0, 1497, __pyx_L1_error) + __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; + + /* "dataRead.pyx":1496 + * cdef unsigned long VLSDLen = 0 + * if not VLSD_flag[record_id]: # not VLSD CG) + * for channel_name in channel_name_set[record_id]: # list of channel classes # <<<<<<<<<<<<<< + * buf[channel_name][index[record_id]] = \ + * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] + */ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":1499 + * buf[channel_name][index[record_id]] = \ + * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] + * index[record_id] += 1 # <<<<<<<<<<<<<< + * position += CGrecordLength[record_id] + * else: # VLSD CG + */ + __Pyx_INCREF(__pyx_v_record_id); + __pyx_t_4 = __pyx_v_record_id; + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_index, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely((PyObject_SetItem(__pyx_v_index, __pyx_t_4, __pyx_t_8) < 0))) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":1500 + * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] + * index[record_id] += 1 + * position += CGrecordLength[record_id] # <<<<<<<<<<<<<< + * else: # VLSD CG + * position += record_id_size + */ + __pyx_t_4 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_CGrecordLength, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_12 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_position = __pyx_t_12; + + /* "dataRead.pyx":1495 + * channel_name_set): + * cdef unsigned long VLSDLen = 0 + * if not VLSD_flag[record_id]: # not VLSD CG) # <<<<<<<<<<<<<< + * for channel_name in channel_name_set[record_id]: # list of channel classes + * buf[channel_name][index[record_id]] = \ + */ + goto __pyx_L3; + } + + /* "dataRead.pyx":1502 + * position += CGrecordLength[record_id] + * else: # VLSD CG + * position += record_id_size # <<<<<<<<<<<<<< + * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length + * position += 4 + */ + /*else*/ { + __pyx_v_position = (__pyx_v_position + ((unsigned PY_LONG_LONG)__pyx_v_record_id_size)); + + /* "dataRead.pyx":1503 + * else: # VLSD CG + * position += record_id_size + * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length # <<<<<<<<<<<<<< + * position += 4 + * signal_data_type = VLSD_CG_signal_data_type[record_id] + */ + (void)(memcpy((&__pyx_v_VLSDLen), (&(__pyx_v_bit_stream[__pyx_v_position])), 4)); + + /* "dataRead.pyx":1504 + * position += record_id_size + * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length + * position += 4 # <<<<<<<<<<<<<< + * signal_data_type = VLSD_CG_signal_data_type[record_id] + * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes + */ + __pyx_v_position = (__pyx_v_position + 4); + + /* "dataRead.pyx":1505 + * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length + * position += 4 + * signal_data_type = VLSD_CG_signal_data_type[record_id] # <<<<<<<<<<<<<< + * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes + * if signal_data_type == 6: + */ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_VLSD_CG_signal_data_type, __pyx_v_record_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_signal_data_type = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dataRead.pyx":1506 + * position += 4 + * signal_data_type = VLSD_CG_signal_data_type[record_id] + * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes # <<<<<<<<<<<<<< + * if signal_data_type == 6: + * temp = temp.decode('ISO8859') + */ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_position, ((__pyx_v_position + __pyx_v_VLSDLen) - 1) - __pyx_v_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_temp = __pyx_t_8; + __pyx_t_8 = 0; + + /* "dataRead.pyx":1507 + * signal_data_type = VLSD_CG_signal_data_type[record_id] + * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes + * if signal_data_type == 6: # <<<<<<<<<<<<<< + * temp = temp.decode('ISO8859') + * elif signal_data_type == 7: + */ + __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_6, 6, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1507, __pyx_L1_error) + if (__pyx_t_3) { + + /* "dataRead.pyx":1508 + * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes + * if signal_data_type == 6: + * temp = temp.decode('ISO8859') # <<<<<<<<<<<<<< + * elif signal_data_type == 7: + * temp = temp.decode('utf-8') + */ + __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); + __pyx_t_8 = 0; + + /* "dataRead.pyx":1507 + * signal_data_type = VLSD_CG_signal_data_type[record_id] + * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes + * if signal_data_type == 6: # <<<<<<<<<<<<<< + * temp = temp.decode('ISO8859') + * elif signal_data_type == 7: + */ + goto __pyx_L7; + } + + /* "dataRead.pyx":1509 + * if signal_data_type == 6: + * temp = temp.decode('ISO8859') + * elif signal_data_type == 7: # <<<<<<<<<<<<<< + * temp = temp.decode('utf-8') + * elif signal_data_type == 8: + */ + __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_7, 7, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1509, __pyx_L1_error) + if (__pyx_t_3) { + + /* "dataRead.pyx":1510 + * temp = temp.decode('ISO8859') + * elif signal_data_type == 7: + * temp = temp.decode('utf-8') # <<<<<<<<<<<<<< + * elif signal_data_type == 8: + * temp = temp.decode('utf-16') + */ + __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, __Pyx_PyUnicode_DecodeUTF16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); + __pyx_t_8 = 0; + + /* "dataRead.pyx":1511 + * elif signal_data_type == 7: + * temp = temp.decode('utf-8') + * elif signal_data_type == 8: # <<<<<<<<<<<<<< + * temp = temp.decode('utf-16') + * VLSD[VLSD_CG_name[record_id]].append(temp) + */ + __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_9, 9, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1513, __pyx_L1_error) + if (__pyx_t_3) { + + /* "dataRead.pyx":1514 + * temp = temp.decode('utf-16') # <<<<<<<<<<<<<< + * VLSD[VLSD_CG_name[record_id]].append(temp) + * position += VLSDLen + */ + __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, __Pyx_PyUnicode_DecodeUTF16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); + __pyx_t_8 = 0; + + /* "dataRead.pyx":1513 + * elif signal_data_type == 8: + * temp = temp.decode('utf-16') + * VLSD[VLSD_CG_name[record_id]].append(temp) + */ + } + __pyx_L7:; + + /* "dataRead.pyx":1515 + * elif signal_data_type == 9: + * temp = temp.decode('>utf-16') + * VLSD[VLSD_CG_name[record_id]].append(temp) # <<<<<<<<<<<<<< + * position += VLSDLen + * return position, buf, VLSD, index + */ + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_VLSD_CG_name, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_VLSD, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_temp); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1515, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dataRead.pyx":1516 + * temp = temp.decode('>utf-16') + * VLSD[VLSD_CG_name[record_id]].append(temp) + * position += VLSDLen # <<<<<<<<<<<<<< + * return position, buf, VLSD, index + * + */ + __pyx_v_position = (__pyx_v_position + ((unsigned PY_LONG_LONG)__pyx_v_VLSDLen)); + } + __pyx_L3:; + + /* "dataRead.pyx":1517 + * VLSD[VLSD_CG_name[record_id]].append(temp) + * position += VLSDLen + * return position, buf, VLSD, index # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_buf); + __Pyx_GIVEREF(__pyx_v_buf); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_buf)) __PYX_ERR(0, 1517, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_VLSD); + __Pyx_GIVEREF(__pyx_v_VLSD); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_VLSD)) __PYX_ERR(0, 1517, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_index)) __PYX_ERR(0, 1517, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + /* "dataRead.pyx":1489 + * return buf + * + * cdef inline unsorted_read4(const char* bit_stream, bytes tmp, record_id, # <<<<<<<<<<<<<< + * unsigned short record_id_size, unsigned long long position, + * buf, VLSD, pos_byte_beg, pos_byte_end, c_format_structure, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("dataRead.unsorted_read4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_channel_name); + __Pyx_XDECREF(__pyx_v_signal_data_type); + __Pyx_XDECREF(__pyx_v_temp); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dataRead.pyx":1520 + * + * + * def sd_data_read(unsigned short signal_data_type, bytes sd_block, # <<<<<<<<<<<<<< + * unsigned long long sd_block_length, unsigned long long n_records): + * """ Reads vlsd channel from its SD Block bytes + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_7sd_data_read(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_8dataRead_6sd_data_read, " Reads vlsd channel from its SD Block bytes\n\n Parameters\n ----------------\n signal_data_type : int\n\n sd_block : bytes\n SD Block bytes\n\n sd_block_length: int\n SD Block data length (header not included)\n\n n_records: int\n number of records\n\n Returns\n -----------\n array\n "); +static PyMethodDef __pyx_mdef_8dataRead_7sd_data_read = {"sd_data_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_7sd_data_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_6sd_data_read}; +static PyObject *__pyx_pw_8dataRead_7sd_data_read(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + unsigned short __pyx_v_signal_data_type; + PyObject *__pyx_v_sd_block = 0; + CYTHON_UNUSED unsigned PY_LONG_LONG __pyx_v_sd_block_length; + unsigned PY_LONG_LONG __pyx_v_n_records; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sd_data_read (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signal_data_type,&__pyx_n_s_sd_block,&__pyx_n_s_sd_block_length,&__pyx_n_s_n_records,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_signal_data_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1520, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sd_block)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - #endif - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_15,&__pyx_t_8,&__pyx_t_14}; - __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1520, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, 1); __PYX_ERR(0, 1520, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sd_block_length)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1520, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, 2); __PYX_ERR(0, 1520, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_records)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1520, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, 3); __PYX_ERR(0, 1520, __pyx_L3_error) } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 875, __pyx_L1_error) - __pyx_t_19 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L12_unpacking_done; - __pyx_L11_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 875, __pyx_L1_error) - __pyx_L12_unpacking_done:; } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sd_data_read") < 0)) __PYX_ERR(0, 1520, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_signal_data_type = __Pyx_PyInt_As_unsigned_short(values[0]); if (unlikely((__pyx_v_signal_data_type == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1520, __pyx_L3_error) + __pyx_v_sd_block = ((PyObject*)values[1]); + __pyx_v_sd_block_length = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[2]); if (unlikely((__pyx_v_sd_block_length == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1521, __pyx_L3_error) + __pyx_v_n_records = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[3]); if (unlikely((__pyx_v_n_records == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1521, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1520, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.sd_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sd_block), (&PyBytes_Type), 1, "sd_block", 1))) __PYX_ERR(0, 1520, __pyx_L1_error) + __pyx_r = __pyx_pf_8dataRead_6sd_data_read(__pyx_self, __pyx_v_signal_data_type, __pyx_v_sd_block, __pyx_v_sd_block_length, __pyx_v_n_records); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8dataRead_6sd_data_read(CYTHON_UNUSED PyObject *__pyx_self, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_sd_block, CYTHON_UNUSED unsigned PY_LONG_LONG __pyx_v_sd_block_length, unsigned PY_LONG_LONG __pyx_v_n_records) { + char const *__pyx_v_bit_stream; + unsigned long __pyx_v_max_len; + unsigned long __pyx_v_vlsd_len; + unsigned long *__pyx_v_VLSDLen; + unsigned PY_LONG_LONG *__pyx_v_pointer; + unsigned PY_LONG_LONG __pyx_v_rec; + PyObject *__pyx_v_channel_format = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + unsigned PY_LONG_LONG __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + char const *__pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sd_data_read", 1); + + /* "dataRead.pyx":1541 + * array + * """ + * cdef const char* bit_stream = PyBytes_AsString(sd_block) # <<<<<<<<<<<<<< + * cdef unsigned long max_len = 0 + * cdef unsigned long vlsd_len = 0 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sd_block); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 1541, __pyx_L1_error) + __pyx_v_bit_stream = __pyx_t_1; + + /* "dataRead.pyx":1542 + * """ + * cdef const char* bit_stream = PyBytes_AsString(sd_block) + * cdef unsigned long max_len = 0 # <<<<<<<<<<<<<< + * cdef unsigned long vlsd_len = 0 + * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) + */ + __pyx_v_max_len = 0; + + /* "dataRead.pyx":1543 + * cdef const char* bit_stream = PyBytes_AsString(sd_block) + * cdef unsigned long max_len = 0 + * cdef unsigned long vlsd_len = 0 # <<<<<<<<<<<<<< + * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) + * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) + */ + __pyx_v_vlsd_len = 0; + + /* "dataRead.pyx":1544 + * cdef unsigned long max_len = 0 + * cdef unsigned long vlsd_len = 0 + * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) # <<<<<<<<<<<<<< + * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) + * cdef unsigned long long rec = 0 + */ + __pyx_v_VLSDLen = ((unsigned long *)PyMem_Malloc((__pyx_v_n_records * (sizeof(unsigned long))))); + + /* "dataRead.pyx":1545 + * cdef unsigned long vlsd_len = 0 + * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) + * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) # <<<<<<<<<<<<<< + * cdef unsigned long long rec = 0 + * if not VLSDLen or not pointer: + */ + __pyx_v_pointer = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_n_records * (sizeof(unsigned PY_LONG_LONG))))); + + /* "dataRead.pyx":1546 + * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) + * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) + * cdef unsigned long long rec = 0 # <<<<<<<<<<<<<< + * if not VLSDLen or not pointer: + * raise MemoryError() + */ + __pyx_v_rec = 0; + + /* "dataRead.pyx":1547 + * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) + * cdef unsigned long long rec = 0 + * if not VLSDLen or not pointer: # <<<<<<<<<<<<<< + * raise MemoryError() + * try: + */ + __pyx_t_3 = (!(__pyx_v_VLSDLen != 0)); + if (!__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (!(__pyx_v_pointer != 0)); + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_2)) { + + /* "dataRead.pyx":1548 + * cdef unsigned long long rec = 0 + * if not VLSDLen or not pointer: + * raise MemoryError() # <<<<<<<<<<<<<< + * try: + * pointer[0] = 0 + */ + PyErr_NoMemory(); __PYX_ERR(0, 1548, __pyx_L1_error) + + /* "dataRead.pyx":1547 + * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) + * cdef unsigned long long rec = 0 + * if not VLSDLen or not pointer: # <<<<<<<<<<<<<< + * raise MemoryError() + * try: + */ + } + + /* "dataRead.pyx":1549 + * if not VLSDLen or not pointer: + * raise MemoryError() + * try: # <<<<<<<<<<<<<< + * pointer[0] = 0 + * VLSDLen[0] = 0 + */ + /*try:*/ { + + /* "dataRead.pyx":1550 + * raise MemoryError() + * try: + * pointer[0] = 0 # <<<<<<<<<<<<<< + * VLSDLen[0] = 0 + * for rec from 0 <= rec < n_records - 1 by 1: + */ + (__pyx_v_pointer[0]) = 0; + + /* "dataRead.pyx":1551 + * try: + * pointer[0] = 0 + * VLSDLen[0] = 0 # <<<<<<<<<<<<<< + * for rec from 0 <= rec < n_records - 1 by 1: + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + */ + (__pyx_v_VLSDLen[0]) = 0; + + /* "dataRead.pyx":1552 + * pointer[0] = 0 + * VLSDLen[0] = 0 + * for rec from 0 <= rec < n_records - 1 by 1: # <<<<<<<<<<<<<< + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len + */ + __pyx_t_4 = (__pyx_v_n_records - 1); + for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_4; __pyx_v_rec+=1) { - /* "dataRead.pyx":875 - * while position < data_block_length: - * memcpy(&record_id_char, &bit_stream[position], 1) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_char, 1, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, + /* "dataRead.pyx":1553 + * VLSDLen[0] = 0 + * for rec from 0 <= rec < n_records - 1 by 1: + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) # <<<<<<<<<<<<<< + * VLSDLen[rec] = vlsd_len + * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] */ - __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 875, __pyx_L1_error) - if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 875, __pyx_L1_error) - if (!(likely(PyDict_CheckExact(__pyx_t_14))||((__pyx_t_14) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_14))) __PYX_ERR(0, 875, __pyx_L1_error) - __pyx_v_position = __pyx_t_20; - __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_15)); - __pyx_t_15 = 0; - __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_14)); - __pyx_t_14 = 0; - } + (void)(memcpy((&__pyx_v_vlsd_len), (&(__pyx_v_bit_stream[(__pyx_v_pointer[__pyx_v_rec])])), 4)); - /* "dataRead.pyx":872 - * channel_name_set[record_id] = record[record_id]['record'].channelNames - * # read data - * if record_id_size == 1: # <<<<<<<<<<<<<< - * while position < data_block_length: - * memcpy(&record_id_char, &bit_stream[position], 1) + /* "dataRead.pyx":1554 + * for rec from 0 <= rec < n_records - 1 by 1: + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len # <<<<<<<<<<<<<< + * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] + * if VLSDLen[rec] > max_len: */ - break; - case 2: + (__pyx_v_VLSDLen[__pyx_v_rec]) = __pyx_v_vlsd_len; - /* "dataRead.pyx":880 - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) - * elif record_id_size == 2: - * while position < data_block_length: # <<<<<<<<<<<<<< - * memcpy(&record_id_short, &bit_stream[position], 2) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, + /* "dataRead.pyx":1555 + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len + * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] # <<<<<<<<<<<<<< + * if VLSDLen[rec] > max_len: + * max_len = VLSDLen[rec] */ - while (1) { - __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); - if (!__pyx_t_7) break; + (__pyx_v_pointer[(__pyx_v_rec + 1)]) = (((__pyx_v_VLSDLen[__pyx_v_rec]) + 4) + (__pyx_v_pointer[__pyx_v_rec])); - /* "dataRead.pyx":881 - * elif record_id_size == 2: - * while position < data_block_length: - * memcpy(&record_id_short, &bit_stream[position], 2) # <<<<<<<<<<<<<< - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, - * position, buf, VLSD, pos_byte_beg, pos_byte_end, + /* "dataRead.pyx":1556 + * VLSDLen[rec] = vlsd_len + * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] + * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< + * max_len = VLSDLen[rec] + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) */ - (void)(memcpy((&__pyx_v_record_id_short), (&(__pyx_v_bit_stream[__pyx_v_position])), 2)); + __pyx_t_2 = ((__pyx_v_VLSDLen[__pyx_v_rec]) > __pyx_v_max_len); + if (__pyx_t_2) { - /* "dataRead.pyx":882 - * while position < data_block_length: - * memcpy(&record_id_short, &bit_stream[position], 2) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, + /* "dataRead.pyx":1557 + * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] + * if VLSDLen[rec] > max_len: + * max_len = VLSDLen[rec] # <<<<<<<<<<<<<< + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len */ - __pyx_t_6 = __Pyx_PyInt_From_unsigned_short(__pyx_v_record_id_short); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_v_max_len = (__pyx_v_VLSDLen[__pyx_v_rec]); - /* "dataRead.pyx":885 - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< - * elif record_id_size == 3: - * while position < data_block_length: + /* "dataRead.pyx":1556 + * VLSDLen[rec] = vlsd_len + * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] + * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< + * max_len = VLSDLen[rec] + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) */ - __pyx_t_14 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_6, 2, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) { - PyObject* sequence = __pyx_t_14; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 882, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); - } else { - __pyx_t_6 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - __pyx_t_15 = PyList_GET_ITEM(sequence, 2); - __pyx_t_2 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_2); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_8,&__pyx_t_15,&__pyx_t_2}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - } - #endif - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_8,&__pyx_t_15,&__pyx_t_2}; - __pyx_t_5 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 882, __pyx_L1_error) - __pyx_t_19 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L16_unpacking_done; - __pyx_L15_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 882, __pyx_L1_error) - __pyx_L16_unpacking_done:; } + } - /* "dataRead.pyx":882 - * while position < data_block_length: - * memcpy(&record_id_short, &bit_stream[position], 2) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_short, 2, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, + /* "dataRead.pyx":1558 + * if VLSDLen[rec] > max_len: + * max_len = VLSDLen[rec] + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) # <<<<<<<<<<<<<< + * VLSDLen[rec] = vlsd_len + * if VLSDLen[rec] > max_len: */ - __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_6); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 882, __pyx_L1_error) - if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 882, __pyx_L1_error) - if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_2))) __PYX_ERR(0, 882, __pyx_L1_error) - __pyx_v_position = __pyx_t_20; - __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_15)); - __pyx_t_15 = 0; - __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; - } + (void)(memcpy((&__pyx_v_vlsd_len), (&(__pyx_v_bit_stream[(__pyx_v_pointer[__pyx_v_rec])])), 4)); - /* "dataRead.pyx":879 - * c_format_structure, index, CGrecordLength, - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) - * elif record_id_size == 2: # <<<<<<<<<<<<<< - * while position < data_block_length: - * memcpy(&record_id_short, &bit_stream[position], 2) + /* "dataRead.pyx":1559 + * max_len = VLSDLen[rec] + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len # <<<<<<<<<<<<<< + * if VLSDLen[rec] > max_len: + * max_len = VLSDLen[rec] */ - break; - case 3: + (__pyx_v_VLSDLen[__pyx_v_rec]) = __pyx_v_vlsd_len; - /* "dataRead.pyx":887 - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) - * elif record_id_size == 3: - * while position < data_block_length: # <<<<<<<<<<<<<< - * memcpy(&record_id_long, &bit_stream[position], 4) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, + /* "dataRead.pyx":1560 + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len + * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< + * max_len = VLSDLen[rec] + * if max_len != 0: */ - while (1) { - __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); - if (!__pyx_t_7) break; + __pyx_t_2 = ((__pyx_v_VLSDLen[__pyx_v_rec]) > __pyx_v_max_len); + if (__pyx_t_2) { - /* "dataRead.pyx":888 - * elif record_id_size == 3: - * while position < data_block_length: - * memcpy(&record_id_long, &bit_stream[position], 4) # <<<<<<<<<<<<<< - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, - * position, buf, VLSD, pos_byte_beg, pos_byte_end, + /* "dataRead.pyx":1561 + * VLSDLen[rec] = vlsd_len + * if VLSDLen[rec] > max_len: + * max_len = VLSDLen[rec] # <<<<<<<<<<<<<< + * if max_len != 0: + * if signal_data_type < 10 or signal_data_type == 17: */ - (void)(memcpy((&__pyx_v_record_id_long), (&(__pyx_v_bit_stream[__pyx_v_position])), 4)); + __pyx_v_max_len = (__pyx_v_VLSDLen[__pyx_v_rec]); - /* "dataRead.pyx":889 - * while position < data_block_length: - * memcpy(&record_id_long, &bit_stream[position], 4) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, + /* "dataRead.pyx":1560 + * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + * VLSDLen[rec] = vlsd_len + * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< + * max_len = VLSDLen[rec] + * if max_len != 0: */ - __pyx_t_14 = __Pyx_PyInt_From_unsigned_long(__pyx_v_record_id_long); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); + } - /* "dataRead.pyx":892 - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) # <<<<<<<<<<<<<< - * elif record_id_size == 4: - * while position < data_block_length: + /* "dataRead.pyx":1562 + * if VLSDLen[rec] > max_len: + * max_len = VLSDLen[rec] + * if max_len != 0: # <<<<<<<<<<<<<< + * if signal_data_type < 10 or signal_data_type == 17: + * if signal_data_type == 6: */ - __pyx_t_2 = __pyx_f_8dataRead_unsorted_read4(__pyx_v_bit_stream, __pyx_v_tmp, __pyx_t_14, 4, __pyx_v_position, __pyx_v_buf, __pyx_v_VLSD, __pyx_v_pos_byte_beg, __pyx_v_pos_byte_end, __pyx_v_c_format_structure, __pyx_v_index, __pyx_v_CGrecordLength, __pyx_v_VLSD_flag, __pyx_v_VLSD_CG_name, __pyx_v_VLSD_CG_signal_data_type, __pyx_v_channel_name_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 889, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); - } else { - __pyx_t_14 = PyList_GET_ITEM(sequence, 0); - __pyx_t_15 = PyList_GET_ITEM(sequence, 1); - __pyx_t_8 = PyList_GET_ITEM(sequence, 2); - __pyx_t_6 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_6); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_8,&__pyx_t_6}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - } - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = (__pyx_v_max_len != 0); + if (__pyx_t_2) { + + /* "dataRead.pyx":1563 + * max_len = VLSDLen[rec] + * if max_len != 0: + * if signal_data_type < 10 or signal_data_type == 17: # <<<<<<<<<<<<<< + * if signal_data_type == 6: + * channel_format = 'ISO8859' + */ + __pyx_t_3 = (__pyx_v_signal_data_type < 10); + if (!__pyx_t_3) { } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_8,&__pyx_t_6}; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L19_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 889, __pyx_L1_error) - __pyx_t_19 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L20_unpacking_done; - __pyx_L19_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 889, __pyx_L1_error) - __pyx_L20_unpacking_done:; + __pyx_t_2 = __pyx_t_3; + goto __pyx_L15_bool_binop_done; } + __pyx_t_3 = (__pyx_v_signal_data_type == 17); + __pyx_t_2 = __pyx_t_3; + __pyx_L15_bool_binop_done:; + if (__pyx_t_2) { - /* "dataRead.pyx":889 - * while position < data_block_length: - * memcpy(&record_id_long, &bit_stream[position], 4) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long, 4, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, + /* "dataRead.pyx":1564 + * if max_len != 0: + * if signal_data_type < 10 or signal_data_type == 17: + * if signal_data_type == 6: # <<<<<<<<<<<<<< + * channel_format = 'ISO8859' + * elif signal_data_type == 7: */ - __pyx_t_20 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_14); if (unlikely((__pyx_t_20 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_15))) __PYX_ERR(0, 889, __pyx_L1_error) - if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 889, __pyx_L1_error) - if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_6))) __PYX_ERR(0, 889, __pyx_L1_error) - __pyx_v_position = __pyx_t_20; - __Pyx_DECREF_SET(__pyx_v_buf, ((PyObject*)__pyx_t_15)); - __pyx_t_15 = 0; - __Pyx_DECREF_SET(__pyx_v_VLSD, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_index, ((PyObject*)__pyx_t_6)); - __pyx_t_6 = 0; - } + switch (__pyx_v_signal_data_type) { + case 6: - /* "dataRead.pyx":886 - * c_format_structure, index, CGrecordLength, - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) - * elif record_id_size == 3: # <<<<<<<<<<<<<< - * while position < data_block_length: - * memcpy(&record_id_long, &bit_stream[position], 4) + /* "dataRead.pyx":1565 + * if signal_data_type < 10 or signal_data_type == 17: + * if signal_data_type == 6: + * channel_format = 'ISO8859' # <<<<<<<<<<<<<< + * elif signal_data_type == 7: + * channel_format = 'utf-8' */ - break; - case 4: + __Pyx_INCREF(__pyx_n_u_ISO8859); + __pyx_v_channel_format = __pyx_n_u_ISO8859; - /* "dataRead.pyx":894 - * VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, channel_name_set) - * elif record_id_size == 4: - * while position < data_block_length: # <<<<<<<<<<<<<< - * memcpy(&record_id_long_long, &bit_stream[position], 8) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, + /* "dataRead.pyx":1564 + * if max_len != 0: + * if signal_data_type < 10 or signal_data_type == 17: + * if signal_data_type == 6: # <<<<<<<<<<<<<< + * channel_format = 'ISO8859' + * elif signal_data_type == 7: */ - while (1) { - __pyx_t_7 = (__pyx_v_position < __pyx_v_data_block_length); - if (!__pyx_t_7) break; + break; + case 7: - /* "dataRead.pyx":895 - * elif record_id_size == 4: - * while position < data_block_length: - * memcpy(&record_id_long_long, &bit_stream[position], 8) # <<<<<<<<<<<<<< - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, - * position, buf, VLSD, pos_byte_beg, pos_byte_end, + /* "dataRead.pyx":1567 + * channel_format = 'ISO8859' + * elif signal_data_type == 7: + * channel_format = 'utf-8' # <<<<<<<<<<<<<< + * elif signal_data_type == 8: + * channel_format = ' 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 896, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - __pyx_t_15 = PyList_GET_ITEM(sequence, 2); - __pyx_t_14 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_14); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_8,&__pyx_t_15,&__pyx_t_14}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 896, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - } - #endif - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_8,&__pyx_t_15,&__pyx_t_14}; - __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_19 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_19(__pyx_t_5); if (unlikely(!item)) goto __pyx_L23_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_5), 4) < 0) __PYX_ERR(0, 896, __pyx_L1_error) - __pyx_t_19 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L24_unpacking_done; - __pyx_L23_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_19 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 896, __pyx_L1_error) - __pyx_L24_unpacking_done:; - } + __Pyx_INCREF(__pyx_kp_u_utf_16); + __pyx_v_channel_format = __pyx_kp_u_utf_16; - /* "dataRead.pyx":896 - * while position < data_block_length: - * memcpy(&record_id_long_long, &bit_stream[position], 8) - * position, buf, VLSD, index = unsorted_read4(bit_stream, tmp, record_id_long_long, 8, # <<<<<<<<<<<<<< - * position, buf, VLSD, pos_byte_beg, pos_byte_end, - * c_format_structure, index, CGrecordLength, + /* "dataRead.pyx":1568 + * elif signal_data_type == 7: + * channel_format = 'utf-8' + * elif signal_data_type == 8: # <<<<<<<<<<<<<< + * channel_format = ' max_len: + * max_len = VLSDLen[rec] + * if max_len != 0: # <<<<<<<<<<<<<< + * if signal_data_type < 10 or signal_data_type == 17: + * if signal_data_type == 6: */ - } + } - /* "dataRead.pyx":905 - * buf[name] = buf[name].view(dtype=numpy_format[name]) - * # convert list to array for VLSD only - * if VLSD: # <<<<<<<<<<<<<< - * for channel_name in VLSD: - * VLSD[channel_name] = np.array(VLSD[channel_name]) + /* "dataRead.pyx":1581 + * return equalize_byte_length(bit_stream, pointer, VLSDLen, max_len, n_records) + * else: + * printf('VLSD channel could not be properly read\n') # <<<<<<<<<<<<<< + * return None + * finally: */ - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_VLSD); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 905, __pyx_L1_error) - if (__pyx_t_7) { + /*else*/ { + (void)(printf(((char const *)"VLSD channel could not be properly read\n"))); - /* "dataRead.pyx":906 - * # convert list to array for VLSD only - * if VLSD: - * for channel_name in VLSD: # <<<<<<<<<<<<<< - * VLSD[channel_name] = np.array(VLSD[channel_name]) - * buf.update(VLSD) + /* "dataRead.pyx":1582 + * else: + * printf('VLSD channel could not be properly read\n') + * return None # <<<<<<<<<<<<<< + * finally: + * PyMem_Free(pointer) */ - __pyx_t_11 = 0; - if (unlikely(__pyx_v_VLSD == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 906, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L6_return; } - __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_VLSD, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_12)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 906, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_6); - __pyx_t_6 = __pyx_t_8; - __pyx_t_8 = 0; - while (1) { - __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_3, &__pyx_t_11, &__pyx_t_8, NULL, NULL, __pyx_t_12); - if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 906, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF_SET(__pyx_v_channel_name, __pyx_t_8); - __pyx_t_8 = 0; + } - /* "dataRead.pyx":907 - * if VLSD: - * for channel_name in VLSD: - * VLSD[channel_name] = np.array(VLSD[channel_name]) # <<<<<<<<<<<<<< - * buf.update(VLSD) - * return buf + /* "dataRead.pyx":1584 + * return None + * finally: + * PyMem_Free(pointer) # <<<<<<<<<<<<<< + * PyMem_Free(VLSDLen) + * */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_array); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(__pyx_v_VLSD == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 907, __pyx_L1_error) - } - __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_VLSD, __pyx_v_channel_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = NULL; - __pyx_t_9 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); - __pyx_t_9 = 1; - } - } - #endif + /*finally:*/ { + __pyx_L7_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename; { - PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_14}; - __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + PyMem_Free(__pyx_v_pointer); + + /* "dataRead.pyx":1585 + * finally: + * PyMem_Free(pointer) + * PyMem_Free(VLSDLen) # <<<<<<<<<<<<<< + * + * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, + */ + PyMem_Free(__pyx_v_VLSDLen); } - if (unlikely(__pyx_v_VLSD == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 907, __pyx_L1_error) + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); } - if (unlikely((PyDict_SetItem(__pyx_v_VLSD, __pyx_v_channel_name, __pyx_t_8) < 0))) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8; + goto __pyx_L1_error; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_L6_return: { + __pyx_t_14 = __pyx_r; + __pyx_r = 0; - /* "dataRead.pyx":908 - * for channel_name in VLSD: - * VLSD[channel_name] = np.array(VLSD[channel_name]) - * buf.update(VLSD) # <<<<<<<<<<<<<< - * return buf + /* "dataRead.pyx":1584 + * return None + * finally: + * PyMem_Free(pointer) # <<<<<<<<<<<<<< + * PyMem_Free(VLSDLen) * */ - __pyx_t_6 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_buf, __pyx_v_VLSD); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + PyMem_Free(__pyx_v_pointer); - /* "dataRead.pyx":905 - * buf[name] = buf[name].view(dtype=numpy_format[name]) - * # convert list to array for VLSD only - * if VLSD: # <<<<<<<<<<<<<< - * for channel_name in VLSD: - * VLSD[channel_name] = np.array(VLSD[channel_name]) + /* "dataRead.pyx":1585 + * finally: + * PyMem_Free(pointer) + * PyMem_Free(VLSDLen) # <<<<<<<<<<<<<< + * + * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, */ + PyMem_Free(__pyx_v_VLSDLen); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + } } - /* "dataRead.pyx":909 - * VLSD[channel_name] = np.array(VLSD[channel_name]) - * buf.update(VLSD) - * return buf # <<<<<<<<<<<<<< + /* "dataRead.pyx":1520 * - * cdef inline unsorted_read4(const char* bit_stream, bytes tmp, record_id, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_buf); - __pyx_r = __pyx_v_buf; - goto __pyx_L0; - - /* "dataRead.pyx":807 - * return buf.byteswap() * - * def unsorted_data_read4(record, info, bytes tmp, # <<<<<<<<<<<<<< - * const unsigned short record_id_size, - * const unsigned long long data_block_length): + * def sd_data_read(unsigned short signal_data_type, bytes sd_block, # <<<<<<<<<<<<<< + * unsigned long long sd_block_length, unsigned long long n_records): + * """ Reads vlsd channel from its SD Block bytes */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_AddTraceback("dataRead.unsorted_data_read4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.sd_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_buf); - __Pyx_XDECREF(__pyx_v_VLSD); - __Pyx_XDECREF(__pyx_v_pos_byte_beg); - __Pyx_XDECREF(__pyx_v_pos_byte_end); - __Pyx_XDECREF(__pyx_v_c_format_structure); - __Pyx_XDECREF(__pyx_v_byte_length); - __Pyx_XDECREF(__pyx_v_numpy_format); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XDECREF(__pyx_v_CGrecordLength); - __Pyx_XDECREF(__pyx_v_VLSD_flag); - __Pyx_XDECREF(__pyx_v_VLSD_CG_name); - __Pyx_XDECREF(__pyx_v_VLSD_CG_signal_data_type); - __Pyx_XDECREF(__pyx_v_channel_name_set); - __Pyx_XDECREF(__pyx_v_record_id); - __Pyx_XDECREF(__pyx_v_Channel); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_channel_name); + __Pyx_XDECREF(__pyx_v_channel_format); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":911 - * return buf +/* "dataRead.pyx":1587 + * PyMem_Free(VLSDLen) * - * cdef inline unsorted_read4(const char* bit_stream, bytes tmp, record_id, # <<<<<<<<<<<<<< - * unsigned short record_id_size, unsigned long long position, - * buf, VLSD, pos_byte_beg, pos_byte_end, c_format_structure, + * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_unsorted_read4(char const *__pyx_v_bit_stream, PyObject *__pyx_v_tmp, PyObject *__pyx_v_record_id, unsigned short __pyx_v_record_id_size, unsigned PY_LONG_LONG __pyx_v_position, PyObject *__pyx_v_buf, PyObject *__pyx_v_VLSD, PyObject *__pyx_v_pos_byte_beg, PyObject *__pyx_v_pos_byte_end, CYTHON_UNUSED PyObject *__pyx_v_c_format_structure, PyObject *__pyx_v_index, PyObject *__pyx_v_CGrecordLength, PyObject *__pyx_v_VLSD_flag, PyObject *__pyx_v_VLSD_CG_name, PyObject *__pyx_v_VLSD_CG_signal_data_type, PyObject *__pyx_v_channel_name_set) { - unsigned long __pyx_v_VLSDLen; - PyObject *__pyx_v_channel_name = NULL; - PyObject *__pyx_v_signal_data_type = NULL; - PyObject *__pyx_v_temp = NULL; +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_byte_length(char const *__pyx_v_bit_stream, unsigned PY_LONG_LONG *__pyx_v_pointer, unsigned long *__pyx_v_VLSDLen, unsigned long __pyx_v_max_len, unsigned PY_LONG_LONG __pyx_v_n_records) { + PyArrayObject *__pyx_v_output = 0; + unsigned long __pyx_v_rec; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(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; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - unsigned PY_LONG_LONG __pyx_t_12; - int __pyx_t_13; + unsigned int __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unsorted_read4", 1); - - /* "dataRead.pyx":916 - * index, CGrecordLength, VLSD_flag, VLSD_CG_name, VLSD_CG_signal_data_type, - * channel_name_set): - * cdef unsigned long VLSDLen = 0 # <<<<<<<<<<<<<< - * if not VLSD_flag[record_id]: # not VLSD CG) - * for channel_name in channel_name_set[record_id]: # list of channel classes - */ - __pyx_v_VLSDLen = 0; + __Pyx_RefNannySetupContext("equalize_byte_length", 1); - /* "dataRead.pyx":917 - * channel_name_set): - * cdef unsigned long VLSDLen = 0 - * if not VLSD_flag[record_id]: # not VLSD CG) # <<<<<<<<<<<<<< - * for channel_name in channel_name_set[record_id]: # list of channel classes - * buf[channel_name][index[record_id]] = \ + /* "dataRead.pyx":1589 + * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, + * unsigned long max_len, unsigned long long n_records): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) # <<<<<<<<<<<<<< + * cdef unsigned long rec = 0 + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain */ - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_VLSD_flag, __pyx_v_record_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 917, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { - - /* "dataRead.pyx":918 - * cdef unsigned long VLSDLen = 0 - * if not VLSD_flag[record_id]: # not VLSD CG) - * for channel_name in channel_name_set[record_id]: # list of channel classes # <<<<<<<<<<<<<< - * buf[channel_name][index[record_id]] = \ - * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] - */ - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_channel_name_set, __pyx_v_record_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_n_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_V_2, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - { - Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); - #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 918, __pyx_L1_error) - #endif - if (__pyx_t_5 >= __pyx_temp) break; - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 918, __pyx_L1_error) - #else - __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - { - Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); - #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 918, __pyx_L1_error) - #endif - if (__pyx_t_5 >= __pyx_temp) break; - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 918, __pyx_L1_error) - #else - __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 918, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_channel_name, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dataRead.pyx":920 - * for channel_name in channel_name_set[record_id]: # list of channel classes - * buf[channel_name][index[record_id]] = \ - * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] # <<<<<<<<<<<<<< - * index[record_id] += 1 - * position += CGrecordLength[record_id] - */ - if (unlikely(__pyx_v_tmp == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 920, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_pos_byte_beg, __pyx_v_channel_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__pyx_t_8 == Py_None); - if (__pyx_t_3) { - __pyx_t_9 = 0; - } else { - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 920, __pyx_L1_error) - __pyx_t_9 = __pyx_t_10; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_pos_byte_end, __pyx_v_channel_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__pyx_t_1 == Py_None); - if (__pyx_t_3) { - __pyx_t_10 = PY_SSIZE_T_MAX; - } else { - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 920, __pyx_L1_error) - __pyx_t_10 = __pyx_t_11; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PySequence_GetSlice(__pyx_v_tmp, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1589, __pyx_L1_error) + __pyx_v_output = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":919 - * if not VLSD_flag[record_id]: # not VLSD CG) - * for channel_name in channel_name_set[record_id]: # list of channel classes - * buf[channel_name][index[record_id]] = \ # <<<<<<<<<<<<<< - * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] - * index[record_id] += 1 + /* "dataRead.pyx":1590 + * unsigned long max_len, unsigned long long n_records): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) + * cdef unsigned long rec = 0 # <<<<<<<<<<<<<< + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_buf, __pyx_v_channel_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 919, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_index, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 919, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely((PyObject_SetItem(__pyx_t_7, __pyx_t_8, __pyx_t_1) < 0))) __PYX_ERR(0, 919, __pyx_L1_error) - __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_v_rec = 0; - /* "dataRead.pyx":918 - * cdef unsigned long VLSDLen = 0 - * if not VLSD_flag[record_id]: # not VLSD CG) - * for channel_name in channel_name_set[record_id]: # list of channel classes # <<<<<<<<<<<<<< - * buf[channel_name][index[record_id]] = \ - * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] + /* "dataRead.pyx":1591 + * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) + * cdef unsigned long rec = 0 + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain # <<<<<<<<<<<<<< + * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') + * return output */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = __pyx_v_n_records; + for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_9; __pyx_v_rec+=1) { - /* "dataRead.pyx":921 - * buf[channel_name][index[record_id]] = \ - * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] - * index[record_id] += 1 # <<<<<<<<<<<<<< - * position += CGrecordLength[record_id] - * else: # VLSD CG + /* "dataRead.pyx":1592 + * cdef unsigned long rec = 0 + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') # <<<<<<<<<<<<<< + * return output + * */ - __Pyx_INCREF(__pyx_v_record_id); - __pyx_t_4 = __pyx_v_record_id; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_index, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + ((__pyx_v_pointer[__pyx_v_rec]) + 4), (((__pyx_v_pointer[__pyx_v_rec]) + 4) + (__pyx_v_VLSDLen[__pyx_v_rec])) - ((__pyx_v_pointer[__pyx_v_rec]) + 4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rjust); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely((PyObject_SetItem(__pyx_v_index, __pyx_t_4, __pyx_t_8) < 0))) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_b__13}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_4, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1592, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } - /* "dataRead.pyx":922 - * tmp[position + pos_byte_beg[channel_name]:position + pos_byte_end[channel_name]] - * index[record_id] += 1 - * position += CGrecordLength[record_id] # <<<<<<<<<<<<<< - * else: # VLSD CG - * position += record_id_size + /* "dataRead.pyx":1593 + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') + * return output # <<<<<<<<<<<<<< + * + * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, */ - __pyx_t_4 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_CGrecordLength, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_position = __pyx_t_12; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_output); + __pyx_r = ((PyObject *)__pyx_v_output); + goto __pyx_L0; - /* "dataRead.pyx":917 - * channel_name_set): - * cdef unsigned long VLSDLen = 0 - * if not VLSD_flag[record_id]: # not VLSD CG) # <<<<<<<<<<<<<< - * for channel_name in channel_name_set[record_id]: # list of channel classes - * buf[channel_name][index[record_id]] = \ + /* "dataRead.pyx":1587 + * PyMem_Free(VLSDLen) + * + * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) */ - goto __pyx_L3; - } - /* "dataRead.pyx":924 - * position += CGrecordLength[record_id] - * else: # VLSD CG - * position += record_id_size # <<<<<<<<<<<<<< - * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length - * position += 4 - */ - /*else*/ { - __pyx_v_position = (__pyx_v_position + ((unsigned PY_LONG_LONG)__pyx_v_record_id_size)); + /* function exit code */ + __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("dataRead.equalize_byte_length", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":925 - * else: # VLSD CG - * position += record_id_size - * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length # <<<<<<<<<<<<<< - * position += 4 - * signal_data_type = VLSD_CG_signal_data_type[record_id] +/* "dataRead.pyx":1595 + * return output + * + * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records, channel_format): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) */ - (void)(memcpy((&__pyx_v_VLSDLen), (&(__pyx_v_bit_stream[__pyx_v_position])), 4)); - /* "dataRead.pyx":926 - * position += record_id_size - * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length - * position += 4 # <<<<<<<<<<<<<< - * signal_data_type = VLSD_CG_signal_data_type[record_id] - * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes - */ - __pyx_v_position = (__pyx_v_position + 4); +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_string_length(char const *__pyx_v_bit_stream, unsigned PY_LONG_LONG *__pyx_v_pointer, unsigned long *__pyx_v_VLSDLen, unsigned long __pyx_v_max_len, unsigned PY_LONG_LONG __pyx_v_n_records, PyObject *__pyx_v_channel_format) { + PyArrayObject *__pyx_v_output = 0; + unsigned long __pyx_v_rec; + PyObject *__pyx_v_raw = 0; + 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; + unsigned int __pyx_t_8; + int __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("equalize_string_length", 1); - /* "dataRead.pyx":927 - * memcpy(&VLSDLen, &bit_stream[position], 4) # VLSD length - * position += 4 - * signal_data_type = VLSD_CG_signal_data_type[record_id] # <<<<<<<<<<<<<< - * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes - * if signal_data_type == 6: + /* "dataRead.pyx":1597 + * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, + * unsigned long max_len, unsigned long long n_records, channel_format): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) # <<<<<<<<<<<<<< + * cdef unsigned long rec = 0 + * cdef bytes raw */ - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_VLSD_CG_signal_data_type, __pyx_v_record_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_signal_data_type = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_n_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_U, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1597, __pyx_L1_error) + __pyx_v_output = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":928 - * position += 4 - * signal_data_type = VLSD_CG_signal_data_type[record_id] - * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes # <<<<<<<<<<<<<< - * if signal_data_type == 6: - * temp = temp.decode('ISO8859') + /* "dataRead.pyx":1598 + * unsigned long max_len, unsigned long long n_records, channel_format): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) + * cdef unsigned long rec = 0 # <<<<<<<<<<<<<< + * cdef bytes raw + * if channel_format == 'bom': */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_position, ((__pyx_v_position + __pyx_v_VLSDLen) - 1) - __pyx_v_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_temp = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_rec = 0; - /* "dataRead.pyx":929 - * signal_data_type = VLSD_CG_signal_data_type[record_id] - * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes - * if signal_data_type == 6: # <<<<<<<<<<<<<< - * temp = temp.decode('ISO8859') - * elif signal_data_type == 7: + /* "dataRead.pyx":1600 + * cdef unsigned long rec = 0 + * cdef bytes raw + * if channel_format == 'bom': # <<<<<<<<<<<<<< + * # signal_data_type 17: detect BOM per value + * for rec from 0 <= rec < n_records by 1: + */ + __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_channel_format, __pyx_n_u_bom, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1600, __pyx_L1_error) + if (__pyx_t_9) { + + /* "dataRead.pyx":1602 + * if channel_format == 'bom': + * # signal_data_type 17: detect BOM per value + * for rec from 0 <= rec < n_records by 1: # <<<<<<<<<<<<<< + * raw = bytes(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]) + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + */ + __pyx_t_10 = __pyx_v_n_records; + for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_10; __pyx_v_rec+=1) { + + /* "dataRead.pyx":1603 + * # signal_data_type 17: detect BOM per value + * for rec from 0 <= rec < n_records by 1: + * raw = bytes(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]) # <<<<<<<<<<<<<< + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + */ + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + ((__pyx_v_pointer[__pyx_v_rec]) + 4), (((__pyx_v_pointer[__pyx_v_rec]) + 4) + (__pyx_v_VLSDLen[__pyx_v_rec])) - ((__pyx_v_pointer[__pyx_v_rec]) + 4)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_raw, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "dataRead.pyx":1604 + * for rec from 0 <= rec < n_records by 1: + * raw = bytes(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]) + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: # <<<<<<<<<<<<<< + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: */ - __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_6, 6, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 929, __pyx_L1_error) - if (__pyx_t_3) { + __pyx_t_11 = __Pyx_PyBytes_GET_SIZE(__pyx_v_raw); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1604, __pyx_L1_error) + __pyx_t_12 = (__pyx_t_11 >= 3); + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_239, 0xEF, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_187, 0xBB, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_191, 0xBF, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1604, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __pyx_t_12; + __pyx_L7_bool_binop_done:; + if (__pyx_t_9) { - /* "dataRead.pyx":930 - * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes - * if signal_data_type == 6: - * temp = temp.decode('ISO8859') # <<<<<<<<<<<<<< - * elif signal_data_type == 7: - * temp = temp.decode('utf-8') + /* "dataRead.pyx":1605 + * raw = bytes(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]) + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') */ - __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_4 = PySequence_GetSlice(__pyx_v_raw, 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1605, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__14, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_3, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":929 - * signal_data_type = VLSD_CG_signal_data_type[record_id] - * temp = bytes(bit_stream[position:position + VLSDLen - 1]) # default: raw bytes - * if signal_data_type == 6: # <<<<<<<<<<<<<< - * temp = temp.decode('ISO8859') - * elif signal_data_type == 7: + /* "dataRead.pyx":1604 + * for rec from 0 <= rec < n_records by 1: + * raw = bytes(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]) + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: # <<<<<<<<<<<<<< + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: */ - goto __pyx_L7; - } + goto __pyx_L6; + } - /* "dataRead.pyx":931 - * if signal_data_type == 6: - * temp = temp.decode('ISO8859') - * elif signal_data_type == 7: # <<<<<<<<<<<<<< - * temp = temp.decode('utf-8') - * elif signal_data_type == 8: + /* "dataRead.pyx":1606 + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: # <<<<<<<<<<<<<< + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: */ - __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_7, 7, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 931, __pyx_L1_error) - if (__pyx_t_3) { + __pyx_t_11 = __Pyx_PyBytes_GET_SIZE(__pyx_v_raw); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1606, __pyx_L1_error) + __pyx_t_12 = (__pyx_t_11 >= 2); + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_255, 0xFF, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_254, 0xFE, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __pyx_t_12; + __pyx_L11_bool_binop_done:; + if (__pyx_t_9) { - /* "dataRead.pyx":932 - * temp = temp.decode('ISO8859') - * elif signal_data_type == 7: - * temp = temp.decode('utf-8') # <<<<<<<<<<<<<< - * elif signal_data_type == 8: - * temp = temp.decode('= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') */ - __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_4 = PySequence_GetSlice(__pyx_v_raw, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1607, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__15, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_3, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":931 - * if signal_data_type == 6: - * temp = temp.decode('ISO8859') - * elif signal_data_type == 7: # <<<<<<<<<<<<<< - * temp = temp.decode('utf-8') - * elif signal_data_type == 8: + /* "dataRead.pyx":1606 + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: # <<<<<<<<<<<<<< + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: */ - goto __pyx_L7; - } + goto __pyx_L6; + } - /* "dataRead.pyx":933 - * elif signal_data_type == 7: - * temp = temp.decode('utf-8') - * elif signal_data_type == 8: # <<<<<<<<<<<<<< - * temp = temp.decode('= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: # <<<<<<<<<<<<<< + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif len(raw) > 0: */ - __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_8, 8, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 933, __pyx_L1_error) - if (__pyx_t_3) { + __pyx_t_11 = __Pyx_PyBytes_GET_SIZE(__pyx_v_raw); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1608, __pyx_L1_error) + __pyx_t_12 = (__pyx_t_11 >= 2); + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_254, 0xFE, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1608, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_12) { + } else { + __pyx_t_9 = __pyx_t_12; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_255, 0xFF, 0)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1608, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __pyx_t_12; + __pyx_L14_bool_binop_done:; + if (__pyx_t_9) { - /* "dataRead.pyx":934 - * temp = temp.decode('utf-8') - * elif signal_data_type == 8: - * temp = temp.decode('utf-16') + /* "dataRead.pyx":1609 + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif len(raw) > 0: + * output[rec] = raw.decode('utf-8', errors='replace').rstrip('\x00') */ - __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, __Pyx_PyUnicode_DecodeUTF16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_4 = PySequence_GetSlice(__pyx_v_raw, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1609, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__16, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_3, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":933 - * elif signal_data_type == 7: - * temp = temp.decode('utf-8') - * elif signal_data_type == 8: # <<<<<<<<<<<<<< - * temp = temp.decode('= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: # <<<<<<<<<<<<<< + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif len(raw) > 0: */ - goto __pyx_L7; - } + goto __pyx_L6; + } - /* "dataRead.pyx":935 - * elif signal_data_type == 8: - * temp = temp.decode('utf-16') - * VLSD[VLSD_CG_name[record_id]].append(temp) + /* "dataRead.pyx":1610 + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif len(raw) > 0: # <<<<<<<<<<<<<< + * output[rec] = raw.decode('utf-8', errors='replace').rstrip('\x00') + * else: */ - __pyx_t_3 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_signal_data_type, __pyx_int_9, 9, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 935, __pyx_L1_error) - if (__pyx_t_3) { + __pyx_t_11 = __Pyx_PyBytes_GET_SIZE(__pyx_v_raw); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1610, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_11 > 0); + if (__pyx_t_9) { - /* "dataRead.pyx":936 - * temp = temp.decode('utf-16') # <<<<<<<<<<<<<< - * VLSD[VLSD_CG_name[record_id]].append(temp) - * position += VLSDLen + /* "dataRead.pyx":1611 + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif len(raw) > 0: + * output[rec] = raw.decode('utf-8', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * else: + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain */ - __pyx_t_8 = __Pyx_decode_bytes(__pyx_v_temp, 0, PY_SSIZE_T_MAX, NULL, NULL, __Pyx_PyUnicode_DecodeUTF16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_raw, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__14, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_3, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1611, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":935 - * elif signal_data_type == 8: - * temp = temp.decode('utf-16') - * VLSD[VLSD_CG_name[record_id]].append(temp) + /* "dataRead.pyx":1610 + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif len(raw) > 0: # <<<<<<<<<<<<<< + * output[rec] = raw.decode('utf-8', errors='replace').rstrip('\x00') + * else: */ + } + __pyx_L6:; } - __pyx_L7:; - /* "dataRead.pyx":937 - * elif signal_data_type == 9: - * temp = temp.decode('>utf-16') - * VLSD[VLSD_CG_name[record_id]].append(temp) # <<<<<<<<<<<<<< - * position += VLSDLen - * return position, buf, VLSD, index + /* "dataRead.pyx":1600 + * cdef unsigned long rec = 0 + * cdef bytes raw + * if channel_format == 'bom': # <<<<<<<<<<<<<< + * # signal_data_type 17: detect BOM per value + * for rec from 0 <= rec < n_records by 1: */ - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_VLSD_CG_name, __pyx_v_record_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 937, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_VLSD, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_temp); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 937, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } - /* "dataRead.pyx":938 - * temp = temp.decode('>utf-16') - * VLSD[VLSD_CG_name[record_id]].append(temp) - * position += VLSDLen # <<<<<<<<<<<<<< - * return position, buf, VLSD, index + /* "dataRead.pyx":1613 + * output[rec] = raw.decode('utf-8', errors='replace').rstrip('\x00') + * else: + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain # <<<<<<<<<<<<<< + * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') + * return output + */ + /*else*/ { + __pyx_t_10 = __pyx_v_n_records; + for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_10; __pyx_v_rec+=1) { + + /* "dataRead.pyx":1614 + * else: + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') # <<<<<<<<<<<<<< + * return output * */ - __pyx_v_position = (__pyx_v_position + ((unsigned PY_LONG_LONG)__pyx_v_VLSDLen)); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + ((__pyx_v_pointer[__pyx_v_rec]) + 4), (((__pyx_v_pointer[__pyx_v_rec]) + 4) + (__pyx_v_VLSDLen[__pyx_v_rec])) - ((__pyx_v_pointer[__pyx_v_rec]) + 4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_channel_format}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_3, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } } __pyx_L3:; - /* "dataRead.pyx":939 - * VLSD[VLSD_CG_name[record_id]].append(temp) - * position += VLSDLen - * return position, buf, VLSD, index # <<<<<<<<<<<<<< + /* "dataRead.pyx":1615 + * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') + * return output # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 939, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_buf); - __Pyx_GIVEREF(__pyx_v_buf); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_buf)) __PYX_ERR(0, 939, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_VLSD); - __Pyx_GIVEREF(__pyx_v_VLSD); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_VLSD)) __PYX_ERR(0, 939, __pyx_L1_error); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_index)) __PYX_ERR(0, 939, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; + __Pyx_INCREF((PyObject *)__pyx_v_output); + __pyx_r = ((PyObject *)__pyx_v_output); goto __pyx_L0; - /* "dataRead.pyx":911 - * return buf + /* "dataRead.pyx":1595 + * return output * - * cdef inline unsorted_read4(const char* bit_stream, bytes tmp, record_id, # <<<<<<<<<<<<<< - * unsigned short record_id_size, unsigned long long position, - * buf, VLSD, pos_byte_beg, pos_byte_end, c_format_structure, + * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records, channel_format): + * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) */ /* function exit code */ __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_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("dataRead.unsorted_read4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.equalize_string_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_channel_name); - __Pyx_XDECREF(__pyx_v_signal_data_type); - __Pyx_XDECREF(__pyx_v_temp); + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XDECREF(__pyx_v_raw); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":942 +/* "dataRead.pyx":1618 * * - * def sd_data_read(unsigned short signal_data_type, bytes sd_block, # <<<<<<<<<<<<<< - * unsigned long long sd_block_length, unsigned long long n_records): - * """ Reads vlsd channel from its SD Block bytes + * def vd_data_read(unsigned short signal_data_type, bytes vd_block, # <<<<<<<<<<<<<< + * object offsets_array, object sizes_array, + * unsigned long long n_records): */ /* Python wrapper */ -static PyObject *__pyx_pw_8dataRead_5sd_data_read(PyObject *__pyx_self, +static PyObject *__pyx_pw_8dataRead_9vd_data_read(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_8dataRead_4sd_data_read, " Reads vlsd channel from its SD Block bytes\n\n Parameters\n ----------------\n signal_data_type : int\n\n sd_block : bytes\n SD Block bytes\n\n sd_block_length: int\n SD Block data length (header not included)\n\n n_records: int\n number of records\n\n Returns\n -----------\n array\n "); -static PyMethodDef __pyx_mdef_8dataRead_5sd_data_read = {"sd_data_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_5sd_data_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_4sd_data_read}; -static PyObject *__pyx_pw_8dataRead_5sd_data_read(PyObject *__pyx_self, +PyDoc_STRVAR(__pyx_doc_8dataRead_8vd_data_read, "Read VLSC channel data from raw VD block bytes.\n\n Parameters\n ----------------\n signal_data_type : int\n signal data type (6=ISO-8859-1, 7=UTF-8, 8=UTF-16-LE, 9=UTF-16-BE,\n 17=BOM, 10+=byte array)\n vd_block : bytes\n raw VD block data (no per-value length prefix, unlike SD blocks)\n offsets_array : numpy uint64 array\n byte offset of each value within vd_block\n sizes_array : numpy uint64 array\n byte size of each value\n n_records : int\n number of records\n\n Returns\n -------\n numpy array of decoded strings (dtype U...) or byte arrays (dtype V...)\n "); +static PyMethodDef __pyx_mdef_8dataRead_9vd_data_read = {"vd_data_read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_9vd_data_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_8vd_data_read}; +static PyObject *__pyx_pw_8dataRead_9vd_data_read(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -32447,20 +41345,21 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { unsigned short __pyx_v_signal_data_type; - PyObject *__pyx_v_sd_block = 0; - CYTHON_UNUSED unsigned PY_LONG_LONG __pyx_v_sd_block_length; + PyObject *__pyx_v_vd_block = 0; + PyObject *__pyx_v_offsets_array = 0; + PyObject *__pyx_v_sizes_array = 0; unsigned PY_LONG_LONG __pyx_v_n_records; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[4] = {0,0,0,0}; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sd_data_read (wrapper)", 0); + __Pyx_RefNannySetupContext("vd_data_read (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); @@ -32470,10 +41369,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signal_data_type,&__pyx_n_s_sd_block,&__pyx_n_s_sd_block_length,&__pyx_n_s_n_records,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signal_data_type,&__pyx_n_s_vd_block,&__pyx_n_s_offsets_array,&__pyx_n_s_sizes_array,&__pyx_n_s_n_records,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); @@ -32492,59 +41393,71 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sd_block)) != 0)) { + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vd_block)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, 1); __PYX_ERR(0, 942, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("vd_data_read", 1, 5, 5, 1); __PYX_ERR(0, 1618, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sd_block_length)) != 0)) { + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offsets_array)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, 2); __PYX_ERR(0, 942, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("vd_data_read", 1, 5, 5, 2); __PYX_ERR(0, 1618, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_records)) != 0)) { + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sizes_array)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("vd_data_read", 1, 5, 5, 3); __PYX_ERR(0, 1618, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_records)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, 3); __PYX_ERR(0, 942, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("vd_data_read", 1, 5, 5, 4); __PYX_ERR(0, 1618, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sd_data_read") < 0)) __PYX_ERR(0, 942, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "vd_data_read") < 0)) __PYX_ERR(0, 1618, __pyx_L3_error) } - } else if (unlikely(__pyx_nargs != 4)) { + } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); } - __pyx_v_signal_data_type = __Pyx_PyInt_As_unsigned_short(values[0]); if (unlikely((__pyx_v_signal_data_type == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) - __pyx_v_sd_block = ((PyObject*)values[1]); - __pyx_v_sd_block_length = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[2]); if (unlikely((__pyx_v_sd_block_length == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error) - __pyx_v_n_records = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[3]); if (unlikely((__pyx_v_n_records == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error) + __pyx_v_signal_data_type = __Pyx_PyInt_As_unsigned_short(values[0]); if (unlikely((__pyx_v_signal_data_type == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L3_error) + __pyx_v_vd_block = ((PyObject*)values[1]); + __pyx_v_offsets_array = values[2]; + __pyx_v_sizes_array = values[3]; + __pyx_v_n_records = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[4]); if (unlikely((__pyx_v_n_records == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1620, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sd_data_read", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 942, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("vd_data_read", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1618, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -32554,12 +41467,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __Pyx_AddTraceback("dataRead.sd_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.vd_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sd_block), (&PyBytes_Type), 1, "sd_block", 1))) __PYX_ERR(0, 942, __pyx_L1_error) - __pyx_r = __pyx_pf_8dataRead_4sd_data_read(__pyx_self, __pyx_v_signal_data_type, __pyx_v_sd_block, __pyx_v_sd_block_length, __pyx_v_n_records); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vd_block), (&PyBytes_Type), 1, "vd_block", 1))) __PYX_ERR(0, 1618, __pyx_L1_error) + __pyx_r = __pyx_pf_8dataRead_8vd_data_read(__pyx_self, __pyx_v_signal_data_type, __pyx_v_vd_block, __pyx_v_offsets_array, __pyx_v_sizes_array, __pyx_v_n_records); /* function exit code */ goto __pyx_L0; @@ -32576,574 +41489,1244 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_8dataRead_4sd_data_read(CYTHON_UNUSED PyObject *__pyx_self, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_sd_block, CYTHON_UNUSED unsigned PY_LONG_LONG __pyx_v_sd_block_length, unsigned PY_LONG_LONG __pyx_v_n_records) { +static PyObject *__pyx_pf_8dataRead_8vd_data_read(CYTHON_UNUSED PyObject *__pyx_self, unsigned short __pyx_v_signal_data_type, PyObject *__pyx_v_vd_block, PyObject *__pyx_v_offsets_array, PyObject *__pyx_v_sizes_array, unsigned PY_LONG_LONG __pyx_v_n_records) { char const *__pyx_v_bit_stream; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned PY_LONG_LONG __pyx_v_size; unsigned long __pyx_v_max_len; - unsigned long __pyx_v_vlsd_len; - unsigned long *__pyx_v_VLSDLen; - unsigned PY_LONG_LONG *__pyx_v_pointer; - unsigned PY_LONG_LONG __pyx_v_rec; - PyObject *__pyx_v_channel_format = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - unsigned PY_LONG_LONG __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - char const *__pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; + unsigned PY_LONG_LONG __pyx_t_2; + unsigned PY_LONG_LONG __pyx_t_3; + unsigned PY_LONG_LONG __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + unsigned PY_LONG_LONG __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sd_data_read", 1); + __Pyx_RefNannySetupContext("vd_data_read", 1); - /* "dataRead.pyx":963 - * array + /* "dataRead.pyx":1641 + * numpy array of decoded strings (dtype U...) or byte arrays (dtype V...) * """ - * cdef const char* bit_stream = PyBytes_AsString(sd_block) # <<<<<<<<<<<<<< - * cdef unsigned long max_len = 0 - * cdef unsigned long vlsd_len = 0 + * cdef const char* bit_stream = PyBytes_AsString(vd_block) # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long long offset, size */ - __pyx_t_1 = PyBytes_AsString(__pyx_v_sd_block); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 963, __pyx_L1_error) + __pyx_t_1 = PyBytes_AsString(__pyx_v_vd_block); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 1641, __pyx_L1_error) __pyx_v_bit_stream = __pyx_t_1; - /* "dataRead.pyx":964 - * """ - * cdef const char* bit_stream = PyBytes_AsString(sd_block) + /* "dataRead.pyx":1644 + * cdef unsigned long long i + * cdef unsigned long long offset, size * cdef unsigned long max_len = 0 # <<<<<<<<<<<<<< - * cdef unsigned long vlsd_len = 0 - * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) + * + * # Find max_len from sizes */ __pyx_v_max_len = 0; - /* "dataRead.pyx":965 - * cdef const char* bit_stream = PyBytes_AsString(sd_block) - * cdef unsigned long max_len = 0 - * cdef unsigned long vlsd_len = 0 # <<<<<<<<<<<<<< - * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) - * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) + /* "dataRead.pyx":1647 + * + * # Find max_len from sizes + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > max_len: */ - __pyx_v_vlsd_len = 0; + __pyx_t_2 = __pyx_v_n_records; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "dataRead.pyx":966 - * cdef unsigned long max_len = 0 - * cdef unsigned long vlsd_len = 0 - * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) # <<<<<<<<<<<<<< - * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) - * cdef unsigned long long rec = 0 + /* "dataRead.pyx":1648 + * # Find max_len from sizes + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > max_len: + * max_len = size */ - __pyx_v_VLSDLen = ((unsigned long *)PyMem_Malloc((__pyx_v_n_records * (sizeof(unsigned long))))); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_size = ((unsigned PY_LONG_LONG)__pyx_t_6); - /* "dataRead.pyx":967 - * cdef unsigned long vlsd_len = 0 - * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) - * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) # <<<<<<<<<<<<<< - * cdef unsigned long long rec = 0 - * if not VLSDLen or not pointer: + /* "dataRead.pyx":1649 + * for i in range(n_records): + * size = sizes_array[i] + * if size > max_len: # <<<<<<<<<<<<<< + * max_len = size + * */ - __pyx_v_pointer = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_n_records * (sizeof(unsigned PY_LONG_LONG))))); + __pyx_t_7 = (__pyx_v_size > __pyx_v_max_len); + if (__pyx_t_7) { - /* "dataRead.pyx":968 - * cdef unsigned long *VLSDLen = PyMem_Malloc(n_records * sizeof(unsigned long)) - * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) - * cdef unsigned long long rec = 0 # <<<<<<<<<<<<<< - * if not VLSDLen or not pointer: - * raise MemoryError() + /* "dataRead.pyx":1650 + * size = sizes_array[i] + * if size > max_len: + * max_len = size # <<<<<<<<<<<<<< + * + * if max_len == 0: */ - __pyx_v_rec = 0; + __pyx_v_max_len = ((unsigned long)__pyx_v_size); - /* "dataRead.pyx":969 - * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) - * cdef unsigned long long rec = 0 - * if not VLSDLen or not pointer: # <<<<<<<<<<<<<< - * raise MemoryError() - * try: + /* "dataRead.pyx":1649 + * for i in range(n_records): + * size = sizes_array[i] + * if size > max_len: # <<<<<<<<<<<<<< + * max_len = size + * */ - __pyx_t_3 = (!(__pyx_v_VLSDLen != 0)); - if (!__pyx_t_3) { - } else { - __pyx_t_2 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; + } } - __pyx_t_3 = (!(__pyx_v_pointer != 0)); - __pyx_t_2 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_2)) { - /* "dataRead.pyx":970 - * cdef unsigned long long rec = 0 - * if not VLSDLen or not pointer: - * raise MemoryError() # <<<<<<<<<<<<<< - * try: - * pointer[0] = 0 + /* "dataRead.pyx":1652 + * max_len = size + * + * if max_len == 0: # <<<<<<<<<<<<<< + * return None + * */ - PyErr_NoMemory(); __PYX_ERR(0, 970, __pyx_L1_error) + __pyx_t_7 = (__pyx_v_max_len == 0); + if (__pyx_t_7) { - /* "dataRead.pyx":969 - * cdef unsigned long long *pointer = PyMem_Malloc(n_records * sizeof(unsigned long long)) - * cdef unsigned long long rec = 0 - * if not VLSDLen or not pointer: # <<<<<<<<<<<<<< - * raise MemoryError() - * try: + /* "dataRead.pyx":1653 + * + * if max_len == 0: + * return None # <<<<<<<<<<<<<< + * + * if signal_data_type < 10 or signal_data_type == 17: */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "dataRead.pyx":971 - * if not VLSDLen or not pointer: - * raise MemoryError() - * try: # <<<<<<<<<<<<<< - * pointer[0] = 0 - * VLSDLen[0] = 0 + /* "dataRead.pyx":1652 + * max_len = size + * + * if max_len == 0: # <<<<<<<<<<<<<< + * return None + * */ - /*try:*/ { + } - /* "dataRead.pyx":972 - * raise MemoryError() - * try: - * pointer[0] = 0 # <<<<<<<<<<<<<< - * VLSDLen[0] = 0 - * for rec from 0 <= rec < n_records - 1 by 1: + /* "dataRead.pyx":1655 + * return None + * + * if signal_data_type < 10 or signal_data_type == 17: # <<<<<<<<<<<<<< + * return vd_equalize_string(bit_stream, offsets_array, sizes_array, + * max_len, n_records, signal_data_type) */ - (__pyx_v_pointer[0]) = 0; + __pyx_t_8 = (__pyx_v_signal_data_type < 10); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_8 = (__pyx_v_signal_data_type == 17); + __pyx_t_7 = __pyx_t_8; + __pyx_L8_bool_binop_done:; + if (__pyx_t_7) { - /* "dataRead.pyx":973 - * try: - * pointer[0] = 0 - * VLSDLen[0] = 0 # <<<<<<<<<<<<<< - * for rec from 0 <= rec < n_records - 1 by 1: - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + /* "dataRead.pyx":1656 + * + * if signal_data_type < 10 or signal_data_type == 17: + * return vd_equalize_string(bit_stream, offsets_array, sizes_array, # <<<<<<<<<<<<<< + * max_len, n_records, signal_data_type) + * else: */ - (__pyx_v_VLSDLen[0]) = 0; + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":974 - * pointer[0] = 0 - * VLSDLen[0] = 0 - * for rec from 0 <= rec < n_records - 1 by 1: # <<<<<<<<<<<<<< - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len + /* "dataRead.pyx":1657 + * if signal_data_type < 10 or signal_data_type == 17: + * return vd_equalize_string(bit_stream, offsets_array, sizes_array, + * max_len, n_records, signal_data_type) # <<<<<<<<<<<<<< + * else: + * return vd_equalize_bytes(bit_stream, offsets_array, sizes_array, */ - __pyx_t_4 = (__pyx_v_n_records - 1); - for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_4; __pyx_v_rec+=1) { + __pyx_t_5 = __pyx_f_8dataRead_vd_equalize_string(__pyx_v_bit_stream, __pyx_v_offsets_array, __pyx_v_sizes_array, __pyx_v_max_len, __pyx_v_n_records, __pyx_v_signal_data_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "dataRead.pyx":975 - * VLSDLen[0] = 0 - * for rec from 0 <= rec < n_records - 1 by 1: - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) # <<<<<<<<<<<<<< - * VLSDLen[rec] = vlsd_len - * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] + /* "dataRead.pyx":1655 + * return None + * + * if signal_data_type < 10 or signal_data_type == 17: # <<<<<<<<<<<<<< + * return vd_equalize_string(bit_stream, offsets_array, sizes_array, + * max_len, n_records, signal_data_type) */ - (void)(memcpy((&__pyx_v_vlsd_len), (&(__pyx_v_bit_stream[(__pyx_v_pointer[__pyx_v_rec])])), 4)); + } - /* "dataRead.pyx":976 - * for rec from 0 <= rec < n_records - 1 by 1: - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len # <<<<<<<<<<<<<< - * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] - * if VLSDLen[rec] > max_len: + /* "dataRead.pyx":1659 + * max_len, n_records, signal_data_type) + * else: + * return vd_equalize_bytes(bit_stream, offsets_array, sizes_array, # <<<<<<<<<<<<<< + * max_len, n_records) + * */ - (__pyx_v_VLSDLen[__pyx_v_rec]) = __pyx_v_vlsd_len; + /*else*/ { + __Pyx_XDECREF(__pyx_r); - /* "dataRead.pyx":977 - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len - * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] # <<<<<<<<<<<<<< - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] + /* "dataRead.pyx":1660 + * else: + * return vd_equalize_bytes(bit_stream, offsets_array, sizes_array, + * max_len, n_records) # <<<<<<<<<<<<<< + * + * */ - (__pyx_v_pointer[(__pyx_v_rec + 1)]) = (((__pyx_v_VLSDLen[__pyx_v_rec]) + 4) + (__pyx_v_pointer[__pyx_v_rec])); + __pyx_t_5 = __pyx_f_8dataRead_vd_equalize_bytes(__pyx_v_bit_stream, __pyx_v_offsets_array, __pyx_v_sizes_array, __pyx_v_max_len, __pyx_v_n_records); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + } - /* "dataRead.pyx":978 - * VLSDLen[rec] = vlsd_len - * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] - * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< - * max_len = VLSDLen[rec] - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) + /* "dataRead.pyx":1618 + * + * + * def vd_data_read(unsigned short signal_data_type, bytes vd_block, # <<<<<<<<<<<<<< + * object offsets_array, object sizes_array, + * unsigned long long n_records): */ - __pyx_t_2 = ((__pyx_v_VLSDLen[__pyx_v_rec]) > __pyx_v_max_len); - if (__pyx_t_2) { - /* "dataRead.pyx":979 - * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] # <<<<<<<<<<<<<< - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len - */ - __pyx_v_max_len = (__pyx_v_VLSDLen[__pyx_v_rec]); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dataRead.vd_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "dataRead.pyx":978 - * VLSDLen[rec] = vlsd_len - * pointer[rec + 1] = VLSDLen[rec] + 4 + pointer[rec] - * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< - * max_len = VLSDLen[rec] - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) +/* "dataRead.pyx":1663 + * + * + * cdef inline vd_equalize_string(const char* bit_stream, object offsets_array, object sizes_array, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records, + * unsigned short signal_data_type): */ - } - } - /* "dataRead.pyx":980 - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) # <<<<<<<<<<<<<< - * VLSDLen[rec] = vlsd_len - * if VLSDLen[rec] > max_len: - */ - (void)(memcpy((&__pyx_v_vlsd_len), (&(__pyx_v_bit_stream[(__pyx_v_pointer[__pyx_v_rec])])), 4)); +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_vd_equalize_string(char const *__pyx_v_bit_stream, PyObject *__pyx_v_offsets_array, PyObject *__pyx_v_sizes_array, unsigned long __pyx_v_max_len, unsigned PY_LONG_LONG __pyx_v_n_records, unsigned short __pyx_v_signal_data_type) { + PyArrayObject *__pyx_v_output = 0; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned PY_LONG_LONG __pyx_v_offset; + unsigned long __pyx_v_size; + PyObject *__pyx_v_raw = 0; + 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; + unsigned int __pyx_t_8; + unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned PY_LONG_LONG __pyx_t_11; + unsigned long __pyx_t_12; + int __pyx_t_13; + unsigned PY_LONG_LONG __pyx_t_14; + int __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vd_equalize_string", 1); - /* "dataRead.pyx":981 - * max_len = VLSDLen[rec] - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len # <<<<<<<<<<<<<< - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] + /* "dataRead.pyx":1667 + * unsigned short signal_data_type): + * """Decode string values from VD block using offset/size pairs.""" + * cdef np.ndarray output = np.zeros((n_records,), dtype='U{}'.format(max_len)) # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long long offset */ - (__pyx_v_VLSDLen[__pyx_v_rec]) = __pyx_v_vlsd_len; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_n_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 1667, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_U, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1667, __pyx_L1_error) + __pyx_v_output = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "dataRead.pyx":982 - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len - * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< - * max_len = VLSDLen[rec] - * if max_len != 0: - */ - __pyx_t_2 = ((__pyx_v_VLSDLen[__pyx_v_rec]) > __pyx_v_max_len); - if (__pyx_t_2) { + /* "dataRead.pyx":1672 + * cdef unsigned long size + * cdef bytes raw + * if signal_data_type == 6: # <<<<<<<<<<<<<< + * for i in range(n_records): + * size = sizes_array[i] + */ + switch (__pyx_v_signal_data_type) { + case 6: + + /* "dataRead.pyx":1673 + * cdef bytes raw + * if signal_data_type == 6: + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > 0: + */ + __pyx_t_9 = __pyx_v_n_records; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "dataRead.pyx":1674 + * if signal_data_type == 6: + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > 0: + * offset = offsets_array[i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_12 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1674, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = ((unsigned long)__pyx_t_12); + + /* "dataRead.pyx":1675 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') + */ + __pyx_t_13 = (__pyx_v_size > 0); + if (__pyx_t_13) { + + /* "dataRead.pyx":1676 + * size = sizes_array[i] + * if size > 0: + * offset = offsets_array[i] # <<<<<<<<<<<<<< + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') + * elif signal_data_type == 7: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_offsets_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_14 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1676, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_offset = ((unsigned PY_LONG_LONG)__pyx_t_14); - /* "dataRead.pyx":983 - * VLSDLen[rec] = vlsd_len - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] # <<<<<<<<<<<<<< - * if max_len != 0: - * if signal_data_type < 10: + /* "dataRead.pyx":1677 + * if size > 0: + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif signal_data_type == 7: + * for i in range(n_records): */ - __pyx_v_max_len = (__pyx_v_VLSDLen[__pyx_v_rec]); + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_offset, (__pyx_v_offset + __pyx_v_size) - __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1677, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_4, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":982 - * memcpy(&vlsd_len, &bit_stream[pointer[rec]], 4) - * VLSDLen[rec] = vlsd_len - * if VLSDLen[rec] > max_len: # <<<<<<<<<<<<<< - * max_len = VLSDLen[rec] - * if max_len != 0: + /* "dataRead.pyx":1675 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') */ + } } - /* "dataRead.pyx":984 - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] - * if max_len != 0: # <<<<<<<<<<<<<< - * if signal_data_type < 10: - * if signal_data_type == 6: - */ - __pyx_t_2 = (__pyx_v_max_len != 0); - if (__pyx_t_2) { - - /* "dataRead.pyx":985 - * max_len = VLSDLen[rec] - * if max_len != 0: - * if signal_data_type < 10: # <<<<<<<<<<<<<< - * if signal_data_type == 6: - * channel_format = 'ISO8859' - */ - __pyx_t_2 = (__pyx_v_signal_data_type < 10); - if (__pyx_t_2) { - - /* "dataRead.pyx":986 - * if max_len != 0: - * if signal_data_type < 10: - * if signal_data_type == 6: # <<<<<<<<<<<<<< - * channel_format = 'ISO8859' - * elif signal_data_type == 7: + /* "dataRead.pyx":1672 + * cdef unsigned long size + * cdef bytes raw + * if signal_data_type == 6: # <<<<<<<<<<<<<< + * for i in range(n_records): + * size = sizes_array[i] */ - switch (__pyx_v_signal_data_type) { - case 6: + break; + case 7: + + /* "dataRead.pyx":1679 + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') + * elif signal_data_type == 7: + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > 0: + */ + __pyx_t_9 = __pyx_v_n_records; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "dataRead.pyx":1680 + * elif signal_data_type == 7: + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > 0: + * offset = offsets_array[i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_12 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1680, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = ((unsigned long)__pyx_t_12); + + /* "dataRead.pyx":1681 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-8', errors='replace').rstrip('\x00') + */ + __pyx_t_13 = (__pyx_v_size > 0); + if (__pyx_t_13) { + + /* "dataRead.pyx":1682 + * size = sizes_array[i] + * if size > 0: + * offset = offsets_array[i] # <<<<<<<<<<<<<< + * output[i] = bit_stream[offset:offset+size].decode('utf-8', errors='replace').rstrip('\x00') + * elif signal_data_type == 8: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_offsets_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_14 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1682, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_offset = ((unsigned PY_LONG_LONG)__pyx_t_14); - /* "dataRead.pyx":987 - * if signal_data_type < 10: - * if signal_data_type == 6: - * channel_format = 'ISO8859' # <<<<<<<<<<<<<< - * elif signal_data_type == 7: - * channel_format = 'utf-8' + /* "dataRead.pyx":1683 + * if size > 0: + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-8', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif signal_data_type == 8: + * for i in range(n_records): */ - __Pyx_INCREF(__pyx_n_u_ISO8859); - __pyx_v_channel_format = __pyx_n_u_ISO8859; + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_offset, (__pyx_v_offset + __pyx_v_size) - __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1683, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__13}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_4, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1683, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":986 - * if max_len != 0: - * if signal_data_type < 10: - * if signal_data_type == 6: # <<<<<<<<<<<<<< - * channel_format = 'ISO8859' - * elif signal_data_type == 7: + /* "dataRead.pyx":1681 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-8', errors='replace').rstrip('\x00') */ - break; - case 7: + } + } - /* "dataRead.pyx":989 - * channel_format = 'ISO8859' - * elif signal_data_type == 7: - * channel_format = 'utf-8' # <<<<<<<<<<<<<< - * elif signal_data_type == 8: - * channel_format = ' offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') + * elif signal_data_type == 7: # <<<<<<<<<<<<<< + * for i in range(n_records): + * size = sizes_array[i] */ - __Pyx_INCREF(__pyx_kp_u_utf_8); - __pyx_v_channel_format = __pyx_kp_u_utf_8; + break; + case 8: + + /* "dataRead.pyx":1685 + * output[i] = bit_stream[offset:offset+size].decode('utf-8', errors='replace').rstrip('\x00') + * elif signal_data_type == 8: + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > 0: + */ + __pyx_t_9 = __pyx_v_n_records; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "dataRead.pyx":1686 + * elif signal_data_type == 8: + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > 0: + * offset = offsets_array[i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1686, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_12 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1686, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = ((unsigned long)__pyx_t_12); + + /* "dataRead.pyx":1687 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-le', errors='replace').rstrip('\x00') + */ + __pyx_t_13 = (__pyx_v_size > 0); + if (__pyx_t_13) { + + /* "dataRead.pyx":1688 + * size = sizes_array[i] + * if size > 0: + * offset = offsets_array[i] # <<<<<<<<<<<<<< + * output[i] = bit_stream[offset:offset+size].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif signal_data_type == 9: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_offsets_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_14 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1688, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_offset = ((unsigned PY_LONG_LONG)__pyx_t_14); - /* "dataRead.pyx":988 - * if signal_data_type == 6: - * channel_format = 'ISO8859' - * elif signal_data_type == 7: # <<<<<<<<<<<<<< - * channel_format = 'utf-8' - * elif signal_data_type == 8: + /* "dataRead.pyx":1689 + * if size > 0: + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-le', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif signal_data_type == 9: + * for i in range(n_records): */ - break; - case 8: + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_offset, (__pyx_v_offset + __pyx_v_size) - __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1689, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__15, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_4, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1689, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":991 - * channel_format = 'utf-8' - * elif signal_data_type == 8: - * channel_format = ' sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-le', errors='replace').rstrip('\x00') */ - __Pyx_INCREF(__pyx_kp_u_utf_16); - __pyx_v_channel_format = __pyx_kp_u_utf_16; + } + } - /* "dataRead.pyx":990 - * elif signal_data_type == 7: - * channel_format = 'utf-8' - * elif signal_data_type == 8: # <<<<<<<<<<<<<< - * channel_format = ' offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-8', errors='replace').rstrip('\x00') + * elif signal_data_type == 8: # <<<<<<<<<<<<<< + * for i in range(n_records): + * size = sizes_array[i] */ - break; - case 9: + break; + case 9: + + /* "dataRead.pyx":1691 + * output[i] = bit_stream[offset:offset+size].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif signal_data_type == 9: + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > 0: + */ + __pyx_t_9 = __pyx_v_n_records; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "dataRead.pyx":1692 + * elif signal_data_type == 9: + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > 0: + * offset = offsets_array[i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_12 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1692, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = ((unsigned long)__pyx_t_12); + + /* "dataRead.pyx":1693 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-be', errors='replace').rstrip('\x00') + */ + __pyx_t_13 = (__pyx_v_size > 0); + if (__pyx_t_13) { + + /* "dataRead.pyx":1694 + * size = sizes_array[i] + * if size > 0: + * offset = offsets_array[i] # <<<<<<<<<<<<<< + * output[i] = bit_stream[offset:offset+size].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif signal_data_type == 17: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_offsets_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_14 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_offset = ((unsigned PY_LONG_LONG)__pyx_t_14); - /* "dataRead.pyx":993 - * channel_format = ' 0: + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-be', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif signal_data_type == 17: + * # BOM-per-value: detect encoding from BOM bytes */ - __Pyx_INCREF(__pyx_kp_u_utf_16_2); - __pyx_v_channel_format = __pyx_kp_u_utf_16_2; + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_offset, (__pyx_v_offset + __pyx_v_size) - __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1695, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__13}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_4, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1695, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":992 - * elif signal_data_type == 8: - * channel_format = ' sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-be', errors='replace').rstrip('\x00') */ - break; - default: + } + } - /* "dataRead.pyx":995 - * channel_format = '>utf-16' - * else: - * channel_format = 'utf-8' # <<<<<<<<<<<<<< - * printf('signal_data_type should have fixed length') - * return equalize_string_length(bit_stream, pointer, VLSDLen, max_len, n_records, channel_format) + /* "dataRead.pyx":1690 + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif signal_data_type == 9: # <<<<<<<<<<<<<< + * for i in range(n_records): + * size = sizes_array[i] */ - __Pyx_INCREF(__pyx_kp_u_utf_8); - __pyx_v_channel_format = __pyx_kp_u_utf_8; + break; + case 17: + + /* "dataRead.pyx":1698 + * elif signal_data_type == 17: + * # BOM-per-value: detect encoding from BOM bytes + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > 0: + */ + __pyx_t_9 = __pyx_v_n_records; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "dataRead.pyx":1699 + * # BOM-per-value: detect encoding from BOM bytes + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > 0: + * offset = offsets_array[i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_12 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1699, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = ((unsigned long)__pyx_t_12); + + /* "dataRead.pyx":1700 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * raw = bytes(bit_stream[offset:offset+size]) + */ + __pyx_t_13 = (__pyx_v_size > 0); + if (__pyx_t_13) { + + /* "dataRead.pyx":1701 + * size = sizes_array[i] + * if size > 0: + * offset = offsets_array[i] # <<<<<<<<<<<<<< + * raw = bytes(bit_stream[offset:offset+size]) + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_offsets_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_14 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1701, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_offset = ((unsigned PY_LONG_LONG)__pyx_t_14); - /* "dataRead.pyx":996 - * else: - * channel_format = 'utf-8' - * printf('signal_data_type should have fixed length') # <<<<<<<<<<<<<< - * return equalize_string_length(bit_stream, pointer, VLSDLen, max_len, n_records, channel_format) - * else: # byte arrays or mime types + /* "dataRead.pyx":1702 + * if size > 0: + * offset = offsets_array[i] + * raw = bytes(bit_stream[offset:offset+size]) # <<<<<<<<<<<<<< + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') */ - (void)(printf(((char const *)"signal_data_type should have fixed length"))); - break; + __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_offset, (__pyx_v_offset + __pyx_v_size) - __pyx_v_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_raw, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "dataRead.pyx":1703 + * offset = offsets_array[i] + * raw = bytes(bit_stream[offset:offset+size]) + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: # <<<<<<<<<<<<<< + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + */ + __pyx_t_15 = (__pyx_v_size >= 3); + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L19_bool_binop_done; } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_239, 0xEF, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1703, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L19_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_187, 0xBB, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1703, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L19_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_191, 0xBF, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1703, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __pyx_t_15; + __pyx_L19_bool_binop_done:; + if (__pyx_t_13) { + + /* "dataRead.pyx":1704 + * raw = bytes(bit_stream[offset:offset+size]) + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + */ + __pyx_t_4 = PySequence_GetSlice(__pyx_v_raw, 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1704, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__14, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_3, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1704, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":997 - * channel_format = 'utf-8' - * printf('signal_data_type should have fixed length') - * return equalize_string_length(bit_stream, pointer, VLSDLen, max_len, n_records, channel_format) # <<<<<<<<<<<<<< - * else: # byte arrays or mime types - * return equalize_byte_length(bit_stream, pointer, VLSDLen, max_len, n_records) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __pyx_f_8dataRead_equalize_string_length(__pyx_v_bit_stream, __pyx_v_pointer, __pyx_v_VLSDLen, __pyx_v_max_len, __pyx_v_n_records, __pyx_v_channel_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 997, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L6_return; - - /* "dataRead.pyx":985 - * max_len = VLSDLen[rec] - * if max_len != 0: - * if signal_data_type < 10: # <<<<<<<<<<<<<< - * if signal_data_type == 6: - * channel_format = 'ISO8859' + /* "dataRead.pyx":1703 + * offset = offsets_array[i] + * raw = bytes(bit_stream[offset:offset+size]) + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: # <<<<<<<<<<<<<< + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: */ - } + goto __pyx_L18; + } - /* "dataRead.pyx":999 - * return equalize_string_length(bit_stream, pointer, VLSDLen, max_len, n_records, channel_format) - * else: # byte arrays or mime types - * return equalize_byte_length(bit_stream, pointer, VLSDLen, max_len, n_records) # <<<<<<<<<<<<<< - * else: - * printf('VLSD channel could not be properly read\n') + /* "dataRead.pyx":1705 + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: # <<<<<<<<<<<<<< + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __pyx_f_8dataRead_equalize_byte_length(__pyx_v_bit_stream, __pyx_v_pointer, __pyx_v_VLSDLen, __pyx_v_max_len, __pyx_v_n_records); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 999, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L6_return; - } + __pyx_t_15 = (__pyx_v_size >= 2); + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_255, 0xFF, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_254, 0xFE, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __pyx_t_15; + __pyx_L23_bool_binop_done:; + if (__pyx_t_13) { + + /* "dataRead.pyx":1706 + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif size >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[i] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + */ + __pyx_t_4 = PySequence_GetSlice(__pyx_v_raw, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1706, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__15, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_3, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dataRead.pyx":984 - * if VLSDLen[rec] > max_len: - * max_len = VLSDLen[rec] - * if max_len != 0: # <<<<<<<<<<<<<< - * if signal_data_type < 10: - * if signal_data_type == 6: + /* "dataRead.pyx":1705 + * if size >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[i] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: # <<<<<<<<<<<<<< + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: */ - } + goto __pyx_L18; + } - /* "dataRead.pyx":1001 - * return equalize_byte_length(bit_stream, pointer, VLSDLen, max_len, n_records) - * else: - * printf('VLSD channel could not be properly read\n') # <<<<<<<<<<<<<< - * return None - * finally: + /* "dataRead.pyx":1707 + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: # <<<<<<<<<<<<<< + * output[i] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * else: */ - /*else*/ { - (void)(printf(((char const *)"VLSD channel could not be properly read\n"))); - - /* "dataRead.pyx":1002 - * else: - * printf('VLSD channel could not be properly read\n') - * return None # <<<<<<<<<<<<<< - * finally: - * PyMem_Free(pointer) + __pyx_t_15 = (__pyx_v_size >= 2); + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L26_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_254, 0xFE, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1707, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_15) { + } else { + __pyx_t_13 = __pyx_t_15; + goto __pyx_L26_bool_binop_done; + } + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_raw, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_255, 0xFF, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 1707, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __pyx_t_15; + __pyx_L26_bool_binop_done:; + if (__pyx_t_13) { + + /* "dataRead.pyx":1708 + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[i] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * else: + * output[i] = raw.decode('utf-8', errors='replace').rstrip('\x00') */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L6_return; - } - } + __pyx_t_4 = PySequence_GetSlice(__pyx_v_raw, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1708, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__16, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_3, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1708, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dataRead.pyx":1707 + * elif size >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[i] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif size >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: # <<<<<<<<<<<<<< + * output[i] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * else: + */ + goto __pyx_L18; + } - /* "dataRead.pyx":1004 - * return None - * finally: - * PyMem_Free(pointer) # <<<<<<<<<<<<<< - * PyMem_Free(VLSDLen) + /* "dataRead.pyx":1710 + * output[i] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + * else: + * output[i] = raw.decode('utf-8', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * return output * */ - /*finally:*/ { - __pyx_L7_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename; - { - PyMem_Free(__pyx_v_pointer); + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_raw, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_errors, __pyx_n_u_replace) < 0) __PYX_ERR(0, 1710, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__14, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__13}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_3, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1710, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L18:; - /* "dataRead.pyx":1005 - * finally: - * PyMem_Free(pointer) - * PyMem_Free(VLSDLen) # <<<<<<<<<<<<<< - * - * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, + /* "dataRead.pyx":1700 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * raw = bytes(bit_stream[offset:offset+size]) */ - PyMem_Free(__pyx_v_VLSDLen); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); } - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8; - goto __pyx_L1_error; } - __pyx_L6_return: { - __pyx_t_14 = __pyx_r; - __pyx_r = 0; - /* "dataRead.pyx":1004 - * return None - * finally: - * PyMem_Free(pointer) # <<<<<<<<<<<<<< - * PyMem_Free(VLSDLen) - * + /* "dataRead.pyx":1696 + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('utf-16-be', errors='replace').rstrip('\x00') + * elif signal_data_type == 17: # <<<<<<<<<<<<<< + * # BOM-per-value: detect encoding from BOM bytes + * for i in range(n_records): */ - PyMem_Free(__pyx_v_pointer); + break; + default: break; + } - /* "dataRead.pyx":1005 - * finally: - * PyMem_Free(pointer) - * PyMem_Free(VLSDLen) # <<<<<<<<<<<<<< + /* "dataRead.pyx":1711 + * else: + * output[i] = raw.decode('utf-8', errors='replace').rstrip('\x00') + * return output # <<<<<<<<<<<<<< + * * - * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, */ - PyMem_Free(__pyx_v_VLSDLen); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; - } - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_output); + __pyx_r = ((PyObject *)__pyx_v_output); + goto __pyx_L0; - /* "dataRead.pyx":942 + /* "dataRead.pyx":1663 * * - * def sd_data_read(unsigned short signal_data_type, bytes sd_block, # <<<<<<<<<<<<<< - * unsigned long long sd_block_length, unsigned long long n_records): - * """ Reads vlsd channel from its SD Block bytes + * cdef inline vd_equalize_string(const char* bit_stream, object offsets_array, object sizes_array, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records, + * unsigned short signal_data_type): */ /* function exit code */ __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("dataRead.sd_data_read", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("dataRead.vd_equalize_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_channel_format); + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XDECREF(__pyx_v_raw); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":1007 - * PyMem_Free(VLSDLen) +/* "dataRead.pyx":1714 * - * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< - * unsigned long max_len, unsigned long long n_records): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) + * + * cdef inline vd_equalize_bytes(const char* bit_stream, object offsets_array, object sizes_array, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records): + * """Return byte-array values from VD block using offset/size pairs.""" */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_byte_length(char const *__pyx_v_bit_stream, unsigned PY_LONG_LONG *__pyx_v_pointer, unsigned long *__pyx_v_VLSDLen, unsigned long __pyx_v_max_len, unsigned PY_LONG_LONG __pyx_v_n_records) { +static CYTHON_INLINE PyObject *__pyx_f_8dataRead_vd_equalize_bytes(char const *__pyx_v_bit_stream, PyObject *__pyx_v_offsets_array, PyObject *__pyx_v_sizes_array, unsigned long __pyx_v_max_len, unsigned PY_LONG_LONG __pyx_v_n_records) { PyArrayObject *__pyx_v_output = 0; - unsigned long __pyx_v_rec; + unsigned PY_LONG_LONG __pyx_v_i; + unsigned PY_LONG_LONG __pyx_v_offset; + unsigned long __pyx_v_size; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -33155,40 +42738,45 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_byte_length(char const PyObject *__pyx_t_7 = NULL; unsigned int __pyx_t_8; unsigned PY_LONG_LONG __pyx_t_9; + unsigned PY_LONG_LONG __pyx_t_10; + unsigned PY_LONG_LONG __pyx_t_11; + unsigned long __pyx_t_12; + int __pyx_t_13; + unsigned PY_LONG_LONG __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("equalize_byte_length", 1); + __Pyx_RefNannySetupContext("vd_equalize_bytes", 1); - /* "dataRead.pyx":1009 - * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, - * unsigned long max_len, unsigned long long n_records): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) # <<<<<<<<<<<<<< - * cdef unsigned long rec = 0 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + /* "dataRead.pyx":1717 + * unsigned long max_len, unsigned long long n_records): + * """Return byte-array values from VD block using offset/size pairs.""" + * cdef np.ndarray output = np.zeros((n_records,), dtype='V{}'.format(max_len)) # <<<<<<<<<<<<<< + * cdef unsigned long long i + * cdef unsigned long long offset */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_n_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_n_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1717, __pyx_L1_error); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L1_error); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_V_2, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_V_2, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -33209,329 +42797,797 @@ static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_byte_length(char const __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1009, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__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; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1009, __pyx_L1_error) + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1717, __pyx_L1_error) __pyx_v_output = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":1010 - * unsigned long max_len, unsigned long long n_records): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) - * cdef unsigned long rec = 0 # <<<<<<<<<<<<<< - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain - * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') + /* "dataRead.pyx":1721 + * cdef unsigned long long offset + * cdef unsigned long size + * for i in range(n_records): # <<<<<<<<<<<<<< + * size = sizes_array[i] + * if size > 0: */ - __pyx_v_rec = 0; - - /* "dataRead.pyx":1011 - * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) - * cdef unsigned long rec = 0 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain # <<<<<<<<<<<<<< - * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') + __pyx_t_9 = __pyx_v_n_records; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "dataRead.pyx":1722 + * cdef unsigned long size + * for i in range(n_records): + * size = sizes_array[i] # <<<<<<<<<<<<<< + * if size > 0: + * offset = offsets_array[i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_sizes_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_long(__pyx_t_4); if (unlikely((__pyx_t_12 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1722, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = ((unsigned long)__pyx_t_12); + + /* "dataRead.pyx":1723 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bytearray(bit_stream[offset:offset+size]).rjust(max_len, b'\x00') + */ + __pyx_t_13 = (__pyx_v_size > 0); + if (__pyx_t_13) { + + /* "dataRead.pyx":1724 + * size = sizes_array[i] + * if size > 0: + * offset = offsets_array[i] # <<<<<<<<<<<<<< + * output[i] = bytearray(bit_stream[offset:offset+size]).rjust(max_len, b'\x00') * return output */ - __pyx_t_9 = __pyx_v_n_records; - for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_9; __pyx_v_rec+=1) { + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_offsets_array, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_14 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_offset = ((unsigned PY_LONG_LONG)__pyx_t_14); - /* "dataRead.pyx":1012 - * cdef unsigned long rec = 0 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain - * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') # <<<<<<<<<<<<<< + /* "dataRead.pyx":1725 + * if size > 0: + * offset = offsets_array[i] + * output[i] = bytearray(bit_stream[offset:offset+size]).rjust(max_len, b'\x00') # <<<<<<<<<<<<<< * return output + */ + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + __pyx_v_offset, (__pyx_v_offset + __pyx_v_size) - __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rjust); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_b__13}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_i, __pyx_t_4, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 0) < 0))) __PYX_ERR(0, 1725, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":1723 + * for i in range(n_records): + * size = sizes_array[i] + * if size > 0: # <<<<<<<<<<<<<< + * offset = offsets_array[i] + * output[i] = bytearray(bit_stream[offset:offset+size]).rjust(max_len, b'\x00') + */ + } + } + + /* "dataRead.pyx":1726 + * offset = offsets_array[i] + * output[i] = bytearray(bit_stream[offset:offset+size]).rjust(max_len, b'\x00') + * return output # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_output); + __pyx_r = ((PyObject *)__pyx_v_output); + goto __pyx_L0; + + /* "dataRead.pyx":1714 + * * + * cdef inline vd_equalize_bytes(const char* bit_stream, object offsets_array, object sizes_array, # <<<<<<<<<<<<<< + * unsigned long max_len, unsigned long long n_records): + * """Return byte-array values from VD block using offset/size pairs.""" + */ + + /* function exit code */ + __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("dataRead.vd_equalize_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_SymBufReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8dataRead_11__pyx_unpickle_SymBufReader(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_8dataRead_11__pyx_unpickle_SymBufReader = {"__pyx_unpickle_SymBufReader", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_11__pyx_unpickle_SymBufReader, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8dataRead_11__pyx_unpickle_SymBufReader(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_SymBufReader (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SymBufReader", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SymBufReader", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_SymBufReader") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SymBufReader", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("dataRead.__pyx_unpickle_SymBufReader", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8dataRead_10__pyx_unpickle_SymBufReader(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8dataRead_10__pyx_unpickle_SymBufReader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + unsigned int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_SymBufReader", 1); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x350e66f, 0x734868b, 0xcff8329): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + */ + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__18, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x350e66f, 0x734868b, 0xcff8329): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + * __pyx_result = SymBufReader.__new__(__pyx_type) */ - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + ((__pyx_v_pointer[__pyx_v_rec]) + 4), (((__pyx_v_pointer[__pyx_v_rec]) + 4) + (__pyx_v_VLSDLen[__pyx_v_rec])) - ((__pyx_v_pointer[__pyx_v_rec]) + 4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1012, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_rjust); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1012, __pyx_L1_error) + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x350e66f, 0x734868b, 0xcff8329): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = SymBufReader.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_1, __pyx_kp_b__11}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1012, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x350e66f, 0x734868b, 0xcff8329): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + * __pyx_result = SymBufReader.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_8dataRead_SymBufReader), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } - if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_4, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1012, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + * __pyx_result = SymBufReader.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":9 + * __pyx_result = SymBufReader.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_f_8dataRead___pyx_unpickle_SymBufReader__set_state(((struct __pyx_obj_8dataRead_SymBufReader *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + * __pyx_result = SymBufReader.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ } - /* "dataRead.pyx":1013 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain - * output[rec] = bytearray(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]).rjust(max_len, b'\x00') - * return output # <<<<<<<<<<<<<< - * - * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_output); - __pyx_r = ((PyObject *)__pyx_v_output); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; - /* "dataRead.pyx":1007 - * PyMem_Free(VLSDLen) - * - * cdef inline equalize_byte_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< - * unsigned long max_len, unsigned long long n_records): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='V{}'.format(max_len)) + /* "(tree fragment)":1 + * def __pyx_unpickle_SymBufReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __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("dataRead.equalize_byte_length", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("dataRead.__pyx_unpickle_SymBufReader", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dataRead.pyx":1015 - * return output - * - * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< - * unsigned long max_len, unsigned long long n_records, channel_format): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) +/* "(tree fragment)":11 + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): */ -static CYTHON_INLINE PyObject *__pyx_f_8dataRead_equalize_string_length(char const *__pyx_v_bit_stream, unsigned PY_LONG_LONG *__pyx_v_pointer, unsigned long *__pyx_v_VLSDLen, unsigned long __pyx_v_max_len, unsigned PY_LONG_LONG __pyx_v_n_records, PyObject *__pyx_v_channel_format) { - PyArrayObject *__pyx_v_output = 0; - unsigned long __pyx_v_rec; +static PyObject *__pyx_f_8dataRead___pyx_unpickle_SymBufReader__set_state(struct __pyx_obj_8dataRead_SymBufReader *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + unsigned char __pyx_t_1[0x10000]; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_4; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; unsigned int __pyx_t_8; - unsigned PY_LONG_LONG __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("equalize_string_length", 1); + __Pyx_RefNannySetupContext("__pyx_unpickle_SymBufReader__set_state", 1); - /* "dataRead.pyx":1017 - * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, - * unsigned long max_len, unsigned long long n_records, channel_format): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) # <<<<<<<<<<<<<< - * cdef unsigned long rec = 0 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[5]) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_n_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + if (unlikely((__Pyx_carray_from_py_unsigned_char(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0), __pyx_t_1, 0x10000) < 0))) __PYX_ERR(1, 12, __pyx_L1_error) + if (unlikely((0x10000) != (0x10000))) { + PyErr_Format(PyExc_ValueError, "Assignment to slice of wrong length, expected %" CYTHON_FORMAT_SSIZE_T "d, got %" CYTHON_FORMAT_SSIZE_T "d", (Py_ssize_t)(0x10000), (Py_ssize_t)(0x10000)); + __PYX_ERR(1, 12, __pyx_L1_error) + } + memcpy(&(__pyx_v___pyx_result->_buf[0]), __pyx_t_1, sizeof(__pyx_v___pyx_result->_buf[0]) * (0x10000)); + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->_buf_len = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->_buf_start = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 3); + __Pyx_INCREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error); + __Pyx_GOTREF(__pyx_v___pyx_result->_fid); + __Pyx_DECREF(__pyx_v___pyx_result->_fid); + __pyx_v___pyx_result->_fid = __pyx_t_3; __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_U, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_max_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) } - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1017, __pyx_L1_error) - __pyx_v_output = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "dataRead.pyx":1018 - * unsigned long max_len, unsigned long long n_records, channel_format): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) - * cdef unsigned long rec = 0 # <<<<<<<<<<<<<< - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain - * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') - */ - __pyx_v_rec = 0; + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4)); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->_pos = __pyx_t_2; - /* "dataRead.pyx":1019 - * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) - * cdef unsigned long rec = 0 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain # <<<<<<<<<<<<<< - * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') - * return output + /* "(tree fragment)":13 + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[5]) */ - __pyx_t_9 = __pyx_v_n_records; - for (__pyx_v_rec = 0; __pyx_v_rec < __pyx_t_9; __pyx_v_rec+=1) { + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_2 > 5); + if (__pyx_t_5) { + } else { + __pyx_t_4 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_4) { - /* "dataRead.pyx":1020 - * cdef unsigned long rec = 0 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain - * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') # <<<<<<<<<<<<<< - * return output + /* "(tree fragment)":14 + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[5]) # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_bit_stream + ((__pyx_v_pointer[__pyx_v_rec]) + 4), (((__pyx_v_pointer[__pyx_v_rec]) + 4) + (__pyx_v_VLSDLen[__pyx_v_rec])) - ((__pyx_v_pointer[__pyx_v_rec]) + 4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); + if (likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_channel_format}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error) + PyObject *__pyx_callargs[2] = {__pyx_t_6, PyTuple_GET_ITEM(__pyx_v___pyx_state, 5)}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u__11}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_output), __pyx_v_rec, __pyx_t_4, unsigned long, 0, __Pyx_PyInt_From_unsigned_long, 0, 0, 0) < 0))) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - /* "dataRead.pyx":1021 - * for rec from 0 <= rec < n_records by 1: # resize string to same length, numpy constrain - * output[rec] = bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]].decode(channel_format).rstrip('\x00') - * return output # <<<<<<<<<<<<<< + /* "(tree fragment)":13 + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[5]) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF((PyObject *)__pyx_v_output); - __pyx_r = ((PyObject *)__pyx_v_output); - goto __pyx_L0; + } - /* "dataRead.pyx":1015 - * return output - * - * cdef inline equalize_string_length(const char* bit_stream, unsigned long long *pointer, unsigned long *VLSDLen, # <<<<<<<<<<<<<< - * unsigned long max_len, unsigned long long n_records, channel_format): - * cdef np.ndarray output = np.zeros((n_records, ), dtype='U{}'.format(max_len)) + /* "(tree fragment)":11 + * __pyx_unpickle_SymBufReader__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_SymBufReader__set_state(SymBufReader __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result._buf = __pyx_state[0]; __pyx_result._buf_len = __pyx_state[1]; __pyx_result._buf_start = __pyx_state[2]; __pyx_result._fid = __pyx_state[3]; __pyx_result._pos = __pyx_state[4] + * if len(__pyx_state) > 5 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ + __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("dataRead.equalize_string_length", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("dataRead.__pyx_unpickle_SymBufReader__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_output); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +static struct __pyx_vtabstruct_8dataRead_SymBufReader __pyx_vtable_8dataRead_SymBufReader; + +static PyObject *__pyx_tp_new_8dataRead_SymBufReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_8dataRead_SymBufReader *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_8dataRead_SymBufReader *)o); + p->__pyx_vtab = __pyx_vtabptr_8dataRead_SymBufReader; + p->_fid = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_8dataRead_SymBufReader(PyObject *o) { + struct __pyx_obj_8dataRead_SymBufReader *p = (struct __pyx_obj_8dataRead_SymBufReader *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_8dataRead_SymBufReader) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->_fid); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static int __pyx_tp_traverse_8dataRead_SymBufReader(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_8dataRead_SymBufReader *p = (struct __pyx_obj_8dataRead_SymBufReader *)o; + if (p->_fid) { + e = (*v)(p->_fid, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_8dataRead_SymBufReader(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_8dataRead_SymBufReader *p = (struct __pyx_obj_8dataRead_SymBufReader *)o; + tmp = ((PyObject*)p->_fid); + p->_fid = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_8dataRead_SymBufReader[] = { + {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_3seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_12SymBufReader_2seek}, + {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_5tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_7read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8dataRead_12SymBufReader_6read}, + {"fileno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_9fileno, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8dataRead_12SymBufReader_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_8dataRead_SymBufReader_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_8dataRead_SymBufReader}, + {Py_tp_doc, (void *)PyDoc_STR("Bidirectional-buffered wrapper around a Python file object.\n\n Drop-in replacement for any ``fid`` used in mdfreader metadata parsing:\n supports ``seek(pos[, whence])``, ``read([n])``, ``tell()``, ``fileno()``.\n ")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_8dataRead_SymBufReader}, + {Py_tp_clear, (void *)__pyx_tp_clear_8dataRead_SymBufReader}, + {Py_tp_methods, (void *)__pyx_methods_8dataRead_SymBufReader}, + {Py_tp_init, (void *)__pyx_pw_8dataRead_12SymBufReader_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_8dataRead_SymBufReader}, + {0, 0}, +}; +static PyType_Spec __pyx_type_8dataRead_SymBufReader_spec = { + "dataRead.SymBufReader", + sizeof(struct __pyx_obj_8dataRead_SymBufReader), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_8dataRead_SymBufReader_slots, +}; +#else + +static PyTypeObject __pyx_type_8dataRead_SymBufReader = { + PyVarObject_HEAD_INIT(0, 0) + "dataRead.""SymBufReader", /*tp_name*/ + sizeof(struct __pyx_obj_8dataRead_SymBufReader), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8dataRead_SymBufReader, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Bidirectional-buffered wrapper around a Python file object.\n\n Drop-in replacement for any ``fid`` used in mdfreader metadata parsing:\n supports ``seek(pos[, whence])``, ``read([n])``, ``tell()``, ``fileno()``.\n "), /*tp_doc*/ + __pyx_tp_traverse_8dataRead_SymBufReader, /*tp_traverse*/ + __pyx_tp_clear_8dataRead_SymBufReader, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8dataRead_SymBufReader, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_8dataRead_12SymBufReader_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8dataRead_SymBufReader, /*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*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif static struct __pyx_vtabstruct_array __pyx_vtable_array; static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -34511,38 +44567,75 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1}, + {&__pyx_n_u_BUS, __pyx_k_BUS, sizeof(__pyx_k_BUS), 0, 1, 0, 1}, {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, {&__pyx_n_u_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 1, 0, 1}, + {&__pyx_n_u_CAN, __pyx_k_CAN, sizeof(__pyx_k_CAN), 0, 1, 0, 1}, + {&__pyx_kp_b_CC, __pyx_k_CC, sizeof(__pyx_k_CC), 0, 0, 0, 0}, {&__pyx_n_s_CGrecordLength, __pyx_k_CGrecordLength, sizeof(__pyx_k_CGrecordLength), 0, 0, 1, 1}, + {&__pyx_kp_b_CN, __pyx_k_CN, sizeof(__pyx_k_CN), 0, 0, 0, 0}, + {&__pyx_n_s_CNcomment, __pyx_k_CNcomment, sizeof(__pyx_k_CNcomment), 0, 0, 1, 1}, + {&__pyx_n_s_CNunit, __pyx_k_CNunit, sizeof(__pyx_k_CNunit), 0, 0, 1, 1}, {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, {&__pyx_n_s_Channel, __pyx_k_Channel, sizeof(__pyx_k_Channel), 0, 0, 1, 1}, + {&__pyx_n_u_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 0, 1, 0, 1}, {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_u_ECU, __pyx_k_ECU, sizeof(__pyx_k_ECU), 0, 1, 0, 1}, + {&__pyx_n_u_ETHERNET, __pyx_k_ETHERNET, sizeof(__pyx_k_ETHERNET), 0, 1, 0, 1}, {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_u_FLEXRAY, __pyx_k_FLEXRAY, sizeof(__pyx_k_FLEXRAY), 0, 1, 0, 1}, {&__pyx_n_s_Flags, __pyx_k_Flags, sizeof(__pyx_k_Flags), 0, 0, 1, 1}, {&__pyx_n_u_ISO8859, __pyx_k_ISO8859, sizeof(__pyx_k_ISO8859), 0, 1, 0, 1}, + {&__pyx_kp_u_ISO_8859_1, __pyx_k_ISO_8859_1, sizeof(__pyx_k_ISO_8859_1), 0, 1, 0, 0}, + {&__pyx_kp_u_I_O, __pyx_k_I_O, sizeof(__pyx_k_I_O), 0, 1, 0, 0}, {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0_2, __pyx_k_Incompatible_checksums_0x_x_vs_0_2, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_2), 0, 0, 1, 0}, {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_u_K_LINE, __pyx_k_K_LINE, sizeof(__pyx_k_K_LINE), 0, 1, 0, 1}, + {&__pyx_n_u_LIN, __pyx_k_LIN, sizeof(__pyx_k_LIN), 0, 1, 0, 1}, + {&__pyx_n_u_MOST, __pyx_k_MOST, sizeof(__pyx_k_MOST), 0, 1, 0, 1}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_n_u_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 1, 0, 1}, {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_n_u_OTHER, __pyx_k_OTHER, sizeof(__pyx_k_OTHER), 0, 1, 0, 1}, {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1}, {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, {&__pyx_n_u_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 1, 0, 1}, + {&__pyx_kp_b_SI, __pyx_k_SI, sizeof(__pyx_k_SI), 0, 0, 0, 0}, + {&__pyx_n_u_SI_2, __pyx_k_SI_2, sizeof(__pyx_k_SI_2), 0, 1, 0, 1}, + {&__pyx_n_s_SI_BUS_MAP, __pyx_k_SI_BUS_MAP, sizeof(__pyx_k_SI_BUS_MAP), 0, 0, 1, 1}, + {&__pyx_n_s_SI_TYPE_MAP, __pyx_k_SI_TYPE_MAP, sizeof(__pyx_k_SI_TYPE_MAP), 0, 0, 1, 1}, {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_SymBufReader, __pyx_k_SymBufReader, sizeof(__pyx_k_SymBufReader), 0, 0, 1, 1}, + {&__pyx_n_s_SymBufReader___reduce_cython, __pyx_k_SymBufReader___reduce_cython, sizeof(__pyx_k_SymBufReader___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_SymBufReader___setstate_cython, __pyx_k_SymBufReader___setstate_cython, sizeof(__pyx_k_SymBufReader___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_SymBufReader_fileno, __pyx_k_SymBufReader_fileno, sizeof(__pyx_k_SymBufReader_fileno), 0, 0, 1, 1}, + {&__pyx_n_s_SymBufReader_read, __pyx_k_SymBufReader_read, sizeof(__pyx_k_SymBufReader_read), 0, 0, 1, 1}, + {&__pyx_n_s_SymBufReader_seek, __pyx_k_SymBufReader_seek, sizeof(__pyx_k_SymBufReader_seek), 0, 0, 1, 1}, + {&__pyx_n_s_SymBufReader_tell, __pyx_k_SymBufReader_tell, sizeof(__pyx_k_SymBufReader_tell), 0, 0, 1, 1}, + {&__pyx_n_u_TOOL, __pyx_k_TOOL, sizeof(__pyx_k_TOOL), 0, 1, 0, 1}, + {&__pyx_kp_b_TX, __pyx_k_TX, sizeof(__pyx_k_TX), 0, 0, 0, 0}, + {&__pyx_kp_b_TX_2, __pyx_k_TX_2, sizeof(__pyx_k_TX_2), 0, 0, 0, 0}, + {&__pyx_n_s_TX_3, __pyx_k_TX_3, sizeof(__pyx_k_TX_3), 0, 0, 1, 1}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_u_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 1, 0, 0}, + {&__pyx_n_u_USB, __pyx_k_USB, sizeof(__pyx_k_USB), 0, 1, 0, 1}, + {&__pyx_n_u_USER, __pyx_k_USER, sizeof(__pyx_k_USER), 0, 1, 0, 1}, {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, {&__pyx_n_u_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 1, 0, 1}, {&__pyx_n_s_VLSD, __pyx_k_VLSD, sizeof(__pyx_k_VLSD), 0, 0, 1, 1}, @@ -34554,11 +44647,13 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_u_V_2, __pyx_k_V_2, sizeof(__pyx_k_V_2), 0, 1, 0, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_kp_b__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 0, 0}, - {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0}, + {&__pyx_kp_b__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 0, 0, 0}, + {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0}, + {&__pyx_kp_b__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 0, 0}, + {&__pyx_kp_u__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 1, 0, 0}, {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, - {&__pyx_n_s__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 1, 1}, {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_n_s__53, __pyx_k__53, sizeof(__pyx_k__53), 0, 0, 1, 1}, {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, @@ -34568,12 +44663,15 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_available, __pyx_k_available, sizeof(__pyx_k_available), 0, 0, 1, 1}, {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, {&__pyx_n_u_big, __pyx_k_big, sizeof(__pyx_k_big), 0, 1, 0, 1}, {&__pyx_n_s_bit_count, __pyx_k_bit_count, sizeof(__pyx_k_bit_count), 0, 0, 1, 1}, {&__pyx_n_s_bit_offset, __pyx_k_bit_offset, sizeof(__pyx_k_bit_offset), 0, 0, 1, 1}, {&__pyx_n_s_bit_stream, __pyx_k_bit_stream, sizeof(__pyx_k_bit_stream), 0, 0, 1, 1}, + {&__pyx_n_u_bom, __pyx_k_bom, sizeof(__pyx_k_bom), 0, 1, 0, 1}, {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1}, + {&__pyx_n_s_buf_end, __pyx_k_buf_end, sizeof(__pyx_k_buf_end), 0, 0, 1, 1}, {&__pyx_n_s_byteOffset, __pyx_k_byteOffset, sizeof(__pyx_k_byteOffset), 0, 0, 1, 1}, {&__pyx_n_s_byte_length, __pyx_k_byte_length, sizeof(__pyx_k_byte_length), 0, 0, 1, 1}, {&__pyx_n_s_byteorder, __pyx_k_byteorder, sizeof(__pyx_k_byteorder), 0, 0, 1, 1}, @@ -34581,45 +44679,114 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, {&__pyx_n_s_c_format_structure, __pyx_k_c_format_structure, sizeof(__pyx_k_c_format_structure), 0, 0, 1, 1}, + {&__pyx_n_u_cc_cc_inverse, __pyx_k_cc_cc_inverse, sizeof(__pyx_k_cc_cc_inverse), 0, 1, 0, 1}, + {&__pyx_n_s_cc_dat, __pyx_k_cc_dat, sizeof(__pyx_k_cc_dat), 0, 0, 1, 1}, + {&__pyx_n_s_cc_data_offset, __pyx_k_cc_data_offset, sizeof(__pyx_k_cc_data_offset), 0, 0, 1, 1}, + {&__pyx_n_s_cc_dict, __pyx_k_cc_dict, sizeof(__pyx_k_cc_dict), 0, 0, 1, 1}, + {&__pyx_n_u_cc_flags, __pyx_k_cc_flags, sizeof(__pyx_k_cc_flags), 0, 1, 0, 1}, + {&__pyx_n_s_cc_hdr, __pyx_k_cc_hdr, sizeof(__pyx_k_cc_hdr), 0, 0, 1, 1}, + {&__pyx_n_u_cc_md_comment, __pyx_k_cc_md_comment, sizeof(__pyx_k_cc_md_comment), 0, 1, 0, 1}, + {&__pyx_n_u_cc_md_unit, __pyx_k_cc_md_unit, sizeof(__pyx_k_cc_md_unit), 0, 1, 0, 1}, + {&__pyx_n_u_cc_phy_range_max, __pyx_k_cc_phy_range_max, sizeof(__pyx_k_cc_phy_range_max), 0, 1, 0, 1}, + {&__pyx_n_u_cc_phy_range_min, __pyx_k_cc_phy_range_min, sizeof(__pyx_k_cc_phy_range_min), 0, 1, 0, 1}, + {&__pyx_n_u_cc_precision, __pyx_k_cc_precision, sizeof(__pyx_k_cc_precision), 0, 1, 0, 1}, + {&__pyx_n_s_cc_ptr, __pyx_k_cc_ptr, sizeof(__pyx_k_cc_ptr), 0, 0, 1, 1}, + {&__pyx_n_u_cc_ref_count, __pyx_k_cc_ref_count, sizeof(__pyx_k_cc_ref_count), 0, 1, 0, 1}, + {&__pyx_n_u_cc_tx_name, __pyx_k_cc_tx_name, sizeof(__pyx_k_cc_tx_name), 0, 1, 0, 1}, + {&__pyx_n_u_cc_type, __pyx_k_cc_type, sizeof(__pyx_k_cc_type), 0, 1, 0, 1}, + {&__pyx_n_u_cc_val, __pyx_k_cc_val, sizeof(__pyx_k_cc_val), 0, 1, 0, 1}, + {&__pyx_n_s_cc_val_buf, __pyx_k_cc_val_buf, sizeof(__pyx_k_cc_val_buf), 0, 0, 1, 1}, + {&__pyx_n_u_cc_val_count, __pyx_k_cc_val_count, sizeof(__pyx_k_cc_val_count), 0, 1, 0, 1}, + {&__pyx_n_s_cc_val_list, __pyx_k_cc_val_list, sizeof(__pyx_k_cc_val_list), 0, 0, 1, 1}, {&__pyx_n_u_channel, __pyx_k_channel, sizeof(__pyx_k_channel), 0, 1, 0, 1}, {&__pyx_n_u_channelName, __pyx_k_channelName, sizeof(__pyx_k_channelName), 0, 1, 0, 1}, {&__pyx_n_s_channelNames, __pyx_k_channelNames, sizeof(__pyx_k_channelNames), 0, 0, 1, 1}, {&__pyx_n_s_channel_format, __pyx_k_channel_format, sizeof(__pyx_k_channel_format), 0, 0, 1, 1}, {&__pyx_n_s_channel_name, __pyx_k_channel_name, sizeof(__pyx_k_channel_name), 0, 0, 1, 1}, + {&__pyx_n_s_channel_name_list, __pyx_k_channel_name_list, sizeof(__pyx_k_channel_name_list), 0, 0, 1, 1}, {&__pyx_n_s_channel_name_set, __pyx_k_channel_name_set, sizeof(__pyx_k_channel_name_set), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_u_cn_at_reference, __pyx_k_cn_at_reference, sizeof(__pyx_k_cn_at_reference), 0, 1, 0, 1}, + {&__pyx_n_u_cn_attachment_count, __pyx_k_cn_attachment_count, sizeof(__pyx_k_cn_attachment_count), 0, 1, 0, 1}, + {&__pyx_n_u_cn_bit_count, __pyx_k_cn_bit_count, sizeof(__pyx_k_cn_bit_count), 0, 1, 0, 1}, + {&__pyx_n_u_cn_bit_offset, __pyx_k_cn_bit_offset, sizeof(__pyx_k_cn_bit_offset), 0, 1, 0, 1}, + {&__pyx_n_u_cn_byte_offset, __pyx_k_cn_byte_offset, sizeof(__pyx_k_cn_byte_offset), 0, 1, 0, 1}, + {&__pyx_n_u_cn_cc_conversion, __pyx_k_cn_cc_conversion, sizeof(__pyx_k_cn_cc_conversion), 0, 1, 0, 1}, + {&__pyx_n_u_cn_cn_next, __pyx_k_cn_cn_next, sizeof(__pyx_k_cn_cn_next), 0, 1, 0, 1}, + {&__pyx_n_u_cn_composition, __pyx_k_cn_composition, sizeof(__pyx_k_cn_composition), 0, 1, 0, 1}, + {&__pyx_n_s_cn_dat, __pyx_k_cn_dat, sizeof(__pyx_k_cn_dat), 0, 0, 1, 1}, + {&__pyx_n_u_cn_data, __pyx_k_cn_data, sizeof(__pyx_k_cn_data), 0, 1, 0, 1}, + {&__pyx_n_u_cn_data_type, __pyx_k_cn_data_type, sizeof(__pyx_k_cn_data_type), 0, 1, 0, 1}, + {&__pyx_n_u_cn_default_x, __pyx_k_cn_default_x, sizeof(__pyx_k_cn_default_x), 0, 1, 0, 1}, + {&__pyx_n_s_cn_dict, __pyx_k_cn_dict, sizeof(__pyx_k_cn_dict), 0, 0, 1, 1}, + {&__pyx_n_u_cn_flags, __pyx_k_cn_flags, sizeof(__pyx_k_cn_flags), 0, 1, 0, 1}, + {&__pyx_n_s_cn_hdr, __pyx_k_cn_hdr, sizeof(__pyx_k_cn_hdr), 0, 0, 1, 1}, + {&__pyx_n_u_cn_invalid_bit_pos, __pyx_k_cn_invalid_bit_pos, sizeof(__pyx_k_cn_invalid_bit_pos), 0, 1, 0, 1}, + {&__pyx_n_s_cn_key, __pyx_k_cn_key, sizeof(__pyx_k_cn_key), 0, 0, 1, 1}, + {&__pyx_n_s_cn_key_neg, __pyx_k_cn_key_neg, sizeof(__pyx_k_cn_key_neg), 0, 0, 1, 1}, + {&__pyx_n_s_cn_key_uint, __pyx_k_cn_key_uint, sizeof(__pyx_k_cn_key_uint), 0, 0, 1, 1}, + {&__pyx_n_u_cn_md_comment, __pyx_k_cn_md_comment, sizeof(__pyx_k_cn_md_comment), 0, 1, 0, 1}, + {&__pyx_n_u_cn_md_unit, __pyx_k_cn_md_unit, sizeof(__pyx_k_cn_md_unit), 0, 1, 0, 1}, + {&__pyx_n_s_cn_name, __pyx_k_cn_name, sizeof(__pyx_k_cn_name), 0, 0, 1, 1}, + {&__pyx_n_u_cn_precision, __pyx_k_cn_precision, sizeof(__pyx_k_cn_precision), 0, 1, 0, 1}, + {&__pyx_n_u_cn_reserved, __pyx_k_cn_reserved, sizeof(__pyx_k_cn_reserved), 0, 1, 0, 1}, + {&__pyx_n_u_cn_si_source, __pyx_k_cn_si_source, sizeof(__pyx_k_cn_si_source), 0, 1, 0, 1}, + {&__pyx_n_u_cn_sync_type, __pyx_k_cn_sync_type, sizeof(__pyx_k_cn_sync_type), 0, 1, 0, 1}, + {&__pyx_n_u_cn_tx_name, __pyx_k_cn_tx_name, sizeof(__pyx_k_cn_tx_name), 0, 1, 0, 1}, + {&__pyx_n_u_cn_type, __pyx_k_cn_type, sizeof(__pyx_k_cn_type), 0, 1, 0, 1}, + {&__pyx_n_u_cn_val_range_max, __pyx_k_cn_val_range_max, sizeof(__pyx_k_cn_val_range_max), 0, 1, 0, 1}, + {&__pyx_n_u_cn_val_range_min, __pyx_k_cn_val_range_min, sizeof(__pyx_k_cn_val_range_min), 0, 1, 0, 1}, {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, {&__pyx_n_s_dataRead, __pyx_k_dataRead, sizeof(__pyx_k_dataRead), 0, 0, 1, 1}, {&__pyx_kp_s_dataRead_pyx, __pyx_k_dataRead_pyx, sizeof(__pyx_k_dataRead_pyx), 0, 0, 1, 0}, {&__pyx_n_s_data_block_length, __pyx_k_data_block_length, sizeof(__pyx_k_data_block_length), 0, 0, 1, 1}, {&__pyx_n_s_data_format, __pyx_k_data_format, sizeof(__pyx_k_data_format), 0, 0, 1, 1}, + {&__pyx_n_s_data_offset, __pyx_k_data_offset, sizeof(__pyx_k_data_offset), 0, 0, 1, 1}, + {&__pyx_n_s_dbl_ptr, __pyx_k_dbl_ptr, sizeof(__pyx_k_dbl_ptr), 0, 0, 1, 1}, {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, + {&__pyx_n_s_desc_str, __pyx_k_desc_str, sizeof(__pyx_k_desc_str), 0, 0, 1, 1}, + {&__pyx_n_u_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 1, 0, 1}, {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1}, {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_errors, __pyx_k_errors, sizeof(__pyx_k_errors), 0, 0, 1, 1}, + {&__pyx_n_s_extra_buf, __pyx_k_extra_buf, sizeof(__pyx_k_extra_buf), 0, 0, 1, 1}, + {&__pyx_n_s_extra_links, __pyx_k_extra_links, sizeof(__pyx_k_extra_links), 0, 0, 1, 1}, + {&__pyx_n_s_fd, __pyx_k_fd, sizeof(__pyx_k_fd), 0, 0, 1, 1}, + {&__pyx_n_s_fid, __pyx_k_fid, sizeof(__pyx_k_fid), 0, 0, 1, 1}, + {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1}, + {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1}, + {&__pyx_n_s_first_pointer, __pyx_k_first_pointer, sizeof(__pyx_k_first_pointer), 0, 0, 1, 1}, {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, {&__pyx_n_s_float16, __pyx_k_float16, sizeof(__pyx_k_float16), 0, 0, 1, 1}, {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, {&__pyx_n_s_frombuffer, __pyx_k_frombuffer, sizeof(__pyx_k_frombuffer), 0, 0, 1, 1}, + {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1}, {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_u_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 1, 0, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1}, @@ -34629,20 +44796,31 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, + {&__pyx_n_u_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 1, 0, 1}, + {&__pyx_n_u_link_count, __pyx_k_link_count, sizeof(__pyx_k_link_count), 0, 1, 0, 1}, {&__pyx_n_u_little, __pyx_k_little, sizeof(__pyx_k_little), 0, 1, 0, 1}, + {&__pyx_n_s_lnk, __pyx_k_lnk, sizeof(__pyx_k_lnk), 0, 0, 1, 1}, + {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1}, + {&__pyx_n_u_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 1, 0, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_max_len, __pyx_k_max_len, sizeof(__pyx_k_max_len), 0, 0, 1, 1}, {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_minimal, __pyx_k_minimal, sizeof(__pyx_k_minimal), 0, 0, 1, 1}, {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, {&__pyx_n_s_nBytes_aligned, __pyx_k_nBytes_aligned, sizeof(__pyx_k_nBytes_aligned), 0, 0, 1, 1}, {&__pyx_n_s_n_bytes, __pyx_k_n_bytes, sizeof(__pyx_k_n_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_n_extra, __pyx_k_n_extra, sizeof(__pyx_k_n_extra), 0, 0, 1, 1}, {&__pyx_n_s_n_records, __pyx_k_n_records, sizeof(__pyx_k_n_records), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_u_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 1, 0, 1}, {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_u_needs_completion, __pyx_k_needs_completion, sizeof(__pyx_k_needs_completion), 0, 1, 0, 1}, {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nread, __pyx_k_nread, sizeof(__pyx_k_nread), 0, 0, 1, 1}, {&__pyx_n_s_numberOfRecords, __pyx_k_numberOfRecords, sizeof(__pyx_k_numberOfRecords), 0, 0, 1, 1}, {&__pyx_n_s_number_of_records, __pyx_k_number_of_records, sizeof(__pyx_k_number_of_records), 0, 0, 1, 1}, {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, @@ -34650,10 +44828,15 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_u_numpy__core_umath_failed_to_impo, __pyx_k_numpy__core_umath_failed_to_impo, sizeof(__pyx_k_numpy__core_umath_failed_to_impo), 0, 1, 0, 0}, {&__pyx_n_s_numpy_format, __pyx_k_numpy_format, sizeof(__pyx_k_numpy_format), 0, 0, 1, 1}, {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_objectify, __pyx_k_objectify, sizeof(__pyx_k_objectify), 0, 0, 1, 1}, + {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1}, + {&__pyx_n_s_offsets_array, __pyx_k_offsets_array, sizeof(__pyx_k_offsets_array), 0, 0, 1, 1}, {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, {&__pyx_n_s_pointer, __pyx_k_pointer, sizeof(__pyx_k_pointer), 0, 0, 1, 1}, + {&__pyx_n_u_pointer, __pyx_k_pointer, sizeof(__pyx_k_pointer), 0, 1, 0, 1}, + {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, {&__pyx_n_s_pos_byte_beg, __pyx_k_pos_byte_beg, sizeof(__pyx_k_pos_byte_beg), 0, 0, 1, 1}, {&__pyx_n_s_pos_byte_end, __pyx_k_pos_byte_end, sizeof(__pyx_k_pos_byte_end), 0, 0, 1, 1}, {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1}, @@ -34663,8 +44846,12 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_SymBufReader, __pyx_k_pyx_unpickle_SymBufReader, sizeof(__pyx_k_pyx_unpickle_SymBufReader), 0, 0, 1, 1}, {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_u_rad, __pyx_k_rad, sizeof(__pyx_k_rad), 0, 1, 0, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, + {&__pyx_n_s_read_cn_chain_fast, __pyx_k_read_cn_chain_fast, sizeof(__pyx_k_read_cn_chain_fast), 0, 0, 1, 1}, {&__pyx_n_s_rec, __pyx_k_rec, sizeof(__pyx_k_rec), 0, 0, 1, 1}, {&__pyx_n_s_record, __pyx_k_record, sizeof(__pyx_k_record), 0, 0, 1, 1}, {&__pyx_n_u_record, __pyx_k_record, sizeof(__pyx_k_record), 0, 1, 0, 1}, @@ -34680,19 +44867,37 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_u_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 1, 0, 1}, + {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1}, {&__pyx_n_s_rjust, __pyx_k_rjust, sizeof(__pyx_k_rjust), 0, 0, 1, 1}, {&__pyx_n_s_rstrip, __pyx_k_rstrip, sizeof(__pyx_k_rstrip), 0, 0, 1, 1}, + {&__pyx_n_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 1}, {&__pyx_n_s_sd_block, __pyx_k_sd_block, sizeof(__pyx_k_sd_block), 0, 0, 1, 1}, {&__pyx_n_s_sd_block_length, __pyx_k_sd_block_length, sizeof(__pyx_k_sd_block_length), 0, 0, 1, 1}, {&__pyx_n_s_sd_data_read, __pyx_k_sd_data_read, sizeof(__pyx_k_sd_data_read), 0, 0, 1, 1}, + {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_u_si_bus_type, __pyx_k_si_bus_type, sizeof(__pyx_k_si_bus_type), 0, 1, 0, 1}, + {&__pyx_n_s_si_cache, __pyx_k_si_cache, sizeof(__pyx_k_si_cache), 0, 0, 1, 1}, + {&__pyx_n_s_si_dict, __pyx_k_si_dict, sizeof(__pyx_k_si_dict), 0, 0, 1, 1}, + {&__pyx_n_u_si_flags, __pyx_k_si_flags, sizeof(__pyx_k_si_flags), 0, 1, 0, 1}, + {&__pyx_n_u_si_md_comment, __pyx_k_si_md_comment, sizeof(__pyx_k_si_md_comment), 0, 1, 0, 1}, + {&__pyx_n_s_si_ptr, __pyx_k_si_ptr, sizeof(__pyx_k_si_ptr), 0, 0, 1, 1}, + {&__pyx_n_u_si_tx_name, __pyx_k_si_tx_name, sizeof(__pyx_k_si_tx_name), 0, 1, 0, 1}, + {&__pyx_n_u_si_tx_path, __pyx_k_si_tx_path, sizeof(__pyx_k_si_tx_path), 0, 1, 0, 1}, + {&__pyx_n_u_si_type, __pyx_k_si_type, sizeof(__pyx_k_si_type), 0, 1, 0, 1}, {&__pyx_n_s_signal_data_type, __pyx_k_signal_data_type, sizeof(__pyx_k_signal_data_type), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_sizes_array, __pyx_k_sizes_array, sizeof(__pyx_k_sizes_array), 0, 0, 1, 1}, {&__pyx_n_s_sorted_data_read, __pyx_k_sorted_data_read, sizeof(__pyx_k_sorted_data_read), 0, 0, 1, 1}, + {&__pyx_n_u_source_name, __pyx_k_source_name, sizeof(__pyx_k_source_name), 0, 1, 0, 1}, + {&__pyx_n_u_source_path, __pyx_k_source_path, sizeof(__pyx_k_source_path), 0, 1, 0, 1}, {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, @@ -34702,21 +44907,30 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, {&__pyx_n_s_swap_flag, __pyx_k_swap_flag, sizeof(__pyx_k_swap_flag), 0, 0, 1, 1}, {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1}, {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_u_unit, __pyx_k_unit, sizeof(__pyx_k_unit), 0, 1, 0, 1}, + {&__pyx_n_s_unit_str, __pyx_k_unit_str, sizeof(__pyx_k_unit_str), 0, 0, 1, 1}, {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, {&__pyx_n_s_unsorted_data_read4, __pyx_k_unsorted_data_read4, sizeof(__pyx_k_unsorted_data_read4), 0, 0, 1, 1}, {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1}, {&__pyx_kp_u_utf_16, __pyx_k_utf_16, sizeof(__pyx_k_utf_16), 0, 1, 0, 0}, {&__pyx_kp_u_utf_16_2, __pyx_k_utf_16_2, sizeof(__pyx_k_utf_16_2), 0, 1, 0, 0}, + {&__pyx_kp_u_utf_16_be, __pyx_k_utf_16_be, sizeof(__pyx_k_utf_16_be), 0, 1, 0, 0}, + {&__pyx_kp_u_utf_16_le, __pyx_k_utf_16_le, sizeof(__pyx_k_utf_16_le), 0, 1, 0, 0}, {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0}, {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {&__pyx_n_s_vd_block, __pyx_k_vd_block, sizeof(__pyx_k_vd_block), 0, 0, 1, 1}, + {&__pyx_n_s_vd_data_read, __pyx_k_vd_data_read, sizeof(__pyx_k_vd_data_read), 0, 0, 1, 1}, {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1}, {&__pyx_n_s_vlsd_len, __pyx_k_vlsd_len, sizeof(__pyx_k_vlsd_len), 0, 0, 1, 1}, + {&__pyx_n_s_whence, __pyx_k_whence, sizeof(__pyx_k_whence), 0, 0, 1, 1}, {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; @@ -34724,16 +44938,18 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { } /* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 173, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 970, __pyx_L1_error) + __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 1548, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 83, __pyx_L1_error) + __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 83, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 86, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 96, __pyx_L1_error) __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1043, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -34803,6 +45019,72 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); + /* "dataRead.pyx":66 + * self._pos += pos + * else: # whence == 2 (from end) + * self._fid.seek(0, 2) # <<<<<<<<<<<<<< + * self._pos = self._fid.tell() + pos + * return self._pos + */ + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "dataRead.pyx":1605 + * raw = bytes(bit_stream[pointer[rec]+4:pointer[rec]+4+VLSDLen[rec]]) + * if len(raw) >= 3 and raw[0] == 0xEF and raw[1] == 0xBB and raw[2] == 0xBF: + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_utf_8); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "dataRead.pyx":1607 + * output[rec] = raw[3:].decode('utf-8', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFF and raw[1] == 0xFE: + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_utf_16_le); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "dataRead.pyx":1609 + * output[rec] = raw[2:].decode('utf-16-le', errors='replace').rstrip('\x00') + * elif len(raw) >= 2 and raw[0] == 0xFE and raw[1] == 0xFF: + * output[rec] = raw[2:].decode('utf-16-be', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif len(raw) > 0: + * output[rec] = raw.decode('utf-8', errors='replace').rstrip('\x00') + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_utf_16_be); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "dataRead.pyx":1677 + * if size > 0: + * offset = offsets_array[i] + * output[i] = bit_stream[offset:offset+size].decode('ISO-8859-1', errors='replace').rstrip('\x00') # <<<<<<<<<<<<<< + * elif signal_data_type == 7: + * for i in range(n_records): + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_ISO_8859_1); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x350e66f, 0x734868b, 0xcff8329): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x350e66f, 0x734868b, 0xcff8329) = (_buf, _buf_len, _buf_start, _fid, _pos))" % __pyx_checksum + */ + __pyx_tuple__18 = PyTuple_Pack(3, __pyx_int_55633519, __pyx_int_120882827, __pyx_int_218071849); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + /* "View.MemoryView":100 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" * try: @@ -34810,12 +45092,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence * else: */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_tuple__13 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__20 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); /* "View.MemoryView":101 * try: @@ -34824,9 +45106,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * else: * __pyx_collections_abc_Sequence = __import__("collections").Sequence */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); /* "View.MemoryView":103 * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence @@ -34835,9 +45117,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * except: * */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); /* "View.MemoryView":309 * return self.name @@ -34846,9 +45128,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); /* "View.MemoryView":310 * @@ -34857,9 +45139,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * cdef indirect = Enum("") * */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); /* "View.MemoryView":311 * cdef generic = Enum("") @@ -34868,9 +45150,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); /* "View.MemoryView":314 * @@ -34879,9 +45161,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); /* "View.MemoryView":315 * @@ -34890,55 +45172,155 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_tuple__21 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "dataRead.pyx":59 + * return 0 + * + * def seek(self, Py_ssize_t pos, int whence=0): # <<<<<<<<<<<<<< + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: + */ + __pyx_tuple__30 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_pos, __pyx_n_s_whence); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_seek, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + + /* "dataRead.pyx":70 + * return self._pos + * + * def tell(self): # <<<<<<<<<<<<<< + * return self._pos + * + */ + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_tell, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 70, __pyx_L1_error) + + /* "dataRead.pyx":73 + * return self._pos + * + * def read(self, Py_ssize_t n=-1): # <<<<<<<<<<<<<< + * """Return up to n bytes from the current position (or all if n<0).""" + * cdef Py_ssize_t pos = self._pos + */ + __pyx_tuple__35 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_pos, __pyx_n_s_buf_end, __pyx_n_s_offset, __pyx_n_s_available, __pyx_n_s_end, __pyx_n_s_data); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_read, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 73, __pyx_L1_error) + + /* "dataRead.pyx":98 + * return data + * + * def fileno(self): # <<<<<<<<<<<<<< + * return self._fid.fileno() + * + */ + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_fileno, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 98, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_tuple__38 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_SymBufReader__set_state(self, __pyx_state) + */ + __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(1, 16, __pyx_L1_error) + + /* "dataRead.pyx":384 + * + * + * def read_cn_chain_fast(object fid, uint64_t first_pointer, # <<<<<<<<<<<<<< + * dict si_cache, int minimal, bint channel_name_list): + * """Read the CN linked list starting at first_pointer using pread(). + */ + __pyx_tuple__42 = PyTuple_Pack(35, __pyx_n_s_fid, __pyx_n_s_first_pointer, __pyx_n_s_si_cache, __pyx_n_s_minimal, __pyx_n_s_channel_name_list, __pyx_n_s_fd, __pyx_n_s_pointer, __pyx_n_s_cn_hdr, __pyx_n_s_cn_dat, __pyx_n_s_cc_hdr, __pyx_n_s_cc_dat, __pyx_n_s_nread, __pyx_n_s_data_offset, __pyx_n_s_cc_data_offset, __pyx_n_s_n_extra, __pyx_n_s_n_bytes, __pyx_n_s_cn_key_uint, __pyx_n_s_si_ptr, __pyx_n_s_cc_ptr, __pyx_n_s_cn_key_neg, __pyx_n_s_cn_key, __pyx_n_s_results, __pyx_n_s_cn_dict, __pyx_n_s_cc_dict, __pyx_n_s_si_dict, __pyx_n_s_cn_name, __pyx_n_s_unit_str, __pyx_n_s_desc_str, __pyx_n_s_extra_buf, __pyx_n_s_dbl_ptr, __pyx_n_s_cc_val_buf, __pyx_n_s_cc_val_list, __pyx_n_s_i, __pyx_n_s_extra_links, __pyx_n_s_lnk); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_read_cn_chain_fast, 384, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 384, __pyx_L1_error) - /* "dataRead.pyx":12 - * cimport cython + /* "dataRead.pyx":589 + * * * @cython.boundscheck(False) # <<<<<<<<<<<<<< * @cython.wraparound(False) * def sorted_data_read(bytes tmp, unsigned short bit_count, */ - __pyx_tuple__23 = PyTuple_Pack(12, __pyx_n_s_tmp, __pyx_n_s_bit_count, __pyx_n_s_signal_data_type, __pyx_n_s_record_format, __pyx_n_s_number_of_records, __pyx_n_s_record_byte_size, __pyx_n_s_bit_offset, __pyx_n_s_pos_byte_beg, __pyx_n_s_n_bytes, __pyx_n_s_array, __pyx_n_s_bit_stream, __pyx_n_s_swap_flag); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_sorted_data_read, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(12, __pyx_n_s_tmp, __pyx_n_s_bit_count, __pyx_n_s_signal_data_type, __pyx_n_s_record_format, __pyx_n_s_number_of_records, __pyx_n_s_record_byte_size, __pyx_n_s_bit_offset, __pyx_n_s_pos_byte_beg, __pyx_n_s_n_bytes, __pyx_n_s_array, __pyx_n_s_bit_stream, __pyx_n_s_swap_flag); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_sorted_data_read, 589, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 589, __pyx_L1_error) - /* "dataRead.pyx":807 + /* "dataRead.pyx":1385 * return buf.byteswap() * * def unsorted_data_read4(record, info, bytes tmp, # <<<<<<<<<<<<<< * const unsigned short record_id_size, * const unsigned long long data_block_length): */ - __pyx_tuple__25 = PyTuple_Pack(28, __pyx_n_s_record, __pyx_n_s_info, __pyx_n_s_tmp, __pyx_n_s_record_id_size, __pyx_n_s_data_block_length, __pyx_n_s_bit_stream, __pyx_n_s_position, __pyx_n_s_record_id_char, __pyx_n_s_record_id_short, __pyx_n_s_record_id_long, __pyx_n_s_record_id_long_long, __pyx_n_s_buf, __pyx_n_s_VLSD, __pyx_n_s_pos_byte_beg, __pyx_n_s_pos_byte_end, __pyx_n_s_c_format_structure, __pyx_n_s_byte_length, __pyx_n_s_numpy_format, __pyx_n_s_index, __pyx_n_s_CGrecordLength, __pyx_n_s_VLSD_flag, __pyx_n_s_VLSD_CG_name, __pyx_n_s_VLSD_CG_signal_data_type, __pyx_n_s_channel_name_set, __pyx_n_s_record_id, __pyx_n_s_Channel, __pyx_n_s_name, __pyx_n_s_channel_name); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 28, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_unsorted_data_read4, 807, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 807, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(28, __pyx_n_s_record, __pyx_n_s_info, __pyx_n_s_tmp, __pyx_n_s_record_id_size, __pyx_n_s_data_block_length, __pyx_n_s_bit_stream, __pyx_n_s_position, __pyx_n_s_record_id_char, __pyx_n_s_record_id_short, __pyx_n_s_record_id_long, __pyx_n_s_record_id_long_long, __pyx_n_s_buf, __pyx_n_s_VLSD, __pyx_n_s_pos_byte_beg, __pyx_n_s_pos_byte_end, __pyx_n_s_c_format_structure, __pyx_n_s_byte_length, __pyx_n_s_numpy_format, __pyx_n_s_index, __pyx_n_s_CGrecordLength, __pyx_n_s_VLSD_flag, __pyx_n_s_VLSD_CG_name, __pyx_n_s_VLSD_CG_signal_data_type, __pyx_n_s_channel_name_set, __pyx_n_s_record_id, __pyx_n_s_Channel, __pyx_n_s_name, __pyx_n_s_channel_name); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 28, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_unsorted_data_read4, 1385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1385, __pyx_L1_error) - /* "dataRead.pyx":942 + /* "dataRead.pyx":1520 * * * def sd_data_read(unsigned short signal_data_type, bytes sd_block, # <<<<<<<<<<<<<< * unsigned long long sd_block_length, unsigned long long n_records): * """ Reads vlsd channel from its SD Block bytes */ - __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_signal_data_type, __pyx_n_s_sd_block, __pyx_n_s_sd_block_length, __pyx_n_s_n_records, __pyx_n_s_bit_stream, __pyx_n_s_max_len, __pyx_n_s_vlsd_len, __pyx_n_s_VLSDLen, __pyx_n_s_pointer, __pyx_n_s_rec, __pyx_n_s_channel_format); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 942, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_sd_data_read, 942, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 942, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(11, __pyx_n_s_signal_data_type, __pyx_n_s_sd_block, __pyx_n_s_sd_block_length, __pyx_n_s_n_records, __pyx_n_s_bit_stream, __pyx_n_s_max_len, __pyx_n_s_vlsd_len, __pyx_n_s_VLSDLen, __pyx_n_s_pointer, __pyx_n_s_rec, __pyx_n_s_channel_format); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_sd_data_read, 1520, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1520, __pyx_L1_error) + + /* "dataRead.pyx":1618 + * + * + * def vd_data_read(unsigned short signal_data_type, bytes vd_block, # <<<<<<<<<<<<<< + * object offsets_array, object sizes_array, + * unsigned long long n_records): + */ + __pyx_tuple__50 = PyTuple_Pack(10, __pyx_n_s_signal_data_type, __pyx_n_s_vd_block, __pyx_n_s_offsets_array, __pyx_n_s_sizes_array, __pyx_n_s_n_records, __pyx_n_s_bit_stream, __pyx_n_s_i, __pyx_n_s_offset, __pyx_n_s_size, __pyx_n_s_max_len); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dataRead_pyx, __pyx_n_s_vd_data_read, 1618, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1618, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __pyx_unpickle_SymBufReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SymBufReader, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -34948,6 +45330,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* #### Code section: init_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + __pyx_umethod_PyBytes_Type_find.type = (PyObject*)&PyBytes_Type; + __pyx_umethod_PyBytes_Type_find.method_name = &__pyx_n_s_find; + __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get; __pyx_umethod_PyDict_Type_update.type = (PyObject*)&PyDict_Type; __pyx_umethod_PyDict_Type_update.method_name = &__pyx_n_s_update; if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); @@ -34955,14 +45341,25 @@ static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_33 = PyInt_FromLong(33); if (unlikely(!__pyx_int_33)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_187 = PyInt_FromLong(187); if (unlikely(!__pyx_int_187)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_191 = PyInt_FromLong(191); if (unlikely(!__pyx_int_191)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_239 = PyInt_FromLong(239); if (unlikely(!__pyx_int_239)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_254 = PyInt_FromLong(254); if (unlikely(!__pyx_int_254)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_65536 = PyInt_FromLong(65536L); if (unlikely(!__pyx_int_65536)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_55633519 = PyInt_FromLong(55633519L); if (unlikely(!__pyx_int_55633519)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_120882827 = PyInt_FromLong(120882827L); if (unlikely(!__pyx_int_120882827)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_218071849 = PyInt_FromLong(218071849L); if (unlikely(!__pyx_int_218071849)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -35047,6 +45444,35 @@ static int __Pyx_modinit_type_init_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ + __pyx_vtabptr_8dataRead_SymBufReader = &__pyx_vtable_8dataRead_SymBufReader; + __pyx_vtable_8dataRead_SymBufReader._fill = (int (*)(struct __pyx_obj_8dataRead_SymBufReader *, Py_ssize_t))__pyx_f_8dataRead_12SymBufReader__fill; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_8dataRead_SymBufReader = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8dataRead_SymBufReader_spec, NULL); if (unlikely(!__pyx_ptype_8dataRead_SymBufReader)) __PYX_ERR(0, 26, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8dataRead_SymBufReader_spec, __pyx_ptype_8dataRead_SymBufReader) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + #else + __pyx_ptype_8dataRead_SymBufReader = &__pyx_type_8dataRead_SymBufReader; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_8dataRead_SymBufReader) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_8dataRead_SymBufReader->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_8dataRead_SymBufReader->tp_dictoffset && __pyx_ptype_8dataRead_SymBufReader->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_8dataRead_SymBufReader->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_ptype_8dataRead_SymBufReader, __pyx_vtabptr_8dataRead_SymBufReader) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_8dataRead_SymBufReader) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SymBufReader, (PyObject *) __pyx_ptype_8dataRead_SymBufReader) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_8dataRead_SymBufReader) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + #endif __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; #if CYTHON_USE_TYPE_SPECS @@ -35564,12 +45990,12 @@ if (!__Pyx_RefNanny) { * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence * else: */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__13, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__20, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -35582,7 +46008,7 @@ if (!__Pyx_RefNanny) { * else: * __pyx_collections_abc_Sequence = __import__("collections").Sequence */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) __Pyx_GOTREF(__pyx_t_5); @@ -35613,7 +46039,7 @@ if (!__Pyx_RefNanny) { * */ /*else*/ { - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) __Pyx_GOTREF(__pyx_t_5); @@ -35778,7 +46204,7 @@ if (!__Pyx_RefNanny) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_7); @@ -35792,7 +46218,7 @@ if (!__Pyx_RefNanny) { * cdef indirect = Enum("") * */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_7); @@ -35806,7 +46232,7 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_7); @@ -35820,7 +46246,7 @@ if (!__Pyx_RefNanny) { * cdef indirect_contiguous = Enum("") * */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_7); @@ -35834,7 +46260,7 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); @@ -36069,7 +46495,7 @@ if (!__Pyx_RefNanny) { * import numpy as np * cimport numpy as np * from sys import byteorder # <<<<<<<<<<<<<< - * from libc.stdint cimport uint16_t, uint32_t, uint64_t + * from libc.stdint cimport int64_t, uint8_t, uint16_t, uint32_t, uint64_t * from libc.stdio cimport printf */ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) @@ -36086,40 +46512,190 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":12 - * cimport cython + /* "dataRead.pyx":59 + * return 0 + * + * def seek(self, Py_ssize_t pos, int whence=0): # <<<<<<<<<<<<<< + * """Update logical cursor; does NOT touch the underlying file.""" + * if whence == 0: + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_12SymBufReader_3seek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SymBufReader_seek, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__32); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8dataRead_SymBufReader, __pyx_n_s_seek, __pyx_t_4) < 0) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_8dataRead_SymBufReader); + + /* "dataRead.pyx":70 + * return self._pos + * + * def tell(self): # <<<<<<<<<<<<<< + * return self._pos + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_12SymBufReader_5tell, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SymBufReader_tell, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8dataRead_SymBufReader, __pyx_n_s_tell, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_8dataRead_SymBufReader); + + /* "dataRead.pyx":73 + * return self._pos + * + * def read(self, Py_ssize_t n=-1): # <<<<<<<<<<<<<< + * """Return up to n bytes from the current position (or all if n<0).""" + * cdef Py_ssize_t pos = self._pos + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_12SymBufReader_7read, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SymBufReader_read, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8dataRead_SymBufReader, __pyx_n_s_read, __pyx_t_4) < 0) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_8dataRead_SymBufReader); + + /* "dataRead.pyx":98 + * return data + * + * def fileno(self): # <<<<<<<<<<<<<< + * return self._fid.fileno() + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_12SymBufReader_9fileno, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SymBufReader_fileno, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8dataRead_SymBufReader, __pyx_n_s_fileno, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_8dataRead_SymBufReader); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_12SymBufReader_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SymBufReader___reduce_cython, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8dataRead_SymBufReader, __pyx_n_s_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_8dataRead_SymBufReader); + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_SymBufReader, (type(self), 0x350e66f, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_SymBufReader__set_state(self, __pyx_state) + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_12SymBufReader_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SymBufReader___setstate_cython, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8dataRead_SymBufReader, __pyx_n_s_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_8dataRead_SymBufReader); + + /* "dataRead.pyx":130 + * # + * + * _SI_TYPE_MAP = {0: 'OTHER', 1: 'ECU', 2: 'BUS', 3: 'I/O', 4: 'TOOL', 5: 'USER'} # <<<<<<<<<<<<<< + * _SI_BUS_MAP = {0: 'NONE', 1: 'OTHER', 2: 'CAN', 3: 'LIN', + * 4: 'MOST', 5: 'FLEXRAY', 6: 'K_LINE', 7: 'ETHERNET', 8: 'USB'} + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_int_0, __pyx_n_u_OTHER) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_1, __pyx_n_u_ECU) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_2, __pyx_n_u_BUS) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_3, __pyx_kp_u_I_O) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_4, __pyx_n_u_TOOL) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_5, __pyx_n_u_USER) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SI_TYPE_MAP, __pyx_t_4) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":131 + * + * _SI_TYPE_MAP = {0: 'OTHER', 1: 'ECU', 2: 'BUS', 3: 'I/O', 4: 'TOOL', 5: 'USER'} + * _SI_BUS_MAP = {0: 'NONE', 1: 'OTHER', 2: 'CAN', 3: 'LIN', # <<<<<<<<<<<<<< + * 4: 'MOST', 5: 'FLEXRAY', 6: 'K_LINE', 7: 'ETHERNET', 8: 'USB'} + * + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_int_0, __pyx_n_u_NONE) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_1, __pyx_n_u_OTHER) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_2, __pyx_n_u_CAN) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_3, __pyx_n_u_LIN) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_4, __pyx_n_u_MOST) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_5, __pyx_n_u_FLEXRAY) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_6, __pyx_n_u_K_LINE) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_7, __pyx_n_u_ETHERNET) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_8, __pyx_n_u_USB) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SI_BUS_MAP, __pyx_t_4) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":384 + * + * + * def read_cn_chain_fast(object fid, uint64_t first_pointer, # <<<<<<<<<<<<<< + * dict si_cache, int minimal, bint channel_name_list): + * """Read the CN linked list starting at first_pointer using pread(). + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_1read_cn_chain_fast, 0, __pyx_n_s_read_cn_chain_fast, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_cn_chain_fast, __pyx_t_4) < 0) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":589 + * * * @cython.boundscheck(False) # <<<<<<<<<<<<<< * @cython.wraparound(False) * def sorted_data_read(bytes tmp, unsigned short bit_count, */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_1sorted_data_read, 0, __pyx_n_s_sorted_data_read, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_3sorted_data_read, 0, __pyx_n_s_sorted_data_read, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sorted_data_read, __pyx_t_4) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sorted_data_read, __pyx_t_4) < 0) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":807 + /* "dataRead.pyx":1385 * return buf.byteswap() * * def unsorted_data_read4(record, info, bytes tmp, # <<<<<<<<<<<<<< * const unsigned short record_id_size, * const unsigned long long data_block_length): */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_3unsorted_data_read4, 0, __pyx_n_s_unsorted_data_read4, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_5unsorted_data_read4, 0, __pyx_n_s_unsorted_data_read4, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unsorted_data_read4, __pyx_t_4) < 0) __PYX_ERR(0, 807, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_unsorted_data_read4, __pyx_t_4) < 0) __PYX_ERR(0, 1385, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dataRead.pyx":942 + /* "dataRead.pyx":1520 * * * def sd_data_read(unsigned short signal_data_type, bytes sd_block, # <<<<<<<<<<<<<< * unsigned long long sd_block_length, unsigned long long n_records): * """ Reads vlsd channel from its SD Block bytes */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_5sd_data_read, 0, __pyx_n_s_sd_data_read, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_7sd_data_read, 0, __pyx_n_s_sd_data_read, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sd_data_read, __pyx_t_4) < 0) __PYX_ERR(0, 1520, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dataRead.pyx":1618 + * + * + * def vd_data_read(unsigned short signal_data_type, bytes vd_block, # <<<<<<<<<<<<<< + * object offsets_array, object sizes_array, + * unsigned long long n_records): + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_9vd_data_read, 0, __pyx_n_s_vd_data_read, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_vd_data_read, __pyx_t_4) < 0) __PYX_ERR(0, 1618, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_SymBufReader(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8dataRead_11__pyx_unpickle_SymBufReader, 0, __pyx_n_s_pyx_unpickle_SymBufReader, NULL, __pyx_n_s_dataRead, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sd_data_read, __pyx_t_4) < 0) __PYX_ERR(0, 942, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SymBufReader, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "dataRead.pyx":1 @@ -36361,6 +46937,204 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; iexc_info; - while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - PyObject *exc_value = exc_info->exc_value; - if (exc_value == NULL || exc_value == Py_None) { - *value = NULL; - *type = NULL; - *tb = NULL; - } else { - *value = exc_value; - Py_INCREF(*value); - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - *tb = PyException_GetTraceback(exc_value); - } - #elif CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); - #endif -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 - _PyErr_StackItem *exc_info = tstate->exc_info; - PyObject *tmp_value = exc_info->exc_value; - exc_info->exc_value = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); - #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - #endif -} -#endif - /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) @@ -38351,122 +49043,6 @@ static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) return __Pyx__ImportDottedModule(name, parts_tuple); } -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (cls == a || cls == b) return 1; - mro = cls->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - PyObject *base = PyTuple_GET_ITEM(mro, i); - if (base == (PyObject *)a || base == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i length) + stop = length; + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + +/* UnpackUnboundCMethod */ +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), + METH_VARARGS | METH_KEYWORDS, + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #else + if (likely(!__Pyx_CyOrPyCFunction_Check(method))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + target->method = unbound_method; + } + } + return 0; +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + if (likely(cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return (*(cfunc->func))(self, arg); + } else if ((PY_VERSION_HEX >= 0x030600B1) && flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + #endif + } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } + return __Pyx__CallUnboundCMethod1(cfunc, self, arg); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(2, self, arg); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + if (likely(cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + #if PY_VERSION_HEX >= 0x030700A0 + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(3); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 1, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 2, arg2); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(3, self, arg1, arg2); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* SliceTupleAndList */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { + Py_ssize_t start = *_start, stop = *_stop, length = *_length; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + else if (stop > length) + stop = length; + *_length = stop - start; + *_start = start; + *_stop = stop; +} +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length = PyList_GET_SIZE(src); + __Pyx_crop_slice(&start, &stop, &length); + if (length <= 0) { + return PyList_New(0); + } + return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length); +} +static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length = PyTuple_GET_SIZE(src); + __Pyx_crop_slice(&start, &stop, &length); + return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length); +} +#endif + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + /* IsLittleEndian */ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) { @@ -39655,120 +50492,6 @@ static CYTHON_INLINE int __Pyx_dict_iter_next( return 1; } -/* UnpackUnboundCMethod */ - static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { - PyObject *result; - PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); - if (unlikely(!selfless_args)) return NULL; - result = PyObject_Call(method, selfless_args, kwargs); - Py_DECREF(selfless_args); - return result; -} -static PyMethodDef __Pyx_UnboundCMethod_Def = { - "CythonUnboundCMethod", - __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), - METH_VARARGS | METH_KEYWORDS, - NULL -}; -static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { - PyObject *method; - method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); - if (unlikely(!method)) - return -1; - target->method = method; -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION >= 3 - if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) - #else - if (likely(!__Pyx_CyOrPyCFunction_Check(method))) - #endif - { - PyMethodDescrObject *descr = (PyMethodDescrObject*) method; - target->func = descr->d_method->ml_meth; - target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); - } else -#endif -#if CYTHON_COMPILING_IN_PYPY -#else - if (PyCFunction_Check(method)) -#endif - { - PyObject *self; - int self_found; -#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY - self = PyObject_GetAttrString(method, "__self__"); - if (!self) { - PyErr_Clear(); - } -#else - self = PyCFunction_GET_SELF(method); -#endif - self_found = (self && self != Py_None); -#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY - Py_XDECREF(self); -#endif - if (self_found) { - PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); - if (unlikely(!unbound_method)) return -1; - Py_DECREF(method); - target->method = unbound_method; - } - } - return 0; -} - -/* CallUnboundCMethod1 */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { - if (likely(cfunc->func)) { - int flag = cfunc->flag; - if (flag == METH_O) { - return (*(cfunc->func))(self, arg); - } else if ((PY_VERSION_HEX >= 0x030600B1) && flag == METH_FASTCALL) { - #if PY_VERSION_HEX >= 0x030700A0 - return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); - #else - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - #endif - } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) { - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } - return __Pyx__CallUnboundCMethod1(cfunc, self, arg); -} -#endif -static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ - PyObject *args, *result = NULL; - if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; -#if CYTHON_COMPILING_IN_CPYTHON - if (cfunc->func && (cfunc->flag & METH_VARARGS)) { - args = PyTuple_New(1); - if (unlikely(!args)) goto bad; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - if (cfunc->flag & METH_KEYWORDS) - result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); - else - result = (*cfunc->func)(self, args); - } else { - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); - } -#else - args = PyTuple_Pack(2, self, arg); - if (unlikely(!args)) goto bad; - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); -#endif -bad: - Py_XDECREF(args); - return result; -} - /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { @@ -39974,33 +50697,6 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, PyObject_RichCompare(op1, op2, Py_EQ)); } -/* decode_c_bytes */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - if (unlikely((start < 0) | (stop < 0))) { - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (stop > length) - stop = length; - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - /* PyObjectCall2Args */ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args[3] = {NULL, arg1, arg2}; @@ -42119,6 +52815,28 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } #endif +/* CIntFromPyVerify */ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { __Pyx_TypeName obj_type_name; @@ -42512,28 +53230,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, #endif #endif -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - /* TypeInfoCompare */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) @@ -42943,8 +53639,275 @@ static CYTHON_INLINE int __pyx_memview_set_nn_uint16_t(const char *itemp, PyObje z.imag = z_r * sinl(z_theta); return z; } - #endif + #endif +#endif + +/* CIntFromPy */ + static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(unsigned char) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(unsigned char, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (unsigned char) val; + } + } +#endif + if (unlikely(!PyLong_Check(x))) { + unsigned char val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (unsigned char) -1; + val = __Pyx_PyInt_As_unsigned_char(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT)) { + return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT)) { + return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT)) { + return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (unsigned char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(unsigned char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) { + return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) { + return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) { + return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) { + return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) { + return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) { + return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(unsigned char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(unsigned char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + unsigned char val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (unsigned char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (unsigned char) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (unsigned char) -1; + } else { + stepval = v; + } + v = NULL; + val = (unsigned char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(unsigned char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((unsigned char) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(unsigned char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((unsigned char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((unsigned char) 1) << (sizeof(unsigned char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); #endif + if (unlikely(ret)) + return (unsigned char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned char"); + return (unsigned char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned char"); + return (unsigned char) -1; +} /* MemviewSliceCopyTemplate */ static __Pyx_memviewslice @@ -43148,6 +54111,540 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } } +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(int) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } +#endif + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntFromPy */ + static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(uint64_t) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (uint64_t) val; + } + } +#endif + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyInt_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + uint64_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint64_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + /* CIntFromPy */ static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -43950,34 +55447,34 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } /* CIntFromPy */ - static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; + const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if ((sizeof(unsigned char) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(unsigned char, long, PyInt_AS_LONG(x)) + if ((sizeof(long) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (unsigned char) val; + return (long) val; } } #endif if (unlikely(!PyLong_Check(x))) { - unsigned char val; + long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (unsigned char) -1; - val = __Pyx_PyInt_As_unsigned_char(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } @@ -43986,35 +55483,35 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { case 2: - if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT)) { - return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: - if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT)) { - return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: - if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT)) { - return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; @@ -44029,93 +55526,93 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (unsigned char) -1; + return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if ((sizeof(unsigned char) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x)) + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(unsigned char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: - if ((8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) { - return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: - if ((8 * sizeof(unsigned char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) { - return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: - if ((8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) { - return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: - if ((8 * sizeof(unsigned char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) { - return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: - if ((8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) { - return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: - if ((8 * sizeof(unsigned char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT)) { - return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } } #endif - if ((sizeof(unsigned char) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x)) + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(unsigned char) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { - unsigned char val; + long val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( @@ -44141,14 +55638,14 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); - if (unlikely(!v)) return (unsigned char) -1; + if (unlikely(!v)) return (long) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); - return (unsigned char) -1; + return (long) -1; } is_negative = result == 1; } @@ -44159,15 +55656,15 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) - return (unsigned char) -1; + return (long) -1; } else { stepval = v; } v = NULL; - val = (unsigned char) 0; + val = (long) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(unsigned char) * 8 - chunk_size; bits += chunk_size) { + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); @@ -44175,7 +55672,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; - val |= ((unsigned char) idigit) << bits; + val |= ((long) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; @@ -44185,13 +55682,13 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(unsigned char) * 8) - bits - (is_unsigned ? 0 : 1); + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; - val |= ((unsigned char) idigit) << bits; + val |= ((long) idigit) << bits; } if (!is_unsigned) { - if (unlikely(val & (((unsigned char) 1) << (sizeof(unsigned char) * 8 - 1)))) + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; @@ -44203,45 +55700,45 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, Py_XDECREF(stepval); #endif if (unlikely(ret)) - return (unsigned char) -1; + return (long) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to unsigned char"); - return (unsigned char) -1; + "value too large to convert to long"); + return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned char"); - return (unsigned char) -1; + "can't convert negative value to long"); + return (long) -1; } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) { + if (sizeof(uint64_t) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) { + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) { + if (sizeof(uint64_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -44256,7 +55753,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(unsigned PY_LONG_LONG), + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -44264,7 +55761,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned PY_LONG_LONG)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -44288,31 +55785,31 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0; + const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(uint16_t) < sizeof(long)) { + if (sizeof(uint8_t) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(uint16_t) <= sizeof(unsigned long)) { + } else if (sizeof(uint8_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(uint16_t) <= sizeof(long)) { + if (sizeof(uint8_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -44327,7 +55824,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(uint16_t), + return _PyLong_FromByteArray(bytes, sizeof(uint8_t), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -44335,7 +55832,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint16_t)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint8_t)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -44358,299 +55855,32 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } } -/* CIntFromPy */ - static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(uint16_t) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (uint16_t) val; - } - } -#endif - if (unlikely(!PyLong_Check(x))) { - uint16_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint16_t) -1; - val = __Pyx_PyInt_As_uint16_t(tmp); - Py_DECREF(tmp); - return val; - } - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - if (unlikely(__Pyx_PyLong_IsNeg(x))) { - goto raise_neg_overflow; - } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(uint16_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_DigitCount(x)) { - case 2: - if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT)) { - return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); - } - } - break; - case 3: - if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT)) { - return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); - } - } - break; - case 4: - if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) >= 4 * PyLong_SHIFT)) { - return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); - } - } - break; - } - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (uint16_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if ((sizeof(uint16_t) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(uint16_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) - } else { - const digit* digits = __Pyx_PyLong_Digits(x); - assert(__Pyx_PyLong_DigitCount(x) > 1); - switch (__Pyx_PyLong_SignedDigitCount(x)) { - case -2: - if ((8 * sizeof(uint16_t) - 1 > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { - return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); - } - } - break; - case 2: - if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { - return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); - } - } - break; - case -3: - if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { - return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); - } - } - break; - case 3: - if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { - return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); - } - } - break; - case -4: - if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { - return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); - } - } - break; - case 4: - if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { - if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { - return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); - } - } - break; - } - } -#endif - if ((sizeof(uint16_t) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(uint16_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(uint16_t) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(uint16_t, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - uint16_t val; - int ret = -1; -#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API - Py_ssize_t bytes_copied = PyLong_AsNativeBytes( - x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); - if (unlikely(bytes_copied == -1)) { - } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { - goto raise_overflow; - } else { - ret = 0; - } -#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - ret = _PyLong_AsByteArray((PyLongObject *)x, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *v; - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (likely(PyLong_CheckExact(x))) { - v = __Pyx_NewRef(x); - } else { - v = PyNumber_Long(x); - if (unlikely(!v)) return (uint16_t) -1; - assert(PyLong_CheckExact(v)); - } - { - int result = PyObject_RichCompareBool(v, Py_False, Py_LT); - if (unlikely(result < 0)) { - Py_DECREF(v); - return (uint16_t) -1; - } - is_negative = result == 1; - } - if (is_unsigned && unlikely(is_negative)) { - Py_DECREF(v); - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - Py_DECREF(v); - if (unlikely(!stepval)) - return (uint16_t) -1; - } else { - stepval = v; - } - v = NULL; - val = (uint16_t) 0; - mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; - shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(uint16_t) * 8 - chunk_size; bits += chunk_size) { - PyObject *tmp, *digit; - long idigit; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - val |= ((uint16_t) idigit) << bits; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - } - Py_DECREF(shift); shift = NULL; - Py_DECREF(mask); mask = NULL; - { - long idigit = PyLong_AsLong(stepval); - if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(uint16_t) * 8) - bits - (is_unsigned ? 0 : 1); - if (unlikely(idigit >= (1L << remaining_bits))) - goto raise_overflow; - val |= ((uint16_t) idigit) << bits; - } - if (!is_unsigned) { - if (unlikely(val & (((uint16_t) 1) << (sizeof(uint16_t) * 8 - 1)))) - goto raise_overflow; - if (is_negative) - val = ~val; - } - ret = 0; - done: - Py_XDECREF(shift); - Py_XDECREF(mask); - Py_XDECREF(stepval); -#endif - if (unlikely(ret)) - return (uint16_t) -1; - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint16_t"); - return (uint16_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint16_t"); - return (uint16_t) -1; -} - /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_short(unsigned short value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const unsigned short neg_one = (unsigned short) -1, const_zero = (unsigned short) 0; + const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(unsigned short) < sizeof(long)) { + if (sizeof(int64_t) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned short) <= sizeof(unsigned long)) { + } else if (sizeof(int64_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned short) <= sizeof(long)) { + if (sizeof(int64_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned short) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -44665,7 +55895,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(unsigned short), + return _PyLong_FromByteArray(bytes, sizeof(int64_t), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -44673,7 +55903,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned short)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int64_t)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -44697,31 +55927,31 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(unsigned char) < sizeof(long)) { + if (sizeof(uint32_t) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { + } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned char) <= sizeof(long)) { + if (sizeof(uint32_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -44736,7 +55966,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(unsigned char), + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -44744,7 +55974,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned char)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint32_t)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -44768,31 +55998,31 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0; + const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(unsigned long) < sizeof(long)) { + if (sizeof(uint16_t) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned long) <= sizeof(unsigned long)) { + } else if (sizeof(uint16_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned long) <= sizeof(long)) { + if (sizeof(uint16_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -44807,7 +56037,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(unsigned long), + return _PyLong_FromByteArray(bytes, sizeof(uint16_t), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -44815,7 +56045,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned long)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint16_t)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -44839,34 +56069,34 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const int neg_one = (int) -1, const_zero = (int) 0; + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + if ((sizeof(uint32_t) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (int) val; + return (uint32_t) val; } } #endif if (unlikely(!PyLong_Check(x))) { - int val; + uint32_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyInt_As_uint32_t(tmp); Py_DECREF(tmp); return val; } @@ -44875,35 +56105,35 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + __PYX_VERIFY_RETURN_INT(uint32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT)) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT)) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT)) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; @@ -44918,93 +56148,93 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (int) -1; + return (uint32_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if ((sizeof(int) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + if ((sizeof(uint32_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if ((sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + __PYX_VERIFY_RETURN_INT(uint32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: - if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 2: - if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case -3: - if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 3: - if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case -4: - if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 4: - if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; } } #endif - if ((sizeof(int) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + if ((sizeof(uint32_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if ((sizeof(uint32_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { - int val; + uint32_t val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( @@ -45030,14 +56260,14 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); - if (unlikely(!v)) return (int) -1; + if (unlikely(!v)) return (uint32_t) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); - return (int) -1; + return (uint32_t) -1; } is_negative = result == 1; } @@ -45048,15 +56278,15 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) - return (int) -1; + return (uint32_t) -1; } else { stepval = v; } v = NULL; - val = (int) 0; + val = (uint32_t) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + for (bits = 0; bits < (int) sizeof(uint32_t) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); @@ -45064,7 +56294,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; - val |= ((int) idigit) << bits; + val |= ((uint32_t) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; @@ -45074,13 +56304,13 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + remaining_bits = ((int) sizeof(uint32_t) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; - val |= ((int) idigit) << bits; + val |= ((uint32_t) idigit) << bits; } if (!is_unsigned) { - if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + if (unlikely(val & (((uint32_t) 1) << (sizeof(uint32_t) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; @@ -45092,21 +56322,21 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, Py_XDECREF(stepval); #endif if (unlikely(ret)) - return (int) -1; + return (uint32_t) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; + "value too large to convert to uint32_t"); + return (uint32_t) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + "can't convert negative value to uint32_t"); + return (uint32_t) -1; } -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -45114,26 +56344,168 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(unsigned PY_LONG_LONG), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned PY_LONG_LONG)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ + static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + if ((sizeof(uint16_t) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (long) val; + return (uint16_t) val; } } #endif if (unlikely(!PyLong_Check(x))) { - long val; + uint16_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); + if (!tmp) return (uint16_t) -1; + val = __Pyx_PyInt_As_uint16_t(tmp); Py_DECREF(tmp); return val; } @@ -45142,35 +56514,35 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + __PYX_VERIFY_RETURN_INT(uint16_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT)) { + return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); } } break; case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT)) { + return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); } } break; case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 4 * PyLong_SHIFT)) { + return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); } } break; @@ -45185,93 +56557,93 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (long) -1; + return (uint16_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if ((sizeof(long) <= sizeof(unsigned long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + if ((sizeof(uint16_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if ((sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { - __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + __PYX_VERIFY_RETURN_INT(uint16_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: - if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); } } break; case 2: - if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); } } break; case -3: - if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); } } break; case 3: - if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); } } break; case -4: - if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); } } break; case 4: - if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); } } break; } } #endif - if ((sizeof(long) <= sizeof(long))) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + if ((sizeof(uint16_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if ((sizeof(uint16_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { - long val; + uint16_t val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( @@ -45297,14 +56669,14 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); - if (unlikely(!v)) return (long) -1; + if (unlikely(!v)) return (uint16_t) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); - return (long) -1; + return (uint16_t) -1; } is_negative = result == 1; } @@ -45315,15 +56687,15 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) - return (long) -1; + return (uint16_t) -1; } else { stepval = v; } v = NULL; - val = (long) 0; + val = (uint16_t) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; - for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + for (bits = 0; bits < (int) sizeof(uint16_t) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); @@ -45331,7 +56703,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; - val |= ((long) idigit) << bits; + val |= ((uint16_t) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; @@ -45341,13 +56713,13 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; - remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + remaining_bits = ((int) sizeof(uint16_t) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; - val |= ((long) idigit) << bits; + val |= ((uint16_t) idigit) << bits; } if (!is_unsigned) { - if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + if (unlikely(val & (((uint16_t) 1) << (sizeof(uint16_t) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; @@ -45359,45 +56731,45 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, Py_XDECREF(stepval); #endif if (unlikely(ret)) - return (long) -1; + return (uint16_t) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; + "value too large to convert to uint16_t"); + return (uint16_t) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; + "can't convert negative value to uint16_t"); + return (uint16_t) -1; } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_short(unsigned short value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const int neg_one = (int) -1, const_zero = (int) 0; + const unsigned short neg_one = (unsigned short) -1, const_zero = (unsigned short) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { + if (sizeof(unsigned short) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned short) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(int) <= sizeof(long)) { + if (sizeof(unsigned short) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned short) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -45412,7 +56784,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(int), + return _PyLong_FromByteArray(bytes, sizeof(unsigned short), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -45420,7 +56792,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned short)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -45444,31 +56816,31 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const long neg_one = (long) -1, const_zero = (long) 0; + const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { + if (sizeof(unsigned char) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(long) <= sizeof(long)) { + if (sizeof(unsigned char) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -45483,7 +56855,7 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(long), + return _PyLong_FromByteArray(bytes, sizeof(unsigned char), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; @@ -45491,7 +56863,149 @@ static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned char)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(unsigned long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; @@ -45791,7 +57305,7 @@ __Pyx_PyType_GetName(PyTypeObject* tp) if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { PyErr_Clear(); Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__29); + name = __Pyx_NewRef(__pyx_n_s__53); } return name; } diff --git a/dataRead.cpython-313-x86_64-linux-gnu.so b/dataRead.cpython-313-x86_64-linux-gnu.so index b7406364..6a12ecf9 100755 Binary files a/dataRead.cpython-313-x86_64-linux-gnu.so and b/dataRead.cpython-313-x86_64-linux-gnu.so differ diff --git a/dataRead.pyx b/dataRead.pyx index 4bb558ce..de46ad65 100644 --- a/dataRead.pyx +++ b/dataRead.pyx @@ -2,13 +2,590 @@ import numpy as np cimport numpy as np from sys import byteorder -from libc.stdint cimport uint16_t, uint32_t, uint64_t +from libc.stdint cimport int64_t, uint8_t, uint16_t, uint32_t, uint64_t from libc.stdio cimport printf from cpython.mem cimport PyMem_Malloc, PyMem_Free from cpython.bytes cimport PyBytes_AsString from libc.string cimport memcpy +from posix.unistd cimport pread as c_pread cimport cython +# ────────────────────────────────────────────────────────────────────────────── +# SymBufReader — bidirectional-buffered file reader +# +# MDF4 metadata blocks are linked by absolute file pointers that often point +# *backward* in the file (blocks are written newest-first). Python's default +# BufferedReader fills its buffer forward, so every backward seek past the +# buffer start forces a new read syscall. This class mirrors the Rust mdfr +# SymBufReader: it keeps a fixed C-level buffer filled *centred* on the current +# position, so backward seeks within BUFSIZE/2 are served from cache. +# ────────────────────────────────────────────────────────────────────────────── + +DEF SYM_BUF_SIZE = 65536 # 64 KB — same default as Rust SymBufReader + +cdef class SymBufReader: + """Bidirectional-buffered wrapper around a Python file object. + + Drop-in replacement for any ``fid`` used in mdfreader metadata parsing: + supports ``seek(pos[, whence])``, ``read([n])``, ``tell()``, ``fileno()``. + """ + cdef object _fid # underlying Python file + cdef unsigned char _buf[SYM_BUF_SIZE] # C-level buffer (no GC pressure) + cdef Py_ssize_t _buf_start # file offset of _buf[0] + cdef Py_ssize_t _buf_len # valid bytes currently in _buf + cdef Py_ssize_t _pos # logical file position (cursor) + + def __init__(self, fid): + self._fid = fid + self._buf_start = 0 + self._buf_len = 0 + self._pos = 0 + + cdef int _fill(self, Py_ssize_t pos) except -1: + """Refill _buf centred on pos, reading from the underlying file.""" + cdef Py_ssize_t start = pos - (SYM_BUF_SIZE >> 1) + cdef bytes raw + cdef Py_ssize_t n + if start < 0: + start = 0 + self._fid.seek(start) + raw = self._fid.read(SYM_BUF_SIZE) + n = len(raw) + memcpy(self._buf, raw, n) + self._buf_start = start + self._buf_len = n + return 0 + + def seek(self, Py_ssize_t pos, int whence=0): + """Update logical cursor; does NOT touch the underlying file.""" + if whence == 0: + self._pos = pos + elif whence == 1: + self._pos += pos + else: # whence == 2 (from end) + self._fid.seek(0, 2) + self._pos = self._fid.tell() + pos + return self._pos + + def tell(self): + return self._pos + + def read(self, Py_ssize_t n=-1): + """Return up to n bytes from the current position (or all if n<0).""" + cdef Py_ssize_t pos = self._pos + cdef Py_ssize_t buf_end, offset, available, end + buf_end = self._buf_start + self._buf_len + # Fast path: serve directly from buffer + if self._buf_len > 0 and self._buf_start <= pos < buf_end: + offset = pos - self._buf_start + available = self._buf_len - offset + if n < 0 or available >= n: + end = offset + (n if n >= 0 else available) + data = bytes(self._buf[offset:end]) + self._pos += len(data) + return data + # Buffer miss: refill centred on pos, then serve + self._fill(pos) + offset = pos - self._buf_start + if offset >= self._buf_len: + return b'' + available = self._buf_len - offset + end = offset + (n if n >= 0 else available) + data = bytes(self._buf[offset:end]) + self._pos += len(data) + return data + + def fileno(self): + return self._fid.fileno() + + +# ─── MDF4 fast metadata reader (pread + C structs) ──────────────────────────── +# +# Goal: replace the Python struct.unpack + fid.seek/read hot path for the +# CN/CC/SI/TX block chain with a single Cython function that eliminates all +# Python overhead in the metadata-reading loop. +# +# Key techniques: +# pread() — POSIX atomic offset read; no seek, no GIL, no Python +# file-object dispatch (~575 k calls eliminated for a 36 k +# channel file). +# memcpy/cast — fields extracted directly from the raw buffer into C +# packed-struct variables; no struct.unpack tuple allocation. +# scan — fast bytes.find() scan for the common MD block pattern +# (), replacing lxml for +# >95% of files. lxml is used only for CDATA / namespaces. +# SI cache — SI blocks are cached by file offset in _si_cache so that +# shared sources (e.g., CAN bus) are read only once. +# +# Design constraints: +# • CC val/ref for cc_type 3/7-11 (formula, text-table, tab conversions) +# are left for the Python CCBlock.read_cc() path — they are rare and +# involve variable-length link arrays not worth the complexity. +# • Composition blocks (CA/CN/DS/CL/CV/CU) are post-processed in Python +# because they are recursive and apply only to a minority of channels. +# • _unique_channel_name() remains in Python — it requires full Info4 +# context (allChannelList, ChannelNamesByDG) and cannot be parallelised. +# ────────────────────────────────────────────────────────────────────────────── + +_SI_TYPE_MAP = {0: 'OTHER', 1: 'ECU', 2: 'BUS', 3: 'I/O', 4: 'TOOL', 5: 'USER'} +_SI_BUS_MAP = {0: 'NONE', 1: 'OTHER', 2: 'CAN', 3: 'LIN', + 4: 'MOST', 5: 'FLEXRAY', 6: 'K_LINE', 7: 'ETHERNET', 8: 'USB'} + +# C struct layout matching the on-disk MDF4 little-endian packed format. +# All structs are declared ``packed`` so that Cython/GCC adds no padding. +# Field names match the ASAM MDF4 specification (section 4.x, Table n). +# +# Reading strategy: +# 1. pread(fd, &struct, sizeof(struct), file_offset) — reads header +# 2. data section offset = 24 + link_count * 8 — past link section +# 3. pread(fd, &data_struct, sizeof(data_struct), offset + data_offset) + +# _CNFixedHdr — 88 bytes: 24-byte common header + 8 standard CN link fields. +# Extra links (attachments, default-X) follow at offset 88 when link_count > 8. +cdef packed struct _CNFixedHdr: + char id[4] # b'##CN' + uint32_t reserved # padding (0) + uint64_t length # total block length in bytes + uint64_t link_count # number of links in link section (≥8) + # Standard links (offsets 24–87): + uint64_t cn_cn_next # next CN block in channel group (0 = last) + uint64_t cn_composition # composition block (CA/CN/DS/CL/CV/CU) or 0 + uint64_t cn_tx_name # TX block with channel name + uint64_t cn_si_source # SI block for signal source (0 if none) + uint64_t cn_cc_conversion # CC block for value conversion (0 = identity) + uint64_t cn_data # signal data block (SD/DZ/HL/DL/CG) or 0 + uint64_t cn_md_unit # TX/MD block with physical unit (0 if none) + uint64_t cn_md_comment # TX/MD block with channel comment (0 if none) + +# _CNData — 72 bytes: data section located at offset 24 + link_count*8. +cdef packed struct _CNData: + uint8_t cn_type # 0=fixed-length, 1=VLSD, 2=master, + # 3=virtual master, 4=sync, 5=MLSD, + # 6=virtual data, 7=VLSC (MDF 4.3) + uint8_t cn_sync_type # 0=none, 1=time, 2=angle, 3=distance, 4=index + uint8_t cn_data_type # 0-15, see ASAM MDF4 spec §4.18.2 + uint8_t cn_bit_offset # bit start position within first byte (0-7) + uint32_t cn_byte_offset # byte start position within the record + uint32_t cn_bit_count # total bit width of channel in the record + uint32_t cn_flags # bitmask; bit 17 (0x20000) = CN_F_DATA_STREAM_MODE + uint32_t cn_invalid_bit_pos # bit position of invalidation flag in the record + uint8_t cn_precision # display decimal precision (0xFF = default) + uint8_t cn_reserved + uint16_t cn_attachment_count # number of AT attachment references + double cn_val_range_min # raw (record) value range minimum + double cn_val_range_max # raw (record) value range maximum + double cn_limit_min # physical limit minimum + double cn_limit_max # physical limit maximum + double cn_limit_ext_min # extended limit minimum + double cn_limit_ext_max # extended limit maximum + +# _CCFixedHdr — 56 bytes: 24-byte header + 4 standard CC link fields. +# Additional cc_ref links follow at offset 56 when link_count > 4. +cdef packed struct _CCFixedHdr: + char id[4] # b'##CC' + uint32_t reserved + uint64_t length + uint64_t link_count # number of links (≥4) + uint64_t cc_tx_name # TX block with conversion name (0 if none) + uint64_t cc_md_unit # TX/MD block with unit (0 if none) + uint64_t cc_md_comment # TX/MD block with comment (0 if none) + uint64_t cc_cc_inverse # inverse CC block (0 if none) + +# _CCData — 24 bytes: data section at offset 24 + link_count*8. +# cc_val doubles and cc_ref links follow after this section. +cdef packed struct _CCData: + uint8_t cc_type # 0=identity, 1=linear, 2=rational, 3=formula, + # 4=tab-interp, 5=tab, 6=range→value, + # 7=value→text, 8=range→text, 9=text→value, + # 10=text→text, 11=bitfield-text + uint8_t cc_precision # decimal places for display (0xFF = inherit from CN) + uint16_t cc_flags # bitmask + uint16_t cc_ref_count # number of cc_ref links beyond the 4 standard links + uint16_t cc_val_count # number of cc_val double entries + double cc_phy_range_min + double cc_phy_range_max + +# _SIBlock — 56 bytes total: 24-byte header + 3 link fields + 8 data bytes. +cdef packed struct _SIBlock: + char id[4] # b'##SI' + uint32_t reserved + uint64_t length + uint64_t link_count # always 3 + uint64_t si_tx_name # TX block with source name + uint64_t si_tx_path # TX block with source path + uint64_t si_md_comment # MD/TX block with comment + uint8_t si_type # 0=OTHER, 1=ECU, 2=BUS, 3=I/O, 4=TOOL, 5=USER + uint8_t si_bus_type # 0=NONE, 1=OTHER, 2=CAN, 3=LIN, 4=MOST, + # 5=FLEXRAY, 6=K_LINE, 7=ETHERNET, 8=USB + uint8_t si_flags # bit 0 = simulated source + char si_reserved[5] + +# _TXHdr — 24-byte common header shared by TX (plain text) and MD (XML) blocks. +# The text/XML payload immediately follows at offset 24. +cdef packed struct _TXHdr: + char id[4] # b'##TX' (plain text) or b'##MD' (XML) + uint32_t reserved + uint64_t length # total block length in bytes (header + payload) + uint64_t link_count # always 0 for TX/MD + + +cdef str _fast_read_tx(int fd, uint64_t pointer): + """Read TX block text via pread. Returns '' if pointer is 0 or read fails.""" + cdef _TXHdr hdr + cdef Py_ssize_t content_len, end, nread + cdef unsigned char* buf + cdef str result + + if pointer == 0: + return '' + with nogil: + nread = c_pread(fd, &hdr, 24, pointer) + if nread < 24 or hdr.length <= 24: + return '' + content_len = (hdr.length - 24) + if content_len <= 0: + return '' + buf = PyMem_Malloc(content_len + 1) + if buf == NULL: + return '' + try: + with nogil: + nread = c_pread(fd, buf, content_len, pointer + 24) + if nread < 1: + return '' + end = nread + while end > 0 and buf[end - 1] == 0: + end -= 1 + buf[end] = 0 + result = (buf[:end]).decode('UTF-8', 'ignore') + finally: + PyMem_Free(buf) + return result + + +cdef str _fast_read_tx_or_md(int fd, uint64_t pointer): + """Read a TX or MD block and return its text content. + + TX blocks + The payload bytes are decoded directly as UTF-8 (ignoring errors) + and returned after stripping trailing null bytes. + + MD blocks (XML) + A fast ``bytes.find()`` scan looks for ```` in the raw + payload. This handles the standard ```` + and ```` patterns that cover >95% of + real MDF4 files. If the scan fails (CDATA sections, namespace + prefixes, nested elements), the full payload is passed to + ``lxml.objectify`` as a fallback. + + Returns '' if *pointer* is 0, the read fails, or no TX text is found. + """ + cdef _TXHdr hdr + cdef Py_ssize_t content_len, nread, tx_start, tx_end, end + cdef unsigned char* buf + cdef bytes payload + cdef str result + + if pointer == 0: + return '' + with nogil: + nread = c_pread(fd, &hdr, 24, pointer) + if nread < 24 or hdr.length <= 24: + return '' + content_len = (hdr.length - 24) + if content_len <= 0: + return '' + buf = PyMem_Malloc(content_len + 1) + if buf == NULL: + return '' + try: + with nogil: + nread = c_pread(fd, buf, content_len, pointer + 24) + if nread < 1: + return '' + end = nread + while end > 0 and buf[end - 1] == 0: + end -= 1 + # TX block (id[2]=='T', id[3]=='X') + if hdr.id[2] == b'T' and hdr.id[3] == b'X': + buf[end] = 0 + result = (buf[:end]).decode('UTF-8', 'ignore') + return result + # MD block: fast ... scan + payload = bytes(buf[:end]) + tx_start = payload.find(b'') + if tx_start >= 0: + tx_start += 4 + tx_end = payload.find(b'', tx_start) + if tx_end >= 0: + return payload[tx_start:tx_end].decode('UTF-8', 'ignore') + # CDATA or namespaced XML: attempt lxml parse + try: + from lxml import objectify as _obj + xml_tree = _obj.fromstring(payload) + # Try common paths: TX, CNcomment.TX, CNunit.TX, etc. + try: + return str(xml_tree.TX) + except AttributeError: + pass + try: + return str(xml_tree.CNcomment.TX) + except AttributeError: + pass + try: + return str(xml_tree.CNunit.TX) + except AttributeError: + pass + except Exception: + pass + return '' + finally: + PyMem_Free(buf) + + +cdef dict _fast_read_si(int fd, uint64_t pointer): + """Read an SI block and return a dict matching the ``SIBlock`` Python format. + + The returned dict contains the same keys as ``SIBlock.read_si()`` would + produce, so it can be stored directly in ``info._si_cache`` and later + assigned to ``info['CN'][dg][cg][cn]['SI']``. + + The ``source_name`` and ``source_path`` sub-dicts are populated by reading + the linked TX blocks via :func:`_fast_read_tx`. + + Returns ``None`` if *pointer* is 0 or the pread fails. + """ + cdef _SIBlock si + cdef Py_ssize_t nread + cdef dict result + + if pointer == 0: + return None + with nogil: + nread = c_pread(fd, &si, 56, pointer) + if nread < 56: + return None + result = { + 'id': b'##SI', + 'length': si.length, + 'link_count': si.link_count, + 'si_tx_name': si.si_tx_name, + 'si_tx_path': si.si_tx_path, + 'si_md_comment': si.si_md_comment, + 'si_type': _SI_TYPE_MAP.get(si.si_type, 'OTHER'), + 'si_bus_type': _SI_BUS_MAP.get(si.si_bus_type, 'NONE'), + 'si_flags': si.si_flags, + 'source_name': {'Comment': _fast_read_tx(fd, si.si_tx_name)}, + 'source_path': {'Comment': _fast_read_tx(fd, si.si_tx_path)}, + } + return result + + +def read_cn_chain_fast(object fid, uint64_t first_pointer, + dict si_cache, int minimal, bint channel_name_list): + """Read the CN linked list starting at first_pointer using pread(). + + Parameters + ---------- + fid : file object (must support fileno()) + first_pointer : uint64_t + File offset of the first CN block in the chain + si_cache : dict + Shared SI block cache keyed by file offset; updated in-place + minimal : int + 0 = load all metadata; non-zero = skip SI and XML comment + channel_name_list : bool + True = read only channel names (skip CC/SI/unit/comment) + + Returns + ------- + list of (cn_key, cn_dict, cc_dict) tuples + cn_key is positive (byte_offset*8 + bit_offset) or negative (DS mode) + cn_dict and cc_dict match the structure produced by read_cn_block() + cc_dict has '_needs_completion'=True for cc_type 3/7-11 + """ + cdef int fd = fid.fileno() + cdef uint64_t pointer = first_pointer + cdef _CNFixedHdr cn_hdr + cdef _CNData cn_dat + cdef _CCFixedHdr cc_hdr + cdef _CCData cc_dat + cdef Py_ssize_t nread, data_offset, cc_data_offset, n_extra, n_bytes + cdef uint64_t cn_key_uint, si_ptr, cc_ptr + cdef int64_t cn_key_neg + cdef object cn_key + cdef list results = [] + cdef dict cn_dict, cc_dict, si_dict + cdef str cn_name, unit_str, desc_str + cdef unsigned char extra_buf[512] # for extra CN links (attachments) + cdef double* dbl_ptr + cdef unsigned char* cc_val_buf + cdef list cc_val_list + cdef uint32_t i + + while pointer != 0: + # ── Read CN fixed header + 8 standard links (88 bytes) ────────────── + with nogil: + nread = c_pread(fd, &cn_hdr, 88, pointer) + if nread < 88: + break + + # ── Read CN data section (72 bytes at variable offset) ─────────────── + data_offset = 24 + (cn_hdr.link_count) * 8 + with nogil: + nread = c_pread(fd, &cn_dat, 72, pointer + data_offset) + if nread < 72: + break + + # ── Compute dict key ───────────────────────────────────────────────── + if cn_dat.cn_flags & 0x20000: # CN_F_DATA_STREAM_MODE + cn_key_neg = -pointer + cn_key = cn_key_neg + else: + cn_key_uint = (cn_dat.cn_byte_offset) * 8 + cn_dat.cn_bit_offset + cn_key = cn_key_uint + + # ── Read channel name (TX block) ───────────────────────────────────── + cn_name = _fast_read_tx(fd, cn_hdr.cn_tx_name) if cn_hdr.cn_tx_name else '' + + # ── Build CN dict ───────────────────────────────────────────────────── + cn_dict = { + 'pointer': pointer, + 'id': b'##CN', + 'length': cn_hdr.length, + 'link_count': cn_hdr.link_count, + 'cn_cn_next': cn_hdr.cn_cn_next, + 'cn_composition': cn_hdr.cn_composition, + 'cn_tx_name': cn_hdr.cn_tx_name, + 'cn_si_source': cn_hdr.cn_si_source, + 'cn_cc_conversion': cn_hdr.cn_cc_conversion, + 'cn_data': cn_hdr.cn_data, + 'cn_md_unit': cn_hdr.cn_md_unit, + 'cn_md_comment': cn_hdr.cn_md_comment, + 'cn_type': cn_dat.cn_type, + 'cn_sync_type': cn_dat.cn_sync_type, + 'cn_data_type': cn_dat.cn_data_type, + 'cn_bit_offset': cn_dat.cn_bit_offset, + 'cn_byte_offset': cn_dat.cn_byte_offset, + 'cn_bit_count': cn_dat.cn_bit_count, + 'cn_flags': cn_dat.cn_flags, + 'cn_invalid_bit_pos': cn_dat.cn_invalid_bit_pos, + 'cn_precision': cn_dat.cn_precision, + 'cn_reserved': 0, + 'cn_attachment_count': cn_dat.cn_attachment_count, + 'cn_val_range_min': cn_dat.cn_val_range_min, + 'cn_val_range_max': cn_dat.cn_val_range_max, + 'cn_default_x': None, + 'name': cn_name, + } + + # ── Handle extra links (attachments, default_x) ─────────────────────── + if cn_hdr.link_count > 8: + n_extra = ((cn_hdr.link_count) - 8) * 8 + if n_extra <= 512: + with nogil: + nread = c_pread(fd, extra_buf, n_extra, pointer + 88) + if nread == n_extra: + extra_links = [] + for i in range(0, n_extra, 8): + lnk = 0 + memcpy(&lnk, extra_buf + i, 8) + extra_links.append(lnk) + if cn_dat.cn_attachment_count > 0: + cn_dict['cn_at_reference'] = extra_links[:cn_dat.cn_attachment_count] + if cn_hdr.link_count > 8 + cn_dat.cn_attachment_count: + cn_dict['cn_default_x'] = extra_links[cn_dat.cn_attachment_count:] + + # ── Read unit (TX or MD block) ───────────────────────────────────────── + if not channel_name_list: + if cn_hdr.cn_md_unit: + unit_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_unit) + if unit_str: + cn_dict['unit'] = unit_str + elif cn_dat.cn_sync_type == 1: + cn_dict['unit'] = 's' + elif cn_dat.cn_sync_type == 2: + cn_dict['unit'] = 'rad' + elif cn_dat.cn_sync_type == 3: + cn_dict['unit'] = 'm' + elif cn_dat.cn_sync_type == 1: + cn_dict['unit'] = 's' + elif cn_dat.cn_sync_type == 2: + cn_dict['unit'] = 'rad' + elif cn_dat.cn_sync_type == 3: + cn_dict['unit'] = 'm' + + # ── Read description (MD/TX block) ───────────────────────────────── + if cn_hdr.cn_md_comment: + desc_str = _fast_read_tx_or_md(fd, cn_hdr.cn_md_comment) + if desc_str: + cn_dict['Comment'] = {'description': desc_str} + + # ── Read CC block ────────────────────────────────────────────────────── + cc_ptr = cn_hdr.cn_cc_conversion + cc_dict = {'cc_type': 0} + if cc_ptr != 0: + with nogil: + nread = c_pread(fd, &cc_hdr, 56, cc_ptr) + if nread == 56: + cc_data_offset = 24 + (cc_hdr.link_count) * 8 + with nogil: + nread = c_pread(fd, &cc_dat, 24, cc_ptr + cc_data_offset) + if nread == 24: + cc_dict = { + 'pointer': cc_ptr, + 'id': b'##CC', + 'length': cc_hdr.length, + 'link_count': cc_hdr.link_count, + 'cc_tx_name': cc_hdr.cc_tx_name, + 'cc_md_unit': cc_hdr.cc_md_unit, + 'cc_md_comment': cc_hdr.cc_md_comment, + 'cc_cc_inverse': cc_hdr.cc_cc_inverse, + 'cc_type': cc_dat.cc_type, + 'cc_precision': cc_dat.cc_precision, + 'cc_flags': cc_dat.cc_flags, + 'cc_ref_count': cc_dat.cc_ref_count, + 'cc_val_count': cc_dat.cc_val_count, + 'cc_phy_range_min': cc_dat.cc_phy_range_min, + 'cc_phy_range_max': cc_dat.cc_phy_range_max, + } + # Read cc_val (doubles) for common conversion types + if cc_dat.cc_val_count > 0 and cc_dat.cc_type not in (3, 7, 8, 9, 10, 11): + n_bytes = cc_dat.cc_val_count * 8 + cc_val_buf = PyMem_Malloc(n_bytes) + if cc_val_buf != NULL: + try: + with nogil: + nread = c_pread(fd, cc_val_buf, + n_bytes, + cc_ptr + cc_data_offset + 24) + if nread == n_bytes: + dbl_ptr = cc_val_buf + cc_val_list = [] + for i in range(cc_dat.cc_val_count): + cc_val_list.append(dbl_ptr[i]) + cc_dict['cc_val'] = cc_val_list + finally: + PyMem_Free(cc_val_buf) + # Mark complex CC types for Python re-read + if cc_dat.cc_type in (3, 7, 8, 9, 10, 11): + cc_dict['_needs_completion'] = True + + # ── Read SI block (cached) ───────────────────────────────────────────── + if not minimal and not channel_name_list and cn_hdr.cn_si_source != 0: + si_ptr = cn_hdr.cn_si_source + if si_ptr not in si_cache: + si_cache[si_ptr] = _fast_read_si(fd, si_ptr) + si_dict = si_cache.get(si_ptr) + if si_dict is not None: + cn_dict['SI'] = si_dict + + results.append((cn_key, cn_dict, cc_dict)) + pointer = cn_hdr.cn_cn_next + + return results + + @cython.boundscheck(False) @cython.wraparound(False) def sorted_data_read(bytes tmp, unsigned short bit_count, diff --git a/docs/channel/index.rst b/docs/channel/index.rst index 68c42605..d4ca00d2 100644 --- a/docs/channel/index.rst +++ b/docs/channel/index.rst @@ -1,8 +1,34 @@ -channel module documentation +channel — per-channel record layout ===================================== +This module provides :class:`~mdfreader.channel.Channel4` and +:class:`~mdfreader.channel.Channel3`, which encapsulate the record-level +layout of a single channel within its channel group. + +These objects are created once during reading and cached in the +:class:`~mdfreader.mdf4reader.Mdf4Record` / +:class:`~mdfreader.mdf3reader.Mdf3Record` structures. They expose helper +methods used by the data readers: + +.. list-table:: + :widths: 30 70 + :header-rows: 1 + + * - Method + - Returns + * - ``unit(info)`` + - Physical unit string from CC or CN block + * - ``desc(info)`` + - Channel description from CN comment block + * - ``conversion(info)`` + - CC block dict for raw→physical conversion + * - ``calc_bytes(info)`` + - Aligned byte width of channel in the record + * - ``set(info)`` + - Populate all attributes from the ``Info4`` dict + .. automodule:: mdfreader.channel :members: :undoc-members: :show-inheritance: - + :member-order: bysource diff --git a/docs/conf.py b/docs/conf.py index 62c09c55..4b1f077b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,13 +20,17 @@ # -- General configuration ----------------------------------------------------- -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'numpydoc', 'sphinx.ext.intersphinx', - 'sphinx.ext.coverage'] +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', + 'sphinx.ext.intersphinx', + 'sphinx.ext.autosummary', + 'sphinx.ext.coverage', + 'numpydoc', +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -34,24 +38,17 @@ # The suffix of source filenames. source_suffix = '.rst' -# The encoding of source files. -#source_encoding = 'utf-8-sig' - # The master toctree document. master_doc = 'index' # General information about the project. project = u'mdfreader' -copyright = u'2018, Aymeric Rateau' +copyright = u'2025, Aymeric Rateau' -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# # The short X.Y version. -version = '4.0' +version = '4.3' # The full version, including alpha/beta/rc tags. -release = '4.0' +release = '4.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -92,7 +89,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -121,7 +118,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -250,4 +247,19 @@ # Your Name - author name in the pdf napoleon_numpy_docstring = True -numpydoc_show_class_members = False \ No newline at end of file +numpydoc_show_class_members = False + +# autodoc defaults +autodoc_default_options = { + 'members': True, + 'undoc-members': True, + 'show-inheritance': True, + 'member-order': 'bysource', +} +autodoc_typehints = 'description' + +# intersphinx: link to numpy, Python docs +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), + 'numpy': ('https://numpy.org/doc/stable', None), +} \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 3092b925..7e6eecdc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,34 +1,126 @@ -.. mdfreader documentation master file, created by - sphinx-quickstart on Wed Dec 10 23:56:46 2014. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +mdfreader |version| documentation +=================================== -Welcome to mdfreader's documentation! -===================================== +**mdfreader** is a Python library for reading and writing MDF files +(Measured Data Format, versions 3.x and 4.x), the standard binary format +used in automotive ECU data logging (INCA, CANape, CANoe). -Contents: +.. code-block:: python -.. toctree:: - :maxdepth: 3 + import mdfreader - mdfreader/index + # Read all channels + mdf = mdfreader.Mdf('recording.mf4') + time = mdf.get_channel_data('t') + speed = mdf.get_channel_data('vehicle_speed') - mdf/index + # Inspect the file structure without loading data + info = mdfreader.MdfInfo('recording.mf4') - mdf3reader/index + # List channels grouped by master (raster) + print(mdf.masterChannelList) - mdfinfo3/index + # Resample and export + mdf.resample(sampling=0.01) + mdf.export_to_csv('output.csv') - mdf4reader/index +Quick-start +----------- - mdfinfo4/index +Install from PyPI (binary wheel includes the Cython extension):: + + pip install mdfreader + +Build from source (recommended for development):: + + pip install cython numpy + python setup.py build_ext --inplace + pip install -e . + +.. seealso:: + + :ref:`genindex`, :ref:`modindex` + +Architecture +------------ + +mdfreader is split into two layers per MDF version: + +.. list-table:: + :widths: 30 70 + :header-rows: 1 + * - Module + - Responsibility + * - :mod:`mdfreader.mdfreader` + - Top-level :class:`~mdfreader.mdfreader.Mdf` and + :class:`~mdfreader.mdfreader.MdfInfo` classes; dispatch by file version + * - :mod:`mdfreader.mdf` + - :class:`~mdfreader.mdf.MdfSkeleton` base class; channel dict structure, + export methods, resampling, plotting + * - :mod:`mdfreader.mdfinfo4` + - MDF4 metadata parser (:class:`~mdfreader.mdfinfo4.Info4`); reads all + block types (HD/DG/CG/CN/CC/SI/TX/MD/AT/EV) into a nested dict + * - :mod:`mdfreader.mdf4reader` + - MDF4 sample-data reader; sorted/unsorted records, DT/DZ/DL/HL blocks, + VLSD/VLSC strings, channel conversion + * - :mod:`mdfreader.mdfinfo3` + - MDF3 metadata parser + * - :mod:`mdfreader.mdf3reader` + - MDF3 sample-data reader + * - :mod:`mdfreader.channel` + - :class:`~mdfreader.channel.Channel4` / + :class:`~mdfreader.channel.Channel3` — per-channel record layout helper + * - ``dataRead`` (Cython) + - Low-level fast helpers: :func:`read_cn_chain_fast`, + :class:`SymBufReader`, :func:`sorted_data_read`, bit-exact decoders. + See :doc:`performance`. + +Channel dict structure +---------------------- + +After reading, each channel in the :class:`~mdfreader.mdfreader.Mdf` dict +has the following keys: + +.. list-table:: + :widths: 20 80 + :header-rows: 1 + + * - Key + - Description + * - ``data`` + - :class:`numpy.ndarray` of channel samples + * - ``unit`` + - Physical unit string (e.g. ``'m/s'``) + * - ``master`` + - Name of the master channel for this raster + * - ``masterType`` + - Master type: ``1``\ =time, ``2``\ =angle, ``3``\ =distance, ``4``\ =index + * - ``description`` + - Free-text channel description + * - ``conversion`` + - Raw→physical conversion dict (present when ``convert_after_read=False``) + * - ``id`` + - ``(dg, cg, cn)`` index tuple into the :class:`~mdfreader.mdfinfo4.Info4` dict + +Contents +-------- + +.. toctree:: + :maxdepth: 2 + + performance + mdfreader/index + mdf/index + mdf4reader/index + mdfinfo4/index + mdf3reader/index + mdfinfo3/index channel/index Indices and tables -================== +------------------ * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/docs/mdf/index.rst b/docs/mdf/index.rst index 71374dca..dc259cd0 100644 --- a/docs/mdf/index.rst +++ b/docs/mdf/index.rst @@ -1,7 +1,54 @@ -mdf module documentation -===================================== +mdf — base class and channel dict +================================== + +:mod:`mdfreader.mdf` provides :class:`~mdfreader.mdf.MdfSkeleton`, the base +class inherited by all version-specific readers. It defines the channel dict +structure, all export methods, resampling, and plotting. + +Channel dict layout +------------------- + +After reading, the :class:`~mdfreader.mdf.MdfSkeleton` object (a ``dict`` +subclass) stores one entry per channel: + +.. code-block:: python + + mdf['channel_name'] = { + 'data': numpy_array, + 'unit': 'm/s', + 'master': 'time_master', + 'masterType': 1, # 1=time, 2=angle, 3=distance, 4=index + 'description': 'Vehicle speed', + # present only when convert_after_read=False: + 'conversion': {'type': 1, 'parameters': {'cc_val': [0.0, 1.0]}}, + 'id': ((dg, cg, cn), (name, source, path), (grp, gs, gp)), + } + +Key constants (importable from :mod:`mdfreader.mdf`): + +.. list-table:: + :widths: 30 70 + :header-rows: 1 + + * - Constant + - Dict key it names + * - ``dataField`` + - ``'data'`` + * - ``unitField`` + - ``'unit'`` + * - ``masterField`` + - ``'master'`` + * - ``masterTypeField`` + - ``'masterType'`` + * - ``descriptionField`` + - ``'description'`` + * - ``conversionField`` + - ``'conversion'`` + * - ``idField`` + - ``'id'`` .. automodule:: mdfreader.mdf :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/docs/mdf3reader/index.rst b/docs/mdf3reader/index.rst index 401dc0b0..d62485fd 100644 --- a/docs/mdf3reader/index.rst +++ b/docs/mdf3reader/index.rst @@ -1,7 +1,19 @@ -mdf3reader module documentation +mdf3reader — MDF3 sample-data reader ===================================== +This module reads sample data from MDF 3.x files. +Metadata is parsed by :mod:`mdfreader.mdfinfo3`. + +MDF3 differences from MDF4 +--------------------------- + +* No compressed data blocks (DZ/DL/HL are MDF4 features) +* Channel conversion types differ — cc\_type 0 is linear (not identity) +* No VLSD or VLSC string channels +* No Source Information (SI) blocks + .. automodule:: mdfreader.mdf3reader :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/docs/mdf4reader/index.rst b/docs/mdf4reader/index.rst index 77cbe6e8..3cf085f2 100644 --- a/docs/mdf4reader/index.rst +++ b/docs/mdf4reader/index.rst @@ -1,7 +1,90 @@ -mdf4reader module documentation +mdf4reader — MDF4 sample-data reader ===================================== +This module reads the *sample data* from MDF 4.x files. +Metadata is parsed separately by :mod:`mdfreader.mdfinfo4`. + +Key classes +----------- + +:class:`~mdfreader.mdf4reader.Mdf4` + Version-4 reader. Inherits from :class:`~mdfreader.mdf.MdfSkeleton` + and is mixed into :class:`~mdfreader.mdfreader.Mdf`. + +:class:`~mdfreader.mdf4reader.Mdf4Record` + Per-channel-group record layout. Built once during reading; holds + dtype, byte offsets and channel references. The + :meth:`~mdfreader.mdf4reader.Mdf4Record.read_all_channels_sorted_record` + method reads all records in a single ``readinto()`` call. + +Data block types +---------------- + +.. list-table:: + :widths: 15 85 + :header-rows: 1 + + * - Block + - Description + * - DT + - Plain data (sorted records concatenated) + * - DZ + - Deflate/transposed-deflate or LZ4/ZStandard compressed data + * - HL + - Header list grouping DL blocks + * - DL + - Data list: ordered sequence of DT/DZ blocks for one channel group + * - SD + - Signal data for VLSD channels (variable-length strings/arrays) + * - DV/DI + - Data Values / Data Invalidation (unsorted records with record IDs) + +Conversion types +---------------- + +Raw-to-physical conversion (``cc_type`` in the CC block) is applied after +reading when ``convert_after_read=True`` (default): + +.. list-table:: + :widths: 10 20 70 + :header-rows: 1 + + * - Type + - Name + - Description + * - 0 + - Identity + - No conversion; raw value is the physical value + * - 1 + - Linear + - ``phys = a0 + a1 * raw`` + * - 2 + - Rational + - Six-coefficient rational function + * - 3 + - Formula + - Algebraic formula (requires ``sympy``) + * - 4 + - Tab (interpolated) + - Piecewise-linear table with interpolation + * - 5 + - Tab (no interpolation) + - Step table + * - 6 + - Range → value + - Maps value ranges to scalar outputs + * - 7 + - Value → text + - Maps discrete values to strings + * - 8 + - Range → text + - Maps value ranges to strings + * - 9–11 + - Text ↔ value/text + - Text input or output conversions + .. automodule:: mdfreader.mdf4reader :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/docs/mdfinfo3/index.rst b/docs/mdfinfo3/index.rst index bec7965e..e6e54567 100644 --- a/docs/mdfinfo3/index.rst +++ b/docs/mdfinfo3/index.rst @@ -1,7 +1,31 @@ -mdfinfo3 module documentation -===================================== +mdfinfo3 — MDF3 metadata parser +================================ + +This module parses the block structure of MDF 3.x files. +The result is stored in an :class:`~mdfreader.mdfinfo3.Info3` nested dict, +analogous to :class:`~mdfreader.mdfinfo4.Info4` for MDF4. + +MDF3 uses different block names than MDF4: + +.. list-table:: + :widths: 30 70 + :header-rows: 1 + + * - Key + - Description + * - ``info['HDBlock']`` + - Header block + * - ``info['DGBlock'][dg]`` + - Data group block + * - ``info['CGBlock'][dg][cg]`` + - Channel group block + * - ``info['CNBlock'][dg][cg][cn]`` + - Channel block + * - ``info['CCBlock'][dg][cg][cn]`` + - Channel conversion block .. automodule:: mdfreader.mdfinfo3 :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/docs/mdfinfo4/index.rst b/docs/mdfinfo4/index.rst index 6acded38..8ed01b73 100644 --- a/docs/mdfinfo4/index.rst +++ b/docs/mdfinfo4/index.rst @@ -1,7 +1,56 @@ -mdfinfo4 module documentation -===================================== +mdfinfo4 — MDF4 metadata parser +================================ + +This module parses the *block structure* of MDF 4.x files and stores the +result in the nested :class:`~mdfreader.mdfinfo4.Info4` dict. It does not +read sample data (that is handled by :mod:`mdfreader.mdf4reader`). + +Reading paths +------------- + +Two paths exist for the CN/CC/SI/TX metadata hot loop. The fast path is +selected automatically when the ``dataRead`` Cython extension is available. +See :doc:`../performance` for a full description. + +.. list-table:: + :widths: 20 80 + :header-rows: 1 + + * - Path + - Description + * - **Fast (Cython)** + - ``read_cn_chain_fast()`` — ``pread()`` + C packed structs, ```` + bytes scan, SI cache. Active when ``_CN_CHAIN_FAST`` is ``True``. + * - **Fallback (Python)** + - :meth:`~mdfreader.mdfinfo4.Info4.read_cn_block` — ``struct.unpack`` + via :class:`~mdfreader.mdfinfo4.CNBlock` / + :class:`~mdfreader.mdfinfo4.CCBlock` / :class:`~mdfreader.mdfinfo4.SIBlock`. + +Info4 dict structure +-------------------- + +.. code-block:: python + + info = mdfreader.MdfInfo('file.mf4') + + info['HD'] # header block + info['DG'][dg] # data group block + info['CG'][dg][cg] # channel group block + info['CN'][dg][cg][cn] # channel block + info['CC'][dg][cg][cn] # conversion block + info['AT'] # attachment blocks + info['VLSD'][dg][cg] # list of VLSD channel keys + info['VLSD_CG'][record_id] # VLSD CG → (cg, cn) + info['MLSD'][dg][cg] # MLSD channel cross-reference + info['masters'] # master channel registry + info['allChannelList'] # set of all channel names + info['ChannelNamesByDG'][dg] # set of channel names per data group + +Block parsers +------------- .. automodule:: mdfreader.mdfinfo4 :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/docs/mdfreader/index.rst b/docs/mdfreader/index.rst index 58cde405..2d8eb537 100644 --- a/docs/mdfreader/index.rst +++ b/docs/mdfreader/index.rst @@ -1,7 +1,34 @@ -mdfreader module documentation -===================================== +mdfreader — top-level API +========================= + +This module provides the two public entry points: + +:class:`~mdfreader.mdfreader.Mdf` + The main class for reading, writing, converting and exporting MDF files. + Inherits from :class:`~mdfreader.mdf4reader.Mdf4` and + :class:`~mdfreader.mdf3reader.Mdf3`, which in turn inherit from + :class:`~mdfreader.mdf.MdfSkeleton`. + + Typical usage:: + + import mdfreader + mdf = mdfreader.Mdf('file.mf4') + data = mdf.get_channel_data('speed') + mdf.resample(0.01) + mdf.export_to_csv('output.csv') + +:class:`~mdfreader.mdfreader.MdfInfo` + Read-only parser that extracts the block structure of an MDF file + without loading sample data. Useful for listing channels, inspecting + metadata, or checking file integrity before a full read. + + Typical usage:: + + info = mdfreader.MdfInfo('file.mf4') + channels = info.list_channels() .. automodule:: mdfreader.mdfreader :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/docs/performance.rst b/docs/performance.rst new file mode 100644 index 00000000..2024dd06 --- /dev/null +++ b/docs/performance.rst @@ -0,0 +1,139 @@ +.. _performance: + +Performance +=========== + +When the ``dataRead`` Cython extension is compiled, mdfreader applies three +complementary optimisations that together give a **3–5× speedup** on large +MDF4 files compared to the pure-Python path. + +Benchmark (184 MB, 36 000-channel MDF4 file) +--------------------------------------------- + +.. list-table:: + :widths: 45 20 20 + :header-rows: 1 + + * - Scenario + - Wall time + - Speedup + * - Pure Python (no Cython) + - ~1.9 s + - 1× + * - v4.2 with Cython (bit-exact reader only) + - ~1.9 s + - 1× + * - v4.3 with all optimisations + - **~0.6 s** + - **~3×** + +Optimisation 1 — Fast CN/CC/SI/TX metadata reader +-------------------------------------------------- + +**Function:** ``read_cn_chain_fast()`` in ``dataRead.pyx`` + +**Called from:** :meth:`~mdfreader.mdfinfo4.Info4.read_cn_blocks` + +MDF4 channel metadata is organised as a singly-linked list of CN blocks. +For a 36 000-channel file this involves: + +* ~575 000 ``fid.seek()`` + ``fid.read()`` Python call pairs +* ~36 000 ``struct.unpack()`` calls per channel +* ~36 000 ``lxml.objectify`` XML parses for unit/description MD blocks +* ~36 000 SI-block reads (often duplicated — same source for many channels) + +``read_cn_chain_fast()`` replaces all of the above with a single C-level loop: + +``pread()`` + POSIX atomic offset-based read (````). No ``seek()``, no GIL + acquired during I/O, no Python file-object method dispatch. Each block + is read in one syscall directly into a C stack buffer. + +C packed structs + All MDF4 block fields are extracted with ``memcpy`` into typed + ``cdef packed struct`` variables matching the on-disk little-endian + layout. No ``struct.unpack()`` tuple allocation, no intermediate + ``bytes`` object. + +Fast ```` scan + Unit and description text lives in MD blocks (XML) of the form + ``text``. A plain ``bytes.find()`` scan + for ```` / ```` handles >95 % of real files without invoking + the XML parser. ``lxml`` is only called for CDATA sections or + namespace-qualified elements. + +SI-block cache + Source Information blocks are shared across many channels (e.g. all + channels from one CAN bus share the same SI block). Results are stored + in ``Info4._si_cache`` (keyed by file offset) so each unique source is + read and decoded only once. + +Unchanged paths (Python) + * ``_unique_channel_name()`` — requires full ``Info4`` context. + * Composition blocks (CA/CN/DS/CL/CV/CU) — recursive, rare. + * CC val/ref for complex types (cc\_type 3, 7–11) — variable-length + link arrays; handled by :class:`~mdfreader.mdfinfo4.CCBlock`. + +Optimisation 2 — SymBufReader (bidirectional file buffer) +--------------------------------------------------------- + +**Class:** ``SymBufReader`` in ``dataRead.pyx`` + +**Called from:** :meth:`~mdfreader.mdfinfo4.Info4.__init__` + +MDF4 metadata blocks are written in reverse order (newest first) and linked +by backward-pointing file offsets. Python's default ``BufferedReader`` +fills its buffer *forward* from the current position, so every backward seek +past the buffer boundary causes a kernel ``read()`` call. + +``SymBufReader`` keeps a **64 KB buffer centred on the current position** +(mirroring the Rust `mdfr` library design). Seeks within ±32 KB of the +last fill position are served from the C-level ``unsigned char`` buffer +without any kernel interaction. The buffer is stored as a C array (not a +Python ``bytes`` object) to avoid allocation and GC pressure. + +.. code-block:: python + + # Transparent drop-in for fid: + from dataRead import SymBufReader + reader = SymBufReader(fid) + reader.seek(offset) + data = reader.read(88) # served from buffer if within ±32 KB + +Optimisation 3 — Single-call record read (sorted data) +------------------------------------------------------ + +**Function:** :meth:`~mdfreader.mdf4reader.Mdf4Record.read_all_channels_sorted_record` + +For sorted channel groups (the common case), all records for the group are +read in **one** ``readinto()`` call into a pre-allocated flat ``uint8`` +buffer. The buffer is then reinterpreted as a structured NumPy record array +via ``.view()``. This eliminates the per-chunk Python loop that previously +issued thousands of ``fid.read()`` calls for large data blocks. + +.. code-block:: python + + raw = numpy.empty(total_size, dtype='u1') + fid.readinto(raw) # single syscall + return raw.view(record_dtype).view(recarray)[:n_records] + +Building the Cython extension +----------------------------- + +The extension is built automatically by ``setup.py`` when Cython and NumPy +are available:: + + pip install cython numpy + python setup.py build_ext --inplace + +If compilation fails, mdfreader falls back to the pure-Python path (with +``bitarray`` for bit-exact channel reading). A ``ImportWarning`` is issued +at import time to alert you. + +To verify the fast path is active: + +.. code-block:: python + + from mdfreader.mdfinfo4 import _CN_CHAIN_FAST, _SYMBUF_AVAILABLE + print('fast CN reader:', _CN_CHAIN_FAST) + print('SymBufReader:', _SYMBUF_AVAILABLE) diff --git a/mdfconverter/__init__.py b/mdfconverter/__init__.py index 96fbcbe1..42ba5823 100644 --- a/mdfconverter/__init__.py +++ b/mdfconverter/__init__.py @@ -12,4 +12,4 @@ # along with this program. If not, see http://www.gnu.org/licenses. # # ---------------------------------------------------------------------- -__version__ = "4.2" +__version__ = "4.3" diff --git a/mdfreader/__init__.py b/mdfreader/__init__.py index c57c65a1..7fa607c5 100644 --- a/mdfreader/__init__.py +++ b/mdfreader/__init__.py @@ -16,7 +16,7 @@ __author__ = 'Aymeric Rateau (aymeric.rateau@gmail.com)' __copyright__ = 'Copyright (c) 2017 Aymeric Rateau' __license__ = 'GPLV3' -__version__ = "4.2" +__version__ = "4.3" from .mdfreader import Mdf, MdfInfo diff --git a/mdfreader/mdf4reader.py b/mdfreader/mdf4reader.py index a8456e4e..a61d0bc6 100644 --- a/mdfreader/mdf4reader.py +++ b/mdfreader/mdf4reader.py @@ -33,7 +33,7 @@ else: from numpy.core.records import fromstring, fromarrays from numpy import array, recarray, asarray, empty, where, frombuffer, reshape -from numpy import arange, right_shift, bitwise_and, all, diff, interp, zeros, concatenate, maximum +from numpy import arange, right_shift, bitwise_and, bitwise_or, all, diff, interp, zeros, concatenate, maximum from numpy import issubdtype, number as numpy_number from numpy import max as npmax, min as npmin from numpy.lib.recfunctions import rename_fields @@ -181,11 +181,9 @@ def _apply_unsorted_bit_masking(buf, record, info): if sig_dt in (2, 3): # signed: sign-extend from bit_count-1 sign_bit_mask = 1 << (bit_count - 1) sign_extend = ((1 << (temp.itemsize * 8 - bit_count)) - 1) << bit_count - sign_bits = bitwise_and(temp, sign_bit_mask) temp_u = temp.view('u{}'.format(temp.itemsize)) - for idx, sign in enumerate(sign_bits): - if sign: - temp_u[idx] |= sign_extend + negative = bitwise_and(temp_u, sign_bit_mask).astype(bool) + temp_u = where(negative, bitwise_or(temp_u, sign_extend), temp_u) temp = temp_u.view(temp.dtype) buf[name] = temp @@ -1339,7 +1337,7 @@ def generate_chunks(self): return chunks def read_all_channels_sorted_record(self, fid): - """ reads all channels from file using numpy fromstring, chunk by chunk + """ reads all channels from file using a single numpy frombuffer call Parameters ------------ @@ -1351,19 +1349,14 @@ def read_all_channels_sorted_record(self, fid): rec : numpy recarray contains a matrix of raw data in a recarray (attributes corresponding to channel name) """ - chunks = self.generate_chunks() - previous_index = 0 - buf = recarray(self.numberOfRecords, dtype={'names': self.dataRecordName, - 'formats': self.numpyDataRecordFormat}) # initialise array + dtype = {'names': self.dataRecordName, 'formats': self.numpyDataRecordFormat} + total_size = self.CGrecordLength * self.numberOfRecords simplefilter('ignore', FutureWarning) - for n_record_chunk, chunk_size in chunks: - buf[previous_index: previous_index + n_record_chunk] = \ - frombuffer(fid.read(chunk_size), - dtype={'names': self.dataRecordName, - 'formats': self.numpyDataRecordFormat}, - count=n_record_chunk) - previous_index += n_record_chunk - return buf + # Read into a flat uint8 buffer, then reinterpret as the structured recarray. + # Single allocation, no copy, and the result is writeable for in-place conversions. + raw = empty(total_size, dtype='u1') + fid.readinto(raw) + return raw.view(dtype).view(recarray)[:self.numberOfRecords] def read_unique_channel(self, fid, info): """ reads all channels from file using numpy fromstring, chunk by chunk diff --git a/mdfreader/mdfinfo4.py b/mdfreader/mdfinfo4.py index f8791461..25003733 100644 --- a/mdfreader/mdfinfo4.py +++ b/mdfreader/mdfinfo4.py @@ -1,12 +1,43 @@ # -*- coding: utf-8 -*- -""" Measured Data Format blocks parser for version 4.x - -Created on Sun Dec 15 12:57:28 2013 +"""MDF4 block structure parser (version 4.x). :Author: `Aymeric Rateau `__ -mdfinfo4 --------------------------- +This module parses the *metadata* of MDF 4.x files — all block types +(HD, DG, CG, CN, CC, SI, TX, MD, AT, EV, …) — and stores them in a +nested ``Info4`` dict. It does **not** read channel sample data; that +is handled by ``mdf4reader.py``. + +Architecture +------------ +The module provides two reading paths for the CN/CC/SI/TX hot path: + +**Fast path (Cython, default when compiled)** + ``read_cn_chain_fast()`` from ``dataRead.pyx`` walks the full CN + linked list for a channel group in a single C-level loop using + POSIX ``pread()`` for all file I/O (no Python file-object dispatch, + no GIL during reads). Struct fields are extracted with ``memcpy`` + into typed C packed structs. TX/MD block text is decoded with a + fast ```` bytes scan before falling back to ``lxml``. + The SI block cache (``_si_cache``) prevents redundant reads when + multiple channels share the same source. + +**Python fallback path** + ``read_cn_block()`` / ``read_cn_blocks()`` use ``struct.unpack`` + and the ``SymBufReader`` bidirectional file buffer. This path is + used when ``dataRead`` is not compiled or when the file object has + no ``fileno()`` (e.g. an in-memory buffer). + +Key classes +----------- +``Info4`` + Top-level parser. Inherits from ``dict``; call + ``Info4(file_name)`` to fully parse a file. +``CNBlock``, ``CCBlock``, ``SIBlock``, ``CommentBlock`` + Individual block parsers used by the Python fallback path. +``DSBlock``, ``CLBlock``, ``CVBlock``, ``CUBlock`` + MDF 4.3 composition block parsers (data-stream, channel-list, + channel-variant, channel-union). """ from struct import calcsize, unpack, pack, Struct from os import remove @@ -33,6 +64,18 @@ from .mdf import _open_mdf, dataField, descriptionField, unitField, \ masterField, masterTypeField, idField, _convert_name +try: + from dataRead import SymBufReader as _SymBufReader + _SYMBUF_AVAILABLE = True +except ImportError: + _SYMBUF_AVAILABLE = False + +try: + from dataRead import read_cn_chain_fast as _read_cn_chain_fast + _CN_CHAIN_FAST = True +except ImportError: + _CN_CHAIN_FAST = False + # datatypes _LINK = '